mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-29 19:21:01 +00:00
compaction_manager: introduce can_submit
Purpose is to reuse code and also make it easier to read. Signed-off-by: Raphael S. Carvalho <raphaelsc@scylladb.com>
This commit is contained in:
@@ -254,8 +254,12 @@ void compaction_manager::signal_less_busy_task() {
|
||||
(*result)->compaction_sem.signal();
|
||||
}
|
||||
|
||||
bool compaction_manager::can_submit() {
|
||||
return !_stopped && !_tasks.empty();
|
||||
}
|
||||
|
||||
void compaction_manager::submit(column_family* cf) {
|
||||
if (_stopped || _tasks.empty()) {
|
||||
if (!can_submit()) {
|
||||
return;
|
||||
}
|
||||
// To avoid having two or more entries of the same cf stored in the queue.
|
||||
@@ -268,7 +272,7 @@ void compaction_manager::submit(column_family* cf) {
|
||||
}
|
||||
|
||||
void compaction_manager::submit_cleanup_job(column_family* cf) {
|
||||
if (_stopped || _tasks.empty()) {
|
||||
if (!can_submit()) {
|
||||
return;
|
||||
}
|
||||
// To avoid having two or more entries of the same cf stored in the queue.
|
||||
|
||||
@@ -82,6 +82,10 @@ private:
|
||||
// This function is called when a cf is submitted for compaction and we need
|
||||
// to wake up a handler.
|
||||
void signal_less_busy_task();
|
||||
// Returns if this compaction manager is accepting new requests.
|
||||
// It will not accept new requests in case the manager was stopped and/or there
|
||||
// is no task to handle them.
|
||||
bool can_submit();
|
||||
public:
|
||||
compaction_manager();
|
||||
~compaction_manager();
|
||||
|
||||
Reference in New Issue
Block a user