Use seastar::checked_ptr<weak_ptr<pepared_statement>> instead of shared_ptr for passing prepared statements around.
This allows an easy tracking and handling of statements invalidation.
This implementation will throw an exception every time an invalidated
statement reference is dereferenced.
Signed-off-by: Vlad Zolotarov <vladz@scylladb.com>
This patchset adds missing properties to the create_view_statement,
such as whether the view is compact or the order of its clustering
columns.
Fixes#1766
This patch extracts the cf_properties class, which contains common
attributes of tables and materialized views.
Signed-off-by: Duarte Nunes <duarte@scylladb.com>
In preparation for the removal of schema_altering_statement::prepare(),
add a fake create_table_statement::prepare(). create_table_statement
has already been split to raw and prepared variants, so this prepare()
will never be called, but it is required because schema_altering_statement
is both a cql_statement and a prepared_statement. This confusion will
be fixed later on.
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>
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>
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>
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>
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>
Move raw_statement implementation out of the header file. This makes
life easier when we modify the class for clustering key support.
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
We're looking up shared_ptr<column_identifier> type so make sure we
lookup by value, not by pointer.
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Make 'create table' statements also specify the following for
schema_ptrs:
- Partition keys
- Regular columns
- Static columns
Please note that clustering keys are _not_ included because we seem to
lack infrastructure like CompoundType and CellNameType to properly
enable them.
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Switch to using schema_builder in create_table_statement in preparation
for also defining columns in the resulting schema_ptr.
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Move create_table_statement code out-of-line in preparation for
modifying the implementation.
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Pass a reference to storage_proxy and apply mutations in
legacy_schema_tables::merge_schema().
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Migration manager announce functions now return a future. Switch to the
new API in modification statements.
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>