Commit Graph

68 Commits

Author SHA1 Message Date
Shlomi Livne
199f4d2545 Add enable-in-memory-data-store,enable-commitlog,enable-cache config
Abillity to enable/disable specific sub-modules - this settings do not
affect system tables which are allways persisted,cached and written to
commitlog

enable-in-memory-data-store marks if tables will be written/read to/from
disk
enable-commitllog marks if tables will be written to commitlog
enable-cache marks if tables will be written/read to/from cache

Please note in-memory-data-store does not change the read path so "old"
sstables are still read and cache may be used to cache their data

Signed-off-by: Shlomi Livne <shlomi@cloudius-systems.com>
2015-08-02 17:19:30 +03:00
Nadav Har'El
280c450892 Fix compilation
The at_exit() callback needs to return a future. In one place we forgot,
and now that at_exit() takes an std::function<>, this is verified at
compilation time and fails compilation.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-07-28 10:28:08 +02:00
Avi Kivity
bb3aef7fd9 Merge "Basic schema handling of compact strategy" from Glauber
"With this patchset, cqlsh's describe table command now work"
2015-07-23 16:47:29 +03:00
Avi Kivity
be32746c58 Merge "Handle Compact Storage" from Glauber
"This is my current proposal for Compact Storage tables - plus
the needed infrastructure.

Getting rid of the CellName abstraction allows us to simplify
things by quite a lot: now all we need is to mark whether or
not a table is composite, and provide functions to play the
role of the comparator when dealing with the strings."
2015-07-23 16:20:31 +03:00
Pekka Enberg
78ee9e7478 db/system_keyspace: Fix "peers" table "schema_version" column type
The column type of "schema_version" is set to UTF8 which results in the
following value conversion errors:

  storage_service: fail to update schema_version for 127.0.0.2: boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::bad_any_cast> > (boost::bad_any_cast: failed conversion using boost::any_cast)

Change the column type to UUID like in Origin. Fixes #35.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-07-23 09:37:32 +03:00
Glauber Costa
f778e2aea2 system keyspace: set compaction strategy options for system.hints
This is the last system table that needed parameters. All them are
now devoid of fixmes

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-23 00:02:11 -04:00
Glauber Costa
5c33549be5 system tables: mark some system tables as compact storage
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-22 23:10:22 -04:00
Glauber Costa
d5b4731e49 schema: make all schemas be generated by the schema_builder
Some of the fields in the schema will not not be passed directly, but
calculated by the schema_builder. This is because they are not simple values of
the form a = x, but slightly more complex and have to be derived from other
properties (for instance, the amount of clustering keys).

For those values, a default value does not really make sense. Take for instance
the case of the comparator: there is always a comparator, and there is not any
comparator that can serve as a default. Which comparator to use depend on
whether or not the table has collections, whether or not it has clustering
keys, and whether or not it is marked as compact storage.

Making all tables go through the builder is a guarantee that all of them
will have their values set.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-22 23:10:21 -04:00
Glauber Costa
0ea8a27b47 system_keyspace: stop the local cache.
Apparently we need to register the stop function explicitly. That was not being
visible before, because the urchin binary was failing on exit before this for
some other reason. Once that was fixed, this one became apparent.

Scylla can correctly shutdown now.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-21 17:21:53 +03:00
Asias He
268f2fa8a1 db/system_keyspace: Change host_id to uuid_type 2015-07-21 17:00:15 +08:00
Glauber Costa
443178ef81 schema: remove set_default_time_to_live
Make calls go through the builder. Current caller is patched.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-17 20:40:40 -04:00
Glauber Costa
8b68fb5ff6 schema: remove set_gc_grace_period
Make all callers go through the builder. Current callers - there are many
in the system tables code, are patched.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-17 20:40:40 -04:00
Pekka Enberg
2520112bda db/system_keyspace: Add query_mutations() function
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-07-16 14:53:30 +03:00
Pekka Enberg
440157b07b db/system_keyspace: Use database::get_version() instead of random UUID
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-07-16 14:53:30 +03:00
Avi Kivity
1d4805236b messaging_service: don't include config.hh in .hh
config.hh changes rapidly, so don't force lots of recompiles by including it.

Need to place seed_provider_type in namespace scope, so we can forward
declare it for that.
2015-07-16 12:26:02 +03:00
Glauber Costa
9c464aff9b database: clean up various APIs
In much of our column_families APIs, we need to pass a pointer to the database.
The only reason we do that, is so we can properly handle the commit log entries
after we seal the current memtables into sstables.

Now that we store a pointer to the commit log in the CF itself at the time it
is created, we no longer have to do it. As a result, the APIs are a lot
cleaner, with no gratuitous parameters.

My motivation for this was the flush method, but as a result, apply() also gets
cleaner.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-15 10:24:20 -04:00
Avi Kivity
4b1fd3d48d Merge "Set currently commented out properties for system tables" from Glauber
"Some of the system tables will set gc_grace_seconds, or default_time_to_live
but right now we are commenting them out.

The best way to do it would have been to somehow save the fields so we don't need to
set it all the time - as this function is effectively doing.

However, those fields would feel very spurious in the constructor, and it is not
like there isn't a lot of other things for us to set. More importantly, calling
those schema functions is a very rare event. We usually call it once and store
the pointer somewhere.

With that, we're very close to implementing everything that the system tables
needs set, missing only COMPACT STORAGE and information about compaction
strategy."
2015-07-14 10:52:22 +03:00
Glauber Costa
5ac6ed72f4 system tables: set default ttl according to Origin settings
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-13 23:58:03 -04:00
Glauber Costa
7b1b8f0e09 system tables: set gc grace period according to Origin settings
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-13 23:58:03 -04:00
Tomasz Grabiec
d4ec9d9566 system_keyspace: Remove the out-of-date comment from query()
The function is currently just a simple wrapper over
storage_proxy::query(). The comment has description of details which
are much lower level than this interface.
2015-07-13 10:27:02 +02:00
Tomasz Grabiec
9aed3fdbfc system_keyspace: Simplify query() by using partition_slice_builder 2015-07-13 10:27:02 +02:00
Tomasz Grabiec
bc0874d299 db: Move storage_proxy::query_local() to db::system_keyspace::query() 2015-07-13 10:27:02 +02:00
Tomasz Grabiec
ad99e84505 storage_proxy: Take schema_ptr in query()
It will be needed for reconciliation.
2015-07-12 12:54:38 +02:00
Glauber Costa
c73d4cba16 system_keyspaces: update hints dropped
Again, not terribly complicated.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-10 10:09:00 +02:00
Glauber Costa
0bf09f6af8 system_keyspace: implement update_preferred_ip
This one is quite simple, we just need very basic translation

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-10 10:09:00 +02:00
Glauber Costa
fe154efffe system_keyspace: implement (remote) update_tokens
There are two versions of update_tokens: one for the tokens used by this node,
which goes to the local table, and another for the remote tokens, used by
remote nodes, which goes to the peers table.

The former was implemented, the latter was not. Implement it.

One node: Origin does not issue a flush here, at least in the version of the
code we imported. However, a flush is present in all other variants, and won't
hurt, aside from creating an extra, probably very small, sstable. So I'm
flushing.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-10 10:09:00 +02:00
Glauber Costa
31f4601329 system_keyspace: remove duplication for blocking flush
We ended up with two different implementations of force_blocking_flush,
none of them ideal.

This patch merges both in one that makes more sense, getting rid of the
duplication.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-10 10:09:00 +02:00
Glauber Costa
afee9ab72a system_keyspaces: implement remove_endpoint
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-09 11:58:31 -04:00
Glauber Costa
e559959632 system_keyspace: implement update_peer_info
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-09 11:58:31 -04:00
Glauber Costa
38465dea70 system_keyspaces: implement load_dc_rack_info
To implement that, we will resort to a cache mechanism, instead of doing the
query all the time.  This is mainly because we want to avoid overfuturization
of the callers, that are usually just interested in passing simple strings
around.

We will be able to intercept all updates to it, and maintain consistency with our
internal cache. The updates are not done in this patchset.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-09 11:58:30 -04:00
Glauber Costa
bac0a8a680 legacy_schema_tables: convert save_system_keyspace_schema()
This function is called at bootstrap, to make sure the system tables exist in
the keyspace list. I honestly don't know why do we have to force a delete +
reconstruct. But let's keep consistency with Origin here.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-09 08:12:47 -04:00
Glauber Costa
cb103449a5 db: move query_context to a header
Do this so we can use it from legacy_schema_tables as well

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-09 00:12:08 -04:00
Avi Kivity
a2e270f3d4 Merge "wire update tokens" from Glauber
"As previously said, there were some unidentified bugs that prevented update_tokens from
working properly. The first one was sent alongside the series, the second one took me more
time, but it is fixed here."
2015-07-08 16:01:37 +03:00
Calle Wilund
4ba0bf7ac6 system_keyspace : add support for storing and reading truncation
* Straight re-impl of origin code
* Uses system tables not yet created, so does not actuall work...
2015-07-08 10:59:57 +02:00
Glauber Costa
12dc7ebd26 system.local: convert update tokens
At this point, users of the interface are futurized already, so we
just need to make sure they call the right function.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-07 20:24:43 -04:00
Glauber Costa
137cf22abf system.local: convert host_id functions
They are already futurized, we just have to implement them.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-07 11:38:23 -04:00
Glauber Costa
a9e69a34cb system.local: convert bootstrap state
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-07 11:38:23 -04:00
Glauber Costa
6d58675092 system.local: force blocking flush
Allows a CF to be flushed, and wait for it to finish.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-07 11:38:23 -04:00
Glauber Costa
072de63427 system.local: convert check_health
This function is called at startup and makes sure that the cluster_name field
in system.local exists, and if it exists, that it matches the expected value.

To simplifly things, I am leaving the sstable check out. For us, that would be
a map-reduce operation, and if the sstables are indeed corrupted, we would have
caught that already for sure.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-07 11:38:23 -04:00
Glauber Costa
30008bc0b1 system.local: schema version
This patch provide a function to store the current schema version.
Currently, it is called every time the node boots, with a random schema.
That is incorrect and will be fixed shortly. But for now, cqlsh needs
to see a valid value here, so this will do.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-07 11:38:23 -04:00
Glauber Costa
e5d27d6485 system.local: setup version fields
Done every time the node boots, unconditionally.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-07 11:38:23 -04:00
Glauber Costa
0f68010152 futurize get_local_host_id and set_local_host_id
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-07 11:38:23 -04:00
Glauber Costa
157f5991ac system keyspace: setup queries
We won't create our own versions of database and query_proxy, so we need
some setup to be done. The current code will capture those variables and
setup the structure used to conduct the queries. Later on, it will also
carry on the database's basic setup.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-07 11:38:22 -04: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
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
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
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
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