Commit Graph

2533 Commits

Author SHA1 Message Date
Avi Kivity
aab6d7a173 cql3: convert lists::discarder to C++
And wire it up.
2015-03-30 14:28:16 +03:00
Avi Kivity
a1dab20422 Merge branch 'tgrabiec/deletes' of github.com:cloudius-systems/seastar-dev into db
Delete support, from Tomasz.
2015-03-30 11:24:22 +03:00
Avi Kivity
4d65825f91 Merge branch 'master' of github.com:cloudius-systems/seastar into db 2015-03-30 11:23:02 +03:00
Avi Kivity
7cf25ce492 distributed: fix use-after-move
distributed::stop() passes the pointer to the instance being destroyed
by reference, in an attempt to keep things clean (by nulling the pointer
after deleting it).  This is illegal, however, since the lambda is moved
in the bowels of submit_to().  In release mode this is optimized away so
the code works, but in debug mode it leads to a crash.

Fix by capturing by value instead (could also have been fixed by switching
the enclosing capture to a reference).

Credit to Gleb for identifying the problem.
2015-03-30 11:18:16 +03:00
Tomasz Grabiec
dc019c6da2 tests: Add tests for deletion scenarios 2015-03-30 09:08:26 +02:00
Tomasz Grabiec
a06f195774 tests: Add more existing tests to the automatic suite 2015-03-30 09:07:01 +02:00
Tomasz Grabiec
ff35be339c tests: cql: Improve error reporting in with_rows() 2015-03-30 09:07:01 +02:00
Tomasz Grabiec
51af0ad8cd to_string: Implement to_string() for std::initializer_list<> 2015-03-30 09:07:01 +02:00
Tomasz Grabiec
14fe96c02e to_string: Implement to_string() using join() 2015-03-30 09:07:01 +02:00
Tomasz Grabiec
e50c5f8305 types: Implement operator<<(ostream&, const bytes_opt&) 2015-03-30 09:07:01 +02:00
Tomasz Grabiec
b52cd91281 db: Properly determine row liveness
In CQL a row is considered as present if its row marker is live or it
has any cells live. The 'insert' statement creates a row
marker. Internally Origin handles that by inserting a special cell
whose name shares the prefix with other cells in that row.

One consequence of this way of things is that when we query a column
slice from sstables we will have to read the whole CQL row, even if
not all columns are queried. We won't have to include the data, but we
will need liveness information in order to commute it with other
mutations, so that we can finally determine if the row is live or not.
2015-03-30 09:07:01 +02:00
Tomasz Grabiec
f155da622f db: Move row limit check to the right place
Could have let in more rows than requested in range queries.
2015-03-30 09:07:01 +02:00
Tomasz Grabiec
f469dd1234 cql3: Fix setter_by_index::execute() to work with empty cells
The list cell may be not set, in which case we should reurn an error
to the user. Current implementation of get_prefetched_list() was
returning collection_mutaion::view in this case, which had an empty
view. Deserialization is not prepared to get an empty view though. I
think we can stick with having non-empty views in the general case and
return an optional in get_prefetched_list().
2015-03-30 09:07:01 +02:00
Tomasz Grabiec
6487e82561 cql3: Fix make_tombstone_just_before()
The timestamp should be decremented, not local deletion time.
2015-03-30 09:07:01 +02:00
Tomasz Grabiec
fb0b2ce159 cql3: Convert grammar rules for 'delete' statement 2015-03-30 09:07:01 +02:00
Tomasz Grabiec
d143f68898 cql3: Convert backend for 'delete' statement 2015-03-30 09:07:01 +02:00
Tomasz Grabiec
30c821d585 tombstone: rename ttl to deletion_time
The current name is confusing to say the least.
2015-03-30 09:07:01 +02:00
Tomasz Grabiec
70341ceb0a db: Return only live cells in query::result::row
The coordinator filters out dead data anyway.
2015-03-30 09:07:01 +02:00
Tomasz Grabiec
4aa74f1312 db: Make mutation_partition::clustered_row() return deletable_row reference 2015-03-30 09:07:00 +02:00
Tomasz Grabiec
808f70b6c3 collection_type_impl: Introduce is_any_live() 2015-03-30 09:07:00 +02:00
Tomasz Grabiec
300bacb3d9 collection_type_impl: Introduce is_empty() 2015-03-30 09:07:00 +02:00
Tomasz Grabiec
95b71f220c types: collection_type_impl: Introduce serialize_mutation_form_only_live()
For serializing only live elements of the collection. Will be needed
by query path.
2015-03-30 09:07:00 +02:00
Tomasz Grabiec
69b4dd76e8 atomic_cell: Add is_live() version which takes a tombstone
It determines if the cell is live given its cointainer has this
tombstone.
2015-03-30 09:07:00 +02:00
Tomasz Grabiec
f30fe80d07 cql3: update_parameters: Add timestamp attribute getter 2015-03-30 09:07:00 +02:00
Tomasz Grabiec
a57414a7c9 cql3: modification_statement: Take conditions vector by value
It will be moved here.
2015-03-30 09:07:00 +02:00
Tomasz Grabiec
7c104a733e cql3: Optimize binding of a single value
This saves us an allocation of vector for single column restrictions.
2015-03-30 09:07:00 +02:00
Tomasz Grabiec
2902395129 Relax includes 2015-03-30 09:01:59 +02:00
Tomasz Grabiec
ac61d7526e db: Take keyspace name by const& 2015-03-30 09:01:59 +02:00
Tomasz Grabiec
2bcc368138 db: Move implementations to source file 2015-03-30 09:01:59 +02:00
Nadav Har'El
f80ac5a629 sstables: rework compression metadata to fix test.
Previously we had both a "compression" structure (read from the Compression
Info file on disk) and a "compression_metadata" class with additional
information, which std::move()ed parts of the compression structure.
This caused problems for the simplistic sstable-writing test (which does
the non-interesting thing of writing a previously-read sstable).

I'm ashamed to say, fixing this was very hard, because all this code is
built like a house of cards - try to change one thing, and everything
falls apart. After many failed attempts in trying to improve this code, what
I ended up doing is simply *extending* the "compression" structure - the
extended part isn't read or written, but it is in the structure.

We also no longer move a shared pointer to the compression structure,
but rather just an ordinary pointer; The assumption is that the user
will already make sure that the sstable structure will live for the
durations of any processing on it - and the compression structure is just
one part of this sstable structure.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-03-29 16:14:53 +03:00
Shlomi Livne
cbf972c135 tests: set BOOST_TEST_SUITE to the test file name instead of the generic "seastar-tests"
Signed-off-by: Shlomi Livne <shlomi@cloudius-systems.com>
2015-03-29 11:54:01 +03:00
Avi Kivity
abcd745539 tests: add discarder test
UPDATE tab SET my_set_or_map = my_set_or_map - { key1, key2 }
2015-03-27 16:10:35 +01:00
Avi Kivity
5369d6744c cql3: convert operation::subtraction to C++ (for sets, maps) 2015-03-27 16:10:35 +01:00
Avi Kivity
05e03f0b88 cql3: convert sets::discarder to C++ 2015-03-27 16:10:35 +01:00
Avi Kivity
844bdef6ac tests: add sets::setter test
UPDATE tab SET myset = { 1, 2, 3 }
2015-03-27 16:09:41 +01:00
Avi Kivity
22f24cc5f6 cql3: implement sets::setter tombstone
Kill existing cells before adding new ones.
2015-03-27 16:09:41 +01:00
Avi Kivity
2602032b5e tests: add tests for setting entire maps
UPDATE tab set my_map = { key: val, ... };

also test a random syntax error.
2015-03-26 18:14:35 +01:00
Avi Kivity
17b929d739 db: implement as_cql3_type() for collections 2015-03-26 18:14:35 +01:00
Avi Kivity
6c343057ea cql3: implement maps setter correctly
Now that we have collection tombstones, we can kill all existing cells
in maps::setter.
2015-03-26 18:14:35 +01:00
Avi Kivity
579a794d14 cql3: de-virtualize cql3_type
cql3_type is a wrapper around data_type, so there's no need for a class
hierarchy -- anything that depends on the actual type can be forwarded
to abstract_type_impl.

We can now use this as a value type (dropping shared_ptr<cql3_type>), but
that is left for later.
2015-03-26 16:04:55 +01:00
Avi Kivity
d92d5b9217 Merge branch 'tgrabiec/static_col' of github.com:cloudius-systems/seastar-dev into db
Static column queries, from Tomasz.
2015-03-26 16:24:29 +02:00
Tomasz Grabiec
2452df8617 tests: cql: Add test for static column query 2015-03-26 14:58:36 +01:00
Tomasz Grabiec
b8063cd76e cql3: Support for querying of static columns 2015-03-26 14:58:36 +01:00
Tomasz Grabiec
fcb4036408 cql3: Fix reading of query limit parameter 2015-03-26 14:57:20 +01:00
Tomasz Grabiec
35b4199374 Merge remote-tracking branch 'dev/penberg/create-keyspace/v4'
From Pekka:

This series adds support for creating keyspaces. We already have the CQL
front-end implemented so all that remains is converging mutations in
legacy_schema_tables.cc as well as parts of migration_manager.hh and
wiring that up to the CQL execution path.
2015-03-26 14:25:54 +01:00
Avi Kivity
1c1c4f923a db: fix collection_type_impl::deserialize_mutation_form() types
It accepts a bytes_view instead of the type-safe wrapper.
2015-03-26 14:31:01 +02:00
Avi Kivity
e664c1640f Merge branch 'tgrabiec/fixes' of github.com:cloudius-systems/seastar-dev into db 2015-03-26 13:47:12 +02:00
Pekka Enberg
d0fef3e31b db: Apply mutations in legacy_schema_tables::merge_schema()
Pass a reference to storage_proxy and apply mutations in
legacy_schema_tables::merge_schema().

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-03-26 13:33:48 +02:00
Pekka Enberg
5bab83b9e0 cql3: Switch to futurized migration_manager
Migration manager announce functions now return a future. Switch to the
new API in modification statements.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-03-26 13:33:48 +02:00
Pekka Enberg
5dfe06d5f1 service: Convert MigrationManager to C++, take 2
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-03-26 13:33:48 +02:00