Commit Graph

196 Commits

Author SHA1 Message Date
Avi Kivity
77196afb95 Merge branch 'master' of github.com:cloudius-systems/seastar into db 2015-03-11 19:32:52 +02:00
Avi Kivity
3a35fe061b tests: tighten when_all() compare
Fails on one compiler.
2015-03-11 19:31:55 +02:00
Avi Kivity
5b6e23ebde tests: reduce BOOST_REQUIRE() calls
when_all() tests generate two million calls to BOOST_REQUIRE(), which
overwhelms the test result parser.  Replace with two calls and use all_of()
to process the result array.
2015-03-11 19:25:54 +02:00
Avi Kivity
b3dd714e00 Merge branch 'tgrabiec/select' of github.com:cloudius-systems/seastar-dev into db
Cql select support, from Tomasz.
2015-03-11 19:02:08 +02:00
Avi Kivity
d0705e6e82 Merge branch 'master' of github.com:cloudius-systems/seastar into db
Conflicts:
	configure.py
2015-03-11 19:01:37 +02:00
Avi Kivity
e659ca2629 Merge branch 'when_all' of github.com:cloudius-systems/seastar-dev
when_all() variant for runtime-sized lists of futures.
2015-03-11 17:06:23 +02:00
Tomasz Grabiec
053f9e6d05 tests: Add tests for parsing and execution of CQL select statement 2015-03-11 16:01:14 +01:00
Tomasz Grabiec
ebb417a03b tests: Add cartesian product test 2015-03-11 14:56:10 +01:00
Tomasz Grabiec
1ba0015a99 Merge remote-tracking branch 'seastar/master'
Conflicts:
	configure.py
2015-03-11 14:45:35 +01:00
Tomasz Grabiec
293a6e7547 tests: Test distributed::map_reduce() version which takes a functor 2015-03-11 13:33:53 +01:00
Tomasz Grabiec
200f4698b5 tests: Add test for map_reduce() 2015-03-11 13:24:31 +01:00
Avi Kivity
713d9561e9 Merge branch 'master' of github.com:cloudius-systems/seastar into db
Conflicts:
	configure.py
2015-03-11 10:12:38 +02:00
Raphael S. Carvalho
10a71dadac tests: add fstream testcase 2015-03-10 18:44:40 -03:00
Avi Kivity
a3695dbcc4 future: add a test case for runtime sized when_all() 2015-03-10 22:01:55 +02:00
Avi Kivity
c4febdeb63 Merge branch 'glommer/index-reader-v4' of github.com:cloudius-systems/seastar-dev into urchin
Sstable index reader, from Glauber.
2015-03-10 20:24:02 +02:00
Glauber Costa
7c96752a46 sstable_tests: add tests for index reads
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-03-10 15:13:14 -03:00
Avi Kivity
0139a210e2 Merge branch 'master' of github.com:cloudius-systems/seastar into db 2015-03-10 17:04:16 +02:00
Shlomi Livne
f8d773dd47 tests: fix future unitest that sometimes fails because of scheduling
Signed-off-by: Shlomi Livne <shlomi@cloudius-systems.com>
2015-03-10 16:38:43 +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
Nadav Har'El
7a04d1f662 fstream: refactor file input stream interface
The file_input_stream interface was messy: it was not fiber safe (e.g., code
doing seek() in the middle of an ongoing read_exactly()), and went against
the PIMPL philosophy.

So this patch removes the file_input_stream class, and replaces it with a
completely different design:

We now have in fstream.hh a global function:

input_stream<char>
make_file_input_stream(
        lw_shared_ptr<file> file, uint64_t offset = 0,
	uint64_t buffer_size = 8192);

In other words, instead of "seeking" in an input stream, we just open a new
input stream object at a particular offset of the given file. Multiple input
streams might be concurrently active on the same file.

Note how make_file_input_stream now returns a regular "input_stream", not a
subtype, and it can be used just like any normal input_stream to read the stream
starting at the given position.

This patch makes "input_stream" a "final" type: we no longer subclass it in our
code, and we shouldn't in the future because it goes against the PIMPL design
(the subclass should be of the inner workings, like the data_source_impl, not
of input_stream).

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-03-10 15:39:17 +02:00
Avi Kivity
9639a7207e Merge branch 'master' of github.com:cloudius-systems/seastar into db
Conflicts:
	test.py
2015-03-10 13:06:02 +02:00
Tomasz Grabiec
dad1253ca1 tests: Add test for tuple_type::compare() 2015-03-10 10:16:55 +02:00
Calle Wilund
d5ba374495 Test fix. Retain commitlog until it is cleared, which is a potentially "blocking" op. Should fix jenkins test crashes.
Signed-off-by: Calle Wilund <calle@cloudius-systems.com>
2015-03-10 08:48:16 +01:00
Amnon Heiman
810d8c88d8 Adding httpd tests 2015-03-08 21:55:57 +02:00
Amnon Heiman
29391d9a9b Extending sstring
This patch adds some of the common functionalities from std:string to
sstring.

It adds length (implement by size() )
It define the constant npos to indicate no possition.
It adds the at (reference and const reference)
It define the find char and find sstring methods
and the substr method

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>

need merge sstring
2015-03-08 21:55:57 +02:00
Shlomi Livne
a40ef8bfe1 future: Add test case for finally being called on non immediate available future
Found that we are missing tests in code coverage review

Signed-off-by: Shlomi Livne <shlomi@cloudius-systems.com>
[avi: fix formatting]
2015-03-08 16:52:26 +02:00
Avi Kivity
9b39bd410e Merge branch 'master' of github.com:cloudius-systems/seastar into db 2015-03-08 15:02:24 +02:00
Tomasz Grabiec
7502f2a3a3 tests: Add test for returning bare values from callbacks 2015-03-06 11:35:56 +01:00
Raphael S. Carvalho
41846256d8 tests: fix fileiotest
engine() cannot be called before the local_engine was constructed because it
dereferences the pointer local_engine to create a reference.
Consequently, the following error can be seen while running fileiotest:
./core/reactor.hh:854:13: runtime error: reference binding to null pointer of
type 'struct reactor' ASAN:SIGSEGV

Let's switch the test to use app_template.

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-03-06 10:06:16 +02:00
Tomasz Grabiec
3db3207b85 Merge branch seastar-dev.git 'collections'
Collections support from Avi.
2015-03-05 20:25:48 +01:00
Avi Kivity
6126670078 mutation_test: test maps 2015-03-05 20:03:57 +02:00
Calle Wilund
054f9ed082 Initial commit log support.
Implements a cassandra-file-compatible segmented log
of "mutations". Handles "batch" and "periodic" mode like
stock version. Also includes "dirty" management for the
interaction log/memtable.

Supports:
* add
* sync/flush
* clear dirty bits (thus discarding segments)

Many more estoric stock functions not yet implemented.

Missing: Storage management. Does not deal with total
size on disk of segments yet. Nor does it have any provisions
for dealing with active buffer bloat should async writes stall.

[avi: adjust for future<>::rescue() removal]
Signed-off-by: Calle Wilund <calle@cloudius-systems.com>
2015-03-05 11:06:09 +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
Tomasz Grabiec
83963b23d3 Replace rescue() usages with then_wrapped()
They are pretty much the same. This change removes rescue().
2015-03-04 17:34:59 +01:00
Raphael S. Carvalho
89ec1f8f6a slab: Add reclaimer functionality
Basic explanation of the reclaimer algorithm:
- Each slab page has a descriptor containing information about it, such as
refcnt, vector of free objects, link into LRU, etc.
- The LRU list will only contain slab pages which items are unused, so as
to make the reclaiming process faster and easier. Maintaining the LRU of slab
pages has a performance penalty of ~1.3%. Shlomi suggested an approach where
LRU would no longer exist and timestamp would be used instead to keep track of
recency. Reclaimer would then iterate through all slab pages checking for an
unused slab page with the lowest timestamp.
- Reclaimer will get the least-recently-used slab page from the LRU list,
do all the management stuff required, and iterate through the page erasing any
of the items there contained. Once reclaimer was called, it's likely that slab
memory usage is calibrated, thus slab pages shouldn't be allocated anymore.
- Reclaimer is enabled by default but can be disabled by specifying the slab
size using the application parameter --max-slab-size.

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-03-04 17:40:58 +02:00
Avi Kivity
a49330095a db: wrap bytes in atomic_cell format
We use bytes for many different things, and it is easy to get confused as
to what format the data is actually in.

Fix that for atomic_cell by proving wrappers.  atomic_cell::one corresponds
to a bytes object holding exactly one atomic cell, and atomic_cell::view is
a bytes_view to an atomic_cell.  The static functions of atomic_cell itself
are privatized to prevent the unwashed masses from using them on the wrong
objects.

Since a row entry can hold either a an atomic cell, or a collection,
depending on the schema, also introduce a variant type
atomic_cell_or_collection and allow the user to pick the type explicitly.
Internally both are stored as bytes object.
2015-03-04 15:49:35 +02:00
Pekka Enberg
d6b5caa1f3 tests: Convert cql_query_test to use Boost.Test
Use Boost.Test so that we can easily specify multiple test cases.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-03-04 13:16:17 +01:00
Pekka Enberg
99a09020e8 types: Fix bytes_type_impl string conversion
Tomek points out that:

  Origin calls org.apache.cassandra.utils.Hex#hexToBytes here, which is
  not what to_bytes() does. BytesType.getSerializer().toString() calls
  ByteBufferUtil.bytesToHex(value), so you should call to_hex() here.

Fix that up.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-03-02 10:38:27 +01:00
Tomasz Grabiec
74295a9759 db: Use opaque bytes for cell values instead of boost::any
Storing cells as boost::any objects makes us use expensive
boost::any_cast to access the data. This change replaces boost::any
with bytes object which holds the value in serialized form (the same
as will be used for on-wire format).

If the cell type is atomic, you use fields accessors defined in
atomic_cell class, eg like this:

if (column.type.is_atomic()) {
   if (atomic_cell::is_live(c) {
      auto timestamp = atomic_cell::timestamp(c);
      ...
   }
}

Eventually we could switch to a more officient semi-serialized form
with native byte order but I don't want to introduce it just yet for
simplicity.
2015-02-27 10:59:43 +01:00
Tomasz Grabiec
a61d9ee18e schema: Add static columns to schema 2015-02-27 10:48:56 +01:00
Tomasz Grabiec
f21d85cfc5 tests: Stop distributed db when test ends
Fixes:

cql_query_test: ./core/distributed.hh:150: distributed<Service>::~distributed() [with Service = database]: Assertion `_instances.empty()' failed.
2015-02-27 10:48:55 +01:00
Glauber Costa
8015b1c1bb sstable: unit tests
This tests the sstable parsing code. The tables provided as exemple are real
tables, that I was using to test my code manually.

The corrupt tables, however, are corrupted by hand.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-02-26 12:14:20 -05:00
Avi Kivity
d39c844ea3 Merge branch 'master' of github.com:cloudius-systems/seastar into db
Conflicts:
	configure.py
	database.cc (added missing include)
	utils/serialize.hh (added missing inlines)
2015-02-26 17:57:18 +02:00
Glauber Costa
6b77cf7d08 linecount: change rw to ro
Avi says it is enough.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-02-26 17:30:02 +02:00
Glauber Costa
9861bfca01 open_file_dma: allow the specification of open flags
It is sometimes frustrating to use open_file_dma, because it has the hardcoded
behavior of always assuming O_CREAT. Sometimes this is not desirable, and it
would be nice to have the option not to do so.

Note that, by design, I am only including in the open_flags enum things that we
want the user of the API to control. Stuff like O_DIRECT should not be
optional, and therefore is not included in the visible interface.

Because of that I am changing the function signature to include a paramater
that specifies whether or not we should create the file if it does not exist.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-02-26 17:30:02 +02:00
Pekka Enberg
a3b2a70f65 tests/perf: CQL statement parser performance test
Add a performance test case for CQL statement parsing to better
understand its performance impact. We also include ANTLR tokenizer and
parser setup as that's what we do in query_processor for each request.

Running the test on my Haswell machine yields the following results:

  [penberg@nero urchin]$ build/release/tests/perf/perf_cql_parser
  Timing CQL statement parsing...
  108090.10 tps
  125366.11 tps
  124400.64 tps
  124274.75 tps
  124850.85 tps

That means that CQL parsing alone sets an upper limit of 120k requests
per second for Urchin for a single core.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-02-26 14:14:53 +01:00
Tomasz Grabiec
cd7a05660e tests: Simplify schema object construction 2015-02-26 10:03:19 +02:00
Raphael S. Carvalho
67560bec48 test: Add slab allocator testcase
Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-02-25 19:32:57 -03:00
Tomasz Grabiec
e0bff0c28e tests: Add test exploiting dynamic_pointer_cast bug 2015-02-25 11:56:07 +02:00
Avi Kivity
2720ba34bf db: shard data
Add database::shard_of() to compute the shard hosting the partition
(with a simplistic algorithm, but perhaps not too bad).

Convert non-metadata invoke_on_all() and local calls on the database
to use shard_of().
2015-02-23 11:37:12 +02:00