Commit Graph

26 Commits

Author SHA1 Message Date
Alexey Zatelepin
2447755700 BackgroundSchedulePool: remove task from delayed even it it is currently executing
If the task was left in the delayed_tasks set, it could lead to a nasty bug:
delayExecutionThreadFunction() would schedule the task, then it would immediately
go on a next iteration and schedule the same task again. Thus this task would be
continually executing, and other delayed tasks would have no chance to run.
2018-06-27 13:47:58 +03:00
alexey-milovidov
46cb408fd8
Update BackgroundSchedulePool.cpp 2018-06-01 16:35:16 +03:00
Alexey Zatelepin
d89221c458 easier init and deactivation of BackgroundSchedulePool tasks 2018-05-31 16:18:52 +03:00
Silviu Caragea
c547c5a7b0 Merge remote-tracking branch 'origin/background-schedule-pool-fix'
# Conflicts:
#	dbms/src/Common/ZooKeeper/LeaderElection.h
#	dbms/src/Common/ZooKeeper/ZooKeeper.cpp
#	dbms/src/Storages/MergeTree/ReplicatedMergeTreeAlterThread.cpp
#	dbms/src/Storages/MergeTree/ReplicatedMergeTreeCleanupThread.cpp
#	dbms/src/Storages/MergeTree/ReplicatedMergeTreeCleanupThread.h
#	dbms/src/Storages/MergeTree/ReplicatedMergeTreePartCheckThread.cpp
#	dbms/src/Storages/MergeTree/ReplicatedMergeTreeRestartingThread.cpp
#	dbms/src/Storages/StorageReplicatedMergeTree.cpp
2018-04-10 16:20:14 +03:00
Silviu Caragea
0a057695aa Reduce the number of lock releases and reacquires in the BckSchPoolDelay thread 2018-03-27 16:29:41 +03:00
Silviu Caragea
7d6268c8a9 Fix bug in the exit predicate 2018-03-26 22:18:56 +03:00
Silviu Caragea
23aee5ed5b Task cannot be scheduled and deactivated in the same time. 2018-03-23 10:05:58 +02:00
Silviu Caragea
24de8d624f Fix for corner case where executing task will occupy not one but two threads in the pool which are in short supply. 2018-03-22 22:26:03 +02:00
Silviu Caragea
a2dc16a582 Remove the link between TaskHandles and ZooKeeper 2018-03-22 17:21:14 +02:00
Silviu Caragea
6629b03af9 Fixed few of the observation of the code review 2018-03-22 17:09:30 +02:00
Silviu Caragea
f2479673d6 Fix BackgroundSchedulePool 2018-03-22 17:07:12 +02:00
Silviu Caragea
b24a4b2111 Add back the buggy BackgroundSchedulePool 2018-03-22 17:07:12 +02:00
Alexey Zatelepin
6d5ce3fa9a revert BackgroundSchedulePool usage in Replicated tables 2017-12-22 21:25:54 +03:00
Silviu Caragea
b08463ed7b Fix for https://github.com/yandex/ClickHouse/issues/1648 2017-12-19 22:41:05 +03:00
Alexey Milovidov
c0321ce752 BackgroundSchedulePool: miscellaneous [#CLICKHOUSE-2]. 2017-11-19 03:59:57 +03:00
Alexey Milovidov
9b92c0fecd BackgroundSchedulePool: miscellaneous [#CLICKHOUSE-2]. 2017-11-19 03:22:13 +03:00
Alexey Milovidov
69714f0671 BackgroundSchedulePool: miscellaneous [#CLICKHOUSE-2]. 2017-11-19 02:55:53 +03:00
Alexey Milovidov
dfb4a92f5a BackgroundSchedulePool: miscellaneous [#CLICKHOUSE-2]. 2017-11-19 02:47:39 +03:00
Alexey Milovidov
076e0ae014 More clear [#CLICKHOUSE-2]. 2017-11-18 00:20:28 +03:00
Alexey Milovidov
8425c56c0f Fixed wrong logic [#CLICKHOUSE-2]. 2017-11-18 00:00:29 +03:00
Alexey Milovidov
7cf5eaddc0 Fixed wrong logic [#CLICKHOUSE-2]. 2017-11-17 23:59:31 +03:00
Alexey Milovidov
4f8009517c Thread name can be 15 bytes max [#CLICKHOUSE-2]. 2017-11-17 23:57:07 +03:00
Alexey Milovidov
7c9ba15ba1 Style [#CLICKHOUSE-2]. 2017-11-17 23:42:03 +03:00
Alexey Milovidov
9264bc4013 Style [#CLICKHOUSE-2]. 2017-11-17 23:18:06 +03:00
Alexey Milovidov
263e262413 Style [#CLICKHOUSE-2]. 2017-11-17 22:43:25 +03:00
Silviu Caragea
64619c614f Basic idea is :
- We add BackgroundSchedulePool which can execute a function at a specific point in time. Basically all tasks are added in a queue and precessed by worker threads.
- The most important difference between this and BackgroundProcessingPool is that we have the guarantee that the same function is not executed from many workers in the same time
- Each of the following classes instead starting a thread will register a task in BackgroundSchedulePool and when they need to run will call schedule or scheduleAfter(duration) functions

This commit is moving all threads created by ReplicatedMergeTree to BackgroundSchedulePool tasks

NOTE: I did a minimum number of changes to be much simple to review the code
2017-11-17 10:58:35 +02:00