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
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.
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.
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.
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>
"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."
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>
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>
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>
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.
"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."
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.
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>
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>
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>
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>
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>
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.
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>