Commit Graph

161 Commits

Author SHA1 Message Date
Pekka Enberg
a64eab772c migration_manager: Convert announceColumnFamilyDrop to C++ as stub
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-07-09 09:22:02 +03:00
Pekka Enberg
386792e63f migration_manager: Convert announceKeyspaceDrop to C++ as stub
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-07-08 18:40:30 +02:00
Gleb Natapov
b0c087b2a5 storage_proxy: fix check for singular range on read
A singular range which a ring_position that does not contains a key may
operate on more than one key and thus is not really singular.
2015-07-08 18:38:39 +03:00
Avi Kivity
a2e270f3d4 Merge "wire update tokens" from Glauber
"As previously said, there were some unidentified bugs that prevented update_tokens from
working properly. The first one was sent alongside the series, the second one took me more
time, but it is fixed here."
2015-07-08 16:01:37 +03:00
Pekka Enberg
3ca9a8c2fb migration_manager: Fix announce_new_column_family() validation
Throw an exception if a column family already exists.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-07-08 13:03:28 +02:00
Glauber Costa
12dc7ebd26 system.local: convert update tokens
At this point, users of the interface are futurized already, so we
just need to make sure they call the right function.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-07 20:24:43 -04:00
Avi Kivity
dd29ac9593 Merge "cqlsh" from Glauber
System table Work to make cqlsh connect.
2015-07-07 19:33:23 +03:00
Glauber Costa
d5302ac796 futurize set_tokens
Soon that will involve a query. The idiom make_ready_future<>().then()
is a bit unusual to say the least, but it will soon be replace by an
actual future.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-07 11:38:23 -04:00
Glauber Costa
0f68010152 futurize get_local_host_id and set_local_host_id
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-07 11:38:23 -04:00
Glauber Costa
39e4e98c35 client_state: default to system for internal queries
Most of the time we're querying internal, we are going for the system.
Defaulting to it just makes it easier, and callers can still change it
with set_keyspace if needed.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-07 11:38:22 -04:00
Pekka Enberg
9cc9cf1e76 service/migration_manager: Announce schema mutations in cluster
Announce schema mutations in a cluster via the DEFINITIONS_UPDATE verb
and pass them to merge_schema() at endpoints.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-07-07 16:48:41 +03:00
Pekka Enberg
a358990855 db/legacy_schema_tables: Pass storage_proxy by reference
We always operate on the local storage proxy so pass it by reference.
This simplifies DEFINITIONS_UPDATE message handler where all we have is
a "this" pointer to the local storage proxy.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-07-07 16:27:58 +03:00
Tomasz Grabiec
93bf8fa3ba Merge branch 'calle/execute_internal' from seastar-dev.git 2015-07-06 15:26:18 +03:00
Gleb Natapov
cfcca4315c do not copy query::result while sending it back to a coordinator
RPC can send directly from a smart pointer now.
2015-07-06 10:17:39 +02:00
Calle Wilund
5919e824c7 storage_proxy: add query_local 2015-07-06 08:21:15 +02:00
Avi Kivity
b0fd850463 Merge "Code missing for a NetworkTopologyStrategy integration" from Vlad
"This series add a code missing for an integration of a NetworkTopologyStrategy
with a current clustering WRITE path."
2015-07-02 17:31:49 +03:00
Avi Kivity
4ef3eaef4d Merge "Add tests for query interface on mutation level" from Tomasz 2015-07-02 16:35:27 +03:00
Vlad Zolotarov
89a7e84483 service: storage_proxy: implement datacenter_sync_write_response_handler
Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2015-07-02 16:00:47 +03:00
Vlad Zolotarov
4a78d173f6 service: storage_proxy::send_to_live_endpoints(): properly query a datacenter name
Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2015-07-02 16:00:47 +03:00
Vlad Zolotarov
acb8b9fcda service: storage_proxy::mutate(): properly query local_dc
Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2015-07-02 16:00:47 +03:00
Gleb Natapov
c81cf80d8a fix mutation forwarding for muti-DC setup
Forwarding lambda is reused, so we cannot move captures out of it
and we cannot pass references to them either since lambda can be
destroyed before send completes.
2015-07-02 15:30:21 +03:00
Tomasz Grabiec
a1f6dec067 result_set: Introduce from_raw_result() factory method 2015-07-02 13:25:46 +02:00
Tomasz Grabiec
c9e5508e3c result_set_builder: Make build() return unwrapped object
It's better to let the user decide which kind (if any) of smart
pointer to wrap it into.
2015-07-02 13:25:46 +02:00
Gleb Natapov
4b9661c608 initial read clustering code
Works only if all replicas (participating in CL) has the same live
data. Does not detects mismatch in tombstones (no infrastructure yet).
Does not report timeout yet.
2015-07-01 13:36:30 +03:00
Gleb Natapov
97a4b0ee40 Store frozen_mutation in shared pointer while processing it
If local mutation write takes longer then write timeout mutation will
be deleted while it is processed by database engine. Fix this by storing
mutation in shared pointer and hold to the pointer until mutation is
locally processed.
2015-06-24 12:51:34 +03:00
Gleb Natapov
7d846e842c use write_request_timeout_in_ms for write request timeout
Fixes another fixme. Also change default value to 2000 which seams to
be what origin uses.
2015-06-24 12:51:33 +03:00
Gleb Natapov
12f3d53372 storage_proxy: cleanup leftovers from timer consolidation 2015-06-23 15:43:59 +03:00
Gleb Natapov
2be9dfc242 storage_proxy: use fb_utilities::get_broadcast_address()
fixes some fixmes
2015-06-23 15:43:59 +03:00
Gleb Natapov
67ea1b0ec8 Revert "db: hold onto write response handler until timeout handler is executed"
This reverts commit 52aa0a3f91.

After c9909dd183 this is no longer needed since reference to a
handler is not used in abstract_write_response_handler::wait() continuation.

Conflicts:
	service/storage_proxy.cc
2015-06-23 15:43:59 +03:00
Gleb Natapov
c9909dd183 cluster: consolidate mutation clustering timers
Currently mutation clustering uses two timers, one expires when wait for
cl timeouts and is canceled when cl is achieved, another expires if some
endpoints do not answer for a long time (cl may be already achieved at
this point and first timer will be canceled). This is too complicated
especially since both timers can expire simultaneously. Simplify it by
having only one timer and checking in a callback whether cl was achieved.
2015-06-23 14:42:56 +03:00
Asias He
5e1348e741 storage_service: Use get_local_snitch_ptr in gossip_snitch_info 2015-06-23 12:12:33 +03:00
Tomasz Grabiec
b8db713b81 service: Increase write timeout to 2 seconds
Current timeout is 100ms. cassandra-stress is failing for me often
because of this, with "Mutation write timeout" message.

The comment says that the timeout value is based on
DatabaseDescriptor.getWriteRpcTimeout(), which in Origin is equal to 2
seconds by default, so bump it up.

Code pointers:

DatabaseDescriptor:L844

    public static long getWriteRpcTimeout()
    {
        return conf.write_request_timeout_in_ms;
    }

Config:L74

  public volatile Long write_request_timeout_in_ms = 2000L;
2015-06-22 15:45:51 +03:00
Gleb Natapov
52aa0a3f91 db: hold onto write response handler until timeout handler is executed
If last response comes after write timeout is triggered, but before
continuation, that suppose to handle it runs the handler can be removed
to earlier and be access from the continuation after deletion. Fix it by
making response handler to be shared pointer instead of unique and
holding to it in timeout continuation.
2015-06-21 13:09:43 +03:00
Tomasz Grabiec
3779506990 db: query: Make partition_range hold ring_position
Current model was not really correct because Origin doesn't support
querying of partition ranges by their value. We can query slices
according to dht::decorated_key ordering, which orders partitions
first by token then by key value.

ring_position encapsulates range constraint. Key value is optional, in
which case only token is constrained.
2015-06-18 15:47:40 +02:00
Gleb Natapov
d8dcceea09 stop storage and messaging services during exit 2015-06-18 15:13:02 +03:00
Gleb Natapov
a338407e29 make storage_proxy object distributed
storage_proxy holds per cpu state now to track clustering, so it has to
be distributed otherwise smp setup does not work.
2015-06-17 15:14:06 +02:00
Pekka Enberg
825588ed48 storage_proxy: Make clustering range configurable for query_local()
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-06-17 12:25:18 +03:00
Asias He
2682d442aa storage_service: Add stop() needed by distributed<> 2015-06-16 15:45:15 +08:00
Asias He
7b6ab5aaa1 storage_service: Implement gossip_snitch_info
Now we have rack and datacenter info injected into gossip.

{ 3 : Value(rack1,9) }  { 4 : Value(datacenter1,11) }
2015-06-16 15:44:30 +08:00
Asias He
13f2292596 storage_service: Use fb_utilities::get_broadcast_address 2015-06-16 15:08:44 +08:00
Avi Kivity
743b6efd54 Merge "initial mutation clustering" from Gleb 2015-06-15 13:25:01 +03:00
Gleb Natapov
969134280a initial mutation clustering code 2015-06-15 12:53:10 +03:00
Gleb Natapov
c500823d35 move init_storage_service out of main.cc 2015-06-15 12:51:04 +03:00
Asias He
d2a9ea7ca6 storage_service: Fix Unable to contact any seeds
Sleep before do bootstrap. This code was not converted from Origin.

With this we can start multiple nodes simultaneously.

./build/release/seastar -c 1 -m 128M --rpc-address 127.0.0.1
--listen-address 127.0.0.1 --seed-provider-parameters 127.0.0.1
--datadir `pwd`/tmp/1 --commitlog-directory `pwd`/tmp/1 2>&1 | tee
/tmp/out1 &

./build/release/seastar -c 1 -m 128M --rpc-address 127.0.0.2
--listen-address 127.0.0.2 --seed-provider-parameters 127.0.0.1
--datadir `pwd`/tmp/2 --commitlog-directory `pwd`/tmp/2 2>&1 | tee
/tmp/out2 &

./build/release/seastar -c 1 -m 128M --rpc-address 127.0.0.3
--listen-address 127.0.0.3 --seed-provider-parameters 127.0.0.1
--datadir `pwd`/tmp/3 --commitlog-directory `pwd`/tmp/3 2>&1 | tee
/tmp/out3 &

./build/release/seastar -c 1 -m 128M --rpc-address 127.0.0.4
--listen-address 127.0.0.4 --seed-provider-parameters 127.0.0.1
--datadir `pwd`/tmp/4 --commitlog-directory `pwd`/tmp/4 2>&1 | tee
/tmp/out4
2015-06-15 12:30:02 +03:00
Gleb Natapov
fc6f6634fa support query of multiple singular ranges 2015-06-11 15:18:07 +03:00
Gleb Natapov
b7155ad862 pass partitions_ranges separately from from read_command
partitions_ranges will be manipulated upon to be split for different
destination, so provide it separately from read_command to not copy the
later for each destination.
2015-06-11 15:18:07 +03:00
Vlad Zolotarov
73278798a9 added missing methods (stubs) required for snitch implementation
Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>

New in v2:
   - storage_service: add a non-const version of get_token_metadata().
   - get_broadcast_address(): check if net::get_messaging_service().local_is_initialized()
     before calling net::get_local_messaging_service().listen_address().
   - get_broadcast_address(): return an inet_address by value.
   - system_keyspace: introduce db::system_keyspace::endpoint_dc_rack
   - fb_utilities: use listen_address as broadcast_address for now
2015-06-09 15:33:29 +03:00
Pekka Enberg
56a790cdc4 service/storage_proxy: Fix query_local() to respect given key
We want query_local() to actually respect the key we pass to it. Fixes
an issue in keyspace merging code where we returned multiple rows for a
keyspace.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-06-05 13:15:12 +02:00
Asias He
1aac08b8ab Revert "storage_service: Remove ad-hoc token_metadata creation"
This reverts commit a19d2171eb.

This commit breaks cql_query_test.

   [asias@hjpc urchin]$ ./cql_query_test
   Running 1 test case...
   WARNING: Not implemented: COMPACT_TABLES
   WARNING: Not implemented: METRICS
   WARNING: Not implemented: PERMISSIONS
   cql_query_test: core/distributed.hh:290: Service&
   distributed<Service>::local() [with Service =
   service::storage_service]: Assertion `local_is_initialized()' failed.
   unknown location(0): fatal error in "test_create_keyspace_statement":
   signal: SIGABRT (application abort requested)
   tests/test-utils.cc(31): last checkpoint

   *** 1 failure detected in test suite "tests/urchin/cql_query_test.cc"
   (gdb) bt
   #0  0x00000032930348d7 in __GI_raise (sig=sig@entry=6) at
   ../sysdeps/unix/sysv/linux/raise.c:55
   #1  0x000000329303653a in __GI_abort () at abort.c:89
   #2  0x000000329302d47d in __assert_fail_base (fmt=0x3293186cb8
   "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n",
   assertion=assertion@entry=0x8ec10a "local_is_initialized()",
   file=file@entry=0x92508d "core/distributed.hh",
       line=line@entry=290, function=function@entry=0x8ed440
   <distributed<service::storage_service>::local()::__PRETTY_FUNCTION__>
   "Service& distributed<Service>::local() [with Service =
   service::storage_service]")
       at assert.c:92
   #3  0x000000329302d532 in __GI___assert_fail (assertion=0x8ec10a
   "local_is_initialized()", file=0x92508d "core/distributed.hh",
   line=290,
       function=0x8ed440
   <distributed<service::storage_service>::local()::__PRETTY_FUNCTION__>
   "Service& distributed<Service>::local() [with Service =
   service::storage_service]") at assert.c:101
   #4  0x0000000000430f19 in local (this=<optimized out>) at
   core/distributed.hh:290
   #5  get_local_storage_service () at service/storage_service.hh:3326
   #6  keyspace::create_replication_strategy (this=0x7ffff6bf8350) at
   database.cc:690
   #7  0x000000000061537a in
   _ZZZN2db20legacy_schema_tables15merge_keyspacesERN7service13storage_proxyEOSt3mapI13basic_sstringIcjLj15EE13lw_shared_ptrIN5query10result_setEESt4lessIS6_ESaISt4pairIKS6_SA_EEESI_ENKUlRT_E0_clISt6ve
   ctorISF_SG_EEEDaSK_ENKUlR8databaseE_clESQ_ () at
   db/legacy_schema_tables.cc:584
   #8  0x0000000000617d19 in operator() (__closure=0x7ffff6bf8650) at
   ./core/distributed.hh:284

In the test, storage_service and other services are not stared.

Let's revert it and figure out a way to run cql_query_test with the
needed services started properly and then bring the "storage_service:
Remove ad-hoc token_metadata creation" change back.
2015-06-05 08:21:59 +03:00
Asias He
77e8f361bb storage_service: Reduce time for non-seed node to join the ring
Waiting for 30 seconds is way too long for testing. Reduce it to 5
seconds.

When we have a proper config system, we can specify in cmdline.
2015-06-04 17:16:50 +08:00