mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 08:40:50 +00:00
Fix distributed send that are scheduled by INSERT query
Before this patch each INSERT query re-schedule distributed send, thus each time it resets the timer, while this is not the expected behaviour, since in on frequent INSERT distributed sends will not be triggered at all. Fix this by not resetting the timer.
This commit is contained in:
parent
6bb39dafc3
commit
0157fd5d93
@ -41,12 +41,14 @@ bool BackgroundSchedulePoolTaskInfo::schedule()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool BackgroundSchedulePoolTaskInfo::scheduleAfter(size_t ms)
|
||||
bool BackgroundSchedulePoolTaskInfo::scheduleAfter(size_t ms, bool overwrite)
|
||||
{
|
||||
std::lock_guard lock(schedule_mutex);
|
||||
|
||||
if (deactivated || scheduled)
|
||||
return false;
|
||||
if (delayed && !overwrite)
|
||||
return false;
|
||||
|
||||
pool.scheduleDelayedTask(shared_from_this(), ms, lock);
|
||||
return true;
|
||||
|
@ -102,7 +102,8 @@ public:
|
||||
bool schedule();
|
||||
|
||||
/// Schedule for execution after specified delay.
|
||||
bool scheduleAfter(size_t ms);
|
||||
/// If overwrite is set then the task will be re-scheduled (if it was already scheduled, i.e. delayed == true).
|
||||
bool scheduleAfter(size_t ms, bool overwrite = true);
|
||||
|
||||
/// Further attempts to schedule become no-op. Will wait till the end of the current execution of the task.
|
||||
void deactivate();
|
||||
|
@ -588,7 +588,7 @@ bool StorageDistributedDirectoryMonitor::scheduleAfter(size_t ms)
|
||||
{
|
||||
if (quit)
|
||||
return false;
|
||||
return task_handle->scheduleAfter(ms);
|
||||
return task_handle->scheduleAfter(ms, false);
|
||||
}
|
||||
|
||||
void StorageDistributedDirectoryMonitor::processFilesWithBatching(const std::map<UInt64, std::string> & files)
|
||||
|
Loading…
Reference in New Issue
Block a user