Commit Graph

433 Commits

Author SHA1 Message Date
Glauber Costa
2fba948ad8 sstables: move timestamps to signed integer
This is to follow Origin

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-05-13 17:14:02 -04:00
Glauber Costa
590abb800e sstables: pass a key_view instead of bytes_view to consume_row_start
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-05-13 17:14:02 -04:00
Gleb Natapov
8d9fb8a96c message: consolidate send_message() and send_message_oneway()
send_message() and send_message_oneway() are almost identical, implement
the later in terms of the former. The patch also fixes send_message() to
work properly with MsgIn = void.

Reviewed-by: Asias He <asias@cloudius-systems.com>
2015-05-13 13:41:24 +03:00
Avi Kivity
8c09dbdbe8 Merge branch 'tgrabiec/cleanups' of github.com:cloudius-systems/seastar-dev into db
Database core cleanups, from Tomasz.
2015-05-13 11:08:21 +03:00
Avi Kivity
097aeb261e Merge branch 'master' of github.com:cloudius-systems/seastar into db 2015-05-13 10:57:53 +03:00
Tomasz Grabiec
f656ae8ed4 db: Encapsulate deletable_row fields 2015-05-13 08:56:54 +02:00
Tomasz Grabiec
dbc40dfb09 db: Encapsulate the "row" class
Reduces coupling. User's should not rely on the fact that it's an
std::map<>.  It also allows us to extend row's interface with
domain-specific methods, which are a lot easier to discover than free
functions.
2015-05-13 08:56:54 +02:00
Tomasz Grabiec
56bea440a7 mutation_partition: Pass schema by const& where applicable
If method doesn't want to share schema ownership it doesn't have to
take it by shared pointer. The benefit is that it's slightly cheaper
and those methods may now be called from places which don't own
schema.
2015-05-13 08:56:54 +02:00
Avi Kivity
f3c8994535 distributed: add map_reduce() variant accepting an initial value
Separating the initial value (and accumulator) from the reducer function
can result in simpler invocations.

Unfortunately, the name conflicts with another variant, so we have to name
the method map_reduce0.
2015-05-12 16:57:50 +03:00
Avi Kivity
b300a05468 Merge branch 'master' of github.com:cloudius-systems/urchin into db 2015-05-12 15:07:16 +03:00
Avi Kivity
548646d4ba Merge branch 'master' of github.com:cloudius-systems/seastar into db
Should fix use-after-free when a frozen_mutation is applied to the
local shard.

Includes two adjustments to urchin collectd usage from Calle:

  - Updated thrift collectd registration to use proper move semantics
  - Commitlog: Fix collectd registration to use move semantics + test

Signed-off-by: Calle Wilund <calle@cloudius-systems.com>
2015-05-12 14:47:07 +03:00
Tomasz Grabiec
c779fa880f Merge branch 'penberg/keyspace-merging-improvements/v2' from seastar-dev.git
From Pekka:

 "This series implements a Maps.difference() function in C++, changes
 storage_proxy::query_local() to not return foreign_ptr>, and finally
 changes the keyspace merging code to follow Origin."
2015-05-12 13:08:02 +02:00
Pekka Enberg
a264f42bd6 Add map_difference::difference() helper
This implements Maps.difference() helper function in C++. We need it to
translate various Origin call-sites that use it. The implementation is
written from scratch with Guava code used as reference to preserve
semantics.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-05-12 10:19:52 +03:00
Raphael S. Carvalho
e1de49e233 tests: move sstable data file generation testcases to another file
I didn't want to create another executable for it because doing so
would take a lot more of disk space. The motivation behind this
change is to debloat the sstables test file, which is growing very
quickly. Suggested by Glauber Costa.

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-05-11 19:37:29 +03:00
Raphael S. Carvalho
feeaae06cf sstables: add support to write tombstone cells
Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-05-11 11:57:32 -03:00
Raphael S. Carvalho
f62f4ef5de sstables: add support to write expiring cells
Expiring cell means a cell with a TTL.

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-05-11 11:55:30 -03:00
Avi Kivity
ec43027d46 Merge branch 'tgrabiec/frozen_mutation' of github.com:cloudius-systems/seastar-dev into db
Introduce frozen_mutation, from Tomasz:

"The immediate motivation for introducing frozen_mutation is inability to
deserialize current "mutation" object, which needs schema reference at the
time it's constructed. It needs schema to initialize its internal maps with
proper key comparators, which depend on schema. We can't lookup schema before
we deserialize column family ID. Another problem is that even if we had the ID
somehow, low level RPC layer doesn't know how to lookup the schema.

This form is primarily destined to be sent over the network channel. Data can
be wrapped in frozen_mutation without schema information, the schema is only
needed to access some of the fields.

frozen_mutation supports reading via visiting, without having to explode it
into an object graph. Because of that, application should be more efficient
because of fewer cache misses.

We also don't have to serialize it back for the commit log, it's serialized
only once on the coordinator node.

Different serialization formats are not supported yet."

Reviewed-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-05-10 11:54:03 +03:00
Raphael S. Carvalho
68d76cb915 sstables: fix a bug in data_consume_rows_context::read_64
When the temporary buffer has enough data for a uint64 to be
consumed, we readily consume it.
The problem is that we were wrongly storing the uint64 into
a uint32 variable.

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-05-08 11:16:42 +02:00
Tomasz Grabiec
08cdeb75d9 tests: Add test for application of mutation_partition_view 2015-05-08 09:19:02 +02:00
Tomasz Grabiec
b5bac12a48 tests: Introduce frozen_mutation_test 2015-05-08 09:19:02 +02:00
Tomasz Grabiec
677b57dea2 tests: Introduce mutation_assertions.hh
For fluent asserting mutations:

  assert_that(what_we_got).is_equal_to(what_we_expect);

We could extend that in future with more specific checks, like
has_cell() etc.
2015-05-08 09:19:01 +02:00
Tomasz Grabiec
4ab66de0ae db: Introduce frozen_mutation
The immediate motivation for introducing frozen_mutation is inability
to deserialize current "mutation" object, which needs schema reference
at the time it's constructed. It needs schema to initialize its
internal maps with proper key comparators, which depend on schema.

frozen_mutation is an immutable, compact form of a mutation. It
doesn't use complex in-memory strucutres, data is stored in a linear
buffer. In case of frozen_mutation schema needs to be supplied only at
the time mutation partition is visited. Therefore it can be trivially
deserialized without schema.
2015-05-08 09:19:01 +02:00
Gleb Natapov
3a01796eef tests: fix message test
Fix inconsistency between handler's parameter types and what is actually
passed to rpc call. Also get rid of unneeded local variables.

Reviewed-by: Asias He <asias@cloudius-systems.com>
2015-05-07 13:28:47 +03:00
Asias He
f12e955b4e message: Drop register_handler_oneway 2015-05-07 13:16:18 +03:00
Avi Kivity
e17f88e948 Merge branch 'asias/gossip_fix' of github.com:cloudius-systems/seastar-dev into db
Gossip fixes, from Asias.
2015-05-07 12:59:21 +03:00
Asias He
c79844e4e5 gossip: Fix passing by reference
Fix the same issue as we do in 7516966db5 (message: Fix passing by
reference).
2015-05-07 15:29:46 +08:00
Tomasz Grabiec
b1e45e4401 db: Store ttl in atomic_cell
Origin does that, so should we. Both ttl and expiry time are stored in
sstables. The value of ttl seems to be used to calculate the read
digest (expiry is not used for that).

The API for creating atomic_cells changed a bit.

To create a non-expiring cell:

  atomic_cell::make_live(timestamp, value);

To create an expiring cell:

  atomic_cell::make_live(timestamp, value, expiry, ttl);

or:

  // Expiry is calculated based on current clock reading
  atomic_cell::make_live(timestamp, value, ttl_optional);
2015-05-06 19:42:38 +02:00
Tomasz Grabiec
784f841b8b tests: Add test for cell ordering 2015-05-06 18:32:17 +02:00
Tomasz Grabiec
5ba1486ae7 db: Rename "ttl" to "expiry" when it's used as time point
To avoid confusion with "ttl" the duration.
2015-05-06 17:27:22 +02:00
Tomasz Grabiec
04846ed3d2 mutation: Make mutation equality comparable 2015-05-06 16:40:48 +02:00
Tomasz Grabiec
6762a92299 mutation_partition: Take schema by reference in apply_row_tombstone() 2015-05-06 16:40:48 +02:00
Tomasz Grabiec
0deec287d4 tests: keys: Add test for key <-> view coversions 2015-05-06 15:52:56 +02:00
Calle Wilund
46e0676a7d commitlog: Add reader stream/subscription
Generic read-all-stream from a commit log segmen file.
Provides a byte view for each data entry, doing CRC checks and padding skips.

Signed-off-by: Calle Wilund <calle@cloudius-systems.com>
2015-05-06 16:45:13 +03:00
Tomasz Grabiec
36ad6c9aa8 Merge tag 'avi/memtables/v3' from seastar-dev.git
Multiple memtable support from Avi.
2015-05-06 15:02:42 +02:00
Avi Kivity
4875028fb3 tests: add test for range scan memtable merging 2015-05-06 15:43:43 +03:00
Avi Kivity
eccb6bfe08 tests: add tests for multiple memtables in column family (single partition) 2015-05-06 15:43:09 +03:00
Avi Kivity
5e81b92dc0 db: split column_family::partitions into a new memtable class
In preparation for multiple memtables, move column_family::partitions into
its own class, and forward relevant calls from column_family.

A testonly_all_memtables() function was added to support sstable_test.
2015-05-06 15:35:14 +03:00
Avi Kivity
f0e30bd1be Merge branch 'master' of github.com:cloudius-systems/seastar into db 2015-05-06 13:32:31 +03:00
Avi Kivity
211c77bf52 shared_ptr: add const support for lw_shared_ptr 2015-05-06 11:41:33 +03:00
Pekka Enberg
33b37f7954 cql: Fix replication strategy class lookup
Fix replication strategy class lookup to support unqualified names such
as "SimpleStrategy". The AbstractReplicationStrategy.getClass() method
in origin does the same thing.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-05-06 10:01:00 +03:00
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