Commit Graph

130 Commits

Author SHA1 Message Date
Alexey Gerasimchuck
63b05da1f2 System logs improvements 2023-07-28 07:23:34 +00:00
Alexey Milovidov
43bd6d1b83
Revert "Add an ability to specify allocations size for sampling memory profiler" 2023-07-23 19:00:49 +03:00
alesapin
835c36cbf3
Merge pull request #52419 from ClickHouse/implement_borders_for_sampling_memory_profiler
Add an ability to specify allocations size for sampling memory profiler
2023-07-22 18:13:26 +02:00
Alexander Sapin
4695ec6802 Add an ability to specify allocations size for sampling memory profiler 2023-07-21 14:56:29 +02:00
Robert Schulze
bd761c365a
Make serializeAST() more regular 2023-07-20 10:39:26 +00:00
Yakov Olkhovskiy
6e769237a7 added setting 'enable_job_stack_trace', default is off 2023-06-28 01:39:06 +00:00
Alexey Milovidov
a8bdb20fc4
Merge pull request #48787 from ClickHouse/background-memory-tracker
Add MemoryTracker for the background tasks [Resubmit]
2023-05-09 07:58:36 +03:00
Dmitry Novik
4ba7530c23 Fix thread MemoryTracker parent after detach 2023-05-05 00:21:13 +02:00
Dmitry Novik
cf5d9a175a Revert "Merge pull request #48760 from ClickHouse/revert-46089-background-memory-tracker"
This reverts commit a61ed33223, reversing
changes made to 5f01b8a2b5.
2023-04-14 16:34:19 +02:00
Alexander Tokmakov
af1bf08663
Revert "Add MemoryTracker for the background tasks" 2023-04-13 21:05:02 +03:00
Dmitry Novik
06e6794fc0 Merge remote-tracking branch 'origin/master' into background-memory-tracker 2023-04-11 15:29:35 +00:00
Sema Checherinda
4dd86a406a
Merge pull request #48543 from azat/mv-uniq-thread-group
Use one ThreadGroup while pushing to materialized views (and some refactoring for ThreadGroup)
2023-04-11 11:47:46 +02:00
Azat Khuzhin
79b83c4fd2 Remove superfluous includes of logger_userful.h from headers
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2023-04-10 17:59:30 +02:00
Azat Khuzhin
aacf2a0838 Move ThreadGroupSwitcher to ThreadStatus.h (out from MergeTree code)
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2023-04-07 15:32:08 +02:00
Azat Khuzhin
5b2b20a0b0 Rename ThreadGroupStatus to ThreadGroup
There are methods like getThreadGroup() and ThreadGroupSwitcher class,
so seems that this is logical.

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2023-04-07 15:31:48 +02:00
Sema Checherinda
9d8d9e8ec9
Merge branch 'master' into fix-query_views_log-from-bg 2023-04-06 18:16:47 +02:00
Sema Checherinda
f504cd5fed avoid race, do not set thread_group.counters.parent from query 2023-04-05 12:36:55 +02:00
Azat Khuzhin
9235d1cde2 Fix system.query_views_log for MVs that are pushed from background threads
Some of such places:
- push from Buffer
- push from Distributed sends
- system.*_log workers

Before #47564 it simply does not work, but after it throws LOGICAL_ERROR
in such situation.

v2: remove expired() check after #46709 got merged
v3: use ThreadGroupStatus ctor with ContextPtr (after #47564)
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2023-04-04 17:43:10 +02:00
Sema Checherinda
b774310dc9 keep query id for logging when optimize query 2023-03-28 16:44:47 +02:00
Sema Checherinda
a6ab33a906 no use query, but storage context 2023-03-27 16:30:32 +02:00
Sema Checherinda
e8295be9be if no group then do attachInternalTextLogsQueue to the thread only 2023-03-17 15:56:30 +01:00
Sema Checherinda
e2af8f6ed6 add a comment, rename a field 2023-03-17 11:59:44 +01:00
Sema Checherinda
df9e247d67 fix tidy build, fix test when Databasereplicated 2023-03-17 10:49:41 +01:00
Sema Checherinda
3c6deddd1d work with comments on PR 2023-03-16 19:55:58 +01:00
Sema Checherinda
67ac858a52 remove counters for threads, fix negative counters 2023-03-15 22:22:22 +01:00
Alexander Tokmakov
082194a755
Merge pull request #47175 from ClickHouse/correct_fatal_handling
More correct handling of fatal errors
2023-03-04 00:38:00 +03:00
Alexander Tokmakov
619b282060 more correct handling of fatal errors 2023-03-03 01:22:04 +01:00
Sema Checherinda
a6c2473518 do flushUntrackedMemory when context swith 2023-03-02 19:21:03 +01:00
vdimir
78c35ffc45
finally fix attachProfileCountersScope 2023-02-20 12:28:44 +00:00
vdimir
0d6c6a94de
finally fix attachProfileCountersScope 2023-02-15 12:18:17 +00:00
vdimir
1b715a3388
Allow scope override in ThreadStatus::attachProfileCountersScope 2023-02-14 14:11:13 +00:00
vdimir
abd9119583
Remove unnecessary ProfileEventsScope 2023-02-14 14:11:12 +00:00
vdimir
83dea52aff
add sanity check to ThreadStatus::attachProfileCountersScope 2023-02-14 14:11:12 +00:00
vdimir
fa08f72bba
Move subthread_profile_events to ThreadStatus 2023-02-14 14:11:11 +00:00
vdimir
a228f7f419
[wip] ProfileCounters for each part 2023-02-14 14:11:09 +00:00
Alexander Tokmakov
70d1adfe4b
Better formatting for exception messages (#45449)
* save format string for NetException

* format exceptions

* format exceptions 2

* format exceptions 3

* format exceptions 4

* format exceptions 5

* format exceptions 6

* fix

* format exceptions 7

* format exceptions 8

* Update MergeTreeIndexGin.cpp

* Update AggregateFunctionMap.cpp

* Update AggregateFunctionMap.cpp

* fix
2023-01-24 00:13:58 +03:00
Zhiguo Zhou
be4d79e924 Deallocate memory of profile events out of critical section
To further shrink the critical section for releasing memory of the
profile events (ProfileEventsCountersAndMemory), this commit puts
the dealloaction out of the critical section while keeping the
memory move under lock. This change could mitigate the contention
for ThreadGroupStatus::mutex.
2023-01-11 09:58:30 +08:00
Raúl Marín
4d3217cb18
Merge branch 'master' into perf_experiment 2022-11-24 10:32:12 +01:00
Azat Khuzhin
ccde92f855 Fix incorrect UserTimeMicroseconds/SystemTimeMicroseconds accounting
After #40732 it became possible that getrusage() (from detachQuery(),
from buildPushingToViewsChain()) will be called for incorrect thread,
and so when the difference will be calculated it will be simply garbage.

But actually the root of this problem is #25714, after which it became
possible to have multiple ThreadStatus for one thread, and this is very
tricky (sigh).

Here are some other thoughts about it:
- Make ThreadStatus nested - decided that complexity does not worth it,
  at least only for this case
- Move some members into ThreadGroupStatus - will break per-thread
  statistics (and hence query_thread_log, BTW does somebody uses it?)
- Move some members into a separate structure

But decided to fix the issue w/o any refactoring, to make easy for
backport.

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-11-18 21:10:43 +01:00
Raúl Marín
6e0a9452e7 Merge remote-tracking branch 'blessed/master' into perf_experiment 2022-10-25 15:25:06 +02:00
Azat Khuzhin
4e76629aaf Fixes for -Wshorten-64-to-32
- lots of static_cast
- add safe_cast
- types adjustments
  - config
  - IStorage::read/watch
  - ...
- some TODO's (to convert types in future)

P.S. That was quite a journey...

v2: fixes after rebase
v3: fix conflicts after #42308 merged
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-10-21 13:25:19 +02:00
Raúl Marín
227af9a074 Optimizations around ThreadStatus 2022-10-13 21:49:21 +02:00
Alexey Milovidov
ec5a32f534 Make thread_ids unique 2022-10-08 02:05:36 +02:00
Anton Popov
148995894f add system table asynchronous_inserts_log 2022-10-03 21:35:55 +00:00
Zhiguo Zhou
223c1230b6 Optimize the lock contentions for ThreadGroupStatus::mutex
The release of ThreadGroupStatus::finished_threads_counters_memory
via the getProfileEventsCountersAndMemoryForThreads method brings
lots of lock contentions for ThreadGroupStatus::mutex and lowers
the overall performance. This commit optimizes this performance
issue by replacing the method call with an equivalent but more
lightweight code block.
2022-09-22 16:23:16 +08:00
Frank Chen
f17d56b528 Merge branch 'master' into tracing_context_propagation 2022-08-30 14:24:36 +08:00
Azat Khuzhin
269453a646 Avoid leaking of ThreadGroupStatus::finished_threads_counters_memory
Cleanup them in ThreadStatus::detachQuery(), anyway they cannot be
received after by the client.

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-08-29 11:08:50 +02:00
Frank Chen
99c37ce6c6
Merge branch 'master' into tracing_context_propagation 2022-08-25 10:07:16 +08:00
Alexey Milovidov
74e1f4dc61 Fix clang-tidy 2022-08-20 17:09:20 +02:00
Frank Chen
40c6e4c0d6 Merge remote-tracking branch 'origin/master' into tracing_context_propagation 2022-08-02 10:02:09 +08:00