Commit Graph

53948 Commits

Author SHA1 Message Date
Avi Kivity
c952248dc5 shared_ptr: improve const support
Allow enable_shared_from_this<T>::shared_from_this() to return
a shared_ptr<const T> when called on a const object.

Reviewed-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-04-29 12:32:43 +03:00
Calle Wilund
03da7399a0 sstring: add iostream input (>>)
Signed-off-by: Calle Wilund <calle@cloudius-systems.com>
2015-04-29 11:34:47 +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
aeb83f2874 Add commitlog to db + use it in storage_proxy/handler
* 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...
* Moved the actual "apply" of mutation into database. If a commitlog
  is active, add an entry to it before applying mutation.
2015-04-29 10:10:21 +02:00
Calle Wilund
07f1208926 Make commitlog respect max disk size setting. 2015-04-29 10:10:21 +02:00
Tomasz Grabiec
ac576bf1dc schema: Remove thrift_schema
It's not used for anything so it only causes confusion.
2015-04-29 10:21:40 +03: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
Tomasz Grabiec
f00f5f39d9 Merge tag 'avi/remedial-collections-2/v1' from seastar-dev.git
Collection support remedial from Avi.
2015-04-28 17:48:07 +02:00
Avi Kivity
0b09296f5d cql3: enable grammer for collection conditions
map['key'] IN (1, 2, 3)

etc.
2015-04-28 18:17:25 +03:00
Avi Kivity
993db76ef8 cql3: fix column_condition::collection_in_condition() naming 2015-04-28 18:16:49 +03:00
Avi Kivity
1f5321d958 db: drop unimplemented::COLLECTIONS
All implemented!
2015-04-28 18:02:56 +03:00
Avi Kivity
372b403258 cql3: implement schema::has_collections() 2015-04-28 18:02:35 +03:00
Avi Kivity
44f44bbeeb cql3: convert collection-related items in single_column_relation to C++ 2015-04-28 18:01:54 +03:00
Avi Kivity
97f689eb03 cql3: convert single_column_restriction::IN_with_marker to C++ 2015-04-28 18:00:35 +03:00
Avi Kivity
9c446a5465 cql3: convert RequestValidations.java to C++ 2015-04-28 17:05:32 +03: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
Pekka Enberg
9ec10c240f db: Convert LegacySchemaTables keyspace merging
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-04-28 15:49:34 +03:00
Pekka Enberg
dd8a08597f service: Add storage_proxy::query_local() helper
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-04-28 15:49:34 +03:00
Pekka Enberg
f17a8a7a92 query: Add support for result sets
Add a query::result_set class that contains per-row cells that can be
accessed by column name. Partition keys, clustering keys, and static
values are duplicated for every row for convenience.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-04-28 15:49:34 +03:00
Pekka Enberg
bba798c1ab keys: Add partition_key::get_component() helper
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-04-28 15:49:34 +03:00
Pekka Enberg
3afceeea09 bytes_ostream.hh: bytes_ostream::empty()
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-04-28 15:49:34 +03:00
Pekka Enberg
ce51d476c2 schema.hh: Add schema::comment() accessor
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-04-28 15:49:33 +03:00
Pekka Enberg
e5457637fb config: Convert ks_meta_data constructors to C++
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-04-28 15:49:33 +03:00
Pekka Enberg
33ceac5643 database: add database::delete_keyspace() stub
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-04-28 15:49:33 +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
8073abb070 Merge branch 'tgrabiec/compound-fixes' of github.com:cloudius-systems/seastar-dev into db
Bug fixes in the compound class, from Tomasz.
2015-04-28 12:41:18 +03:00
Avi Kivity
4e91a3b005 tests: add test for list append/prepend operations 2015-04-28 12:13:38 +03:00
Avi Kivity
448d67053f cql3: convert operation::prepend to C++ 2015-04-28 12:13:38 +03:00
Avi Kivity
abca68458e cql3: convert lists::prepender to C++
Note the original code contains a bug, causing the prepended literal to
be reversed.  The conversion (and Origin) are fixed.
2015-04-28 12:13:38 +03:00
Avi Kivity
4736504f4a cql3: convert lists::marker::bind() to C++ 2015-04-28 12:13:38 +03:00
Avi Kivity
9131c094a7 cql3: convert lists::precision_time to C++ 2015-04-28 12:13:38 +03:00
Avi Kivity
38a09a6c1a cql3: remove gunk from lists.hh 2015-04-28 12:10:33 +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
Tomasz Grabiec
923aca98f4 compound: Fix handling of empty components in prefixable compounds
We didn't handle properly the case when the last component of a
prefixable compound was empty. Because we do not encode component's
length, we did not distinguish a compound with last element empty from
a compound without the last element.

The fix is to always encode lengths in prefixable tuples.
2015-04-28 11:03:20 +02:00
Tomasz Grabiec
bdf0db974a compound: Swap order of enum elements
The order doesn't matter for correctness, but now "yes" will show as
"1" and "no" as "0" in GDB (it doesn't seem to resolve enum values to
names).
2015-04-28 11:01:04 +02:00
Avi Kivity
47f1fe8eb5 cql3: implement list append operation
UPDATE tab SET mylist = mylist + [1, 2, 3]
2015-04-27 14:54:16 +03:00
Avi Kivity
dc9e705952 cql3: convert lists::appender to C++ 2015-04-27 14:53:51 +03:00
Avi Kivity
f1219c1d74 cql3: enable collections in column_condition 2015-04-27 14:43:43 +03: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
23db4e0b54 db: rename db_tuple_type to tuple_type
Now that we reclaimed the tuple_type name, use it for its rightful owner.
2015-04-27 12:27:18 +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
Pekka Enberg
cf1d6197d6 database: add database::update_keyspace() stub
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-04-27 11:39:57 +03:00
Pekka Enberg
00510d610b database: Add set_clustered_cell() variant
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-04-27 11:39:57 +03:00
Gleb Natapov
3f3987e7ab rpc: handle exception during unmarshalling
Unmarshalling function should not throw, but in case it does move
connection to an error state and report the error to an rpc client.
Currently all errors are reported as rpc::closed_error().
2015-04-27 11:21:54 +03:00
Gleb Natapov
8825b96a44 rpc: add virtual destructor for reply_handler
Without virtual destructor handler's memory is leaking.
2015-04-27 11:21:53 +03:00
Avi Kivity
28f9f629c9 Merge branch 'asias/locator_v1' of github.com:cloudius-systems/seastar-dev into db
Convert some more snitch related classes, from Asias.
2015-04-27 10:46:05 +03:00