Compressor type is only a part of the information kept in compressor
parameters and things like schema.get_compressor().get_compressor()
do not look very good.
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
Same as for keyspaces, and we will reuse most of the code. CFs that are
found on disk upon bootstrap are now recreated in memory.
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
This patch bootstraps the keyspaces found in system sstables and make
our in-memory structures reflect them. It tries to reuse as much code
as we can from db::legacy_system_tables, but keeping everything local
and without applying any mutations to the database - since the latter
would only unnecessarily complicate the write path.
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
In order for us to call some function from db::legacy_schema_tables, we need
a working storage proxy. We will use those functions in order to leverage the
work done in keyspace / table creation from mutations
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Soon I will introduce some changes that make init_from_data_directory dependent
on a working storage proxy.
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
This patch adds support to the Swagger-UI. It does so by adding
reference to the Swagger-UI target directory, after applying this patch
/ui/ will display the Swagger-UI page with the available APIs.
From the Swagger-UI page it is possible to run the different APIs.
The target directory of the ui can be override from the command line.
Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
"This patch series introduces compression_parameters class which is used
to handle compression options specified at table creation. Such information
is now properly propagated to the database internals."
Passing a single enum specifying a compressor type around is not enough,
since there are other compression options user may want to specify.
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
midpoint(l, r) where l > r needs to wrap around the end of the ring. Adjust
the midpoint() function to do this.
Note this is still broken for the murmur3 partitioner, since it doesn't treat
tokens as unsigned.
This is an example of how to use the low-level compact_sstable() function
to compact all the sstables of one column family into one. It is not a
full-fledged "compaction strategy" but the real ones can be based on this
example.
Among the things that this code doesn't do yet is to delete the old
sstables. In the future, this should happen automatically in the sstable
destructor when all the references to the sstable get deleted.
Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
"Consolidate Keyspaces" from Glauber:
"In some situations, we fail to create a keyspace directory where we should.
This leads later sstable creation invocations to fail.
Moreover, we are replicating a lot of code in this front.
This patchset consolidates the callers to create_keyspace, and guarantees that
we will always do the right thing.
It is still possible to create an in-memory only keyspace (to be used in my
upcoming bootstrap patchset), but that will now be a private method of the
database."
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>
There is only one user in tree, and as Tomek pointed out, it is buggy. The
reason is that ksm is a shard-local structure, and it is currently used
indiscriminately by all shards which can easily lead to problems.
We could fix it with some tricks, but it is way better and safer to make sure
the callers are doing it right instead. There is only one caller, so let's fix
that.
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
The two separate functions can now be merged. As a result, the code
that generates statistics data is now much easier to understand.
Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
Assert should be completely avoided. Instead, we should trigger an
exception, allowing the db to proceed with a "smooth" shutdown.
Signed-off-by: Raphael S. Carvalho <raphaelsc@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"
KW_MINCOMPACTIONTHRESHOLD and KW_MAXCOMPACTIONTHRESHOLD shouldn't be
allowed, they are properties of compaction strategy not the table itself.
KW_COMPACTION and KW_COMPRESSION should be allowed.
Reported-by: Shlomi Livne <shlomi@cloudius-systems.com>
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
Apparently, after writing a new sstable, with write_components(), it
is necessary to load() it. I'm not sure why, but we get a crash on
an aio to a closed file descriptor if we don't.
Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Instead of requiring the user to subclass a "sstable_creator" class to
specify how to create a new sstable (or in the future, several of them),
switch to an std::function.
In practice, it is much easier to specify a lambda than a class, especialy
since C++11 made it easy to capture variables into lambdas - but not into
local classes.
The "commit()" function is also unnecessary. Then intention there was to
provide a function to "commit" the new sstables (i.e., rename them).
But the caller doesn't need to supply this function - it can just wait
for the future of the end of compaction, and do his own committing code
right then.
Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
"This series adds the cache_service definition file with a stub implementation.
The API is based on the CacheServiceMBean interface.
The stubbed API return stubbed value of the correct type."
This adds a stub implementation for the cache_service. It also register
the API doc.
The cache_service doc will be available at:
http://localhost:10000/api-doc/cache_service/
The stub implementation returns the correct value type with stubbed
values.
After this patch the following path will be available:
/cache_service/row_cache_save_period
/cache_service/key_cache_save_period
/cache_service/counter_cache_save_period
/cache_service/row_cache_keys_to_save
/cache_service/key_cache_keys_to_save
/cache_service/counter_cache_keys_to_save
/cache_service/invalidate_key_cache
/cache_service/invalidate_counter_cache
/cache_service/row_cache_capacity
/cache_service/key_cache_capacity
/cache_service/counter_cache_capacity
/cache_service/save_caches
Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
This adds the definition file for the cache service, the API is based on
the CacheServiceMBean definition and contain the following command:
get_row_cache_save_period_in_seconds
set_row_cache_save_period_in_seconds
get_key_cache_save_period_in_seconds
set_key_cache_save_period_in_seconds
get_counter_cache_save_period_in_seconds
set_counter_cache_save_period_in_seconds
get_row_cache_keys_to_save
set_row_cache_keys_to_save
get_key_cache_keys_to_save
set_key_cache_keys_to_save
get_counter_cache_keys_to_save
set_counter_cache_keys_to_save
invalidate_key_cache
invalidate_counter_cache
set_row_cache_capacity_in_mb
set_key_cache_capacity_in_mb
set_counter_cache_capacity_in_mb
save_caches
Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>