Commit Graph

5110 Commits

Author SHA1 Message Date
Glauber Costa
4cd143de87 filter_tracker: define and call a stop method
All sharded services "should" define a stop method. Calling them is also
a good practice. For this one specifically, though, we will not call stop.
We miss a good way to add a Deleter to a shared_ptr class, and that would
be the only reliable way to tie into its lifetime.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-23 11:11:57 -04:00
Glauber Costa
b488b06fa4 cql_server: define and call a stop method
All sharded services "should" define a stop method. Calling them is also
a good practice.

Blindly calling it at exit is wrong, but it is less wrong than not calling
it at all, and makes it now equally as wrong as any of the other services.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-23 11:11:57 -04:00
Glauber Costa
60cdfa20c1 thrift_server: define and call a stop method
All sharded services "should" define a stop method. Calling them is also
a good practice.

Blindly calling it at exit is wrong, but it is less wrong than not calling
it at all, and makes it now equally as wrong as any of the other services.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-23 11:10:48 -04:00
Glauber Costa
f323551ebb thrift_server: make destructor out of line
The destructor depends on a lot of things (like the thrift lib classes), that
are not visible from the .hh. It works fine so far because nobody is trying to
destroy it explicitly either. But soon I will.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-23 10:57:53 -04: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
f413e137dd Merge seastar upstream 2015-07-23 16:35:28 +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
2d2422b6b7 Merge 2015-07-23 16:19:41 +03:00
Tomasz Grabiec
5cb840ad09 Merge tag 'asias/tests/gossip_fix/v1' from seastar-dev.git
Gossip test fixes from Asias.
2015-07-23 16:16:46 +03:00
Pekka Enberg
b912c888f1 service/migration_manager: Fix logging by de-thread-localizing loggers
The migration_manager and migration_task logging is currently not
visible in the logs. Fix that by de-thread-localizing both loggers.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-07-23 16:16:14 +03:00
Avi Kivity
eea955723e Merge "Serialize query::range<token> in stream_request" from Asias 2015-07-23 16:06:33 +03:00
Tomasz Grabiec
3fd682de4b db/legacy_schema_tables: Fix dead lock in create table statement
merge_schema() was recursively calling itself, causing it to block
iself on a non-recursive lock.
2015-07-23 12:37:42 +02:00
Gleb Natapov
e41880fc66 drop reference to storage_proxy from read executors
Now when storage_proxy can be accessed globally there is no need to
waste memory to save its pointer in each read executor.
2015-07-23 12:32:21 +03:00
Gleb Natapov
00d4974cec storage_proxy: add logger
Uncomment exiting logging points.
2015-07-23 12:32:21 +03:00
Gleb Natapov
f122ee39b9 storage_proxy: return proper error codes to transport layer
Transport layer expects to get error code in an exception of type
exceptions::cassandra_exception. Fix code to use it as a base for
all user visible exceptions and put correct error code there.
2015-07-23 12:32:21 +03:00
Asias He
e558efc42c tests: Use time based generation_number number 2015-07-23 15:26:46 +08:00
Asias He
879ca5adaf tests: Fix tests/urchin/gossip.cc
After commit 67f4b55b16 "gms/gossiper: Fix is_gossip_only_member() logic",
storage_service is needed by gossip.

To fix, start storage_service in the test. Also, improve the
indentation.
2015-07-23 15:26:46 +08:00
Pekka Enberg
78ee9e7478 db/system_keyspace: Fix "peers" table "schema_version" column type
The column type of "schema_version" is set to UTF8 which results in the
following value conversion errors:

  storage_service: fail to update schema_version for 127.0.0.2: boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::bad_any_cast> > (boost::bad_any_cast: failed conversion using boost::any_cast)

Change the column type to UUID like in Origin. Fixes #35.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-07-23 09:37:32 +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
f778e2aea2 system keyspace: set compaction strategy options for system.hints
This is the last system table that needed parameters. All them are
now devoid of fixmes

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-23 00:02:11 -04:00
Glauber Costa
2c3463cf1f schema: handle compaction strategy options
We will store the options in the schema, but it is not yet used by
the compaction code.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-23 00:02:11 -04: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
3a21ca5056 unimplemented: remove compact table
We have it now.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-22 23:51:00 -04:00
Glauber Costa
5c33549be5 system tables: mark some system tables as compact storage
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-22 23:10:22 -04:00
Glauber Costa
81e7a9ced7 sstable tests: test the writing of a compact sstable
Since the read tests are validated using Origin-generated tables, our
write test will just write to the tables and make sure we can read them
back ok.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-22 23:10:22 -04:00
Glauber Costa
c2232d2f2e tests: move some definition from mutation_test to the common header
I would like to use them from sstable_datafile_test.cc to make sure that
the tables we write are really correct.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-22 23:10:22 -04:00
Glauber Costa
cd91f2ecdc sstables: add tests for dense tables
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-22 23:10:22 -04:00
Glauber Costa
96f7c77a04 sstables: write dense tables
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-22 23:10:22 -04:00
Glauber Costa
2757cc595a sstable partition: read dense tables
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-22 23:10:22 -04:00
Glauber Costa
bb78499063 sstables: test for non-compound tables
Test the read of a table that is not compound NOR dense.
Dense tables will be handled later.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-22 23:10:21 -04:00
Glauber Costa
87c77acbac sstables: correctly write column names for non compound types
This can happen for COMPACT STORAGE.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-22 23:10:21 -04:00
Glauber Costa
3383c619ad partition: handle reads of non-composite types
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-22 23:10:21 -04:00
Glauber Costa
e9094db7ef sstable partition: remove dead code
This is no longer used

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-22 23:10:21 -04:00
Glauber Costa
5b7c749310 sstables: simplified version of write_column_name for non-clustered columns
We still want to wrap it instead of writing the column name directly, so we are
able to update the statistics.

It is better to have a separate function for this, because write_column_name
doesn't have enough information to decide when to do what. Augmenting it so we
could have would require passing the schema, or an extra parameter, which would
then spread to all callers.

Keep in mind that testing for an empty clustering key is not enough, since
composite types will serialize the empty clustering key in this case.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-22 23:10:21 -04:00
Glauber Costa
09631cbf5a schema: fix comparator field
We were currently using the regular column name as the comparator. That is
only correct in some specific cases, in particular, of a non-compound cell name,
that has no collections.

Now that we have the cell_name.hh infrastructure, we can use it.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-22 23:10:21 -04:00
Glauber Costa
d7cb078592 sstable_tests: convert schemas to use the schema_builder
Technically, this is not needed for the existing schemas: the builder is only
necessary when we are setting properties. For consistency, however, let's
convert them all.

Soon we will have some schemas that will set properties. In particular, compact
storage.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-22 23:10:21 -04:00
Glauber Costa
194a24fd37 sstable_tests: move cs schema to sstable_test.hh
This solitary schema definition should go live with the rest.
We give it a more descriptive name now that it is going.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-22 23:10:21 -04:00
Glauber Costa
d5b4731e49 schema: make all schemas be generated by the schema_builder
Some of the fields in the schema will not not be passed directly, but
calculated by the schema_builder. This is because they are not simple values of
the form a = x, but slightly more complex and have to be derived from other
properties (for instance, the amount of clustering keys).

For those values, a default value does not really make sense. Take for instance
the case of the comparator: there is always a comparator, and there is not any
comparator that can serve as a default. Which comparator to use depend on
whether or not the table has collections, whether or not it has clustering
keys, and whether or not it is marked as compact storage.

Making all tables go through the builder is a guarantee that all of them
will have their values set.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-22 23:10:21 -04:00
Glauber Costa
5cc955d69c comparator: functions to manipulate a compound type
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-22 23:10:21 -04:00
Glauber Costa
ddf6a2d8d5 schema: add a new column_kind
Origin has another column_kind, that we lack: compact_value. This kind is
used to identify regular columns of dense tables.

Take for instance, the following table:

CREATE TABLE ks2.compact (
    ks text,
    cl1 text,
    cl2 text,
    PRIMARY KEY (ks, cl1)
) WITH COMPACT STORAGE

cqlsh> select keyspace_name, columnfamily_name, column_name, type from system.schema_columns \
       where keyspace_name='ks2' and columnfamily_name='compact';

 keyspace_name | columnfamily_name | column_name | type
---------------+-------------------+-------------+----------------
           ks2 |           compact |         cl1 | clustering_key
           ks2 |           compact |         cl2 |  compact_value
           ks2 |           compact |          ks |  partition_key

We will treat those columns as regular columns for most purposes. Because of
that, we don't need to separate them from the regular columns when we sort
initially, for instance. All we have to do is change its type.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-22 23:10:21 -04:00
Glauber Costa
66a10c3b38 schema: add empty column for dense tables that do not have a regular column
This is how it happens for Origin. Take for instance the following CF:

CREATE TABLE ks2.noregular_cs2 (
    ks text,
    cl1 text,
    cl2 text,
    PRIMARY KEY (ks, cl1, cl2)
) WITH COMPACT STORAGE;

cqlsh> select keyspace_name, columnfamily_name, column_name from system.schema_columns \
       where keyspace_name='ks2' and columnfamily_name='noregular_cs2';

 keyspace_name | columnfamily_name | column_name
---------------+-------------------+-------------
           ks2 |     noregular_cs2 |                <===== added this.
           ks2 |     noregular_cs2 |         cl1
           ks2 |     noregular_cs2 |         cl2
           ks2 |     noregular_cs2 |          ks

In order to achieve that, we need to relax the test in db/legacy_schema_tables.cc.
It will throw in case it finds an empty name.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-22 23:10:21 -04:00
Glauber Costa
10436c29c1 thrift: implement compound comparator test
Now that we do that for the main schema, we can just copy the result for
thrift.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-22 23:10:20 -04:00
Glauber Costa
aa4b1dcc58 schema: add a field for compound
We are deviating a bit from Origin here: In Origin, we would store a full
comparator class. However, due to the fact that our types are very different,
and as a consequence we will not call a serializer directly on the cell name,
that is not necessary.

The only information that we will need to store is whether or not the table is
compound. Some functions to manipulate it will be presented in the next patch.
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-22 23:09:05 -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
Asias He
a216f258a2 streaming: Serialize query::range<token> in stream_request 2015-07-23 09:08:15 +08:00
Asias He
243dbd3bfd dht: Reuse token serializer in ring_position 2015-07-23 09:08:15 +08:00
Asias He
1761be4dc4 dht: Implement serializer interface for token
It is needed by query::range<token>.
2015-07-23 09:08:15 +08:00
Paweł Dziepak
23cccb3c1a tests/cql3: add more ordering tests
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-07-23 02:38:43 +02:00