Commit Graph

200 Commits

Author SHA1 Message Date
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
Pekka Enberg
c24b7d42ce db/legacy_schema_tables: Store CF key validator in system tables
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>
2015-07-06 20:33:05 +03:00
Vlad Zolotarov
45ce351f60 db: consistency_level.hh: added is_sufficient_live_nodes()
Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2015-07-05 17:34:56 +03:00
Vlad Zolotarov
501737cb84 db: consistency_level.hh: Complete the implementation of filter_for_query()
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.
2015-07-05 17:34:50 +03:00
Vlad Zolotarov
a9a3bd1927 db: consistency_level.hh: Styling in filter_for_query()
- Make live_endpoints.erase() call more readable.
   - Adjust the comments to our naming.

Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2015-07-05 17:15:23 +03:00
Tomasz Grabiec
48d2c96b3c db/serializer: Introduce write() which works with bytes_ostream 2015-07-04 13:46:31 +02:00
Avi Kivity
b0fd850463 Merge "Code missing for a NetworkTopologyStrategy integration" from Vlad
"This series add a code missing for an integration of a NetworkTopologyStrategy
with a current clustering WRITE path."
2015-07-02 17:31:49 +03:00
Vlad Zolotarov
77c50dc013 db: consistency_level.hh: complete assure_sufficient_live_nodes()
Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>

New in v2:
   - Use static_cast instead of a dynamic_cast.
2015-07-02 16:00:17 +03:00
Vlad Zolotarov
a4a6c0d69e db: consistency_level.hh: implement is_local()
Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2015-07-02 15:59:40 +03:00
Vlad Zolotarov
ff770a61a5 db: consistency_level.hh: complete block_for() function
Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>

New in v2:
   - Use static_cast instead of a dynamic_cast.
2015-07-02 15:58:50 +03:00
Vlad Zolotarov
6b609d5b35 db: consistency_level.hh: implement local_quorum_for()
Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>

New in v2:
   - Use static_cast instead of a dynamic_cast.
2015-07-02 15:56:56 +03:00
Tomasz Grabiec
a1f6dec067 result_set: Introduce from_raw_result() factory method 2015-07-02 13:25:46 +02:00
Tomasz Grabiec
c9e5508e3c result_set_builder: Make build() return unwrapped object
It's better to let the user decide which kind (if any) of smart
pointer to wrap it into.
2015-07-02 13:25:46 +02:00
Gleb Natapov
4b9661c608 initial read clustering code
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.
2015-07-01 13:36:30 +03:00
Vlad Zolotarov
e47e0dcde9 locator: moved endpoint_dc_rack from db::system_keyspace to locator namespace
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>
2015-06-29 14:35:47 +03:00
Paweł Dziepak
bad8f7cc72 db/legacy_schema_tables: support compression_parameters
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-06-29 09:36:28 +02:00
Glauber Costa
a0b5c5d13e do not move altered inside capture
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>
2015-06-25 22:00:18 +02:00
Glauber Costa
7fa8071dde fix creation of keyspaces
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>
2015-06-24 12:44:05 -04:00
Tomasz Grabiec
dc6bfb63da system_keyspace: Introduce query()
Simple method to get all data from a system table.

Note: Perhaps we should move storage_proxy::query_local() here as well.
2015-06-24 18:13:02 +03:00
Avi Kivity
3d22623a6b Merge "Flush schema changes to disk" from Glauber
"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"
2015-06-24 17:08:33 +03:00
Gleb Natapov
7d846e842c use write_request_timeout_in_ms for write request timeout
Fixes another fixme. Also change default value to 2000 which seams to
be what origin uses.
2015-06-24 12:51:33 +03:00
Glauber Costa
d6b14c967f db: flush system tables to disk
We flush the mutation we receive, and this is not complete yet.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-06-23 15:23:37 -04:00
Glauber Costa
83d4a47a21 stop using get() / get0() arbitrarily
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>
2015-06-23 21:16:56 +03:00
Tomasz Grabiec
b9288d9fa7 db: Make column_family managed by lw_shared_ptr<>
It will be share-owned by readers.
2015-06-23 13:49:24 +02:00
Vlad Zolotarov
3520d4de10 locator: introduce a global distributed<snitch_ptr> i_endpoint_snitch::snitch_instance()
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.
2015-06-22 23:18:31 +03:00
Glauber Costa
a7d612f196 schema tables: add missing columns
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>
2015-06-22 19:09:38 +03:00
Shlomi Livne
b3e4094e11 Updating setting of system keyspace strategy to be local_strategy
Signed-off-by: Shlomi Livne <shlomi@cloudius-systems.com>
2015-06-22 14:18:42 +03:00
Glauber Costa
e6090146e5 merge tables: properly generate column family config
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>
2015-06-18 09:22:20 -04:00
Glauber Costa
a95a529865 database: allow for empty data file directories
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>
2015-06-18 09:22:20 -04:00
Avi Kivity
8ec6826dca Merge "Enable snitch via config" from Shlomi 2015-06-18 13:46: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
38187f2e72 db/legacy_schema_tables: Instantiate columns from system tables
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>
2015-06-17 12:25:18 +03:00
Pekka Enberg
0fb6d6f2cb db/marshal: Convert TypeParser to C++
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-06-17 12:25:18 +03:00
Pekka Enberg
506a8f4598 db/marshal: Import TypeParser.java
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-06-17 12:25:18 +03:00
Pekka Enberg
1c45cdcb3b db/legacy_schema_tables: Store column component index
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>
2015-06-17 11:18:53 +02:00
Glauber Costa
72cc16299c system keyspaces: use existing constant instead of hardcoding keyspace name
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Reviewed-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-06-17 09:41:57 +03:00
Glauber Costa
e1ba4d8fe1 system_keyspace: don't read from bogus ks
The current code moves ks inside the database, then reads from it.
That's wrong. Make it right.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Reviewed-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-06-17 09:41:50 +03:00
Pekka Enberg
2d9397de58 db/legacy_schema_tables: Store columns to system tables
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-06-16 12:20:20 +02:00
Pekka Enberg
2776b5e657 db/legacy_schema_tables: Add missing attributes in add_table_to_schema_mutation()
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>
2015-06-16 12:20:20 +02:00
Shlomi Livne
84da02d67f Enable endpoint_snitch
Signed-off-by: Shlomi Livne <shlomi@cloudius-systems.com>
2015-06-15 15:32:13 +03:00
Avi Kivity
743b6efd54 Merge "initial mutation clustering" from Gleb 2015-06-15 13:25:01 +03:00
Gleb Natapov
969134280a initial mutation clustering code 2015-06-15 12:53:10 +03:00
Gleb Natapov
7cee40bff2 add frozen_mutation serializer 2015-06-15 12:51:09 +03:00
Gleb Natapov
2d409250f2 remove ad-hoc token_metadata creation 2015-06-15 12:51:09 +03:00
Pekka Enberg
e12cbb1836 db/legacy_schema_tables: Use async() for merge_schema()
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>
2015-06-15 12:50:07 +03:00
Tomasz Grabiec
c53ed98731 Merge branch 'shlomi/enable_cluster_via_config' from seatar-dev.git 2015-06-15 09:22:41 +02:00
Vlad Zolotarov
e045d8465c db: use snitch name from the configuration file
Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2015-06-14 15:31:58 +03:00
Shlomi Livne
2c6ba8971f Different seperator for map elements
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>
2015-06-14 11:32:57 +03:00
Pekka Enberg
5b4c073170 db/legacy_schema_tables: Store keyspace strategy options
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-06-11 13:02:42 +03:00