This automatically exposes them in partition_key and clustering_key too.
The iterators return bytes_view to components.
For example:
schema s;
partition_key k;
for (bytes_view component : boost::make_iterator_range(key.begin(s), key.end(s))) {
// ...
}
boost/test/unit_test.hpp is sufficient for tests which link with boost
UTF dynamically. It includes much less headers than
boost/test/included/unit_test.hpp.
The previous implementation could read either one sstable row or several,
but only when all the data was read in advance into a contiguous memory
buffer.
This patch changes the row read implementation into a state machine,
which can work on either a pre-read buffer, or data streamed via the
input_stream::consume() function:
The sstable::data_consume_rows_at_once() method reads the given byte range
into memory and then processes it, while the sstable::data_consume_rows()
method reads the data piecementally, not trying to fit all of it into
memory. The first function is (or will be...) optimized for reading one
row, and the second function for iterating over all rows - although both
can be used to read any number of rows.
The state-machine implementation is unfortunately a bit ugly (and much
longer than the code it replaces), and could probably be improved in the
future. But the focus was parsing performance: when we use large buffers
(the default is 8192 bytes), most of the time we don't need to read
byte-by-byte, and efficiently read entire integers at once, or even larger
chunks. For strings (like column names and values), we even avoid copying
them if they don't cross a buffer boundary.
To test the rare boundary-crossing case despite having a small sstable,
the code includes in "#if 0" a hack to split one buffer into many tiny
buffers (1 byte, or any other number) and process them one by one.
The tests still pass with this hack turned on.
This implementation of sstable reading also adds a feature not present
in the previous version: reading range tombstones. An sstable with an
INSERT of a collection always has a range tombstone (to delete all old
items from the collection), so we need this feature to read collections.
A test for this is included in this patch.
Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Register the handler of gossip verbs using ms::register_handler.
Implement send_gossip using ms::send_message. The handlers are only
placeholders for now. Will implement them later.
A periodic timer (1 seconds) is added to send gossip message
periodically.
The on-disk format is about name of the components, where each is
followed by a new line character. The text is encoded using ASCII
code.
Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
The definition of summary_la at types.hh provides a good explanation
on the on-disk format of the Summary file.
Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
query_options is needlessy organized as a class hierarchy, even though it's
really a simple value type.
Fix by folding all the derived classes into it.
bytes and sstring are distinct types, since their internal buffers are of
different length, but bytes_view is an alias of sstring_view, which makes
it possible of objects of different types to leak across the abstraction
boundary.
Fix this by making bytes a basic_sstring<int8_t, ...> instead of using char.
int8_t is a 'signed char', which is a distinct type from char, so now
bytes_view is a distinct type from sstring_view.
uint8_t would have been an even better choice, but that diverges from Origin
and would have required an audit.
Test the sstables::data_consume_row() function by consuming a row from
an sstable with known contents, and comparing the expected row key,
deletion time, and for each cell - its name, value and timestamp.
The test tests this on both a compressed and non-compressed sstable
(the contents of the two sstables is the same, except the timestamp
which is different).
Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
This code adds the ability to write statistics to disk.
On-disk format:
uint32_t Size;
struct {
uint32_t metadata_type;
uint32_t offset; /* offset into this file */
} metadata_metadata[Size];
* each metadata_metadata entry corresponds to a metadata
stored in the file.
Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>