compaction_manager: perform_task_on_all_files: return early when there are no sstables to compact
Prevent the creation of a compaction task when the list of sstables is known to be empty ahead of time. Refs scylladb/scylladb#16694 Fixes scylladb/scylladb#16803 Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
This commit is contained in:
@@ -1627,6 +1627,9 @@ future<compaction_manager::compaction_stats_opt> compaction_manager::perform_tas
|
||||
return a->data_size() > b->data_size();
|
||||
});
|
||||
});
|
||||
if (sstables.empty()) {
|
||||
co_return std::nullopt;
|
||||
}
|
||||
co_return co_await perform_compaction<TaskType>(throw_if_stopping::no, info, &t, info.value_or(tasks::task_info{}).id, std::move(options), std::move(owned_ranges_ptr), std::move(sstables), std::move(compacting), std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ def assert_task_does_not_exist(rest_api, task_id):
|
||||
assert resp.status_code == requests.codes.bad_request, f"Task {task_id} is kept in memory"
|
||||
|
||||
def check_child_parent_relationship(rest_api, parent, tree_depth, allow_no_children, depth=0):
|
||||
assert allow_no_children or parent.get("children_ids", []), "Child tasks were not created"
|
||||
assert allow_no_children or parent.get("children_ids", []), f"Child tasks were not created for {parent}"
|
||||
|
||||
for child_id in parent.get("children_ids", []):
|
||||
child = wait_for_task(rest_api, child_id)
|
||||
|
||||
@@ -91,7 +91,7 @@ def test_offstrategy_keyspace_compaction_task(cql, this_dc, rest_api):
|
||||
check_compaction_task(cql, this_dc, rest_api, lambda keyspace, _: rest_api.send("POST", f"storage_service/keyspace_offstrategy_compaction/{keyspace}"), "offstrategy compaction", task_tree_depth, True)
|
||||
|
||||
def test_rewrite_sstables_keyspace_compaction_task(cql, this_dc, rest_api):
|
||||
task_tree_depth = 3
|
||||
task_tree_depth = 2
|
||||
# upgrade sstables compaction
|
||||
check_compaction_task(cql, this_dc, rest_api, lambda keyspace, _: rest_api.send("GET", f"storage_service/keyspace_upgrade_sstables/{keyspace}"), "upgrade sstables compaction", task_tree_depth)
|
||||
# scrub sstables compaction
|
||||
|
||||
Reference in New Issue
Block a user