Commit Graph

53948 Commits

Author SHA1 Message Date
Asias He
8734213890 streaming: Lookup session 2015-07-14 20:41:14 +08:00
Asias He
fd04337e80 streaming: Wire up register_receiving init_receiving_side
Now stream_result_future can create a stream_coordinator if not
provided.

So
 - On sending side, stream_coordinator is created by stream_plan
 - On receiving side, stream_coordinator is created by stream_result_future
2015-07-14 20:41:14 +08:00
Asias He
d1720ffed1 streaming: Hold a shared_ptr inside stream_plan 2015-07-14 20:41:14 +08:00
Asias He
1828019d60 streaming: Convert StreamManager.java to C++ 2015-07-14 20:41:14 +08:00
Asias He
692c5b4c40 streaming: Import StreamManager.java 2015-07-14 20:41:14 +08:00
Asias He
f1cab93212 streaming: Return empty prepare_message for now
We can not find a session on the receiver side currently. Return a empty
prepare_message for now.
2015-07-14 20:41:14 +08:00
Asias He
38ee079916 streaming: Add test helper function
This is a very preliminary test to make sure negotiating between two
nodes is ok.
2015-07-14 20:41:14 +08:00
Asias He
01aa42ddca streaming: Add streaming_debug
Add debug print for message exchange
2015-07-14 20:41:14 +08:00
Asias He
285d1907ef streaming: Fix Assertion _instances.empty() failed
seastar: ./core/sharded.hh:227: seastar::sharded<Service>::~sharded()
[with Service = streaming::stream_session::handler]: Assertion
`_instances.empty()' failed.
2015-07-14 20:41:14 +08:00
Asias He
85d9204d0e streaming: Drop connection_handler
stream_session::stream_session(inet_address peer_, inet_address connecting_,
    int index_, bool keep_ss_table_level_)
    : peer(peer_)
    , connecting(connecting_)
    , conn_handler(shared_from_this())

Calling shared_from_this() inside stream_session's constructor is
problematic. I got

   Exiting on unhandled exception of type 'std::bad_weak_ptr': bad_weak_ptr

exceptions, with

   auto session = std::make_shared<stream_session>(peer, connecting, size, _keep_ss_table_level)

Also, the logic in connection_handler is not very useful for us. The
sending and receiving of messages are handled using messaging_service.
There is no need to add another layer.
2015-07-14 20:41:14 +08:00
Asias He
0f2bc82f82 streaming: Fix stream_init_message destination
It should be peer, not ourself.
2015-07-14 20:41:14 +08:00
Asias He
14ae9e66ae streaming: Use shared_ptr to track back to stream_session
I tried our lw_shared_ptr, the compiler complained endless usage of
incomplete type stream_session. I can not include stream_session.hh
everywhere due to circular dependency.

For now, I'm using std::shared_ptr which works fine.
2015-07-14 20:41:14 +08:00
Asias He
5ffb946dac streaming: futurize stream_session::on_initialization_complete 2015-07-14 20:41:14 +08:00
Avi Kivity
a0cb90fe67 logger: add API to convert log_level to/from iostream 2015-07-14 15:33:02 +03:00
Avi Kivity
6ef552ef34 logger: add registry APIs to manage loggers 2015-07-14 15:19:14 +03:00
Avi Kivity
c065623da5 logger: add APIs to set and retrieve the log level 2015-07-14 14:48:53 +03:00
Gleb Natapov
7fbe154a26 token_metadata: add include_min handling in tokens_iterator
Sometimes it is needed to include minimum token during wrap around while
iterating over all tokens. This support was omitted in initial
tokens_iterator implementation, add it now.
2015-07-14 12:22:37 +03:00
Gleb Natapov
49fb10d640 improve token printout
Add min/max token printout
2015-07-14 12:21:42 +03:00
Gleb Natapov
c037666491 stroage_proxy: fix response_id moving in send_to_live_endpoints() 2015-07-14 12:21:12 +03:00
Avi Kivity
d36041d654 Merge seastar upstream 2015-07-14 11:57:55 +03:00
Amnon Heiman
53745dc357 Adding a void_json object to the json_elements
There are cases where a handler that returns a json element needs to
return a successfull empty response. This is common in async operation.
Though it is legit to return an empty string in this situation, it is
cleaner to return an empty response.

This adds a json_void class, that a method that needs to return a value
(i.e. the json_function) can return and the formatter will set the
response to empty.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-07-14 11:22:32 +03:00
Avi Kivity
4b1fd3d48d Merge "Set currently commented out properties for system tables" from Glauber
"Some of the system tables will set gc_grace_seconds, or default_time_to_live
but right now we are commenting them out.

The best way to do it would have been to somehow save the fields so we don't need to
set it all the time - as this function is effectively doing.

However, those fields would feel very spurious in the constructor, and it is not
like there isn't a lot of other things for us to set. More importantly, calling
those schema functions is a very rare event. We usually call it once and store
the pointer somewhere.

With that, we're very close to implementing everything that the system tables
needs set, missing only COMPACT STORAGE and information about compaction
strategy."
2015-07-14 10:52:22 +03:00
Avi Kivity
6024e9489a Merge seastar upstream 2015-07-14 10:52:00 +03:00
Amnon Heiman
7b355a6a02 json-api: Add an assignment operator to the json_list obj
This patch adds a general assignment operator to the json_list object.
It can accept any data structure that support const range iteration and
that its contained object can be assigned to the json_list object.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-07-14 10:41:40 +03:00
Glauber Costa
62364fcdd7 sstring: add compare method for parts of a sstring
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-14 09:26:03 +03:00
Glauber Costa
5ac6ed72f4 system tables: set default ttl according to Origin settings
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-13 23:58:03 -04:00
Glauber Costa
7b1b8f0e09 system tables: set gc grace period according to Origin settings
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-13 23:58:03 -04:00
Glauber Costa
39ca76fd03 schema: allow for the setting of default time to live
We have been leaving all the setter functions in the schema_builder, which is
usually fine.

The system tables, however, are not built this way, which means we need set
properties needed by them in some other way.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-13 23:58:03 -04:00
Glauber Costa
5165e8b439 schema: allow for the setting of gc grace period
We have been leaving all the setter functions in the schema_builder, which is
usually fine.

The system tables, however, are not built this way, which means we need set
properties needed by them in some other way.

Most properties are right there in the constructor, but I argue that this one
does not belong there.

Instead, provide a set method so that the system tables which need it can call.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-13 23:30:27 -04:00
Avi Kivity
62babd6b39 Merge seastar upstream 2015-07-13 19:09:36 +03:00
Avi Kivity
66451d5a9c tcp: fix assertion failure on connection reset
The connection reset code posted an exception on the _data_received promise
to break a waiter (if any), but left the optional<promise<>> engaged.  This
caused the connection destructor to attempt to post a new exception on the
same promise, which is not legal.

Fix by disengaging the optional promise, and give the same treatment to
_all_data_acked_promise.
2015-07-13 19:07:35 +03:00
Avi Kivity
0171dfbf81 tests: drop http server from messaging test
Not needed, and doesn't compile.
2015-07-13 13:20:56 +03:00
Tomasz Grabiec
f2502ae1ad row_cache: Value-initialize stats 2015-07-13 12:57:15 +03:00
Avi Kivity
bfe9d21808 Merge "Adding the storage proxy metrics" from Amnon
"This series adds the storage proxy metrics API. The definition are based on the
StorageProxyMetrics definition. This series also adds stats object to the
storage_proxy a getter function for it and an implementation based on it, but
it is currently does not adds the code to manipulate the counters."
2015-07-13 11:55:50 +03:00
Avi Kivity
e03b26ef9b Merge "Cleanup storage_proxy::query_local()" from Tomasz 2015-07-13 11:35:50 +03:00
Tomasz Grabiec
d4ec9d9566 system_keyspace: Remove the out-of-date comment from query()
The function is currently just a simple wrapper over
storage_proxy::query(). The comment has description of details which
are much lower level than this interface.
2015-07-13 10:27:02 +02:00
Tomasz Grabiec
9aed3fdbfc system_keyspace: Simplify query() by using partition_slice_builder 2015-07-13 10:27:02 +02:00
Tomasz Grabiec
bc0874d299 db: Move storage_proxy::query_local() to db::system_keyspace::query() 2015-07-13 10:27:02 +02:00
Gleb Natapov
f3adc5b729 drop unneeded && qualifier from query::result_merger::get() 2015-07-13 10:24:31 +02:00
Paweł Dziepak
38cf77b16b transport: use begin() and end() instead of sstring_view::data()
sstring_view::data() can return a pointer to a string that isn't null
terminated.

Fixes #19.

Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-07-13 10:20:39 +03:00
Amnon Heiman
06df13b091 API: Adding an implementation to storage_proxy counters
This adds an implementation to the storage_service counters. The
implementation uses the stats object inside the storage_proxy.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-07-12 22:59:43 +03:00
Amnon Heiman
dfc7121fd8 API: Add a helper function to sum stat values of a distributed objec
A common scenario in the API is to get a sigle value from a distributed
object that has a get_stats method.

The helper function would get the object and a function that return a
single value from the stat object and would perform the map_reduce.

It would return a future that can be used as a return value from the
API.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-07-12 22:59:37 +03:00
Amnon Heiman
d0ce45efbb API: Add a reference to storage_proxy into API context
The API needs to call the storage_proxy, for that a reference to the
distribute storage_proxy is added to the context and is set in main.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-07-12 22:59:37 +03:00
Amnon Heiman
0eeef904d7 Storage proxy: Adding a stats object
This adds a stat object with counters that will be used by the API. The
stat object instance will be return with a get_stats method.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-07-12 22:59:32 +03:00
Avi Kivity
b89c54df9d query::range: fix call to internal deserialized_size() template
query::range::serialized_size() calls a template method (also
called serialized_size()) within a lambda, however it is called with
a const 'this' while the template is non-const-qualified.  gcc 5
rightly rejects it (nicely annotating the template as a near miss).

Fix by making the template static; it doesn't need 'this' anyway.
2015-07-12 21:18:21 +03:00
Avi Kivity
1072a960e7 build: avoid false positive warning on gcc 5
Maybe-uninitialized, but maybe it is?  No thanks.
2015-07-12 20:55:49 +03:00
Glauber Costa
d162922e03 core: simplify do_flush_directory
files can be copied now. No need to play the unique_ptr card anymore.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-12 19:58:31 +03:00
Avi Kivity
8a50b3d9ba main: be more explicit about make directory errors 2015-07-12 19:38:59 +03:00
Glauber Costa
322b1c30dd main: make sure data directory exists before proceeding
Right now when we initiate the database, we exist with just an exception if the
data directory does not exist. That does not tell much to the user about what
is going on.

It would be nice to at the very least catch the exception and turn it into a
user friendly message. But we can obviously do much better and create the
directory.

If we fail, then we can capture and tell the user why.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-12 19:14:06 +03:00
Avi Kivity
d9a4645e24 Merge seastar upstream 2015-07-12 19:13:52 +03:00