Commit Graph

38 Commits

Author SHA1 Message Date
Pekka Enberg
62fba73a05 schema_builder: Add index_metadata support 2017-05-04 14:59:11 +03:00
Duarte Nunes
a64c47f315 schema: Move raw_view_info outside of raw_schema
In preparation of an upcoming patch, where the schema
won't directly store the raw_view_info.

Signed-off-by: Duarte Nunes <duarte@scylladb.com>
2017-03-15 15:38:31 +01:00
Duarte Nunes
82ce8eedbd schema: Add view_info field
This patch adds a view_info optional field to the schema. It's
presence indicates the schema represents a materialized view.

Signed-off-by: Duarte Nunes <duarte@scylladb.com>
2016-12-20 13:06:11 +00:00
Duarte Nunes
5995aebf39 schema_builder: Ensure dense tables have compact col
This patch ensures that when the schema is dense, regardless of
compact_storage being set, the single regular columns is translated
into a compact column.

This fixes an issue where Thrift dynamic column families are
translated to a dense schema with a regular column, instead of a
compact one.

Since a compact column is also a regular column (e.g., for purposes of
querying), no further changes are required.

Signed-off-by: Duarte Nunes <duarte@scylladb.com>
Message-Id: <1470062410-1414-1-git-send-email-duarte@scylladb.com>
2016-08-02 14:49:13 +02:00
Pekka Enberg
38a54df863 Fix pre-ScyllaDB copyright statements
People keep tripping over the old copyrights and copy-pasting them to
new files. Search and replace "Cloudius Systems" with "ScyllaDB".

Message-Id: <1460013664-25966-1-git-send-email-penberg@scylladb.com>
2016-04-08 08:12:47 +03:00
Tomasz Grabiec
41d475d9c0 schema_builder: Fluentize property setters 2016-02-22 20:23:29 +01:00
Paweł Dziepak
84840c1c98 schema: keep track of removed collections
Cassandra disallows adding a column with the same name as a collection
that existed in the past in that table if the types aren't compatible.
To enforce that Scylla needs to keep track of all collections that ever
existed in the column family.

Signed-off-by: Paweł Dziepak <pdziepak@scylladb.com>
2016-01-18 08:34:29 +01:00
Paweł Dziepak
da0f999123 schema_builder: add with_altered_column_type()
Signed-off-by: Paweł Dziepak <pdziepak@scylladb.com>
2016-01-11 10:34:54 +01:00
Paweł Dziepak
9807ddd158 schema_builder: add with_column_rename()
Columns that are part of the primary key can be renamed.

Signed-off-by: Paweł Dziepak <pdziepak@scylladb.com>
2016-01-11 10:34:54 +01:00
Paweł Dziepak
42dc4ce715 schema: keep track of dropped columns
Knowing which columns were dropped (and when) is important to prevent
the data from the dropped ones reappearing if a new column is added with
the same name.

Signed-off-by: Paweł Dziepak <pdziepak@scylladb.com>
2016-01-11 10:34:53 +01:00
Tomasz Grabiec
f58c2dec1e schema: Make schema objects versioned
The version needs to change value not only on structural changes but
also temporal. This is needed for nodes to detect if the version they
see was already synchronized with or not even if it has the same
structure as the past versions. We also need to end up with the same
version on all nodes when schema changes are commuted.

For regular mutable schemas version will be calculated from underlying
mutations when schema is announced. For static schemas of system
keyspace it is calculated by hashing scylla version and column id,
because we don't have mutations at the time of building the schema.
2016-01-08 21:10:26 +01:00
Tomasz Grabiec
13295563e0 schema_builder: Move compact_storage setting outside build()
Properties of the schema are set using methods of schema_builder and
different variants of build() are for different forms of the final
schema object.
2016-01-08 21:10:26 +01:00
Avi Kivity
d5cf0fb2b1 Add license notices 2015-09-20 10:43:39 +03:00
Glauber Costa
21ebaeffae schema_builder: provide a build function that doesn't take compact storage.
We will invoke the schema builder from schema_tables.cc, and at that point, the
information about compact storage no longer exists anywhere. If we just call it
like this, it will be the same as calling it with compact_storage::no, which
will trigger a (wrong) recomputation for compact_storage::yes CFs

The best way to solve that, is make the compact_storage parameter mandatory
every time we create a new table - instead of defaulting to no. This will
ensure that the correct dense and compound calculation are always done when
calling the builder with a parameter, and not done at all when we call it
without a parameter.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-08-07 09:30:54 -05:00
Glauber Costa
498824971d schema: handle caching options
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-08-07 09:30:53 -05:00
Tomasz Grabiec
c68c37ae2f Revert "schema: support dropped columns"
This reverts commit 9887bc5f5f.

Breaks "CREATE TABLE" statement.
2015-07-30 10:56:01 +02:00
Glauber Costa
9887bc5f5f schema: support dropped columns
Because we don't support alter table, we won't have anyone actually manipulating this.
But we will set up so it appears properly as an empty map in queries.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-29 18:44:59 -04:00
Glauber Costa
f49eb92880 schema: speculative retry
When added to the schema and handled by legacy_schema_tables.cc, will then
appear correctly in the respective system tables.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-29 18:44:59 -04:00
Glauber Costa
01e5fcad5e schema: memtable flush period
currently set to 0, which is Origin's default

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-29 18:44:59 -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
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
Paweł Dziepak
54268889a1 schema: allow specifying column component index
The order of columns that belong to partition key or clustering key
needs to be preserved.

Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-07-14 19:34:27 +02:00
Glauber Costa
fe370ec848 schema: read_repair_chance
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-10 10:29:02 -04:00
Glauber Costa
ea17f6d76f schema: max and min index interval
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-10 10:29:02 -04:00
Glauber Costa
aa270a149f schema: compaction strategy
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-10 10:29:02 -04:00
Glauber Costa
b75bd9ef53 schema: add local_repair_chance parameter
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-10 10:29:02 -04:00
Glauber Costa
8218c819a5 schema: access gc_grace_seconds
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-10 10:29:02 -04:00
Glauber Costa
9a691503ff add default_validator to schema_builder
We eventually need to wire them all up. This one is needed for describe
keyspaces to work.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-09 00:12:08 -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
3437a49d26 cql3: Enable CF "bloom_filter_fp_chance"
Enable column family "bloom_filter_fp_chance" from the CQL front-end and
make sure its persisted to system tables.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-07-07 13:09:58 +03:00
Paweł Dziepak
9606b3f911 schema_builder: add set_compressor_params()
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-06-29 09:36:22 +02:00
Tomasz Grabiec
f444f88dbe schema_builder: Add missing include 2015-06-25 18:45:13 +02:00
Calle Wilund
a234414ae5 Added schema_builder::add_default_index_names
Transposition of CFMetaData.addDefaultIndexNames()
2015-06-03 10:13:53 +02:00
Calle Wilund
3b6fc56cb5 Make schema_builder constructible from schema
* Make schema_builder use schema::raw_schema to ensure it carries the
same info
* Make it constructible from schema to allow modify-replace flows
2015-06-02 11:22:42 +02:00
Calle Wilund
1d30b85ac6 Unify column_definition::column_kind and ::column_kind enums 2015-06-02 11:22:41 +02:00
Tomasz Grabiec
49f9794b1b schema: Introduce schema_builder
It's more flexible than schema's constructor. Primarily meant to be
used from tests, but not necessarily only there.
2015-05-06 16:40:48 +02:00