Commit Graph

50 Commits

Author SHA1 Message Date
Paweł Dziepak
23d931780a mutation_partition: add empty()
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-09-07 21:20:32 +02:00
Paweł Dziepak
1e5ed89009 mutation_partition: add compact_for_compaction()
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-09-07 21:19:29 +02:00
Paweł Dziepak
f45aceb436 mutation_partition: purge tombstones in compact_and_expire()
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-09-07 21:18:45 +02:00
Tomasz Grabiec
74603425ac mutation_partition: Introduce r-value version of apply() 2015-09-07 09:41:36 +02:00
Tomasz Grabiec
8a140a9ba9 mutation_partition: row: Move implementation to source file 2015-09-06 21:25:44 +02:00
Tomasz Grabiec
bf2b64d3f7 mutation_partition: row: Fix operator==()
Spotted by clion inspections.
2015-09-06 21:25:44 +02:00
Tomasz Grabiec
ba35788817 mutation_partition: De-templetize methods
Instead of accepting a column resolver callable, accept a schema and
column_kind or column_selector. Makes the interface easier to use and
enables us to move implementation to .cc file.
2015-09-06 21:25:44 +02:00
Tomasz Grabiec
1c68045b61 mutation_partition: row: Make copy constructor exception-safe 2015-09-06 21:24:58 +02:00
Tomasz Grabiec
828b7c2f54 mutation_partition: Make copy constructor exception-safe 2015-09-06 21:24:58 +02:00
Paweł Dziepak
87481c3f53 mutation_partition: row: store cells either in vector or set
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-08-31 17:29:16 +02:00
Paweł Dziepak
25dfd70bc6 mutation_partition: use row::_cells directly in operator<<
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-08-31 17:27:20 +02:00
Paweł Dziepak
f7e5ea0436 mutation_partition: drop rows_equal()
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-08-31 17:27:20 +02:00
Paweł Dziepak
7a9cc916a3 mutation_partition: add row::operator==()
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-08-31 17:27:20 +02:00
Paweł Dziepak
e0d5ab1459 mutation_partition: use row::merge() in apply()
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-08-31 17:26:55 +02:00
Paweł Dziepak
4246c6b47a mutation_partition: use for_each_cell() in has_any_live_data()
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-08-31 17:26:35 +02:00
Gleb Natapov
d7b1146080 Include trailing tombstones in mutation when enforcing row_limit
It is how Origin deals with https://issues.apache.org/jira/browse/CASSANDRA-8933
and since we are going to implement same short read protection algorithm
as origin we need same behaviour here too.
2015-08-17 18:11:25 +03:00
Tomasz Grabiec
cd12e365c5 mutation_partition: Avoid copy in merge_column() 2015-08-06 14:05:16 +02:00
Tomasz Grabiec
cda31eccf7 db: Use LSA to allocate data inside memtable 2015-08-06 14:05:16 +02:00
Paweł Dziepak
32b9879a34 mutation_partition: apply row marker in apply()
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-07-30 14:10:06 +02:00
Paweł Dziepak
39c8e29566 mutation_partition: try to compact and expire row marker
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-07-30 14:10:06 +02:00
Paweł Dziepak
c84763d434 mutation_partition: use row_marker in deletable_row
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-07-30 14:10:06 +02:00
Paweł Dziepak
ed21fd1ef8 mutation_partition: add row_marker class
Row marker can be in one of three states: missing, live (possibly
expiring) or dead. Since it basically behaves like a normal cell, except
it doesn't have any value, row_marker class provides an interface
similar to atomic_cell.

Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-07-30 14:10:06 +02:00
Paweł Dziepak
953f7b2af9 mutation_partition: support reading rows in reversed order
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-07-23 02:38:26 +02:00
Paweł Dziepak
8e85592309 mutation_partition: add for_each_row()
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-07-23 02:38:23 +02:00
Tomasz Grabiec
8267eb3c1f mutation_partition: Simplify range() 2015-07-18 11:10:31 +02:00
Tomasz Grabiec
33ca07af33 mutation: Introduce live_row_count() 2015-07-15 18:56:10 +02:00
Tomasz Grabiec
446ba5bf27 mutation_partition: Extract row liveness checking logic to deletable_row::is_live() 2015-07-15 18:38:12 +02:00
Tomasz Grabiec
7356024dde mutation_partition: Introduce compact_for_query()
Prepares the partition to be returned in a mutation query:
 - throws out data which doesn't belong to row_ranges
 - expires cells based on query_time
 - drops cells covered by higher-level tombstones (compaction)
 - leaves at most row_limit live rows

Until we have a fine-grained reader, it's best to perform these on an
existing object. Later we can do it on-the-fly. Based on Origin's
org.apache.cassandra.db.filter.SliceQueryFilter#collectReducedColumns
2015-07-12 12:51:38 +02:00
Tomasz Grabiec
9724b84bb3 db: Fix query of partitions with no live clustered rows
When partition has no live regular rows, but has some data live in the
static row, then it should appear in the results, even though we
didn't select any static column.

To reproduce:

  create table cf (k blob, c blob, v blob, s1 blob static, primary key (k, c));
  update cf set s1 = 0x01 where k = 0x01;
  update cf set s1 = 0x02 where k = 0x02;
  select k from cf;

The "select" statement should return 2 rows, but was returning 0.

The following query worked fine, because static columns were included:

  select * from cf;

The data query should contain only live data, so we shouldn't write a
partition entry if it's supposed to be absent from the results. We
can'r tell that though until we've processed all the data. To solve
this problem, query result writer is using an optimistic approach,
where the partition header will be retracted from the buffer
(cheaply), if it turns out there's no live data in it.
2015-07-09 19:55:00 +02:00
Tomasz Grabiec
09ed972068 mutation_partition: Remove redundant slice parameter from query()
The slice used by partition_writer must match the one used by query()
anyway.
2015-07-09 19:47:32 +02:00
Paweł Dziepak
183b6fc6d9 db: do not return already expired cells in queries
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-07-02 17:25:41 +02:00
Tomasz Grabiec
3fc951e807 mutation_partition: Use default value for row_limit in query() 2015-07-02 13:25:46 +02: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
Tomasz Grabiec
f7abbda156 db: Apply frozen_mutation directly
We don't convert it back to mutation before applying.

mutation_partition has now apply() which works on
mutation_partition_view.
2015-05-08 09:19:02 +02:00
Tomasz Grabiec
386d17dff6 mutation_partition: Introduce apply_insert() 2015-05-08 09:19:01 +02:00
Tomasz Grabiec
84d2b2b2ea mutation_partition: Add view version of apply_delete() 2015-05-08 09:19:01 +02:00
Tomasz Grabiec
9235ca57ad mutation_partition: Reuse clustered_row() in apply_delete() 2015-05-08 09:19:01 +02:00
Tomasz Grabiec
cc4e2ec622 mutation_partition: Add r-value variant of clustered_row() 2015-05-08 09:19:01 +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
0aef6f2ff7 mutation_partition: Allow row lookup by clustering_key_view 2015-05-06 16:40:42 +02:00
Avi Kivity
b717b4b6bb db: add ostream operators for more types (mutation_partition and components) 2015-05-06 15:39:31 +03:00
Avi Kivity
cdfe03a5b2 db: implement mutation_partition assignment operators 2015-05-05 20:21:04 +03:00
Avi Kivity
aa94cd62dc db: implement mutation_partition copy constructor
As a temporary measure, we will return temporary mutation_partition
objects in response to queries, so we need an easy way to construct
them.
2015-05-05 20:21:04 +03:00
Avi Kivity
3a0de14aa8 db: more const correctness for column_family and component types
Ensure that read-side accessors are const.  This is important in preparation
for multiple memtables (and later, sstables) since a read-side
mutation_partition may be a temporary object coming from multiple memtables
(and sstables) while a write-side mutation_partition is guaranteed to belong
to a single memtable (and thus, not be temporary).

Since writers will want non-const mutation_partitions to write to, they won't
be able to use the read-side accessors by accident.
2015-05-05 19:37:21 +03:00
Raphael S. Carvalho
9a263328d5 mutation_partition: rename tombstone_for_static_row to partition_tombstone
tombstone from mutation partition is also used for static row purposes,
but under the hood, it's the partition tombstone.

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-05-05 11:15:46 +03:00
Avi Kivity
6290dee438 db: const correctness for abstract_type and friends
Types are immutable.
2015-04-29 15:40:38 +03:00
Tomasz Grabiec
0d4821009c db: Move mutation and mutation_partition to separate headers and compilation units 2015-04-22 18:42:33 +02:00