Commit Graph

53948 Commits

Author SHA1 Message Date
Shlomi Livne
f8d773dd47 tests: fix future unitest that sometimes fails because of scheduling
Signed-off-by: Shlomi Livne <shlomi@cloudius-systems.com>
2015-03-10 16:38:43 +02:00
Raphael S. Carvalho
3637b2f09c temporary_buffer: add static method aligned
used to allocate a temporary_buffer with an aligned buf.

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-03-10 16:33:38 +02:00
Glauber Costa
7d43e26c58 sstables: use net::packed in potentially unaligned accesses
Fixes debug build test code.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-03-10 15:54:13 +02:00
Avi Kivity
9288b360f6 Merge branch 'master' of github.com:cloudius-systems/seastar into db
Includes adaptation by Nadav for the removal of file_input_stream:

sstables.cc used file_input_stream, which we replaced by the new
make_file_input_stream. We also couldn't make sstables.cc read either
a file_input_stream or the planned compressed_file_input_stream.

So in this patch we implement an API similar to the old "file_input_stream"
based on the new make_file_input_stream. file_input_stream now has a parent
class "random_access_reader", preparing for a future patch to support both
file_input_stream and compressed_file_input_stream in the same code - by making
all the parsers take a random_access_reader reference instead of file_input_stream.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-03-10 15:50:04 +02:00
Nadav Har'El
7a04d1f662 fstream: refactor file input stream interface
The file_input_stream interface was messy: it was not fiber safe (e.g., code
doing seek() in the middle of an ongoing read_exactly()), and went against
the PIMPL philosophy.

So this patch removes the file_input_stream class, and replaces it with a
completely different design:

We now have in fstream.hh a global function:

input_stream<char>
make_file_input_stream(
        lw_shared_ptr<file> file, uint64_t offset = 0,
	uint64_t buffer_size = 8192);

In other words, instead of "seeking" in an input stream, we just open a new
input stream object at a particular offset of the given file. Multiple input
streams might be concurrently active on the same file.

Note how make_file_input_stream now returns a regular "input_stream", not a
subtype, and it can be used just like any normal input_stream to read the stream
starting at the given position.

This patch makes "input_stream" a "final" type: we no longer subclass it in our
code, and we shouldn't in the future because it goes against the PIMPL design
(the subclass should be of the inner workings, like the data_source_impl, not
of input_stream).

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-03-10 15:39:17 +02:00
Nadav Har'El
20df45de44 scattered_message: Fix include loop
We had an include loop, which can cause problems in some cases:

1. iostream.hh #includes scattered_message.hh #includes reactor.hh
2. reactor.hh #includes iostream.hh

This patch fixes the loop be removing an unnecessary include.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-03-10 15:01:51 +02:00
Nadav Har'El
e45a507100 Remove unnecessary forward declarations from reactor.hh
reactor.hh includes forward declarations for input_stream, output_stream
template classes. These are unnecessary, because it #include's iostream.hh,
which contains the full definition of these classes.

These unnecessary forward declarations are harmless in the current code, but
they will become harmful if we change the definitions in iostream.hh (e.g., I
wanted to make input_stream a "final" class).

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-03-10 15:01:34 +02:00
Avi Kivity
9639a7207e Merge branch 'master' of github.com:cloudius-systems/seastar into db
Conflicts:
	test.py
2015-03-10 13:06:02 +02:00
Gleb Natapov
8fd570d854 core: use perfect forwarding for function object in apply() 2015-03-10 12:57:13 +02:00
Nadav Har'El
4868bde49e Remove duplicate #include in reactor.hh
core/reactor.hh had two #include lines in the middle of the file, which
duplicate previous #include lines in the top of the file. So remove them.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-03-10 12:42:11 +02:00
Avi Kivity
8628d98542 shared_ptr: fix reference count loss when creating a derived type with e_s_f_t
make_shared() has a special case for detecting a created class deriving
from enable_shared_from_this<>, so it can point the refcount pointer into
the object's data area instead of creating a shared_ptr_count_base for it.

The code, however, fails to detect a creating class deriving indirectly
from enable_shared_from_this:

   struct base : enable_shared_from_this<base> {};

   struct derived : base {};

   make_shared<derived>();  // <- allocates independent refcount

The result is that the object reference counter lives in two locations.

Fix by detecting the derived class case as well.
2015-03-10 10:56:10 +02:00
Avi Kivity
24532ba421 Merge branch 'asias/gossip' of github.com:cloudius-systems/seastar-dev into db
Gossip failure detector, from Asias.
2015-03-10 10:49:26 +02:00
Tomasz Grabiec
dad1253ca1 tests: Add test for tuple_type::compare() 2015-03-10 10:16:55 +02:00
Tomasz Grabiec
124ec33a4a types: Fix tuple_type::compare() for missing values 2015-03-10 10:16:55 +02:00
Asias He
b811eb2ca2 gossip: Convert gms/FailureDetector.java to C++ 2015-03-10 16:13:59 +08:00
Asias He
2aaec04bb0 gossip: Import gms/FailureDetector.java 2015-03-10 16:04:24 +08:00
Asias He
3d323bd030 gossip: Return optional for get_endpoint_state_for_endpoint 2015-03-10 16:04:24 +08:00
Asias He
74b872f085 gossip: Convert gms/Gossiper.java to C++
Stub only.
2015-03-10 16:04:24 +08:00
Asias He
7e2d1b1fb5 gossip: Import gms/Gossiper.java 2015-03-10 16:04:24 +08:00
Asias He
5ddab29a3c utils: Convert utils/BoundedStatsDeque.java to C++ 2015-03-10 16:04:24 +08:00
Calle Wilund
d5ba374495 Test fix. Retain commitlog until it is cleared, which is a potentially "blocking" op. Should fix jenkins test crashes.
Signed-off-by: Calle Wilund <calle@cloudius-systems.com>
2015-03-10 08:48:16 +01:00
Asias He
0ffdd1896f utils: Import utils/BoundedStatsDeque.java 2015-03-10 15:11:36 +08:00
Asias He
41a20bde12 gossip: Add is_broadcast_address helper for inet_address 2015-03-10 15:11:36 +08:00
Asias He
00e3832daf gossip: Add inet_address(sstring) constructor 2015-03-10 10:11:33 +08:00
Asias He
5876e5af56 unimplemented: Add casue for GOSSIP 2015-03-10 10:10:58 +08:00
Avi Kivity
e3d1b8b3f2 transport: pipeline requests
Return to the read fiber immediately after parsing the request;
write the response after the query is complete, but take care not to
interleave responses by using a _ready_to_respond variable.
2015-03-09 18:13:47 +01:00
Calle Wilund
80b244cc4b commitlog: fix using wrong segment
Commit log segment "finish_and_get_new" should not call "new_segment"
explicitly, since more than one invocation might get there on the same
flush condition (segment full).

Signed-off-by: Calle Wilund <calle@cloudius-systems.com>
2015-03-09 17:54:47 +02:00
Avi Kivity
9ca0873adf Merge branch 'asias/gossip' of github.com:cloudius-systems/seastar-dev into db
More gossip work from Asias.
2015-03-09 15:50:04 +02:00
Asias He
7e8bc7d86b gossip: Convert gms/IFailureDetector.java to C++ 2015-03-09 21:44:16 +08:00
Asias He
986ceb3873 gossip: Import gms/IFailureDetector.java 2015-03-09 21:43:50 +08:00
Asias He
b335e953e7 gossip: Convert gms/IFailureDetectionEventListener.java to C++ 2015-03-09 21:43:48 +08:00
Asias He
54a5d636f1 gossip: Import gms/IFailureDetectionEventListener.java 2015-03-09 21:43:26 +08:00
Asias He
fdcc7e0bc1 gossip: Convert gms/IEndpointStateChangeSubscriber.java to C++ 2015-03-09 21:43:20 +08:00
Asias He
66d2429ee8 gossip: Import gms/IEndpointStateChangeSubscriber.java 2015-03-09 20:45:20 +08:00
Asias He
30f6f7cd21 gossip: Convert gms/TokenSerializer.java to C++ 2015-03-09 20:45:20 +08:00
Asias He
316209b217 gossip: Import gms/TokenSerializer.java 2015-03-09 20:45:20 +08:00
Asias He
3a8e8bca25 gossip: Convert gms/EndpointState.java to C++, #2 2015-03-09 20:45:20 +08:00
Asias He
818136cfd7 gossip: Add "operator<<" for class versioned_value
Will be used by class endpoint_state.
2015-03-09 20:45:20 +08:00
Asias He
457c78f6bd gossip: Convert gms/HeartBeatState.java to C++ 2015-03-09 20:45:19 +08:00
Asias He
59cd37cfa2 gossip: Import gms/HeartBeatState.java 2015-03-09 20:45:19 +08:00
Asias He
0839c6ba35 gossip: Convert gms/GossipDigestAck2.java to C++ 2015-03-09 20:45:19 +08:00
Avi Kivity
49b560e969 Merge branch 'amnon/basic_http' of github.com:cloudius-systems/seastar-dev
httpd librarification and generalization work, from Amnon.
2015-03-09 10:57:40 +02:00
Asias He
ded6db5a19 gossip: Import gms/GossipDigestAck2.java 2015-03-09 09:32:08 +08:00
Asias He
1313116114 gossip: Convert gms/EndpointState.java to C++
Stub only.
2015-03-09 09:32:08 +08:00
Asias He
4ea4fc6687 gossip: Import gms/EndpointState.java 2015-03-09 09:32:08 +08:00
Amnon Heiman
810d8c88d8 Adding httpd tests 2015-03-08 21:55:57 +02:00
Amnon Heiman
427a6165b3 using the routes and request from the http directory
This use the routes and the reqeuest found in the http directory and
move all files but main to the http directory

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-03-08 21:55:57 +02:00
Amnon Heiman
8fccdb77a0 Adding the routes object
The route object is the url dispatcher, it uses it matching rules to
find what handler should handle a request, perform the call and handle
exceptions that hanend during the handling.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-03-08 21:55:57 +02:00
Amnon Heiman
1866091b3d Adding basic json support
This is a migration of the basic json support taken from the
osv/httpserver.

The routes uses the json object to return errors in a json format.

This also adds json_exception which has a constructor from an exception.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-03-08 21:55:57 +02:00
Amnon Heiman
5aca499a7e Adding the matcher and match rules
The matcher and match rules are used to define and match a url rule. A
rule define a list of string and parameters.
For example, the rule /api/get/{id}/name
Will be mapped by the list of matcher:
str_match for /api/get
param_match for the {id}
and str_match for name

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-03-08 21:55:57 +02:00