system_keyspace: Make save_truncation_record() non-static
... and stop using qctx Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
This commit is contained in:
@@ -1512,7 +1512,7 @@ future<> system_keyspace::cache_truncation_record() {
|
||||
|
||||
future<> system_keyspace::save_truncation_record(table_id id, db_clock::time_point truncated_at, db::replay_position rp) {
|
||||
sstring req = format("INSERT INTO system.{} (table_uuid, shard, position, segment_id, truncated_at) VALUES(?,?,?,?,?)", TRUNCATED);
|
||||
return qctx->qp().execute_internal(req, {id.uuid(), int32_t(rp.shard_id()), int32_t(rp.pos), int64_t(rp.base_id()), truncated_at}, cql3::query_processor::cache_internal::yes).discard_result().then([] {
|
||||
return _qp.execute_internal(req, {id.uuid(), int32_t(rp.shard_id()), int32_t(rp.pos), int64_t(rp.base_id()), truncated_at}, cql3::query_processor::cache_internal::yes).discard_result().then([] {
|
||||
return force_blocking_flush(TRUNCATED);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -348,8 +348,8 @@ public:
|
||||
|
||||
typedef std::vector<db::replay_position> replay_positions;
|
||||
|
||||
static future<> save_truncation_record(table_id, db_clock::time_point truncated_at, db::replay_position);
|
||||
static future<> save_truncation_record(const replica::column_family&, db_clock::time_point truncated_at, db::replay_position);
|
||||
future<> save_truncation_record(table_id, db_clock::time_point truncated_at, db::replay_position);
|
||||
future<> save_truncation_record(const replica::column_family&, db_clock::time_point truncated_at, db::replay_position);
|
||||
future<replay_positions> get_truncated_position(table_id);
|
||||
future<db_clock::time_point> get_truncated_at(table_id);
|
||||
|
||||
|
||||
@@ -2599,16 +2599,16 @@ future<> database::truncate(db::system_keyspace& sys_ks, column_family& cf, cons
|
||||
if (rp == db::replay_position()) {
|
||||
rp = st.low_mark;
|
||||
}
|
||||
co_await coroutine::parallel_for_each(cf.views(), [this, truncated_at] (view_ptr v) -> future<> {
|
||||
co_await coroutine::parallel_for_each(cf.views(), [this, &sys_ks, truncated_at] (view_ptr v) -> future<> {
|
||||
auto& vcf = find_column_family(v);
|
||||
db::replay_position rp = co_await vcf.discard_sstables(truncated_at);
|
||||
co_await db::system_keyspace::save_truncation_record(vcf, truncated_at, rp);
|
||||
co_await sys_ks.save_truncation_record(vcf, truncated_at, rp);
|
||||
});
|
||||
// save_truncation_record() may actually fail after we cached the truncation time
|
||||
// but this is not be worse that if failing without caching: at least the correct time
|
||||
// will be available until next reboot and a client will have to retry truncation anyway.
|
||||
cf.cache_truncation_record(truncated_at);
|
||||
co_await db::system_keyspace::save_truncation_record(cf, truncated_at, rp);
|
||||
co_await sys_ks.save_truncation_record(cf, truncated_at, rp);
|
||||
|
||||
auto& gc_state = get_compaction_manager().get_tombstone_gc_state();
|
||||
gc_state.drop_repair_history_map_for_table(uuid);
|
||||
|
||||
Reference in New Issue
Block a user