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>
"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."
"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."
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>
"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)"
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
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>
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>
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>
"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."
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>
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>
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>
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>
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>