mutation_compactor: pass tombstone_gc_state to compact_mutation_state

Used in get_gc_before.

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
This commit is contained in:
Benny Halevy
2022-09-05 15:58:11 +03:00
parent d86810d22c
commit 8b38893895
2 changed files with 7 additions and 6 deletions

View File

@@ -140,7 +140,7 @@ class compact_mutation_state {
uint64_t _row_limit{};
uint32_t _partition_limit{};
uint64_t _partition_row_limit{};
tombstone_gc_state _tombstone_gc_state; // FIXME: default-constructed for now
tombstone_gc_state _tombstone_gc_state;
tombstone _partition_tombstone;
@@ -273,6 +273,7 @@ public:
, _row_limit(limit)
, _partition_limit(partition_limit)
, _partition_row_limit(_slice.options.contains(query::partition_slice::option::distinct) ? 1 : slice.partition_row_limit())
, _tombstone_gc_state(nullptr)
, _last_dk({dht::token(), partition_key::make_empty()})
, _last_pos(position_in_partition::end_of_partition_tag_t())
{
@@ -280,12 +281,14 @@ public:
}
compact_mutation_state(const schema& s, gc_clock::time_point compaction_time,
std::function<api::timestamp_type(const dht::decorated_key&)> get_max_purgeable)
std::function<api::timestamp_type(const dht::decorated_key&)> get_max_purgeable,
const tombstone_gc_state& gc_state)
: _schema(s)
, _query_time(compaction_time)
, _get_max_purgeable(std::move(get_max_purgeable))
, _can_gc([this] (tombstone t) { return can_gc(t); })
, _slice(s.full_slice())
, _tombstone_gc_state(gc_state)
, _last_dk({dht::token(), partition_key::make_empty()})
, _last_pos(position_in_partition::end_of_partition_tag_t())
, _collector(std::make_unique<mutation_compactor_garbage_collector>(_schema))
@@ -585,10 +588,9 @@ public:
// Can only be used for compact_for_sstables::yes
compact_mutation_v2(const schema& s, gc_clock::time_point compaction_time,
std::function<api::timestamp_type(const dht::decorated_key&)> get_max_purgeable,
// FIXME: pass to compact_mutation_state if compact_for_sstables
const tombstone_gc_state& gc_state,
Consumer consumer, GCConsumer gc_consumer = GCConsumer())
: _state(make_lw_shared<compact_mutation_state<SSTableCompaction>>(s, compaction_time, get_max_purgeable))
: _state(make_lw_shared<compact_mutation_state<SSTableCompaction>>(s, compaction_time, get_max_purgeable, gc_state))
, _consumer(std::move(consumer))
, _gc_consumer(std::move(gc_consumer)) {
}

View File

@@ -1457,12 +1457,11 @@ private:
public:
compacting_reader(flat_mutation_reader_v2 source, gc_clock::time_point compaction_time,
std::function<api::timestamp_type(const dht::decorated_key&)> get_max_purgeable,
// FIXME: pass to _compactor
const tombstone_gc_state& gc_state,
streamed_mutation::forwarding fwd = streamed_mutation::forwarding::no)
: impl(source.schema(), source.permit())
, _reader(std::move(source))
, _compactor(*_schema, compaction_time, get_max_purgeable)
, _compactor(*_schema, compaction_time, get_max_purgeable, gc_state)
, _last_uncompacted_partition_start(dht::decorated_key(dht::minimum_token(), partition_key::make_empty()), tombstone{})
, _fwd(fwd) {
}