Current code passes the storage_proxy instance of the shard on which the
message was received instead of using the storage_proxy instance of the
shard that sent the request.
Signed-off-by: Shlomi Livne <shlomi@cloudius-systems.com>
In preparation for adding listener state to migration manager, use
sharded<> for migration manager.
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
It will be stored in the schema, so move there, where it belongs. We'll need
to do more than just store a type, so provide a class that encapsulates it.
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Now that consistency level dependency issues are sorted out, move
request_timeout_exception to exceptions.hh.
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Move unavailable_exception to exceptions.hh where other CQL transport
level exceptions are defined in.
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Use the shiny new read_timeout_exception that handles CQL transport
protocol encoding properly.
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
This patch set the write timmers: histogram, timeout and unavailable.
For the histogram a latency is needed. For that the latency object is
used.
Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
The storage proxy needs to collect statistics about read, write and
range. For that the ihistogram object was added to its stats object.
Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
range::is_wrap_around() and range::contains() rely on total ordering
on values to work properly. Current ring_position_comparator was only
imposing a weak ordering (token positions equal to all key positions
with that token).
range::before() and range::after() can't work for weak ordering. If
the bound is exclusive, we don't know if user-provided token position
is inside or outside.
Also, is_wrap_around() can't properly detect wrap around in all
cases. Consider this case:
(1) ]A; B]
(2) [A; B]
For A = (tok1) and B = (tok1, key1), (1) is a wrap around and (2) is
not. Without total ordering between A and B, range::is_wrap_around() can't
tell that.
I think the simplest soution is to define a total ordering on
ring_position by making token positions positioned either before or
after all keys with that token.
The migration_manager and migration_task logging is currently not
visible in the logs. Fix that by de-thread-localizing both loggers.
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Transport layer expects to get error code in an exception of type
exceptions::cassandra_exception. Fix code to use it as a base for
all user visible exceptions and put correct error code there.
Return a std::chrono::steady_clock::duration and switch the caller in
migration manager to also use proper C++ durations.
Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Make storage proxy a singleton and add helpers to look up a reference.
This makes it easier to convert code from Origin in areas such as
storage service.
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
If we had a range (x; ...] then x is excluded, but token iterator was
initialized with x. The splitting loop would exit prematurely because
it would detect that the token is outside the range.
The fix is to teach ring_range() to recognize this and always give
tokens which are not smaller than the range's lower bound.
Origin has no notion of a maximum token so a range without upper bound
is represented as (x; min]. The splitting code is supposed to produce
only non-wrapping ranges, but (x; min] looks like a wrapping range, so
database code which consumes it would have to special-case for it. A
simpler solution is to change the splitting code to never produce a
wrapping range.
The wrappers also take care of cases when each bound is undefined, and
return mimimum or maximum token respectively, which fixes undefined
behavior in get_restricted_ranges().
Alternative solution would be to make partition_range use a different
type of range, the one where bounds are always specified. However it's
not worth introducing a new range type just for those few users.
Booting a bootstrapped node had a race condition between setting and
advertising the state as boot strapped (call to
storage_service::bootstrap) and setting and advertising the
state as normal (call to storage_service::set_tokens) - as such a node
could get into a state in which it was "stuck" in bootstrap mode.
Following this patch you must wait for 5 seconds to have the cluster in
a stable state.
Signed-off-by: Shlomi Livne <shlomi@cloudius-systems.com>
The patch introduces reconciliation code. The same code suppose to be
working for both range and single key queries. Handling of raw_limit,
short reads and read repairs is still very much missing.
--
v1->v2:
- call live_row_count() only once.