Commit Graph

20 Commits

Author SHA1 Message Date
Glauber Costa
c0ad2a8e0e sstables: parse the index file
We usually don't read the whole file into memory, so the probing interface will
also allow for the specification of boundaries that we should be use for
reading.

The sstable needs to be informed - usually by the schema - of how many columns
the partition key is composed of - 1 for simple keys, more than one, for
composites.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-03-10 15:13:14 -03:00
Glauber Costa
a3febe2ae0 sstable: open data and index files.
Because we're expected to go to those files many times, it doesn't make sense
to keep opening them. Upon sstable load, we will open those files and then move
the reference to the sstable main structure. From this point on, we can just seek
to the position we want.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-03-10 15:13:14 -03:00
Glauber Costa
cea4825642 sstables: change exception message
So it represents all kinds of mismatches. Not only buf < expected.
It will be useful in the index parsing code.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-03-10 15:13:14 -03:00
Glauber Costa
d19abb59fb file_input_stream: accept a shared pointer in the constructor
Right now we will always move the file to create a shared pointer from it.
However, there are situations in which we don't really want to move it, because
it will be still used elsewhere.

One example is the index and data readers, where we will store a file object to
avoid opening the file all the time. In such situation, we can pass a shared
pointer that is already constructed to the file_input_stream.

The alternative to that would have been to store the file_input_stream itself.
That would, however, require us to export that in some header. It's best to
keep it private. Since we will already deal with a shared pointer anyway, it is
best to provide this option.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-03-10 15:03:51 -03:00
Glauber Costa
87e6b7ab56 sstables: signal eof in file_input_stream
We signal that condition in the underlying input_stream. Export that
to the file stream.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-03-10 15:03:51 -03:00
Glauber Costa
7d43e26c58 sstables: use net::packed in potentially unaligned accesses
Fixes debug build test code.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-03-10 15:54:13 +02:00
Avi Kivity
9288b360f6 Merge branch 'master' of github.com:cloudius-systems/seastar into db
Includes adaptation by Nadav for the removal of file_input_stream:

sstables.cc used file_input_stream, which we replaced by the new
make_file_input_stream. We also couldn't make sstables.cc read either
a file_input_stream or the planned compressed_file_input_stream.

So in this patch we implement an API similar to the old "file_input_stream"
based on the new make_file_input_stream. file_input_stream now has a parent
class "random_access_reader", preparing for a future patch to support both
file_input_stream and compressed_file_input_stream in the same code - by making
all the parsers take a random_access_reader reference instead of file_input_stream.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-03-10 15:50:04 +02:00
Avi Kivity
5902243dc5 Merge branch 'master' of github.com:cloudius-systems/seastar into db
Global adjustment due to the removal of future<>::rescue().
2015-03-05 11:00:11 +02:00
Avi Kivity
f039904d75 Merge branch 'master' into db
Updated usages of std::hash<some_enum_type> to accomodate 25168fc73d.
2015-03-01 15:24:47 +02:00
Avi Kivity
81ca06fa36 sstable: fix TOC size check
Make sure we detect a too-large TOC correctly.
2015-02-28 23:50:36 +02:00
Avi Kivity
7441ce5b51 sstable: fix buffer overflow in TOC
boost::split() expects either a NUL terminated string or a proper container.
We give it neither.

Fix by wrapping the buffer in a string_view, which tells split() what size
the string is.
2015-02-28 23:49:07 +02:00
Glauber Costa
fb3682cb4f sstable statistics file
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-02-26 12:14:19 -05:00
Glauber Costa
0d98caf885 summary file
TODO: read in the actual index. This is schema-dependent.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-02-26 12:14:19 -05:00
Glauber Costa
1b75a5bccb bloom filter
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-02-26 12:14:19 -05:00
Glauber Costa
d810f03bb7 compression file
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-02-26 12:14:19 -05:00
Glauber Costa
3e4ab6848b read toc
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-02-26 12:14:19 -05:00
Glauber Costa
cc4f8f09e5 parser: disk_hash type
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-02-26 12:06:25 -05:00
Glauber Costa
110facf479 parser: more basic types
bool, enum and double.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-02-26 12:06:25 -05:00
Glauber Costa
001606209a sstable parser
This is a parser for the sstable files based on template recursion.
With this, one can easily extend it to parse any complex data structure
by writing

    parse(in, struct.a, struct.b ... );

This patch contains the most basic types used during parsing as building
blocks.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-02-26 12:06:25 -05:00
Glauber Costa
b7281bd463 sstables: initial file
This represents an sstable with its multiple in-disk file. We don't yet
read any of them, though.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-02-26 12:06:25 -05:00