Commit Graph

21 Commits

Author SHA1 Message Date
Tomasz Grabiec
b42d3a90b3 cql3: create_table_statement: Sort _defined_names by text
Currently they are sorted by address in memory, which breaks the
check for column name duplicates, which assumes sorting by text.

Fixes #975.

Message-Id: <1456937400-20475-1-git-send-email-tgrabiec@scylladb.com>
2016-03-02 18:53:43 +02:00
Avi Kivity
d5cf0fb2b1 Add license notices 2015-09-20 10:43:39 +03: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
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
Pekka Enberg
86d913954a db/legacy_schema_tables: Store CF "is_dense" to system tables
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>
2015-07-07 12:36:50 +02:00
Pekka Enberg
4bb1c049f7 cql3: Fix create_table_statement::raw_statement definition lookup
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>
2015-06-17 16:34:09 +03:00
Pekka Enberg
765ace5900 cql3: Fix static column set lookups
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>
2015-06-17 16:34:09 +03:00
Gleb Natapov
a338407e29 make storage_proxy object distributed
storage_proxy holds per cpu state now to track clustering, so it has to
be distributed otherwise smp setup does not work.
2015-06-17 15:14:06 +02:00
Pekka Enberg
b6c348807c cql3: Add clustering key support to create_table_statement
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>
2015-06-17 11:18:53 +02:00
Pekka Enberg
24e74f331d cql3: Move create_table_statement::raw_statement implementation
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>
2015-06-16 17:35:24 +03:00
Pekka Enberg
9bcb590efe cql3: Fix column identifier lookups
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>
2015-06-08 09:23:33 +03:00
Pekka Enberg
07e4286f9e cql3: Make 'create table' include columns in schema_ptr
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>
2015-06-05 15:15:12 +03:00
Pekka Enberg
4365b8bb69 cql3: Use schema_builder for create table statements
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>
2015-06-05 15:15:12 +03:00
Pekka Enberg
cf6cdc6541 cql3: Move create_table_statement code out-of-line
Move create_table_statement code out-of-line in preparation for
modifying the implementation.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-06-05 15:15:12 +03:00
Calle Wilund
1631ce132e Add "storage_proxy&" argument to cql_statement::validate
To make db, schemas etc reachable
2015-06-03 10:13:52 +02:00
Pekka Enberg
11b633208d cql3: Remove Java imports from C++ files
Remove left-over Java imports from files that are already translated to
C++.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-05-12 16:41:12 +03:00
Avi Kivity
bc669add40 schema: const correctness
Make schema accessors const, and make schema_ptr refer to a const schema.
2015-05-06 13:52:59 +02:00
Tomasz Grabiec
06f198b10c schema: Add id field
It uniquely identifies column_family globally. Will be used for
column_family lookups.
2015-04-15 20:33:48 +02:00
Pekka Enberg
d0fef3e31b db: Apply mutations in legacy_schema_tables::merge_schema()
Pass a reference to storage_proxy and apply mutations in
legacy_schema_tables::merge_schema().

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-03-26 13:33:48 +02:00
Pekka Enberg
5bab83b9e0 cql3: Switch to futurized migration_manager
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>
2015-03-26 13:33:48 +02:00
Pekka Enberg
1c6e5ebc36 cql3: Convert CreateTableStatement to C++
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-03-24 15:06:06 +02:00