Commit Graph

30 Commits

Author SHA1 Message Date
Azat Khuzhin
7ffa15b94b ThreadPool: fix thread_id assignment
As found by @KochetovNicolai before this patch, lambda in
ThreadFromGlobalPool() ctor assigns value only to a copy of the
thread_id value, and so check in joinable() had been working
incorrectly, fix this by changing the value not the shared_ptr itself.

Also it is not safe to assign thread_id w/o atomics, since this can be
racy, so wrap id with std::atomic<>

Fixes: #28431
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-07-13 15:42:46 +03:00
Azat Khuzhin
25eb82f120 ThreadPool: do not use joinable() internally
joinable() should be used only outside, since internally it is enough to
know `state` to know that something is wrong.

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-07-13 15:42:46 +03:00
Azat Khuzhin
3473b80077 ThreadPool: add some clarification comments
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-07-13 15:42:46 +03:00
Nikita Mikhaylov
36bdee0499 Deleted settings 2022-04-22 13:56:16 +00:00
Maksim Kita
e7772ed434 Fix clang-tidy warnings in Common folder 2022-03-14 18:17:35 +00:00
Tomáš Hromada
445b0ba7cc
Expose all GlobalThreadPool config params (#31285) 2021-11-12 16:24:47 +03:00
Alexey Milovidov
fe6b7c77c7 Rename "common" to "base" 2021-10-02 10:13:14 +03:00
alexey-milovidov
28911a959f
Merge pull request #28431 from azat/thread-pool-joinable
[RFC] Do not allow ThreadFromGlobalPool::join() from the spawned/occupated thread
2021-09-11 05:44:56 +03:00
Nikita Mikhaylov
ea0fbf81af Renaming 2021-09-06 12:01:16 +00:00
Nikita Mikhaylov
0249015515 added priority queue 2021-09-06 11:37:51 +00:00
Azat Khuzhin
e7ed98fa58 Do not allow ThreadFromGlobalPool::join() from the spawned/occupated thread
v2: wrap with shared_ptr
    https://clickhouse-test-reports.s3.yandex.net/28431/f7b3a3e952038923b1347b3d461061326d0ffc27/functional_stateless_tests_(address).html#fail1
2021-09-05 21:59:49 +03:00
Nikita Mikhaylov
cc7c221fad Own PriorityQueue + prettifying the code 2021-09-02 21:31:32 +00:00
Nikita Mikhaylov
a6fe91ca47 get rid of half of allocations 2021-09-02 17:40:29 +00:00
Maksim Kita
67e9b85951 Merge ext into common 2021-06-16 23:28:41 +03:00
Azat Khuzhin
590a6b9855 Add ThreadPool::finished() 2021-04-28 22:33:29 +03:00
Nikita Mikhailov
2f04cb5ebe abort() instead of std::terminate() + cleanup 2020-12-30 08:31:45 +03:00
Nikita Mikhailov
07e9a25bd8 style 2020-12-29 04:19:57 +03:00
Nikita Mikhailov
c0eef84c50 better 2020-12-29 04:15:26 +03:00
Nikita Mikhailov
c3288c3fbf Merge branch 'master' of github.com:ClickHouse/ClickHouse into parallel-parsing-input-format 2020-12-28 15:09:37 +03:00
Anton Popov
57a1642035 fix race in aggregation with combinator distinct 2020-12-22 14:30:29 +03:00
Nikita Mikhaylov
0a508c7b8a save 2020-12-15 00:56:46 +03:00
Nikolai Kochetov
40f62719ff Move event to stack. 2020-10-15 13:24:18 +03:00
Nikolai Kochetov
0e412686bc Better comments. 2020-09-30 11:25:22 +03:00
Nikolai Kochetov
727289cb09 Destroy resurces captured by lambda after ThreadFromGlobalPool::join(). 2020-09-29 23:43:02 +03:00
Nikolai Kochetov
a2c70c4611 Destroy resurces captured by lambda after ThreadFromGlobalPool::join(). 2020-09-29 22:11:40 +03:00
Nikolai Kochetov
a7e7fd084f Destroy resurces captured by lambda after ThreadFromGlobalPool::join(). 2020-09-29 13:48:11 +03:00
Vitaly Baranov
668653600c Use SettingMaxThreads only in Settings, call getNumberOfPhysicalCPUCores() instead of SettingMaxThreads::getAuto(). 2020-07-31 19:11:27 +03:00
Alexander Kuzmenkov
96d2e9c997 Initialize GlobalThreadPool explicitly 2020-06-22 22:04:12 +03:00
Bharat Nallan
c43bd228ab make max global thread pool setting configurable
This PR adds a server level config for overriding the default max number
of threads in global thread pool that is currently allowed (10,000).

This might be useful in scenarios where there are a large number of
distributed queries that are executing concurrently and where the
default number of max threads might not be necessarily be sufficient.
2020-06-15 22:04:30 -07:00
Ivan Lezhankin
06446b4f08 dbms/ → src/ 2020-04-03 18:14:31 +03:00