Commit Graph

672 Commits

Author SHA1 Message Date
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
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
Paweł Dziepak
5f2fd9b4dd cql3: cassandra_exceptions shouldn't be logged as errors
Only unexpected server errors should be logged, exception classes
deriving from cassandra_exception do not count as those.

Fixes #60.

Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-08-03 11:09:50 +03:00
Paweł Dziepak
690e9b55f4 cql3: set proper expiration of row marker
INSERT statements update row marker ttl and expiry to the same values
which are set to the added/modified cells.

Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-07-30 14:10:06 +02:00
Paweł Dziepak
f5fff734ed cq3: update_parameters: add getters for ttl and expiry
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-07-30 14:10:06 +02:00
Paweł Dziepak
87916612bd cql3: set default time to live when building schema
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-07-30 14:09:00 +02:00
Glauber Costa
f49eb92880 schema: speculative retry
When added to the schema and handled by legacy_schema_tables.cc, will then
appear correctly in the respective system tables.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-29 18:44:59 -04:00
Glauber Costa
01e5fcad5e schema: memtable flush period
currently set to 0, which is Origin's default

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-29 18:44:59 -04:00
Glauber Costa
3bb16fba7e create table: fix creation of compact storage tables
The statement being removed in this patch is wrong, and nonexistent in Origin.
If the list of column aliases is empty, we should leave it this way.

This code was already present before the compact storage series. But because
tables created using the schema_builder directly won't exercise this code path,
I ended up not noticing - specially because it only happens with tables that
lack a clustering key. The ones I tested through cqlsh, all had a clustering
key.

Fixes #45

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-28 10:05:05 +02:00
Avi Kivity
2e745bebad Merge "use compaction strategy options" from Raphael 2015-07-27 17:06:43 +03:00
Avi Kivity
095c2f2920 Merge "Fixes for partition_range model" from Tomasz
"range::is_wrap_around() will not work with current ring_position, because it
relies on total ordering. Same for range::contains(). Currently ring_position
is weakly ordered. This series fixes this problem by making ring_position
totally ordered.

Another problem fixed by this series is handling of wrap-around ranges. In
Origin, ]x; x] is treated as a wrap around range covering whole ring."
2015-07-25 17:47:40 +03:00
Avi Kivity
73dfa66b8a remove "reversed_type.hh"
Not used (and fix one accidental use).
2015-07-25 17:34:56 +03:00
Glauber Costa
21fc542af1 create_table_statement: revert reversed types
We have the information that they should be reverted, but we are not yet
reverting them. Go ahead and do it

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-24 22:55:12 -04:00
Glauber Costa
5306c70f3f create_table statement: sanity test defined_order
Code-conversion, mainly

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-24 22:55:12 -04:00
Glauber Costa
3c0982a01f create_table_statement: adjust _defined_ordering
First of all, we should abide by our convention of prepending member names with
a '_'. (That is the underline character, it just looks like a face)

But more importantly, because we will be searching its contents frequently, a
helper function is provided.

Note that obviously a hash is better suited for this: but because we do need to
keep the fields in order they are inserted, a vector really is the best choice
for that.

A table is not expected to have a lot of clustering keys. So this search should
be cheap. If it turns out to be a problem, we can adjust later.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-24 22:55:12 -04:00
Tomasz Grabiec
e5feff5d71 dht: ring_position: Switch to total ordering
range::is_wrap_around() and range::contains() rely on total ordering
on values to work properly. Current ring_position_comparator was only
imposing a weak ordering (token positions equal to all key positions
with that token).

range::before() and range::after() can't work for weak ordering. If
the bound is exclusive, we don't know if user-provided token position
is inside or outside.

Also, is_wrap_around() can't properly detect wrap around in all
cases. Consider this case:

 (1) ]A; B]
 (2) [A; B]

For A = (tok1) and B = (tok1, key1), (1) is a wrap around and (2) is
not. Without total ordering between A and B, range::is_wrap_around() can't
tell that.

I think the simplest soution is to define a total ordering on
ring_position by making token positions positioned either before or
after all keys with that token.
2015-07-24 16:08:41 +02:00
Pekka Enberg
78840a690f cql3: Move ut_name implementation to .cc file
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-07-24 10:21:11 +02:00
Pekka Enberg
de6b38e316 cql3: Move column_identifier implementation to .cc file
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-07-24 10:21:11 +02:00
Pekka Enberg
872a7215b2 cql3: Separate column_identifier::raw class
Move column_identifier::raw class definition outside of
column_identifier class.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-07-24 10:21:11 +02:00
Pekka Enberg
1e5fad25d7 cql3: Move attributes implementation to .cc file
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-07-24 10:21:11 +02:00
Pekka Enberg
0e09b2769c cql3: Move abstract_marker implementation to .cc file
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-07-24 10:21:11 +02:00
Pekka Enberg
ca3690726a cql3: Remove unused cql3_row.hh
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-07-24 10:21:11 +02:00
Raphael S. Carvalho
ab30ee04f1 cql3: add static function to_long to property definitions
Useful for retrieving a long value from a string.

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-07-23 14:47:43 -03:00
Raphael S. Carvalho
e3d3d9be71 cql3: add static function to_double to property_definitions
Useful for retrieving a double value from a string.

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-07-23 14:42:20 -03:00
Avi Kivity
bb3aef7fd9 Merge "Basic schema handling of compact strategy" from Glauber
"With this patchset, cqlsh's describe table command now work"
2015-07-23 16:47:29 +03:00
Avi Kivity
be32746c58 Merge "Handle Compact Storage" from Glauber
"This is my current proposal for Compact Storage tables - plus
the needed infrastructure.

Getting rid of the CellName abstraction allows us to simplify
things by quite a lot: now all we need is to mark whether or
not a table is composite, and provide functions to play the
role of the comparator when dealing with the strings."
2015-07-23 16:20:31 +03:00
Avi Kivity
c1aed26377 Merge "More fixes for ORDER BY clauses"
"These patches fix more problems related to ORDER BY clauses.
Firstly, mutation_partition::query() can now return rows in reveresed
order which makes it easy for select statements to ask for data from
single partition with clustering keys in reversed order even if limit
of rows is set.
That alone is not sufficient, though, if the request contains IN clause
on partition keys and number of returned rows is limited. The information
needed to determine which rows need to be in the reply isn't available
before post-query sort is done, so select statement asks for more rows
than the limit and trims the output later."
2015-07-23 07:27:53 +03:00
Avi Kivity
ae6ea2a7a8 Merge "Fix setting collections to null" from Paweł
"The following patches fix a bug in collections setters where the tombstone
was created but never applied if the collection was set to null.

This series makes cql_tests.py:TestCQL.null_support_test pass."
2015-07-23 07:23:08 +03:00
Glauber Costa
4e83530c3f do not "throw new"
This is how Java does. But in C++, "throw new", although valid, would require
the catcher to catch a pointer to the exception - which isn't really what we
do.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-23 07:07:17 +03:00
Glauber Costa
d1496944d9 sstables: handle compaction strategy
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-23 00:02:11 -04:00
Glauber Costa
cb94f3f27e schema_builder: calculate is_dense from the schema builder
We currently have code to calculate "is_dense" in the create statement handler.
That obviously don't work for the system schemas, which are not defined this
way.

Since all of our schemas now have to pass through the schema_builder one way or
another, that is the best place in which to do that calculation.

Note that unfortunately, that does not mean we can just get rid of
set_is_dense() in the schema builder: we still need to set it in some
situations, where for instance, we read that property in schema_columnfamilies,
and then apply to the relevant CF. Those uses are, however, all internal to
legacy_schema_tables.cc

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-22 23:09:05 -04:00
Paweł Dziepak
53b6c2cdfa cql3: drop reverse_primary_key_restrictions
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-07-23 02:38:38 +02:00
Paweł Dziepak
281a8d97a5 cql3: make sure enough rows is returned in queries with IN clause
In case of queries with IN on partition key, ORDER BY and LIMIT it is
not known until after post-query sort which rows should be included in
the result set. To make sure that the output is correct each partition
specified in IN clause is queried for LIMIT rows and the excess data is
trimmed after the results are sorted.

Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-07-23 02:38:33 +02:00
Paweł Dziepak
b14aa8760a cql3: support reversed order in select statements
When partition_slice option reversed is set the query will already
return rows in desired (i.e. reversed) order. That's not true, however,
for statements using IN restriction on partition keys. In such case
post-query ordering is still needed.

Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-07-23 02:38:30 +02:00
Tomasz Grabiec
76bf7b228c cql: token_restriction: Fix range produced for contradicting restrictions
We want to return no results in this case, so we should return no
range instead of range open on both sides, which yields all data.
2015-07-22 17:55:50 +02:00
Tomasz Grabiec
47e006bfae cql: token_restriction: Fix the check detecting contradicting restrictions
The condition is incorrect after 9b52f5bf2b.

We no longer express the full range as (min, min], and missing upper
bound as bound as (x, min] so we don't need to exclude those cases in
the check.
2015-07-22 17:55:42 +02:00
Paweł Dziepak
6788a7afdb cql3: remove tombstone argument from do_{add, put, append}
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-07-22 15:30:13 +02:00
Paweł Dziepak
69d0eba9c7 cql3: fix setting collections to null
Before this patch the tombstone created in setter::execute() was never
applied if the new collection value was null.

Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-07-22 15:29:54 +02:00
Tomasz Grabiec
9b52f5bf2b storage_proxy: Make range splitting never produce a wrap around range
Origin has no notion of a maximum token so a range without upper bound
is represented as (x; min]. The splitting code is supposed to produce
only non-wrapping ranges, but (x; min] looks like a wrapping range, so
database code which consumes it would have to special-case for it. A
simpler solution is to change the splitting code to never produce a
wrapping range.
2015-07-22 10:27:48 +02:00
Avi Kivity
675a1ee8ea Merge "Add varint type" from Paweł
"This patchset adds support for varint type."
2015-07-21 18:21:21 +03:00
Paweł Dziepak
babb2fa261 types: add varint type
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-07-21 14:46:34 +02:00
Avi Kivity
c84fc789c5 cql3: avoid use-after-free of stack variable in create_keyspace_statement
Capture it by value.
2015-07-21 12:19:19 +03:00
Gleb Natapov
c58aea07c3 remove storage_proxy::query_local()
Use storage_proxy::query() instead.
2015-07-20 12:06:00 +02:00
Paweł Dziepak
fe491ee5f5 cql3: make sure an exception is caught in create statements
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-07-16 16:23:39 +02:00
Paweł Dziepak
b2cdd36769 cql3: make sure an exception is caught in delete statements
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-07-16 16:23:27 +02:00