Commit Graph

601 Commits

Author SHA1 Message Date
Pekka Enberg
842eb00a68 cql3: Import IndexName.java
Origin commit: ebc50d783505854f04f183297ad3009b9095b07e

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-07-10 10:33:28 +03:00
Pekka Enberg
2c02c9c436 cql3: Convert KeyspaceElementName to C++
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-07-10 10:31:56 +03:00
Pekka Enberg
34563ca8e4 cql3: Import KeyspaceElementName.java
Origin commit: ebc50d783505854f04f183297ad3009b9095b07e

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-07-10 10:12:15 +03:00
Tomasz Grabiec
06917666f9 Merge tag 'bootstrap-v3' from git@github.com:glommer/urchin.git
Among other things, saving of system keyspace schema, from Glauber.
2015-07-09 15:31:27 +03:00
Pekka Enberg
31248ee0cf cql3: Enable DROP TABLE statement grammar
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-07-09 09:36:39 +03:00
Pekka Enberg
b68f93191e cql3: Convert DropTableStatement to C++
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-07-09 09:36:39 +03:00
Glauber Costa
cdeab4a3d3 cql3: provide a mechanism to get a timestamp higher than any
It is common for some operations, like system table updates, to try and guarantee
some particular ordering of operations.

The way Origin does it, is by simply incrementing one to the current timestamp.
Our calls, however, are being dispatched through our internal query processor, which
has a builtin client_state.

Our client_state has a mechanism to guarantee monotonicity, by adding 1 if needed
to operations that happen subsequentially. By using a clock that is not wired up
to this mechanism, we can't really guarantee that if other operations happened to
get in between.

If we expose this mechanism through the query_processor, we will be able to guarantee
that.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-09 00:12:08 -04:00
Glauber Costa
0cb43b42d0 query_options: use native_protocol instead of 3 for internal options as well.
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-09 00:12:08 -04:00
Pekka Enberg
69c56997e2 cql3: Enable DROP KEYSPACE statement grammar
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-07-08 18:40:30 +02:00
Pekka Enberg
816254ed45 cql3: Convert DropKeyspaceStatement to C++
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-07-08 18:40:30 +02: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
Avi Kivity
a209c91662 Merge "Fix empty sstable_compression property" from Paweł
"This patches prevent compression validation code from rejecting statements
with an empty sstable_compression property. Correct behaviour in such cases
is not to use compression at all.

This would have been a 10 minuts fix if antlr3 didn't prepare surprise of its
own. Empty STRING_LITERALS weren't handled properly and a workaround for that
problem was introduced."
2015-07-08 13:14:12 +03:00
Paweł Dziepak
8405361e81 Cql.g: support empty STRING_LITERALS
setText() is meant to override the token value. However, when antlr3 is
asked to return the token value and needs to determine whether setText()
was called it checks if the string set by setText() is empty or not.
This basically means that it is impossible to override token value with
an empty string.

This problem is solved by using a string with a single byte set to -1 to
represent empty string.

Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-07-08 10:38:33 +02:00
Avi Kivity
957b4076a2 Merge "CQL: Handle token function & restrictions" from Calle
"Implementation of:

* Token func
* Token restriction
* Token relation
* Token cql parsing

This series contains some hefty refactoring of the cql3::restrictions
interfaces, to handle the slightly different conditions of the token
relation. (See individual commit comment)"
2015-07-08 11:35:22 +03:00
Calle Wilund
84b5ba5270 query_processor bug fix: execute_internal did not keep options alive
... across the whole call chain. Should fix test failure.
2015-07-08 11:03:57 +03:00
Calle Wilund
94fcce501e Cql3.g: handle token in grammar 2015-07-08 10:02:31 +02:00
Calle Wilund
bb6677b47a TokenRelation: Java -> c++ 2015-07-08 10:02:31 +02:00
Calle Wilund
d7c10ff3b6 cql3::relation - fix constness 2015-07-08 10:02:31 +02:00
Calle Wilund
73421cb413 TokenRestriction: Java->c++ 2015-07-08 10:02:31 +02:00
Calle Wilund
4a5a5359b0 cql3::restrictions - refactor and clean up
Needed to reasonably cleanly implement token restrictions. 

* Fixed constness for various virtuals. 
* primary_key_restrictions now inherit abstract_restriction,
  similuar to Origin (for better or for worse), to avoid 
  duplicating attributes etc. 
* primary_key_restrictions bounds & values renamed (so not to
  collide with restriction), and some logic pushed downwards 
  (building bounds), to avoid abstraction breakage in 
  statement_restrictions
* primary_key_restrictions merging is now potentially replacing
  to make dispatching token/multicolumn restrictions simpler
2015-07-08 10:02:31 +02:00
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
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
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
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
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
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
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
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
0452175ef1 Merge "Enabling *asBlob() and blobAs*() functions" from Paweł
"This series enables *asBlob() and blobAs*() built-in cql functions. Both
of them were already implemented but the names were autogenerated using
fully qualified class name instead of cql type name. Moreover, built-in types
didn't have validate() method implemented what prevented blobAs*() from
failing on incorrect data."
2015-07-07 15:37:20 +03:00
Avi Kivity
fb28054c2e cql3: convert sets::marker::bind to C++ 2015-07-07 14:31:35 +02:00
Pekka Enberg
86d913954a db/legacy_schema_tables: Store CF "is_dense" to system tables
Persist column family's "is_dense" value to system tables. Please note
that we throw an exception if "is_dense" is null upon read. That needs
to be fixed later by inferring the value from other information like
Origin does.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-07-07 12:36:50 +02:00
Pekka Enberg
3437a49d26 cql3: Enable CF "bloom_filter_fp_chance"
Enable column family "bloom_filter_fp_chance" from the CQL front-end and
make sure its persisted to system tables.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-07-07 13:09:58 +03:00
Paweł Dziepak
a910294be0 cql3: fix *asblob() and blobas*() functions names
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-07-07 11:24:43 +02:00
Paweł Dziepak
024a706692 exceptions: remove duplicate marshal_exception
There are both marshal_exception (defined in types.hh) and
exceptions::marshal_exception (defined ini exceptions/exceptions.hh).
The latter is never thrown by anything but caught in few places which
obviously is incorrect.

Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-07-06 23:36:48 +02:00
Paweł Dziepak
cce2996cde cql3: enable inet type in cql grammar definition
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-07-06 23:26:40 +02:00
Pekka Enberg
c24b7d42ce db/legacy_schema_tables: Store CF key validator in system tables
Store the column family key validator in system tables. Please note that
we derive the validator from CQL partition keys and never actually read
it from the database. This is different from Origin which uses
CompositeType that is both stored and read from the system tables.

Fixes #7.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Tested-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-07-06 20:33:05 +03:00
Tomasz Grabiec
93bf8fa3ba Merge branch 'calle/execute_internal' from seastar-dev.git 2015-07-06 15:26:18 +03:00
Tomasz Grabiec
510f236e7c Merge branch 'penberg/cql-truncate-stmt' from seastar-dev.git
"truncate" statement grammar from Pekka.
2015-07-06 09:54:12 +02:00
Pekka Enberg
55fd6cc629 cql3: Enable create index statement grammar definition
Create index statement AST class is converted to C++ so enable its grammar
definition.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-07-06 10:23:13 +03:00
Pekka Enberg
480200f0ea cql3: Enable truncate statement grammar definition
Truncate statement AST class is converted to C++ (although its
functionality is unimplemented). Enable the CQL grammar definition so
that users get an "not implemented" error instead of a syntax error.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-07-06 10:07:20 +03:00
Calle Wilund
3253474eda query_processor : implement execute_internal
For internal CQL queries dispatched almost like external
2015-07-06 08:21:16 +02:00
Calle Wilund
53c3067fc4 cql3::query_options - add convinience constructor for internals 2015-07-06 08:21:16 +02:00
Calle Wilund
4a4f8c9d38 UntypedResultSet Java->C++
Initial translation, needed to implement
query_processor::execute_internal
2015-07-06 08:21:16 +02:00
Calle Wilund
62e4185fff Implement schema_altering_statement::execute_internal 2015-07-06 08:21:15 +02:00
Calle Wilund
41cbd0d267 Implement modification_statement::execute_internal 2015-07-06 08:21:15 +02:00
Calle Wilund
333af5b61a Implement select_statement::execute_internal 2015-07-06 08:21:15 +02:00
Calle Wilund
e99ffef141 cql_statement: change signature of execute_internal.
* Use storage_proxy here as well, even though the execution is 
  by definition local. (Since some local ops are better done 
  via SP anyway)
2015-07-06 08:21:15 +02:00
Calle Wilund
72ebb6360f modification_statement bugfix: don't move out of shared pointer in loop 2015-07-05 16:04:41 +03:00