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>
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>
Store the column family key validator in system tables. Please note that
we derive the validator from CQL partition keys and never actually read
it from the database. This is different from Origin which uses
CompositeType that is both stored and read from the system tables.
Fixes#7.
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Tested-by: Pekka Enberg <penberg@cloudius-systems.com>
Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
New in v2:
- Use std::partition_copy() and boost::range::algorithm::partition().
- Don't use std::move() when returning a local vector variable.
Works only if all replicas (participating in CL) has the same live
data. Does not detects mismatch in tombstones (no infrastructure yet).
Does not report timeout yet.
This is meant to resolve to dependecy loop between token_metadata.hh
and system_keyspace.hh.
Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
If we move altered inside this lambda, the next invocations of the outter
lambda will see a corrupted value. So in the case of smp, invoke_on_all will
invoke correctly in the first shard, but then see a bogus altered vector on
the subsequent ones.
Capturing a reference is fine, because the outer lambda will not be destroyed
until the inner one completes - so the object will live in the capture list.
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
When we call merge_keyspaces, we end up calling db.add_keyspace, which means we
don't do parts of creation of a keyspace - like creating the directory. This works
in some situations where all the work was already done, but not in others.
We should be calling create_keyspace instead, which will take care of all that
for us. That will include creating a directory when one is needed.
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
"This is the current patchset to flush and persist schema changes to disk.
It is not perfect, in the sense that older changes still in flight won't be
waited for. But as we discussed - at this moment we'll just note that, and
leave the fix for later"
Being able to just get() a future inside a thread is a very nice functionality,
but we should be more careful a to when we do it. In particular, we are doing this
in a function inside db::legacy_schema_tables, because that function is supposed to
be used - so far - only inside a threaded function.
That approach simplify things, but at a great reusability cost. That means that this
function can now only be reused inside thread code.
This patch turns the offender into a normal future function, and moves the get0() to
code that is directly under seastar::async.
As a rule of thumb, we should stay away from ever doing get / get0 in functions that
are not used directly by async code.
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Snitch class semantics defined to be per-Node. To make it so we
introduce here a static member in an i_endpoint_snitch class that
has to contain the pointer to the relevant snitch class instance.
Since the snitch contents are not always pure const it has to be per
shard, therefore we'll make it a "distributed". All the I/O is going
to take place on a single shard and if there are changes - they are going
to be propagated to the rest of the shards.
The application is responsible to initialize this distributed<shnitch>
before it's used for the first time.
This patch effectively reverts most of the "locator: futurize
snitch creation" a2594015f9 patch - the part that modifies the
code that was creating the snitch instance. Since snitch is
created explicitly by the application and all the rest of the code
simply assumes that the above global is initialized we won't need
all those changes any more and the code will get back to be nice and simple
as it was before the patch above.
So, to summarize, this patch does the following:
- Reverts the changes introduced by a2594015f9 related to the fact that
every time a replication strategy was created there should have been created
a snitch that would have been stored in this strategy object. More specifically,
methods like keyspace::create_replication_strategy() do not return a future<>
any more and this allows to simplify the code that calls it significantly.
- Introduce the global distributed<snitch_ptr> object:
- It belongs to the i_endpoint_snitch class.
- There has been added a corresponding interface to access both global and
shard-local instances.
- locator::abstract_replication_strategy::create_replication_strategy() does
not accept snitch_ptr&& - it'll get and pass the corresponding shard-local
instance of the snitch to the replication strategy's constructor by itself.
- Adjusted the existing snitch infrastructure to the new semantics:
- Modified the create_snitch() to create and start all per-shard snitch
instances and update the global variable.
- Introduced a static i_endpoint_snitch::stop_snitch() function that properly
stops the global distributed snitch.
- Added the code to the gossiping_property_file_snitch that distributes the
changed data to all per-shard snitch objects.
- Made all existing snitches classes properly maintain their state in order
to be able to shut down cleanly.
- Patched both urchin and cql_query_test to initialize a snitch instance before
all other services.
Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
New in v6:
- Rebased to the current master.
- Extended a commit message a little - the summary.
New in v5:
- database::create_keyspace(): added a missing _keyspaces.emplace()
New in v4:
- Kept the database::create_keyspace() to return future<> by Glauber's request
and added a description to this method that needs to be changed when Glauber
adds his bits that require this interface.
We left some columns at a FIXME state, because we didn't have all types
implemented to reflect this. In particular, all collection types were left
behind.
Now that we do, let's refresh the system table's schemas.
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
We are currently generating an empty config, which is wrong and won't
propagate important characteristics of the keyspace.
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
A lot of our tests run in memory only, but now that our write path is complete,
we may start running into problems soon, as we write down the sstables.
It would be nice to force the database to run in-memory only in some situations.
Even in the real world, some scenarios may benefit from that in the future.
This patch forces durable_writes to be always false in case we force the data
directory to be an empty list.
For system tables, the patch also fixes a bug. Because system tables were
forceably initialized with durable_writes = false, we would never write them to
disk, even when we were supposed to.
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
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>
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 attributes that we didn't support when the code was first
translated. Please note that we still don't cover all of the so somebody
needs to revisit this later.
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Convert the merge_schema() function to use async() to make the code
easier to read and write.
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Origin's --seed-provider-parameters format is seeds=<ip1>,<ip2>,<ip3> to
align with yaml configuration file format and command line options a
different seperator must be used instead of "," - switched to using ";"
Signed-off-by: Shlomi Livne <shlomi@cloudius-systems.com>