Commit Graph

2462 Commits

Author SHA1 Message Date
Pekka Enberg
3150bb5b78 database: Initialize system keyspace in database constructor
System keyspace is used for things like keyspace and table metadata.
Initialize it in database constructor so that they're always available.
Needed for CQL create keyspace test case, for example.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-03-26 12:41:00 +02:00
Pekka Enberg
fd8e92ab07 database: Add mutation::set_cell() variant
This adds a set_cell() variant which accepts a column name and a
boost::any value and does column definition lookup and decomposition
under the hood. Simplifies code that manipulates system tables directly
in db/legacy_schema_tables.cc.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-03-26 12:40:58 +02:00
Pekka Enberg
0117906af1 db_clock: Add now_in_usecs() helper function
Add a helper function similar to FBUtilities.timestampMicros() in origin.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-03-26 12:25:00 +02:00
Pekka Enberg
ad0deebbb4 config: Convert KSMetaData to C++, take 2
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-03-26 12:25:00 +02:00
Avi Kivity
467ede53b7 Merge branch 'tgrabiec/query-v2' of github.com:cloudius-systems/seastar-dev into db
Query tests and cleanups, from Tomasz.
2015-03-25 15:45:14 +02:00
Nadav Har'El
d305e1f95c sstables: add FIXME
Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-03-25 15:45:00 +02:00
Tomasz Grabiec
121fa4ff46 test: Introduce test for in-memory CQL query performance
The schema and queries resemble that used by cassandra-stress.

Results on my laptop:

$ build/release/tests/perf/perf_simple_query -c1
Concurrency = 100 x 1
Creating 1000 partitions...
Timing single key selects...
452146.50 tps
449365.24 tps
457650.58 tps
460334.78 tps
458281.51 tps
Timing random key selects...
439181.03 tps
449899.67 tps
405146.90 tps
440228.84 tps
440889.50 tps

$ build/release/tests/perf/perf_simple_query -c3
Concurrency = 100 x 3
Creating 1000 partitions...
Timing single key selects...
302615.08 tps
301471.02 tps
303040.67 tps
302114.77 tps
302465.13 tps
Timing random key selects...
627516.46 tps
628978.04 tps
623664.15 tps
624098.48 tps
614549.85 tps
2015-03-25 12:59:25 +01:00
Tomasz Grabiec
8f73f7df47 tests: Add time_parallel() utility 2015-03-25 12:59:25 +01:00
Raphael S. Carvalho
d81cbbabf7 tests: add testcase for sstables compression info
Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-03-25 13:24:48 +02:00
Raphael S. Carvalho
92b75413cb sstables: add function to set generation
Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-03-25 13:23:24 +02:00
Raphael S. Carvalho
daaa1a6dcb sstables: extend it to support write of components
By the time being, compression info is the unique component being
written by store(). Changes introduced by this patch are generic,
so as to make it easier writing other components as well.

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-03-25 13:22:42 +02:00
Nadav Har'El
b4e805e811 sstable: test reading from data file
Test sstable::data_read(pos, len), for both compressed and uncompressed
data files. We already have compressed and uncompressed sstables in our
test tree with identical data, we read from them in a particular position
and expect to find the string "gustaf" there.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-03-25 12:35:33 +02:00
Nadav Har'El
891763d7fd sstables: implement low-level data file random-access reading
This patch implements sstable::data_read(pos, len) to do random-access
read of a specific byte range from the data file. Later we'll determine
the byte range needed to read a specific row, using the summary and index
files.

This function works for either a compressed or uncompressed data file.
To support the compressed data file, we need to determine when opening
the sstable also the data file's size, and then make a compression_metadata
object using the data we read from the compression file and the data
file's size.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-03-25 12:35:32 +02:00
Nadav Har'El
4d57c8fd28 sstables: fix LZ4 decompression
It turns out that Cassandra's LZ4Compressor doesn't use the LZ4
compressor directly - instead it prepends the uncompressed length,
in 4-byte little-endian (!) encoding, to the compressed chunk.
We don't need this extra information - we already know the expected
uncompressed chunk length, so we need to just skip it.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-03-25 12:35:32 +02:00
Tomasz Grabiec
b829062985 tests: Make time_it() template static 2015-03-25 10:36:19 +01:00
Tomasz Grabiec
e605a0368a tests: Use lowres_clock in time_it() 2015-03-25 10:36:19 +01:00
Tomasz Grabiec
967073c3c2 tests: Add helpers for setting up CQL environment for tests 2015-03-25 10:36:19 +01:00
Tomasz Grabiec
cf2f2b1cf7 cql3: Take prepared statement id by const& 2015-03-25 10:36:19 +01:00
Tomasz Grabiec
b26b39504a db: Add find_or_create_keyspace()
Needed for tests.
2015-03-25 10:36:19 +01:00
Tomasz Grabiec
9eafa69d43 db: Avoid unnecessary lookup of row key when applying range tombstones 2015-03-25 10:36:19 +01:00
Tomasz Grabiec
7bd076ed85 db: Extract range tombstone lookup to separate method
While at it, convert affected methods to take a schema by const& instead
of a shared pointer to save on unnecessary shared ptr copies.
2015-03-25 10:36:19 +01:00
Tomasz Grabiec
866dd449db db: Remove unused methods 2015-03-25 10:36:18 +01:00
Tomasz Grabiec
201aad7fb1 Merge remote-tracking branch 'seastar/master' 2015-03-25 10:29:52 +01:00
Avi Kivity
4eff2e0db9 Merge branch 'tgrabiec/distributed' of github.com:cloudius-systems/seastar-dev
distributed::start() fix, from Tomasz.
2015-03-25 11:19:13 +02:00
Tomasz Grabiec
4dc8a6a09c test: distrubuted_test: Test that constructor arguments are copied on each core 2015-03-25 09:39:34 +01:00
Tomasz Grabiec
5133a0b2ab tests: distributed_test: Add missing start() invocation 2015-03-25 09:39:34 +01:00
Tomasz Grabiec
dc4eb7af2d tests: Rename map_reduce_test.cc to distributed_test.cc 2015-03-25 09:39:34 +01:00
Tomasz Grabiec
040f8ffcfb tests: Convert tabs to spaces 2015-03-25 09:39:34 +01:00
Tomasz Grabiec
8abd982ec9 distributed: Do not move arguments when passing to many cores 2015-03-25 09:39:34 +01:00
Avi Kivity
52909cb0d6 build: link with zlib, for sstable compression 2015-03-24 18:16:49 +02:00
Nadav Har'El
c6eb2a87ea Move compress.{cc,hh} to sstables/
Move compress.{cc,hh} from db/ to sstables/. This makes more sense, as
this code is only used for sstables (un)compression.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-03-24 16:54:58 +02:00
Glauber Costa
1880baa873 database: read-in sstables metadata
Now that the code for sstable metadata is ready, we can read it when we are
loading the keyspaces.

At this moment, only the system tables are processed. This is because we will
require the schema to be already determined in order to properly read the
sstables. The system schema is known at compile time. The others will have to
be derived when we are able to read it from the system tables themselves.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-03-24 15:52:24 +02:00
Glauber Costa
e695c1632c sstable: return a format or version given a string
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-03-24 15:52:23 +02:00
Glauber Costa
a916b66984 sstable: generalize reverse transversal code.
While reading the TOC, we are given a string and then transverse the components
map in the search of a key of that corresponding value. This behavior will also
be necessary when we are parsing the filename, for version and format.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-03-24 15:52:22 +02:00
Glauber Costa
041933b179 sstables: epoch -> generation
Name matches Origin.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-03-24 15:52:20 +02:00
Avi Kivity
a5a6b1412b Merge branch 'master' of github.com:cloudius-systems/urchin into db 2015-03-24 15:46:00 +02:00
Tomasz Grabiec
ce767f1e89 Merge remote-tracking branch 'dev/penberg/create-table-stmt/v2'
From Pekka:

This patch series adds support for _parsing_ CQL create table
statements. Changes to underlying schema are done by the migration
manager which is not implemented yet.
2015-03-24 14:12:02 +01:00
Nadav Har'El
4db17a454c sstables: add compressed reading to sstable.cc
This patch adds compressed_file_input_stream, which is a
"random_access_reader" subclass just like the existing file_input_stream.

Changed all the parsers to take a reference to random_access_reader (the
base class) instead of file_input_stream.

The code is now ready (sort of) for compressed-file reading, but it doesn't
actually do that: sstable::read_simple() still always uses file_input_stream
for now.

Note: despite all the layers of classes holding our input streams, we
actually pay surprisingly little cost for virtual function calls or pointer
dereferencing: random_access_reader::read_exactly is *not* a virtual function -
it always calls _in.read_exactly(). This is input_stream::read_exactly(),
which again is not a virtual function (the rarely called get() is a virtual
function is virtual, but input_stream::read_exactly() usually just reads reads
from an already available buffer.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-03-24 15:08:14 +02:00
Pekka Enberg
13372695e6 tests: create table statement test case
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-03-24 15:06:06 +02:00
Pekka Enberg
a4070bbe9b cql3: Convert create table statement grammar to C++
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-03-24 15:06:06 +02:00
Pekka Enberg
1c6e5ebc36 cql3: Convert CreateTableStatement to C++
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-03-24 15:06:06 +02:00
Nadav Har'El
0aef58a446 sstable: decompression support
This patch adds a make_compressed_file_input_stream - our futuristic version
of cassandra.io.compress.CompressedRandomAccessReader, and compression_metadata
(parallel of CompressionMetadata). It will allow us to read chunk-compressed
SSTable files.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-03-24 15:05:26 +02:00
Pekka Enberg
c6f57e0201 cql3: Convert CFPropDefs to C++
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-03-24 15:05:13 +02:00
Pekka Enberg
fd7382cef7 cql3: Fix missing include in propety_definitions.hh
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-03-24 15:04:18 +02:00
Pekka Enberg
0600d746a6 cql3: Drop virtual inheritance from schema_altering_statement
Needed for create_table_statement.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-03-24 15:04:18 +02:00
Pekka Enberg
28b03772f2 Add schema::set_comment() member function
Needed by the cf_prop_defs class to modify a schema object in the
apply_to_cf_metadata() function.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-03-24 15:04:17 +02:00
Pekka Enberg
49fbe52088 service: Convert MigrationManager.announceNewColumnFamily to C++
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-03-24 15:02:33 +02:00
Avi Kivity
f7f4a18cf8 cql3: move sets.hh code into .cc file 2015-03-24 14:53:48 +02:00
Avi Kivity
79d1980aa3 cql3: move lists.hh code into .cc file 2015-03-24 14:38:55 +02:00
Avi Kivity
ea004d20d7 Merge branch 'tgrabiec/schema' of github.com:cloudius-systems/seastar-dev into db
Fix schema copy constructor, from Tomasz.
2015-03-24 14:07:36 +02:00