Commit Graph

53948 Commits

Author SHA1 Message Date
Avi Kivity
8d050b679a db: improve make_local_reader()
Instead of merging shard data using make_combined_reader(), take advantage
of the fact that shard data is disjoint, and use make_joining_reader().
This removes the need to sort the partitions as they are being read.
2015-08-04 17:11:39 +03:00
Avi Kivity
951eef2945 mutation_reader: add make_lazy_reader
Construct the reader on first use.  Useful with make_joining_reader().
2015-08-04 16:55:31 +03:00
Paweł Dziepak
b4d967fcf2 tests/cql3: add tests for SELECT DISTINCT
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-08-04 15:39:57 +02:00
Paweł Dziepak
7a7919a62e cql3: set properly partition_slice for SELECT DISTINCT
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-08-04 15:39:54 +02:00
Paweł Dziepak
8a0d21b8b8 query: support option distinct in partition_slice
In case of SELECT DISTINCT statments we are not intersted in clustering
keys at all. The only important information is whether partition key
exists and what's in static row (if it exists).

Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-08-04 15:39:42 +02:00
Paweł Dziepak
71e7d3bc20 partition_slice: add distinct option
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-08-04 15:38:36 +02:00
Nadav Har'El
1d4c1eda51 ninja: add "clean" target
This patch adds a "ninja clean", better than the current "ninja -t clean".

Ninja's "ninja -t clean" is a nice trick, designed to save the Makefile writer
the tedious chore of listing the targets to remove, by automatically gathering
this list. But our build system, following OSv's one, actually uses a much
cooler (and better) trick: All build files are generated in a single
subdirectory, "build/", and cleaning the build products is as simple as
"rm -rf build".

So this patch adds a target, "ninja clean", which does exactly this (rm -rf
build). "ninja clean" is not only easier to type than "ninja -t clean", it
also has one important benefit: When the ninja rules change, "ninja -t clean"
doesn't remember to delete now-defunct targets, and they stay behind. On my
build machine, "ninja -t clean" left behind almost a gigabyte of old crap.
Moreover, when the ninja file changes drastically (as it changed a few days
ago), not cleaning up everything can even cause new builds to break - e.g.,
when something was previously a file and now needs to be a directory.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-08-04 16:00:09 +03:00
Avi Kivity
318cc489c8 mutation_reader: add make_joining_reader()
Reads from provided readers, in order (assumes provided readers are
disjoint and in required order).
2015-08-04 15:49:09 +03:00
Asias He
2aec155f50 storage_service: Add debug print to dump token to endpoint map 2015-08-04 20:39:33 +08:00
Asias He
c42df5b40d token_metadata: Enable remove_from_moving 2015-08-04 20:39:33 +08:00
Asias He
2250123654 storage_service: Enable code for remove_endpoint in handle_state_normal 2015-08-04 20:39:33 +08:00
Asias He
9dc155a8ef token_metadata: Make get_endpoint_for_host_id return optional 2015-08-04 20:39:32 +08:00
Asias He
66f5cfaf39 token_metadata: Add remove_endpoint 2015-08-04 20:39:32 +08:00
Asias He
ba1a8c5ad7 storage_service: Enable debug print for tokens 2015-08-04 20:39:32 +08:00
Asias He
e572101433 to_string: Support print std::unordered_set
With this, we can do

std::unordered_set<dht::tokens> tokens
logger.debug("tokens = {}", tokens)
2015-08-04 20:39:32 +08:00
Asias He
a7b9a8faed storage_service: Remove debug print for tokens in on_join 2015-08-04 20:26:34 +08:00
Asias He
95775917c9 storage_service: Rename camel case to snake case
They are leftovers.
2015-08-04 20:26:34 +08:00
Asias He
31eb9cea3d storage_service: Remove storage_service header in debug print 2015-08-04 20:26:34 +08:00
Asias He
c9ba5fa847 storage_service: Add more debug info for state change 2015-08-04 20:26:34 +08:00
Asias He
a5cd9ee315 storage_service: Remove the SS header in debug print
Since the logger will print logger name, no need to print it twice.
2015-08-04 20:26:34 +08:00
Asias He
28b2e6e95f storage_service: Print start gossiper service earlier
Otherwise, you see gossip log before gossiper service is started.
2015-08-04 20:26:34 +08:00
Pekka Enberg
5b3f7f8091 service: Convert MigrationListener to C++
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-08-04 15:08:24 +03:00
Tomasz Grabiec
52904021d2 thrift: Use migration_manager to create keyspace
Current code is broken, because it doesn't announce nor update system tables.

Fixes #63.
2015-08-04 13:55:43 +02:00
Vlad Zolotarov
6819ee641b transport: cql_server::connection::process(): return the missing 'return'
Return the 'return' statement removed by mistake in
commit 707f3b25e3.

Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2015-08-04 13:39:52 +03:00
Pekka Enberg
44b53be4a1 service: Import IMigrationListener.java
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-08-04 13:17:05 +03:00
Vlad Zolotarov
707f3b25e3 transport: cql_server::connection: paralellization of cql requests handling
Take the request processing part into the separate function and
run it in parallel for incoming requests.

Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2015-08-04 13:05:46 +03:00
Avi Kivity
8bc863bd14 Merge "Translating multi column restrictions" from Paweł
"This patchset translates all the remaining parts of Java code needed to
support multi column restrictions. There are at least two problems left
though:
 - CASSANDRA-8613 - allow something like:
   SELECT * FROM table WHERE c1 = 0 AND (c2, c3) = (1, 2)
   currently columns restricted by multi column restrictions need to be a
   prefix of clustering key
 - CASSANDRA-7281 - incorrect results if some of the columns have reversed
   type
I didn't want to delay this patchset any further and fixing these issues
isn't as straighforward as just translating Java to C++."
2015-08-04 12:51:27 +03:00
Nadav Har'El
27a5f53b10 main: better error message on invalid logger name
If a user tries to configure a non-existant logger, he gets an obscure error
message:

    $ scylla --logger-log-level nonexistant=info
    Exiting on unhandled exception of type 'std::out_of_range': _Map_base::at

With this patch,

    $ scylla --logger-log-level nonexistant=info
    Exiting on unhandled exception of type 'std::runtime_error':
    Unknown logger 'nonexistant'. Use --help-loggers to list available loggers.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-08-04 12:29:04 +03:00
Paweł Dziepak
77dd2faee0 tests/cql3: add tests for multi column relations
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-08-04 10:59:15 +02:00
Paweł Dziepak
0069040eb3 cql3: enable multi column restrictions
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-08-04 10:59:13 +02:00
Paweł Dziepak
f5a9fdfc61 cql3: translate MultiColumnRelation.java to C++
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-08-04 10:59:06 +02:00
Paweł Dziepak
c27acf56d3 cql3: translate MultiColumnRestriction.java to C++
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-08-04 10:58:53 +02:00
Paweł Dziepak
a03b148f54 cql3: make check_[not]_null() validator work with stdx::optional
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-08-04 10:58:32 +02:00
Paweł Dziepak
38ba7edf53 cql3: add method to_string() to term_slice
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-08-04 10:58:26 +02:00
Paweł Dziepak
9f2fd53a6e cql3: trasnlate remaining parts of tuples.hh to C++
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-08-04 10:58:06 +02:00
Nadav Har'El
6bd3817ed0 main: better error message for unsupported log level
If someone uses "--logger-log-level" with an unknown log level, e.g.,
"--logger-log-level repair=hello", the exception currently reported to the
user is:

   bad lexical cast: source type value could not be interpreted as target

In a long command line, the user has no idea where this exception is coming
from. This patches catches this exception, and instead reports a runtime_error
with the text:

   Unknown log level 'hello'

Which hopefully should be much more user friendly.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-08-04 11:24:37 +03:00
Shlomi Livne
b8bcf6d6e7 Fix a bug in mutation response processing in smp
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>
2015-08-04 11:23:49 +03:00
Pekka Enberg
a3c95235e6 migration_manager: Make stateful with sharded<>
In preparation for adding listener state to migration manager, use
sharded<> for migration manager.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-08-04 11:23:23 +03:00
Asias He
924ca5915e stream_session: Make sure cf exists before streaming
We use storage_proxy::mutate_locally() to apply the mutations when we
receive them. mutate_locally() will ignore the mutation if the cf does not
exist. We check in the prepare phase to make sure all the cf's exist.
2015-08-04 16:21:40 +08:00
Asias He
36eb1d1d79 streaming: Add operator<< for stream_summary 2015-08-04 16:21:40 +08:00
Asias He
02ae515541 streaming: Add sharding support
Thanks to the new mutation reader (storage_proxy::make_local_reader), we
can read mutations for a cf on all shard. This simplifies the sharding
handling a lot. When user of streaming creates a stream_plan on any
shard, it will send data from all shards to remote node and receive
data from all shards on remote node.
2015-08-04 16:21:40 +08:00
Avi Kivity
536d6fa32a tests: fix mutation_test use-after-free
Two bugs:
 - column_family not stop()ped after use
 - flush() future not waited on
2015-08-04 11:19:59 +03:00
Tomasz Grabiec
793a4fabf9 locator: Drop the _logger suffix from logger name
We know it's a logger.
2015-08-04 10:49:38 +03:00
Raphael S. Carvalho
34eaeedff2 db: remove imprecise log message about compaction
This message is printed when we are about to run the strategy code
which may not decide to compact anything. Compaction is already
properly logged in sstables::compact_sstables().

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-08-04 00:15:50 +03:00
Avi Kivity
9663ea86e9 db: fix test for whether an sstable includes a shard's range
Spotted by Raphael and Nadav.
2015-08-04 00:14:22 +03:00
Avi Kivity
eaca3f7cd1 build: forward compiler selection to seastar configuration 2015-08-03 22:37:32 +03:00
Avi Kivity
3a5e3c8829 sstables: de-futurize write path
The sstables write path has been partially de-futurized, but now creates a
ton of threads, and yet does not exploit this as everything is serialized.

Remove those extra threads and futures and use a single thread to write
everything.  If needed, we'll employ write-behind in output_stream to
increase parallelism.

Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-08-03 20:33:59 +03:00
Avi Kivity
2929510ef3 Merge "Range friendly sharding"
Switch sharding to work on the most significant bits of the token,
rather than the least significant bits.  This is more friendly to
range operations, since adjacent partitions will reside on the same shard.

Not exploited yet, except for ignoring sstables that don't belong to a
shard.
2015-08-03 20:32:58 +03:00
Avi Kivity
c1a2831d41 db: ignore sstables that clearly don't belong to this shard 2015-08-03 20:17:41 +03:00
Avi Kivity
ad443e4771 sstable: add accessor for first/last partition keys 2015-08-03 20:17:41 +03:00