From Glauber:
"Shlomi found a bug when writing summary files under certain conditions.
The current patchset fixes it, while also performing some generally useful
cleanups."
The column_identifiers are wrapped in shared_ptr<> so use the
appropriate hash and comparison functions for the container.
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
The column_identifiers are wrapped in shared_ptr<> so use the
appropriate hash and comparison functions for the container.
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
From Pekka:
"This series improves the CQL test for 'create table' statement. It
hardens the test_create_statement() test case and converts
create_table() calls to use CQL where possible. Please note that we need
to go through the remaining create_table() call-sites and fix potential
issues in the CQL front-end or schema management code."
Add a require_table_exists() assertion after 'create table' statement is
executed to ensure in-memory schema is updated accordingly.
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
We are always adding one to the number of entries, but that is incorrect. If
we have an exact multiple of the sampling rate, then we shouldn't.
This is no longer affecting us as a bug, because we now compute the size after
we seal the file. However, we should still do it right, because we will need
the correct value at some point, if we support changes to the sampling level.
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
We have recently had a bug where we were messing up with the summary generation
in certain corner cases. In particular, when the number of keys was an exact multiple
of the sampling rate.
Add a test case to make sure we never regress on this.
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
We do a lot more work than we should in prepare_summary. In particular,
in cases where we will create sstables from compression, some of that information
will not be known until later.
This code is also fragile, as exposed by a recent bug, in which we miscalculated
s.header.size, ending up with a completely unusable file.
The scheme proposed in this patch makes sure things like that does not happen,
because we will be generating the header based on what we actually write, and
not based on what we estimate that we will write.
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
From Pekka:
"This series updates the table merging code to instantiate columns from
system tables. To do that, the db/marshal/TypeParser class was imported
from Origin and converted to support primitive and collection types to
make CQL test pass."
Read the system tables and instantiate table columns to in-memory data
structures.
NOTE! We only support one component per partition and clustering key
because there is no way to pass component index to the schema builder.
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Fix data type naming to follow Origin's conventions so that we can
serialize the names to database.
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Add a parse_type() function for parsing a serialized type name and
returning a data_type for it. Please note that collection types are
handled elsewhere.
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Add clustering key support to create_table_statement. While at it, add
compound types for partition keys, to unify schema building code for
both partition and clustering keys.
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Make sure add_column_to_schema_mutation() also sets "column_index" for a
column that is stored to system tables.
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Add a position() helper function that returns component index if there
is one and zero if there isn't. This is similar to what
ColumnDefinition.position() does in Origin. We will use this for a table
creation mutation.
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>