Commit Graph

393 Commits

Author SHA1 Message Date
Avi Kivity
8028fb441a db: make column_family a class, not a struct
Don't expose privates in public.
2015-05-05 20:21:03 +03:00
Avi Kivity
00dfa05833 Merge branch 'mutation-v2' of github.com:glommer/urchin into db
Read mutations from sstables, from Glauber.

Conflicts:
	sstables/key.cc
	sstables/key.hh
	sstables/sstables.cc
	sstables/sstables.hh

[avi: adjust sstables/partition.cc:149 for ambiguity due to new
      basic_sstring range constructor]
2015-05-05 17:17:08 +03:00
Asias He
7516966db5 message: Fix passing by reference
From Avi:
'''
start() returns immediately, then the listen object is destroyed (it is
on the stack), then the lambda runs. [&] is also very dangerous.
'''

This fixes a bug in initialization of messaging_service.

[asias@hjpc urchin]$ ./message --listen-address 127.0.0.100
listen =127.0.0.100
protocol::server::server: addr=127.0.0.100:7000
opts.reuse_address=1, _reuseport=1
messaging_service on cpu_id=0, ip=127.0.0.100,
listen_address=127.0.0.100
protocol::server::server: addr=0.36.145.24:7000
opts.reuse_address=1, _reuseport=1
messaging_service on cpu_id=1, ip=0.36.145.24,
listen_address=0.36.145.24
Messaging server listening on port 7000 ...
2015-05-05 13:50:43 +03:00
Raphael S. Carvalho
73a2fd04a7 tests: Add testcase to generation of SSTable data file
Each testcase generates a data file from a given schema + a mutation,
and then check the correctness of the generated data file.
The data used to check the correctness of the generated data file
is from C* data file itself.

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-05-05 11:15:46 +03:00
Asias He
f689ef705a gossip: Forward gossip message to cpu0
There is one gossiper instance per node and it runs on cpu0 only. We can
not guarantee there will always be a core to core tcp connection within
messaging service, so messaging service needs to listen on all cpus.
When a remote node connects to local node with a connection bound to cpu
other than cpu0, we need to forward this message to cpu0.
2015-05-05 10:56:55 +03:00
Gleb Natapov
78d36eabc2 Merge remote-tracking branch 'origin/master' into tmpmerge
message_service: create object using placement new()

Object reference may point to a unit member that was not properly
created, so assign will not work on it. Use placement new() instead.
2015-05-05 10:39:51 +03:00
Glauber Costa
fe4b33053e sstable_test: move some interesting functions to a header file
This test is too big already. The mutation tests would be better off in their own files

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-04-30 15:50:16 -04:00
Glauber Costa
9993344ab8 tests: test the binary search over a full index list
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-04-30 15:15:36 -04:00
Tomasz Grabiec
93aab46406 tests: Fix murmur_hash_test 2015-04-30 14:23:24 +02:00
Avi Kivity
a28f0efd9a sstring: add iterator range constructor 2015-04-30 15:03:27 +03:00
Tomasz Grabiec
72c327b02f tests: Add partitioner test 2015-04-30 12:02:39 +02:00
Tomasz Grabiec
aec740f895 db: Make decorated_key have ordering compatible with Origin 2015-04-30 12:02:39 +02:00
Tomasz Grabiec
46e72cbc64 tests: Introduce perf_hash.cc, hashing benchmark
Output on my laptop:

$ build/release/tests/perf/perf_hash
Timing fixed hash...
28671657.15 tps
28720930.45 tps
28622017.20 tps
28677088.01 tps
29223543.70 tps
Timing iterator hash...
22023042.57 tps
21953352.04 tps
21393787.05 tps
21613837.10 tps
21563284.57 tps
2015-04-30 11:16:53 +02:00
Tomasz Grabiec
ce78aef19a tests: Introduce murmur_hash_test.cc 2015-04-30 11:16:53 +02:00
Tomasz Grabiec
71e580c9c6 tests: keys: Add compatibility layer tests 2015-04-30 11:16:52 +02:00
Tomasz Grabiec
e7c282fdf2 tests: Add tests for compound adaptors 2015-04-30 11:16:52 +02:00
Tomasz Grabiec
6a9c49ee47 compound: Implement postfix incrementation in the component iterator 2015-04-30 11:16:52 +02:00
Calle Wilund
5054892657 Cassandra compatible "config" object
* Based on the property set of cassandra 2.1
* Structure mapping all "known" cassandra.yaml config properties
* YAML and command line parsing of opts.
* Tracks is-set? and set-from-where?
* Uses giant macros to make Avi happy.
2015-04-29 17:00:15 +02:00
Glauber Costa
34d099dfbf sstables: make read_summary_entry private
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-04-29 09:47:19 -04:00
Glauber Costa
198f55dc5c sstables: don't expose summary binary search
There is no need to expose binary search. It can be an internal function
that is accessible for test only.

Also, in the end, the implementation of the summary version was such a simple
one, that there is no need to have a specific method for that. We can just pass
the summary entries as a parameter.

Some header file massage is needed to keep it compiling

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-04-29 09:47:19 -04:00
Avi Kivity
6290dee438 db: const correctness for abstract_type and friends
Types are immutable.
2015-04-29 15:40:38 +03:00
Avi Kivity
257efda9d5 Merge branch 'master' of github.com:cloudius-systems/seastar into db 2015-04-29 12:40:08 +03:00
Avi Kivity
d45e0ebd4a tests: add shared_ptr tests for const support
Reviewed-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-04-29 12:32:54 +03:00
Avi Kivity
3162873d7f Merge branch 'calle/commitlog' of github.com:cloudius-systems/seastar-dev into db
Use commit log in database, from Calle:

"Initial" usage of the commitlog in database mutation path.
A commitlog is created in "work" dirs when initing the db
from a datadir. However, since we have neither disk data storage,
nor replay capability yet (and no real db config), the settings
are basically to just write in-memory serialization, write them to
disk and then discard them. So in fact, pointless. But at least using
the log...
2015-04-29 11:28:05 +03:00
Calle Wilund
07f1208926 Make commitlog respect max disk size setting. 2015-04-29 10:10:21 +02:00
Tomasz Grabiec
cae462c534 Merge remote-tracking branch 'dev/penberg/keyspace-merging/v5' from seastar-dev.git
From Pekka:

"This patch series converts LegacySchemaTables keyspace merging code to
C++. After this series, keyspaces are actually created as demonstrated
by the newly added test in cql_query_test.cc."
2015-04-28 18:06:23 +02:00
Pekka Enberg
987d7ba698 tests: Make create keyspace test case more robust
Add an assertion to check that the newly created keyspace actually
exists.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-04-28 15:49:34 +03:00
Tomasz Grabiec
02eb356cae Merge tag 'avi/remedial-collections-1/v1' from seastar-dev.git
Implementation of missing collections functionality from Avi.
2015-04-28 14:28:14 +02:00
Nadav Har'El
8e6d11df1b sstable read: support deleted cells
This patch adds support to reading deleted cells (a.k.a. cell tombstones)
from the SSTable.

The way deleted cells are encoded in the sstable is explained in the
"Cell tombstone" section of
https://github.com/cloudius-systems/urchin/wiki/SSTables-interpretation-in-Urchin

This more-or-less completes the low-level SSTable row reading code - the
only remaining untreated case are counters, which we agreed to leave to
later. If counters are found in the SSTable, we'll throw an exception.

This patch adds a new callback, consume_deleted_cell, taking the name of
the cell and its deletion_time (as usual, deletion_time includes both a
64-bit timestamp, for ordering events, and a 32-bit "local_deletion_time"
used to schedule gc of old tombstones).

This patch also adds a test SSTable with deleted cell, created by the
following Cassandra Commands:

	CREATE TABLE deleted (
		name text,
		age int,
		PRIMARY KEY (name)
	);
	INSERT INTO deleted (name, age) VALUES ('nadav', 40);
	<flush table - the second table is what we're after>
	DELETE age FROM deleted WHERE name = 'nadav';

We test our ability to read this sstable, and see the deleted cell
and its expected deletion time.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-04-28 14:56:04 +03:00
Nadav Har'El
0adc4812ba sstable read: support cell expiration time
This patch adds support to reading sstable cells with expiration time.

It adds two more parameters to the row_consumer::consume_cell() - "ttl"
and "expiration". The "ttl" is the original TTL set on the cell in seconds,
the "expiration" is the absolute time (in seconds since the Unix epoch) when
this cell is set to expire. I don't know why both values are needed...

When a cell has no expiration time set (most cells will be like that), the
callback with will be called expiration==0 (and ttl==0).

This patch also adds a test SSTable with cells with set TTL, created by
the following Cassandra commands:

	CREATE TABLE ttl (
		name text,
		age int,
		PRIMARY KEY (name)
	);
	INSERT INTO ttl (name, age) VALUES ('nadav', 40) USING TTL 3600;

And tests our ability to read the resulting sstable, and get the expected
expiration time.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-04-28 14:56:01 +03:00
Avi Kivity
4e91a3b005 tests: add test for list append/prepend operations 2015-04-28 12:13:38 +03:00
Tomasz Grabiec
b4c400612a tests: Introduce compound_test 2015-04-28 11:03:21 +02:00
Tomasz Grabiec
4c2390348e tests: Introduce range_assert
Makes it wasier to express requirements about ranges.
2015-04-28 11:03:20 +02:00
Pekka Enberg
066a37ad21 shared_ptr: Make shared_ptr work with foreign_ptr
The foreign_ptr wrapper needs 'element_type' to be present in
shared_ptr to be able to access the data.

Fixes the following compilation failure when trying to use shared_ptr
with foreign_ptr:

  In file included from tests/foreign_ptr_test.cc:24:0:
  ./core/distributed.hh: In instantiation of ‘class foreign_ptr<shared_ptr<basic_sstring<char, unsigned int, 15u> > >’:
  tests/foreign_ptr_test.cc:28:54:   required from here
  ./core/distributed.hh:272:56: error: no type named ‘element_type’ in ‘class shared_ptr<basic_sstring<char, unsigned int, 15u> >’
       using element_type = typename PtrType::element_type;

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-04-27 14:39:12 +03:00
Tomasz Grabiec
6e78344c87 Merge tag 'avi/usertypes-addendum/v1' from seastar-dev.git 2015-04-27 12:53:00 +02:00
Avi Kivity
f779c54d75 db: rename tuple_type family to compound_type
tuples already have a meaning in Cassandra and in C++, let's not overload
the word even more.  Use compound, which is the word used in Origin as well.
2015-04-27 12:27:18 +02:00
Avi Kivity
803481792b tests: test cql3 type-cast with user-defined types 2015-04-26 19:25:39 +03:00
Avi Kivity
fcaf33328f tests: fix test_user_type comment 2015-04-26 19:25:39 +03:00
Avi Kivity
57b5907572 tests: add local_db() method to cql_test_env
Needed for functionality not yet exposed by cql.
2015-04-26 19:25:39 +03:00
Avi Kivity
65b8b19ca7 Merge branch 'tgrabiec/order-partitions-by-decorated-key' of github.com:cloudius-systems/seastar-dev into db
Use decorated_key in partition maps, from Tomasz:

"Partitions should be ordered using Origin's ordering, which is the natural
ordering of decorated_key. This is achieved by switching column_family's
partition map to use decorated_key instead of a bare partition_key.

This also includes some cleanups."

[avi] trivial adjustments to sstables/keys.cc
2015-04-25 19:22:51 +03:00
Tomasz Grabiec
5a7e3d3278 db: Order partitions by decorated_key
Partitions should be ordered using Origin's ordering, which is first
by token, then by Origin's representation of the key. That is the
natural ordering of decorated_key.

This also changes mutation class to hold decorated_key, to avoid
decoration overhead at different layers.
2015-04-24 18:01:01 +02:00
Tomasz Grabiec
1c3275c950 mutation: Encapsulate fields 2015-04-24 18:01:01 +02:00
Tomasz Grabiec
a9972b4b28 Relax header dependencies 2015-04-24 18:01:01 +02:00
Glauber Costa
00f8c148d6 tests: test summary binary search.
Make sure that, for selected Summary files, the first key is always found to be
in position 0. In order to do that, we need to create an sstable::key. By having
this test using multiple data types (including collections and composites), we also
make sure that the serialization is sound.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-04-24 10:11:50 -04:00
Asias He
9377cdcc45 tests: Add exception tests to tests/urchin/message.cc 2015-04-23 14:55:27 +08:00
Asias He
346d00cc8c tests: Add listen-address option to tests/urchin/message.cc 2015-04-23 14:55:27 +08:00
Asias He
5bb42de010 tests: Update load info over the time in tests/urchin/gossip.cc 2015-04-23 14:55:26 +08:00
Avi Kivity
74edad888f Merge branch 'master' of github.com:cloudius-systems/seastar into db 2015-04-22 10:12:16 +03:00
Amnon Heiman
8a0538a218 http: fix query parameter parsing of last parameter
When serving a request with multiple query parameters the last parameter
was parsed incorectly.

This fix the issue and add a test to verify it

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-04-21 10:29:14 +03:00
Avi Kivity
08932571c1 tests: add user type literal test 2015-04-20 16:15:35 +03:00