Skip to content

Commit

Permalink
Merge "Support for writing range tombstones to SSTables 3.x" from Vla…
Browse files Browse the repository at this point in the history
…dimir

This patchset brings support for writing range tombstones to SSTables
3.x. ('mc' format).

In SSTables 3.x, range tombstones are represented by so-called range
tombstone markers (hereafter RT markers) that denote range tombstone
start and end bounds. So each range tombstone is represented in data
file by two ordered RT markers.
There are also markers that both close the previous range tombstone and
open the new one in case if two range tombstones are ajdacent. This is
done to consume less disk space on such occasions.
Range tombstones written as RT markers are naturally non-overlapping.

* github.com:argenet/scylla projects/sstables-30/write-range-tombstones/v6
range_tombstone_stream: Remove an unused boolean flag.
Revert "Add missing enum values to bound_kind."
sstables: Move to_deletion_time helper up and make it static.
sstables: Write end-of-partition byte before flushing the last index
block.
sstables: Add support for writing range tombstones in SSTables 3.x
format.
tests: Add unit test covering simple range tombstone.
tests: Add unit test covering adjacent range tombstones.
tests: Add test to cover non-adjacent RTs.
tests: Add test covering mixed rows and range tombstones.
tests: Add test covering SSTables 3.x with many RTs.
tests: Add unit test covering overlapping RTs and rows.
tests: Add tests writing a range tombstone and a row overlapping with
its start.
tests: Add tests writing a range tombstone and a row overlapping with
its end.
tests: Add function that writes from multiple memtable into SSTables.
tests: Add test where 2nd range tombstone covers the remainder of the
1st one.
tests: Add test writing two non-adjacent range tombstones with same
clustering key prefix at their bounds.
tests: Add test covering overlapped range tombstones.
  • Loading branch information
tgrabiec committed Jun 22, 2018
2 parents f09fff0 + ea09cf7 commit 2d41773
Show file tree
Hide file tree
Showing 62 changed files with 756 additions and 77 deletions.
5 changes: 1 addition & 4 deletions clustering_bounds_comparator.hh
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@
enum class bound_kind : uint8_t {
excl_end = 0,
incl_start = 1,
excl_end_incl_start = 2,
static_clustering = 3,
clustering = 4,
incl_end_excl_start = 5,
// values 2 to 5 are reserved for forward Origin compatibility
incl_end = 6,
excl_start = 7,
};
Expand Down
14 changes: 0 additions & 14 deletions keys.cc
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,6 @@ std::ostream& operator<<(std::ostream& out, const bound_kind k) {
return out << "excl end";
case bound_kind::incl_start:
return out << "incl start";
case bound_kind::excl_end_incl_start:
return out << "excl end + incl start";
case bound_kind::static_clustering:
return out << "static clustering";
case bound_kind ::clustering:
return out << "clustering";
case bound_kind::incl_end_excl_start:
return out << "incl end + excl start";
case bound_kind::incl_end:
return out << "incl end";
case bound_kind::excl_start:
Expand All @@ -103,10 +95,6 @@ bound_kind invert_kind(bound_kind k) {
case bound_kind::incl_start: return bound_kind::excl_end;
case bound_kind::excl_end: return bound_kind::incl_start;
case bound_kind::incl_end: return bound_kind::excl_start;
case bound_kind::excl_end_incl_start: return bound_kind::incl_end_excl_start;
case bound_kind::incl_end_excl_start: return bound_kind::excl_end_incl_start;
case bound_kind::static_clustering: return bound_kind::static_clustering;
case bound_kind::clustering: return bound_kind::clustering;
}
abort();
}
Expand All @@ -121,8 +109,6 @@ int32_t weight(bound_kind k) {
return 1;
case bound_kind::excl_start:
return 2;
default:
throw std::invalid_argument(sprint("weight() is not defined for bound_kind {}", k));
}
abort();
}
Expand Down
1 change: 0 additions & 1 deletion mutation_fragment.cc
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,6 @@ void range_tombstone_stream::apply(const range_tombstone_list& list, const query
}

void range_tombstone_stream::reset() {
_inside_range_tombstone = false;
_list.clear();
}

Expand Down
1 change: 0 additions & 1 deletion mutation_fragment.hh
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,6 @@ class range_tombstone_stream {
const schema& _schema;
position_in_partition::less_compare _cmp;
range_tombstone_list _list;
bool _inside_range_tombstone = false;
private:
mutation_fragment_opt do_get_next();
public:
Expand Down
5 changes: 0 additions & 5 deletions position_in_partition.hh
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,10 @@ int position_weight(bound_kind k) {
switch(k) {
case bound_kind::excl_end:
case bound_kind::incl_start:
case bound_kind::excl_end_incl_start:
return -1;
case bound_kind::incl_end:
case bound_kind::excl_start:
case bound_kind::incl_end_excl_start:
return 1;
case bound_kind::clustering:
case bound_kind::static_clustering:
return 0;
}
abort();
}
Expand Down

0 comments on commit 2d41773

Please sign in to comment.