mutation_partition: Harmonize apply_delete overloads

This patch ensures the different mutation_partition::apply_delete()
overloads behave similarly, so that, for example, an empty clustering
key is treated the same way as an empty
exploded_clustering_key_prefix.

Signed-off-by: Duarte Nunes <duarte@scylladb.com>
This commit is contained in:
Duarte Nunes
2017-05-03 20:59:28 +02:00
parent 07e648251b
commit db63ffdbb4
2 changed files with 30 additions and 6 deletions

View File

@@ -429,6 +429,17 @@ mutation_partition::apply_delete(const schema& schema, const exploded_clustering
}
}
void
mutation_partition::apply_delete(const schema& schema, const clustering_key_prefix& prefix, tombstone t) {
if (prefix.is_empty(schema)) {
apply(t);
} else if (prefix.is_full(schema)) {
clustered_row(schema, prefix).apply(t);
} else {
apply_row_tombstone(schema, prefix, t);
}
}
void
mutation_partition::apply_delete(const schema& schema, range_tombstone rt) {
if (range_tombstone::is_single_clustering_row_tombstone(schema, rt.start, rt.start_kind, rt.end, rt.end_kind)) {
@@ -439,13 +450,25 @@ mutation_partition::apply_delete(const schema& schema, range_tombstone rt) {
}
void
mutation_partition::apply_delete(const schema& schema, clustering_key&& key, tombstone t) {
clustered_row(schema, std::move(key)).apply(t);
mutation_partition::apply_delete(const schema& schema, clustering_key&& prefix, tombstone t) {
if (prefix.is_empty(schema)) {
apply(t);
} else if (prefix.is_full(schema)) {
clustered_row(schema, std::move(prefix)).apply(t);
} else {
apply_row_tombstone(schema, std::move(prefix), t);
}
}
void
mutation_partition::apply_delete(const schema& schema, clustering_key_view key, tombstone t) {
clustered_row(schema, key).apply(t);
mutation_partition::apply_delete(const schema& schema, clustering_key_prefix_view prefix, tombstone t) {
if (prefix.is_empty(schema)) {
apply(t);
} else if (prefix.is_full(schema)) {
clustered_row(schema, prefix).apply(t);
} else {
apply_row_tombstone(schema, prefix, t);
}
}
void

View File

@@ -779,9 +779,10 @@ public:
public:
void apply(tombstone t) { _tombstone.apply(t); }
void apply_delete(const schema& schema, const exploded_clustering_prefix& prefix, tombstone t);
void apply_delete(const schema& schema, const clustering_key_prefix& prefix, tombstone t);
void apply_delete(const schema& schema, range_tombstone rt);
void apply_delete(const schema& schema, clustering_key&& key, tombstone t);
void apply_delete(const schema& schema, clustering_key_view key, tombstone t);
void apply_delete(const schema& schema, clustering_key_prefix&& prefix, tombstone t);
void apply_delete(const schema& schema, clustering_key_prefix_view prefix, tombstone t);
// Equivalent to applying a mutation with an empty row, created with given timestamp
void apply_insert(const schema& s, clustering_key_view, api::timestamp_type created_at);
// prefix must not be full