From 9eafa69d43ce26eda3b829fddfcae02ab501dee3 Mon Sep 17 00:00:00 2001 From: Tomasz Grabiec Date: Tue, 24 Mar 2015 12:00:29 +0100 Subject: [PATCH] db: Avoid unnecessary lookup of row key when applying range tombstones --- database.cc | 9 ++++++++- database.hh | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/database.cc b/database.cc index 71c6487e18..382a0617e8 100644 --- a/database.cc +++ b/database.cc @@ -537,6 +537,13 @@ mutation_partition::tombstone_for_row(const schema& schema, const clustering_key return t; } +tombstone +mutation_partition::tombstone_for_row(const schema& schema, const rows_entry& e) { + tombstone t = range_tombstone_for_row(schema, e.key()); + t.apply(e.row().t); + return t; +} + void mutation_partition::apply_row_tombstone(schema_ptr schema, clustering_key_prefix prefix, tombstone t) { assert(!prefix.is_full(*schema)); @@ -649,7 +656,7 @@ column_family::get_partition_slice(mutation_partition& partition, const query::p auto&& cells = &row.row().cells; // FIXME: handle removed rows properly. In CQL rows are separate entities (can be live or dead). - auto row_tombstone = partition.tombstone_for_row(*_schema, row.key()); + auto row_tombstone = partition.tombstone_for_row(*_schema, row); query::result::row result_row; result_row.cells.reserve(slice.regular_columns.size()); diff --git a/database.hh b/database.hh index fe0ae61b8b..9854beb434 100644 --- a/database.hh +++ b/database.hh @@ -194,6 +194,7 @@ public: rows_entry* find_entry(schema_ptr schema, const clustering_key_prefix& key); tombstone range_tombstone_for_row(const schema& schema, const clustering_key& key); tombstone tombstone_for_row(const schema& schema, const clustering_key& key); + tombstone tombstone_for_row(const schema& schema, const rows_entry& e); friend std::ostream& operator<<(std::ostream& os, const mutation_partition& mp); boost::iterator_range range(const schema& schema, const query::range& r); };