Commit Graph

131 Commits

Author SHA1 Message Date
Alexander Tokmakov
d8e97b51bf Merge branch 'master' into cannot_allocate_thread 2024-04-10 21:21:42 +02:00
Alexander Tokmakov
5db9fbed52 cancel tasks on exception 2024-04-04 22:32:57 +02:00
Robert Schulze
de2a0be025
Don't access static members through instance
- clang-tidy rightfully complains (-readability-static-accessed-through-instance)
- not going to enable the warning for now to avoid breaking the build
2024-04-03 18:50:33 +00:00
Alexander Tokmakov
9082a018a5
Merge pull request #59082 from ClickHouse/fix_race_async_inserts_queue
Fix race on `Context::async_insert_queue`
2024-03-22 16:06:13 +01:00
Alexander Tokmakov
1913466da4 fix uaf of async_insert_queue 2024-03-19 21:07:42 +01:00
Raúl Marín
de855ca917 Reduce header dependencies 2024-03-19 17:04:29 +01:00
Anton Popov
edaf2c8023 Merge remote-tracking branch 'upstream/master' into HEAD 2024-03-14 17:06:22 +00:00
Anton Popov
f35987928b free memory earlier in inserts 2024-03-12 18:05:14 +00:00
Robert Schulze
e5e84419af
Fix clang-tidy-s 2024-03-11 10:58:54 +00:00
Nikita Taranov
4f6cb21d51 set priority when scheduling task in thread pool 2024-03-05 19:45:25 +01:00
Nikita Taranov
4735eb3ab4 wait for pool jobs in case of exception on scheduling 2024-03-02 00:02:00 +01:00
pufit
330a206470
Add definers for views (Attempt 2) (#60439) 2024-02-27 19:00:17 -05:00
Raúl Marín
464b5e0e15
Revert "Add definers for views (#54901)"
This reverts commit 57306706b3.
2024-02-23 12:44:31 +01:00
pufit
57306706b3
Add definers for views (#54901) 2024-02-22 17:47:50 +01:00
Julia Kartseva
e598ad9157 Better logging for adaptive async timeouts
Log the adaptive async timeout value after normalization.
2024-02-08 21:42:44 +00:00
Julia Kartseva
689c368b76 Adaptive async timeouts: consider queue flush history
In addition to the time since the most recent insert,
consider the elapsed time between the two recent queue
flushes when decreasing the timeout or processing an
entry synchronously.
2024-02-01 22:45:10 +00:00
Julia Kartseva
4ef02a1895 Log timeout for entries processed asynchronously 2024-02-01 22:45:09 +00:00
Julia Kartseva
c04e5a4f35 Asynchronous insert queue size and bytes metrics
Add AsynchronousInsertQueueSize and AsynchronousInsertQueueBytes
metrics to improve observability of asynchronous inserts.
The metrics do not account for tasks dispatched for immediate processing
(as opposed to, e.g., PendingAsyncInsert).

```
SELECT value
FROM system.metrics
WHERE metric IN ('AsynchronousInsertQueueSize', 'PendingAsyncInsert')

Query id: a711dd83-b48d-4ad5-8031-fa59b21a7c38

┌─value─┐
│    18 │
│    23 │
└───────┘
```

```
SELECT value
FROM system.metrics
WHERE metric IN ('AsynchronousInsertQueueSize', 'AsynchronousInsertQueueBytes')

Query id: b35a7ceb-2bb5-46ad-b301-e6cf03508699

┌─value─┐
│    28 │
│  1372 │
└───────┘
```
2024-02-01 22:45:09 +00:00
Julia Kartseva
04c8bd1be5 Adaptive asynchronous insert timeouts
Implement the algorithm described in #56783 for adaptive asynchronous
insert timeouts.
- The adaptive async insert timeout can take values within
[async_insert_busy_timeout_min_ms, async_insert_busy_timeout_max_ms].
- The initial value is set to async_insert_busy_timeout_min_ms.
- If the elapsed time since the most recent queue insert was
  greater than the maximum timeout, process the queue content immediately,
  and reduce the timeout.
- If the elapsed time was long enough (longer than a would-be decreased
  timeout), decrease the timeout.
- The adaptive timeout is changes exponentially based on the
  async_insert_busy_timeout_{increase|decrease}_rate.

Fixes: https://github.com/ClickHouse/ClickHouse/issues/56783
2024-02-01 22:45:06 +00:00
Julia Kartseva
bbaa08199a Introduce polling timeout for asynchronous queue
The current timeout for checking updates in the asynchronous queue is
equal to the timeout used for queue entry
(async_insert_busy_timeout_ms).
That means that, in the worst case, an entry spends twice the time of the
asynchronous timeout in the queue.
2024-02-01 08:27:41 +00:00
Maksim Kita
2a327107b6 Updated implementation 2024-01-25 14:31:49 +03:00
avogar
c6085b3eb9 Fix working with read buffers in StreamingFormatExecutor 2023-12-28 18:47:57 +00:00
Alexey Milovidov
d56cbda185 Add metrics for the number of queued jobs, which is useful for the IO thread pool 2023-11-18 19:07:59 +01:00
Robert Schulze
b899270372
Remove default value for argument 'ignore_aliases' from IAST::updateTreeHash() 2023-11-13 13:18:35 +00:00
Anton Popov
5819bcd07a
Support asynchronous inserts for native protocol (#54730)
* support async insert for native protocol

* use separate queue for async inserts via native protocol

* fix test

* better logging for async inserts and more tests

* disable mixed internal and external data in async inserts

* fix tests

* fix quota in async inserts

* disable async insert for secondary query of distributed
2023-10-20 18:39:48 +02:00
Vitaly Baranov
cf7eea569b Fix quota consumption 2023-10-05 15:46:36 +02:00
Vitaly Baranov
a54d3f31e4 Add new fields to InsertQuery::hash and operator == 2023-10-05 11:03:05 +02:00
Vitaly Baranov
76766a200e Fix access checking in evaluations of defaults during async insert. 2023-10-05 10:26:44 +02:00
Raúl Marín
93dac0c880 Support clang-18 (Wmissing-field-initializers) 2023-08-23 15:53:45 +02:00
ltrk2
a2054c04dd
Merge branch 'master' into feature/mergetree-checksum-big-endian-support 2023-08-10 10:21:34 -04:00
Raúl Marín
d37283e9fb Fix query_id in part_log with async flush queries 2023-08-07 10:46:55 +02:00
ltrk2
6c9a1b14ef
Merge branch 'master' into feature/mergetree-checksum-big-endian-support 2023-07-28 16:18:46 -04:00
Alexey Gerasimchuck
63b05da1f2 System logs improvements 2023-07-28 07:23:34 +00:00
Robert Schulze
d48b1cadb0
Merge pull request #52384 from rschu1ze/query_cache_usage_in_query_log
Include query cache usage in SYSTEM.QUERY_LOG
2023-07-27 17:16:54 +02:00
Robert Schulze
c755fde3a4
Include query cache usage in SYSTEM.QUERY_LOG 2023-07-24 16:24:36 +00:00
Anton Popov
347f442f84 Merge remote-tracking branch 'upstream/master' into HEAD 2023-07-24 10:55:31 +00:00
ltrk2
90a2c460c6
Merge branch 'master' into feature/mergetree-checksum-big-endian-support 2023-07-21 08:07:18 -04:00
Nikita Mikhaylov
668062dc29
Merge branch 'master' into no-keep-context-lock-while-calculating-access 2023-07-20 14:42:13 +02:00
ltrk2
51e2c58a53 Implement endianness-independent SipHash and MergeTree checksum serialization 2023-07-19 10:01:55 -07:00
Han Fei
e8be6ec23f
Merge branch 'master' into hanfei/support-insert-token 2023-07-19 10:06:03 +02:00
Vitaly Baranov
815a3857de Remove non-const function Context::getClientInfo(). 2023-07-17 15:02:07 +02:00
Han Fei
b75c4ae2e5 Merge branch 'master' into hanfei/support-insert-token 2023-07-17 14:57:48 +02:00
Han Fei
7761e5ef9d support async_deduplicate_token for async insert 2023-07-15 14:42:08 +02:00
Raúl Marín
dbdfc07790
Merge branch 'master' into async_to_query_log 2023-07-10 10:32:56 +02:00
Nikita Taranov
c23e29d6aa don't account session's memory in thread/user mem tracker 2023-07-06 14:41:03 +02:00
Raúl Marín
b1cedf0e42 Simplify handling of AsyncInsertFlush 2023-06-20 11:38:19 +02:00
Raúl Marín
5ee813b8d0 Fix style 2023-06-20 11:38:19 +02:00
Raúl Marín
5ac7d95baf Cleanup 2023-06-20 11:38:19 +02:00
Raúl Marín
cf74aee6c9 Log async query flushes to query_log 2023-06-20 11:38:19 +02:00
Raúl Marín
7ab660acfb Extract logging functions outside of executeQueryImpl 2023-06-20 11:38:19 +02:00