Empty parameter definition is not accepted by the swagger UI, instead,
the parameter list itself should be empty.
Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
From Amnon:
"This seriese adds functionality to the storage_service API. It focus on tokens
information, that are partially supported in the storage_service and the call
to the API will return an empty list."
After commit 3ae81e68a0, we already support
in input_stream::consume() the possibility of the consumer blocking by
returning a future. But the code for sstable consumption had now way to
use this capability. This patch adds a future<> return code for
consume_row_end(), allowing the consumer to pause after reading each
sstable row (but not, currently, after each cell in the row).
We also need to use this capability in read_range_rows(), which wrongly
ignored the future<> returned by the "walker" function - now this future<>
is returned to the sstable reader, and causes it to pause reading until
the future is fulfilled.
Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
The current scheme of creating temporary files inside the current directory is
very fragile.
First, whenever we start writing new files, the test breaks if we forget to
include it in the list of removed files (likely).
Second, because we have to manually delete the files after we're done with
them, we can either forget, or if the test crashes, the final condition may not
run.
Instead of doing that, let's move the files to a separate directory. That makes
it a lot easier to make sure we're deleting all the relevant files, because we
can just wipe out the whole directory.
All tests are then wrapped in a function that makes sure that the proper setup
is in place.
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
remove() is a convenient glibc wrapper that will unlink() a file and rmdir() a
directory. It will allow us to operate on both without creating a separate
function for a directory.
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
max_size, as currently used, will return -1 and while it will fix the previous
bug, it will uncover another.
We can go back to using size, as long as we make sure that all sites correctly
pick a size when creating the bitset. Aside from that, for compatibility with
the java code, the total number of bits has to be a power of two.
The best way to achieve those goals, is to just set the size ourselves through
resize() in the filter constructor. num_blocks() * bits_per_block is guaranteed
to yield a power of two as we need, and in case one caller did not explicitly
set a size, it will be set from this moment on.
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
There is a hidden exception that could be thrown insize file::dma_get_bulk()
if file size is not aligned with fstream::_buffer_size. In this case
file::dma_read_bulk() will be given a _buffer_size as a length for the last data
chunk in the file too. file::dma_read_bulk() will get a short read (till EOF)
and then will try to read beyond it (by calling file::read_maybe_eof())
in order to differentiate between I/O error and EOF. file::read_maybe_eof()
will throw a file::eof_error exception to indicate the EOF, it will be caught
by file::dma_read_bulk() and since we have read some "good" bytes by now this
exception won't be forwarded further. However the damage by throwing the exception
has already been done and we want to avoid this in fstream flow (unless there are
real errors).
In order to prevent the above we will always request file::dma_read_bulk() to
read the amount of data it should be able to deliver (not beyond EOF).
Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
Make read_maybe_eof() return zero-sized buffer when pos is at or beyond
EOF. This will prevent an internal exception throwing inside "file" class
in cases when dma_read_bulk() is going to succeed and return read data, e.g. when
it was called with "offset" less than file size but "offset" + "range_size"
beyond EOF.
Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
Move read_state helper class, file::dma_read_bulk() and file::read_maybe_eof()
definitions outside the class declaration in order to make reading the class
interface easier.
Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
Requiring next_fn to be available at listen() time means you can't pass
subscriptions around, and it is often hard to create next_fn, since it
usually needs to capture 'this', while this also points to the subscription
itself, creating a chicken and egg problem.
Fix by separating the registration process into two steps: listen() creates
the subscription, and start() accepts the next callback and starts processing
events.
Tomek says:
"Some types may yield different byte-representations for equal
values."
Fix that up.
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
From Pekka:
"This series wires up migration manager column family announcements in
preparation for eventually storing column family schema in system
tables."
Convert code to use the deserialize() function and drop the duplicate
compose() wrapper that we inherited from Origin.
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
If map value type is lw_shared_ptr<T>, for example, we need to be able
to pass our own value comparison function to the difference() function.
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
This adds implementation to the added storage service definitions.
After this patch, the following calls will be supported:
/storage_service/tokens
/storage_service/tokens/{endpoint}
/storage_service/commitlog
/storage_service/tokens_endpoint
Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
The storage service runs on CPU 0, this adds a wrapper function that
would expose the relevent storage_service function but will hide the
cpu this is actually be run on.
The implemented methods are the one needed by the API and are equivelent
to the ones defined in StorageServiceMBean
Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
This adds an API that expose the token to endpoint mapping and the token
that are associate with an address.
Both method will be used by the API to expose the tokens.
Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
This adds the following definitions to the storage_service swagger
definition file:
/storage_service/tokens
/storage_service/tokens/{endpoint}
/storage_service/commitlog
/storage_service/tokens_endpoint
Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
These adds a helper function to transfer a list of object to a list of
string. It will be used by the API implementation.
Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Use CQL for keyspace creation to make sure the keyspace definition also
exists in system tables.
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Pekka says:
"This series adds comparison operators for query result sets that are
needed by schema merging code. The operators are implemented using a
newly added "data_value" type that encodes the type of the value."
Schema merging code needs to be able to compare two result sets to
determine if a keyspace, for example, has changed. Add comparison
operators for that.
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Add a data_value class that also encodes a value type. This makes it
easier to use than plain boost::any for comparing two values.
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
There is no guarantee that vector tmp will be alive by the time
it's written via output stream. Let's use do_with here.
Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>