"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."
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.
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>
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>
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>
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>
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>
Add locking to merge_schema() to ensure only one CPU is able to fiddle
with internals at a time.
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
recently, "file" started to use a shared_ptr internally, and is already
copy-able and reference counted, and there is no reason to use
lw_shared_ptr<file>. This patch cleans up a few remaining places where
lw_shared_ptr<file> was used.
Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Apparently we need to register the stop function explicitly. That was not being
visible before, because the urchin binary was failing on exit before this for
some other reason. Once that was fixed, this one became apparent.
Scylla can correctly shutdown now.
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Make all callers go through the builder. Current callers - there are many
in the system tables code, are patched.
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
According to the comments, we are doing this for simplicity, to avoid
creating a new type_parse object.
However, while this approach works well for the simple case where we expect
a single token, it won't work as the parser becomes more able to recognize
other cases.
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Note that the multicell attribute can't be part of the parse instance, because
otherwise we would either freeze every subsequent element, or complicate the
flow considerably to handle it.
It is instead, passed as a parameter to get_instance_types(), which will then
have to be propagated to parse() and get_abstract_type()
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
We currently have a bug when parsing collection types that contains collections
themselves.
We call the recursion correctly, but get_abstract_type gets its value by copy, not
reference. Therefore, all work it does in the _idx manipulation is done in the copy,
and when the callee returns, the caller, with its _idx unchanged, will try recursing
again.
Fix it by passing by reference
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Collections can at times have the form <hex>:type. This is the case,
for instance, for the strings that compose the comparator string. The
actual hex number isn't terribly interesting: it is used as a key to
hash the collection types, but since we hash them by their types anyway,
we can safely ignore them.
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
syslogd supprt from Avi:
Allow log output to go to syslog, from where it can be shipped to journald/
some other machine/splunk/whatever. Disabled by default, exposed via config.
config.hh changes rapidly, so don't force lots of recompiles by including it.
Need to place seed_provider_type in namespace scope, so we can forward
declare it for that.
In much of our column_families APIs, we need to pass a pointer to the database.
The only reason we do that, is so we can properly handle the commit log entries
after we seal the current memtables into sstables.
Now that we store a pointer to the commit log in the CF itself at the time it
is created, we no longer have to do it. As a result, the APIs are a lot
cleaner, with no gratuitous parameters.
My motivation for this was the flush method, but as a result, apply() also gets
cleaner.
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
The logger class constructor registers itself with the logger registry,
in order to enable dynamically setting log levels. However, since
thread_local variables may be (and are) initialized at the time of first
use, when the program starts up no loggers are registered.
Fix by making loggers global, not thread_local. This requires that the
registry use locking to prevent registration happening on different threads
from corrupting the registry.
Note that technically global variables can also be initialized at the
point of first use, and there is no portable way for classes to self-register.
However this is the best we can do.
"Some of the system tables will set gc_grace_seconds, or default_time_to_live
but right now we are commenting them out.
The best way to do it would have been to somehow save the fields so we don't need to
set it all the time - as this function is effectively doing.
However, those fields would feel very spurious in the constructor, and it is not
like there isn't a lot of other things for us to set. More importantly, calling
those schema functions is a very rare event. We usually call it once and store
the pointer somewhere.
With that, we're very close to implementing everything that the system tables
needs set, missing only COMPACT STORAGE and information about compaction
strategy."