Merge 'Backport compaction-backlog-tracker fixes to branch-5.2' from Raphael "Raph" Carvalho
Both patches are important to fix inefficiencies when updating the backlog tracker, which can manifest as a reactor stall, on a special event like schema change.
No conflicts when backporting.
Regression since 1d9f53c881, which is present in branch 5.1 onwards.
Closes #12851
* github.com:scylladb/scylladb:
compaction: Fix inefficiency when updating LCS backlog tracker
table: Fix quadratic behavior when inserting sstables into tracker on schema change
This commit is contained in:
@@ -409,7 +409,9 @@ public:
|
||||
l0_old_ssts.push_back(std::move(sst));
|
||||
}
|
||||
}
|
||||
_l0_scts.replace_sstables(std::move(l0_old_ssts), std::move(l0_new_ssts));
|
||||
if (l0_old_ssts.size() || l0_new_ssts.size()) {
|
||||
_l0_scts.replace_sstables(std::move(l0_old_ssts), std::move(l0_new_ssts));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1253,10 +1253,13 @@ void table::set_compaction_strategy(sstables::compaction_strategy_type strategy)
|
||||
cg.get_backlog_tracker().copy_ongoing_charges(new_bt, move_read_charges);
|
||||
|
||||
new_sstables = make_lw_shared<sstables::sstable_set>(new_cs.make_sstable_set(t._schema));
|
||||
cg.main_sstables()->for_each_sstable([this] (const sstables::shared_sstable& s) {
|
||||
add_sstable_to_backlog_tracker(new_bt, s);
|
||||
std::vector<sstables::shared_sstable> new_sstables_for_backlog_tracker;
|
||||
new_sstables_for_backlog_tracker.reserve(cg.main_sstables()->all()->size());
|
||||
cg.main_sstables()->for_each_sstable([this, &new_sstables_for_backlog_tracker] (const sstables::shared_sstable& s) {
|
||||
new_sstables->insert(s);
|
||||
new_sstables_for_backlog_tracker.push_back(s);
|
||||
});
|
||||
new_bt.replace_sstables({}, std::move(new_sstables_for_backlog_tracker));
|
||||
}
|
||||
|
||||
void execute() noexcept {
|
||||
|
||||
Reference in New Issue
Block a user