Commit Graph

310 Commits

Author SHA1 Message Date
Asias He
1b97cd988d storage_service: Fix indentation in init_server 2015-08-18 17:06:03 +08:00
Asias He
eda11a35e6 storage_service: Partially implement handle_state_removing 2015-08-18 17:06:03 +08:00
Asias He
0f2e4003ce storage_service: Implement handle_state_moving 2015-08-18 17:06:03 +08:00
Asias He
8a7f7d5d8b storage_service: Implement handle_state_left 2015-08-18 17:06:03 +08:00
Asias He
455ea0e87c storage_service: Implement handle_state_leaving 2015-08-18 17:06:03 +08:00
Asias He
7c72ed227b storage_service: Enable !join_ring case in init_server 2015-08-18 17:06:03 +08:00
Asias He
c111f8395c storage_service: Enable load_tokens logic in init_server 2015-08-18 17:06:03 +08:00
Asias He
a8efcac89b storage_service: Run init_server inside seastar::async
This helps enabling more code inside it.
2015-08-18 17:06:02 +08:00
Asias He
63d32fb681 storage_service: Enable remove_endpoint in bootstrap 2015-08-18 17:06:02 +08:00
Asias He
c7d2d07fc1 storage_service: Kill one FIXME for is_replacing 2015-08-18 17:06:02 +08:00
Asias He
7a0bc19c98 storage_service: Enable set_bootstrap_state and friends.
It is enabled in system_keyspace now.
2015-08-18 17:06:02 +08:00
Glauber Costa
6a682d0e49 storage_service: futurize get_tokens
Because all its users are already futurized, this is actually an easy one.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-08-17 11:03:37 -07:00
Gleb Natapov
6b1669468a Fix short read problem.
Fix https://issues.apache.org/jira/browse/CASSANDRA-2643 same way
Origin does it: if short read is detected retry with bigger limit and
check again.
2015-08-17 18:11:26 +03:00
Avi Kivity
7a14bcd66e Merge "API: add get estimated row size histogram to column family" from Amnon
"This series cleans the streaming_histogram and the estimated histogram that
were importad from origin, it then uses it to get the estimated min and max row
estimation in the API."
2015-08-16 17:31:23 +03:00
Gleb Natapov
6f9cc6efe4 fix query::read_command lifetime issue in mutation_result_merger
mutation_result_merger can outlive query::read_command, so it have to
hold shared pointer to it instead of reference. The bug was introduced by
89e36541c3
2015-08-16 10:59:43 +03:00
Gleb Natapov
89e36541c3 Correctly enforce row limit in mutation_result_merger
Currently limit is enforced only on partition boundary, so real result
can contain 2*row_limit - 1 rows in the worst case. Fix it by trimming
rows from a mutation if only part of its rows fit the requested limit.
2015-08-13 18:28:30 +03:00
Gleb Natapov
987bf33865 storage_proxy: cleanup commented origin code
Remove code that was already reimplemented. Makes file navigation much
easier.
2015-08-12 16:50:57 +03:00
Gleb Natapov
ea2632e15b Move overloaded_exception to exceptions.hh 2015-08-12 16:12:09 +03:00
Gleb Natapov
0b3d2de2f1 Fix mutation write timeout exception reporting
Make it compatible with CQL specification
2015-08-12 14:58:48 +03:00
Amnon Heiman
c0a52a28bc Adding the read latency support to the storage proxy
This adds the latency histogram support to the storage_proxy.

It uses a the latency object to mark the opetation latency, if there
will be an impact on performance, it can be changed from all operations
to sample of the operation.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-08-12 13:10:18 +03:00
Asias He
dd34f4b0a4 storage_service: Enable update_local_tokens 2015-08-12 08:02:07 +08:00
Asias He
b3f7507e0a storage_service: Enable gossiper.replacement_quarantine in handle_state_normal 2015-08-12 07:50:26 +08:00
Asias He
4d3f333ec0 storage_service: Enable call to remove_endpoint in on_remove 2015-08-12 07:50:26 +08:00
Asias He
951c0d192b storage_service: Enable _is_survey_mode logic in join_token_ring 2015-08-12 07:50:26 +08:00
Asias He
6874663c9d storage_service: Enable current in prepare_to_join 2015-08-12 07:50:26 +08:00
Asias He
645700d261 storage_service: Implement join_ring
Join the ring by operator request.
2015-08-12 07:50:26 +08:00
Asias He
3ea91504ba storage_service: Enable get_saved_tokens and get_initial_tokens 2015-08-12 07:50:26 +08:00
Gleb Natapov
36c7c2ac5f Provide correct data_present for read_timeout_exception
Fix fixmes.
2015-08-11 19:45:59 +03:00
Gleb Natapov
6046316352 Untemplatize continuation in storage_proxy::query
Nothing wrong with it besides that it crashs my eclips indexer for some
reason.
2015-08-11 19:45:59 +03:00
Calle Wilund
b7c7c97295 StorageProxy: implement mutate_atomically
Atomically == add to batch log before doing actual mutate
2015-08-11 17:10:17 +02:00
Avi Kivity
5c73819a2e Merge "gossip: futurize callback" from Asias
"We run a gossip round inside a seastar thread which runs every second, so we
can wait for the operations inside the callback to complete."
2015-08-10 12:52:30 +03:00
Asias He
7fcaca56bd storage_service: Wait for schedule_schema_pull
It returns a future, we should not ignore it.
2015-08-10 10:26:27 +08:00
Asias He
1291344e68 storage_service: Wait for operations to complete in gossip callback
Since all the gossip callback (e.g., on_change) are executed inside a
seastar::async context, we can make wait for the operations like update
system table to complete.
2015-08-10 10:21:57 +08:00
Glauber Costa
3426b3ecc1 bootstrap tokens: get tokens from config file
Aside from being the obviously correct thing to do, not having this will force us
to manually adjust num_tokens when running our sstables into Cassandra.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-08-07 11:10:56 -05:00
Glauber Costa
2678b0e606 dht: change get_bootstrap_tokens()'s signature
It needs to access the non-existent "DatabaseDescriptor". Do as we have been doing,
and just pass the database object instead.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-08-07 11:10:56 -05:00
Nadav Har'El
b6fd3dd623 storage_proxy::make_local_reader: support wrap-around ranges
If the requested range wraps around the end of the ring, make_local_reader()
ends up trying to create an sstable reader with that wrapping range, which
is not supported. Also our shard-looping code is wrong in a wrapping range.

The solution is simple: split the wrap-around range into two (from the start
of the range until the end of the ring, and then from the beginning of the
ring until the end of the range), and read each of these subranges normally.

This feature is needed to allow streaming a range that wraps around, because
streaming currently uses make_local_reader().

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-08-07 11:38:03 +03:00
Nadav Har'El
6af8fb1d4a storage_proxy::make_local_reader: simplify lifetime of range parameter
make_local_reader takes a partition-range parameter, passed by *reference*.
The meaning of this passing-by-reference is not documented: when
make_local_reader returns, which of the following two statements holds?

  1. make_local_reader still holds this reference, so the caller is
     forced to keep the range object alive. For how long?
or
  2. make_local_reader reads the range before returning, and when it
     returns, the caller continues to "own" the range object, and is
     allowed to do anything, including delete it.

The principle of least surprise suggests that #2 is better, unless
there is a very good reason to choose #1, and unless this requirement to
keep the argument alive (and for how long) was clearly documented.
But neither is the case here - the overhead of copying the argument is
negligable compared to the other overheads of make_local_reader, and
nothing was documented.

But it turns out the current code did #1 - the address of the range was
passed around *after* make_local_reader returns - the different readers
on different cpus continue to use it to eventually find the right sstable
byte range to iterate over. It very easy to forget this and call
make_local_reader on a on-stack range variable, and the result is a
hard-to-debug use-after-free mess.

This patch switches us to situation #2: Before make_local_reader returns,
the range is copied to whoever needs to hold it after the return, namely
each individual shard_reader. The patch to do this is trivial (one
character removed).

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-08-07 11:38:03 +03:00
Pekka Enberg
921d9386cc service/storage_service: Endpoint lifecycle subscriber hooks
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-08-06 15:26:40 +03:00
Pekka Enberg
8d0d60168e service: Convert IEndpointLifecycleSubscriber to C++
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-08-06 15:26:40 +03:00
Pekka Enberg
bbe2c52d9b service: Import IEndpointLifecycleSubscriber.java
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-08-06 15:26:40 +03:00
Nadav Har'El
91d804de9b storage_service: fix compilation on gcc 4.9
gcc 4.9 fails to compiles the following legal code (which compiles fine on
gcc 5.1):

	#include <unordered_set>
	std::unordered_set<int> hi() {
        	return {};
	}

Work around this problem to make Scylla compile on gcc 4.9 again.

Note that this bug is specific to std::unordered_set - we have other places
in the code code which "return {}" for std::set, and those work fine.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-08-06 13:01:31 +03:00
Asias He
c21fd58189 storage_service: Sleep less if we get schema version
This drops the second node boot up time from ~12 to ~7 seconds.
2015-08-06 15:23:51 +08:00
Asias He
b27201bd56 storage_service: Pass db into storage_service
It is needed for db.get_version(). I really hated to pass &db everywhere
If we had a global helper function like get_local_db(), life will be much
easier.
2015-08-06 15:23:51 +08:00
Asias He
470e9972a3 storage_service: Use set_mode
Now that set_mode is enabled, use it.
2015-08-06 15:23:51 +08:00
Asias He
5764e98b49 storage_service: Enable set_mode 2015-08-06 15:23:51 +08:00
Asias He
006554821c storage_service: Improve prepare_to_join
Use seastar::async to simplify the code. This code is only executed
during boot up, so it is fine to use seastar::async.

More commented out code are enabled.
2015-08-06 15:23:51 +08:00
Asias He
efe067fd74 storage_service: Enable more code in prepare_to_join 2015-08-06 15:23:51 +08:00
Asias He
f7b3b9646f storage_service: Stub prepare_replacement_info() 2015-08-06 15:23:51 +08:00
Asias He
93de64a061 storage_service: Add helper to get property and friends
They are used but we don't support them yet. Add stub helpers for now.
2015-08-06 15:23:51 +08:00
Pekka Enberg
99a80050e3 db: Rename legacy_schema_tables to schema_tables
There's nothing legacy about it so rename legacy_schema_tables to
schema_tables. The naming comes from a Cassandra 3.x development branch
which is not relevant for us in the near future.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-08-05 13:56:47 +03:00