mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-03 13:02:00 +00:00
Retrieve correct settings for BackgroundJobsAssignee
This commit is contained in:
parent
9dd9c227e5
commit
f7b6c6d343
@ -11,13 +11,24 @@ namespace DB
|
||||
|
||||
BackgroundJobsAssignee::BackgroundJobsAssignee(MergeTreeData & data_, BackgroundJobsAssignee::Type type_, ContextPtr global_context_)
|
||||
: WithContext(global_context_)
|
||||
, data(data_)
|
||||
, sleep_settings(global_context_->getBackgroundMoveTaskSchedulingSettings())
|
||||
, rng(randomSeed())
|
||||
, type(type_)
|
||||
, data(data_)
|
||||
, rng(randomSeed())
|
||||
, sleep_settings(getSettings())
|
||||
{
|
||||
}
|
||||
|
||||
BackgroundTaskSchedulingSettings BackgroundJobsAssignee::getSettings() const
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case Type::DataProcessing:
|
||||
return getContext()->getBackgroundProcessingTaskSchedulingSettings();
|
||||
case Type::Moving:
|
||||
return getContext()->getBackgroundMoveTaskSchedulingSettings();
|
||||
}
|
||||
}
|
||||
|
||||
void BackgroundJobsAssignee::trigger()
|
||||
{
|
||||
std::lock_guard lock(holder_mutex);
|
||||
|
@ -32,23 +32,6 @@ class MergeTreeData;
|
||||
|
||||
class BackgroundJobsAssignee : public WithContext
|
||||
{
|
||||
private:
|
||||
MergeTreeData & data;
|
||||
|
||||
/// Settings for execution control of background scheduling task
|
||||
BackgroundTaskSchedulingSettings sleep_settings;
|
||||
/// Useful for random backoff timeouts generation
|
||||
pcg64 rng;
|
||||
|
||||
/// How many times execution of background job failed or we have
|
||||
/// no new jobs.
|
||||
size_t no_work_done_count = 0;
|
||||
|
||||
/// Scheduling task which assign jobs in background pool
|
||||
BackgroundSchedulePool::TaskHolder holder;
|
||||
/// Mutex for thread safety
|
||||
std::mutex holder_mutex;
|
||||
|
||||
public:
|
||||
/// In case of ReplicatedMergeTree the first assignee will be responsible for
|
||||
/// polling the replication queue and schedule operations according to the LogEntry type
|
||||
@ -81,11 +64,28 @@ public:
|
||||
ContextPtr global_context_);
|
||||
|
||||
private:
|
||||
MergeTreeData & data;
|
||||
|
||||
/// Useful for random backoff timeouts generation
|
||||
pcg64 rng;
|
||||
|
||||
/// How many times execution of background job failed or we have
|
||||
/// no new jobs.
|
||||
size_t no_work_done_count = 0;
|
||||
|
||||
/// Scheduling task which assign jobs in background pool
|
||||
BackgroundSchedulePool::TaskHolder holder;
|
||||
/// Mutex for thread safety
|
||||
std::mutex holder_mutex;
|
||||
|
||||
/// Settings for execution control of background scheduling task
|
||||
BackgroundTaskSchedulingSettings sleep_settings;
|
||||
|
||||
static String toString(Type type);
|
||||
|
||||
/// Function that executes in background scheduling pool
|
||||
void threadFunc();
|
||||
|
||||
BackgroundTaskSchedulingSettings getSettings() const;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user