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>
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>
When closing the read-end side of the pipe, we need to notify the writer
only if it was blocked in write() on a full pipe - because if it wasn't
blocked, it will get the broken pipe on the next write() attempt.
We used queue::abort() for that, which is fine, because this function
won't do anything if nobody is waiting on a full buffer. But we still
call std::make_exception_ptr() unconditionally, which is slow (involves
throwing an exception and catching it) and an annoying false-alarm when
trying to debug with gdb's "catch throw" (which stops on any throw).
So this patch does
if (_buf.full()) {
_buf.abort(std::make_exception_ptr(broken_pipe_exception()));
}
So that in the typical case when the buffer was not full (hopefully it
is empty), we don't do anything.
Signed-off-by: Nadav Har'El <nyh@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."
This adds the following implementation to the storage_service API:
get_leaving_nodes
get_moving_nodes
get_joining_nodes
get_all_data_file_locations
get_saved_caches_location
get_host_id_map
get_current_generation_number
get_keyspaces
force_keyspace_flush
force_keyspace_compaction
Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
This adds a general map_to_key_value method that can work with any map
like object. This method gets the target vector in a parameter to help
the compiler inference the parameters type.
map_keys is a helper function that gets a map like objects and returns a
vector with its keys (i.e. the call to it's iterator first)
split is a wraper around the boost split and split_cf is a specific
split that is aligned with how column family are passed in the API
parameters.
Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
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.
get_config returns a const reference to the configuration object inside
the database object because it returns a const referent it could be
const. This is helpful when the call is made from a const reference to the
database.
Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
This expose the _leaving_endpoints, _moving_endpoints and
_bootstrap_tokens.
It also changes the signature of get_endpoint_to_host_id_map_for_reading
from auto so the compiler will be able to resolve the method signature
outside of the cc file.
Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
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."