Commit Graph

53948 Commits

Author SHA1 Message Date
Calle Wilund
a18889380e cql3::functions::functions: dispatch token function 2015-07-08 10:02:31 +02:00
Calle Wilund
b17c3bf6df TokenFct Java->C++ 2015-07-08 10:02:31 +02:00
Calle Wilund
9c4c9eff50 schema: add outstream << op to print column_definition pointers
- since these are typically non-smart.
2015-07-08 10:02:31 +02:00
Calle Wilund
15642f917c query_processor bug fix: execute_internal did not keep options alive
... across the whole call chain. Should fix test failure.
2015-07-08 10:02:30 +02:00
Paweł Dziepak
189dfd5954 tests/type: add test cases for validation
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-07-08 10:02:30 +02:00
Paweł Dziepak
414c37f06f types: implement validation for built-in types
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-07-08 10:02:30 +02:00
Paweł Dziepak
0d869276b5 tests/cql: add tests for blobAs*() and *AsBlob() functions
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-07-08 10:02:30 +02:00
Paweł Dziepak
296a77b7f3 cql3: fix *asblob() and blobas*() functions names
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-07-08 10:02:30 +02:00
Nadav Har'El
913ee1e8ac reactor: circumvent ASAN false positive
Our debugging builds always produce the annoying false warning like:

==1199==ERROR: AddressSanitizer: alloc-dealloc-mismatch (malloc vs operator delete) on 0x62300003d500

This error could be silenced by setting ASAN_OPTIONS=alloc_dealloc_mismatch=0
(and we do this in test.py), but it's still annoying for manual runs, and
can mask real bugs of this type.

The problem appears to be that the address sanitizer doesn't understand
our new(with_align(..)) trick we used to allocate the reactor object,
and when we eventually use ordinary "delete" on this object, it thinks
we mixed malloc and delete.

This patch uses posix_memalign() and free() to allocate and free the
reactor structure, and ASAN stops complaining.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-07-08 11:02:19 +03: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
Glauber Costa
655c4eb104 cql sets: fix less comparator
The comparator used to sort the set should the underlying types' comparator,
not the set's comparator.

Using the latter will eventually crash with out of bound reads if we're lucky (I was),
or sort incorrectly if we are unlucky.

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
137cf22abf system.local: convert host_id functions
They are already futurized, we just have to implement them.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-07 11:38:23 -04:00
Glauber Costa
a9e69a34cb system.local: convert bootstrap state
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-07 11:38:23 -04:00
Glauber Costa
6d58675092 system.local: force blocking flush
Allows a CF to be flushed, and wait for it to finish.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-07 11:38:23 -04:00
Glauber Costa
072de63427 system.local: convert check_health
This function is called at startup and makes sure that the cluster_name field
in system.local exists, and if it exists, that it matches the expected value.

To simplifly things, I am leaving the sstable check out. For us, that would be
a map-reduce operation, and if the sstables are indeed corrupted, we would have
caught that already for sure.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-07 11:38:23 -04:00
Glauber Costa
30008bc0b1 system.local: schema version
This patch provide a function to store the current schema version.
Currently, it is called every time the node boots, with a random schema.
That is incorrect and will be fixed shortly. But for now, cqlsh needs
to see a valid value here, so this will do.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-07 11:38:23 -04:00
Glauber Costa
e5d27d6485 system.local: setup version fields
Done every time the node boots, unconditionally.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-07 11:38:23 -04: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
5545e08bf7 database: introduce flush method
We will have to flush it from other places as well, so wrap the flushing code
into a method - specially because the current code has issues and it will be
easier to deal with it if it is in a single place.

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
fd4c384216 thrift version field
Same as C*

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-07 11:38:22 -04:00
Glauber Costa
ffdd2eaacb query_options: use version::native_protocol() for version
Now that we have it, we can reuse here instead of hard coding the number 3.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-07 11:38:22 -04:00
Glauber Costa
90b9de9939 add file with some version strings that don't really belong anywhere
This should really be generated by the build scripts, but since we haven't
even discussed any versioning scheme, I'm introducing the functions here - they
are needed to populate some system tables, and later on we can make them return
the right thing.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-07 11:38:22 -04:00
Glauber Costa
157f5991ac system keyspace: setup queries
We won't create our own versions of database and query_proxy, so we need
some setup to be done. The current code will capture those variables and
setup the structure used to conduct the queries. Later on, it will also
carry on the database's basic setup.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-07 11:38:22 -04:00
Glauber Costa
ba33af1a8d service: split messaging service initialization in two parts
The messaging service is initialized very early, before we have the
proxy or query processor initialized. It is mostly fine, except for
the fact that the messaging service also finishes the initialization
of the storage service. That part will issue queries agains the system
tables, (as soon as we support them), and need to happen later.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-07 11:38:22 -04:00
Glauber Costa
bd13e3995b dht: implement method to convert a token to a string
We need to be able to do it so we can, among other things, create CQL
statements that include the current state of the tokens.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-07 11:38:22 -04:00
Glauber Costa
586ccd43b0 query processor: relay internal queries
If the client state is marked as internal, go for the internal version
of the queries instead.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-07 11:38:22 -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
Glauber Costa
fe6be361ba cql_tests: mark the client as external instead of external
What "internal" really means here, is queries that operate on the system tables.
Up until now, there wasn't really an issue because we weren't really checking
on this flag, and the internal calls were all unimplemented.

Now that we are about to hook up the internal calls, leaving this state marked
as internal will lead us to fail when we try to issue statements - like create
table - that are not, and will not be implemented in their internal
counterparts.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-07 11:38:22 -04:00
Glauber Costa
03cca755ac cql3: fix use-after-move
received is moved to the inner attribute _receiver. Trying to call receiver
after that will SEGFAULT us.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-07 11:38:22 -04:00
Glauber Costa
ae3c7283f9 cql3: allow for the creation of empty untyped_result_set messages
They are useful in situations when we have nothing to respond.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-07 11:38:22 -04:00
Glauber Costa
45905ec94d dht: change partitioner name to sstring
It is a better fit for things that are names, not blobs. We have a user that expects
a bytes parameter, but that is for no other reason than the fact that the field used
to be of bytes type.

Let's fix that, and future users will be able to use sstrings

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-07 11:38:22 -04:00
Glauber Costa
3087df014d untyped_result_set: add include guard
Otherwise it will eventually break

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-07 11:38:22 -04:00
Avi Kivity
c719475901 Merge branch 'master' of github.com:cloudius-systems/urchin into db 2015-07-07 18:29:38 +03:00
Calle Wilund
db0469af80 test.py: add query_processor_test to list
Signed-off-by: Calle Wilund <calle@cloudius-systems.com>
2015-07-07 17:21:00 +02:00
Avi Kivity
5d9222d935 Merge "Filter sstable data not belonging to current shard" from Tomasz
"We don't want multiple shards to respond with the same data. Higher level code
assumes that shard data is non-overlapping. It's cheaper to drop duplicates as
soon as possible. Memtable reader for example will never have overlapping
data, so cache hitting queries will never need to pay for this. Compaction
process may also rely on this."
2015-07-07 18:12:35 +03:00
Calle Wilund
c5f6348572 test.py: add query_processor_test to list
Signed-off-by: Calle Wilund <calle@cloudius-systems.com>
2015-07-07 18:12:22 +03:00
Avi Kivity
a7d608b33a Merge seastar upstream 2015-07-07 18:11:57 +03:00
Avi Kivity
19206a038f reactor: stop using SIGALRM
SIGALRM is used by the boost unit test library, which interferes with our
use.  This causes spurious unit test failures.

Switch to a real-time signal instead.
2015-07-07 18:00:35 +03:00
Tomasz Grabiec
66dfeb33d7 db: Filter out sstable partitions not belonging to current shard 2015-07-07 16:56:25 +02:00
Tomasz Grabiec
d035c499b8 db: Move database::shard_of() to dht::shard_of() 2015-07-07 16:56:25 +02:00
Tomasz Grabiec
4dca9f4f09 tests: Add tests for make_filtering_reader() 2015-07-07 16:56:25 +02:00
Tomasz Grabiec
ed463ac3a7 mutation_reader: Introduce make_filtering_reader() 2015-07-07 16:56:25 +02:00
Avi Kivity
8e2d36ed74 Merge seastar upstream 2015-07-07 17:34:32 +03:00
Avi Kivity
7ad4483879 Revert "build: allow the compiler to be a script"
This reverts commit 68b192d1be5efb50e49e46f19370ed49d9d28e30; it fails
unconditionally, causing debug symbols (for example) not to be emitted.
2015-07-07 17:17:46 +03:00
Avi Kivity
5d6c960faa Merge "Announce schema mutations in cluster" from Pekka
"This series implements schema mutation announcement by pushing schema
mutations via migration manager as well as wiring up DEFINITIONS_UPDATE
verb to the merge_schema() function. This makes schema changes visible
to all nodes that are live at the time:

  Node 1:

  [penberg@nero apache-cassandra-2.1.7]$ ./bin/cqlsh --no-color 127.0.0.1
  Connected to TestCluster at 127.0.0.1:9042.
  [cqlsh 5.0.1 | Cassandra 3.0.0-SNAPSHOT | CQL spec 3.2.0 | Native protocol v3]
  Use HELP for help.
  cqlsh> CREATE KEYSPACE keyspace3 WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };
  cqlsh> SELECT * FROM system.schema_keyspaces;

   keyspace_name | durable_writes | strategy_class                             | strategy_options
  ---------------+----------------+--------------------------------------------+------------------------------
       keyspace3 |           True |                             SimpleStrategy | {"replication_factor":"1"}\n
          system |           True | org.apache.cassandra.locator.LocalStrategy |                           {}

  (2 rows)
  cqlsh> CREATE TABLE keyspace3.standard1 ( key blob PRIMARY KEY, C0 blob, C1 blob, C2 blob, C3 blob, C4 blob);
  cqlsh> SELECT keyspace_name, columnfamily_name, key_validator FROM system.schema_columnfamilies;

   keyspace_name | columnfamily_name     | key_validator
  ---------------+-----------------------+-------------------------------------------
       keyspace3 |             standard1 | org.apache.cassandra.db.marshal.BytesType
          system |                 local |  org.apache.cassandra.db.marshal.UTF8Type
          system |                 peers |  org.apache.cassandra.db.marshal.UTF8Type
          system | schema_columnfamilies |  org.apache.cassandra.db.marshal.UTF8Type
          system |        schema_columns |  org.apache.cassandra.db.marshal.UTF8Type
          system |      schema_keyspaces |  org.apache.cassandra.db.marshal.UTF8Type

  (6 rows)
  cqlsh>

  Node 2:

  [penberg@nero apache-cassandra-2.1.7]$ ./bin/cqlsh --no-color 127.0.0.2
  Connected to TestCluster at 127.0.0.2:9042.
  [cqlsh 5.0.1 | Cassandra 3.0.0-SNAPSHOT | CQL spec 3.2.0 | Native protocol v3]
  Use HELP for help.
  cqlsh> SELECT * FROM system.schema_keyspaces;

   keyspace_name | durable_writes | strategy_class                             | strategy_options
  ---------------+----------------+--------------------------------------------+------------------------------
       keyspace3 |           True |                             SimpleStrategy | {"replication_factor":"1"}\n
          system |           True | org.apache.cassandra.locator.LocalStrategy |                           {}

  (2 rows)
  cqlsh> SELECT keyspace_name, columnfamily_name, key_validator FROM system.schema_columnfamilies;

   keyspace_name | columnfamily_name     | key_validator
  ---------------+-----------------------+-------------------------------------------
       keyspace3 |             standard1 | org.apache.cassandra.db.marshal.BytesType
          system |                 local |  org.apache.cassandra.db.marshal.UTF8Type
          system |                 peers |  org.apache.cassandra.db.marshal.UTF8Type
          system | schema_columnfamilies |  org.apache.cassandra.db.marshal.UTF8Type
          system |        schema_columns |  org.apache.cassandra.db.marshal.UTF8Type
          system |      schema_keyspaces |  org.apache.cassandra.db.marshal.UTF8Type

  (6 rows)
  cqlsh>

We eventually also need schema pulling capability for nodes that join
late or get out of sync for full schema distribution support. That is,
however, out of scope for this patch series."
2015-07-07 17:15:14 +03: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
Avi Kivity
c77761a8b1 messaging: improve serialization for vectors
Various enable_if overload take precedence if a non-const frozen_mutation
is provided (instead of matching the const frozen_mutation& signature).

Provide a non-const frozen_mutation& signature to work around the issue.
2015-07-07 16:48:41 +03:00
Avi Kivity
228762421c messaging: support complex types in vector<> serialization
do_with() required a movable type, but the union U is not movable if the
vector element type is not, with out help from us.
2015-07-07 16:48:41 +03:00