compaction_manager: offstrategy compaction: skip compaction if no candidates are found
In many cases we trigger offstrategy compaction opportunistically also when there's nothing to do. In this case we still print to the log lots of info-level message and call `run_offstrategy_compaction` that wastes more cpu cycles on learning that it has nothing to do. This change bails out early if the maintenance set is empty and prints a "Skipping off-strategy compaction" message in debug level instead. Fixes #13466 Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
This commit is contained in:
@@ -1264,9 +1264,15 @@ protected:
|
||||
std::exception_ptr ex;
|
||||
try {
|
||||
table_state& t = *_compacting_table;
|
||||
auto maintenance_sstables = t.maintenance_sstable_set().all();
|
||||
auto size = t.maintenance_sstable_set().size();
|
||||
if (!size) {
|
||||
cmlog.debug("Skipping off-strategy compaction for {}.{}, No candidates were found",
|
||||
t.schema()->ks_name(), t.schema()->cf_name());
|
||||
finish_compaction();
|
||||
co_return std::nullopt;
|
||||
}
|
||||
cmlog.info("Starting off-strategy compaction for {}.{}, {} candidates were found",
|
||||
t.schema()->ks_name(), t.schema()->cf_name(), maintenance_sstables->size());
|
||||
t.schema()->ks_name(), t.schema()->cf_name(), size);
|
||||
co_await run_offstrategy_compaction(_compaction_data);
|
||||
finish_compaction();
|
||||
cmlog.info("Done with off-strategy compaction for {}.{}", t.schema()->ks_name(), t.schema()->cf_name());
|
||||
|
||||
Reference in New Issue
Block a user