mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 23:52:03 +00:00
Merge remote-tracking branch 'origin/master' into allow-to-change-some-cache-settings-without-restart
This commit is contained in:
commit
8be3c9d218
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -354,9 +354,6 @@
|
|||||||
[submodule "contrib/aklomp-base64"]
|
[submodule "contrib/aklomp-base64"]
|
||||||
path = contrib/aklomp-base64
|
path = contrib/aklomp-base64
|
||||||
url = https://github.com/aklomp/base64.git
|
url = https://github.com/aklomp/base64.git
|
||||||
[submodule "contrib/pocketfft"]
|
|
||||||
path = contrib/pocketfft
|
|
||||||
url = https://github.com/mreineck/pocketfft.git
|
|
||||||
[submodule "contrib/sqids-cpp"]
|
[submodule "contrib/sqids-cpp"]
|
||||||
path = contrib/sqids-cpp
|
path = contrib/sqids-cpp
|
||||||
url = https://github.com/sqids/sqids-cpp.git
|
url = https://github.com/sqids/sqids-cpp.git
|
||||||
|
238
CHANGELOG.md
238
CHANGELOG.md
@ -1,4 +1,5 @@
|
|||||||
### Table of Contents
|
### Table of Contents
|
||||||
|
**[ClickHouse release v23.11, 2023-12-06](#2311)**<br/>
|
||||||
**[ClickHouse release v23.10, 2023-11-02](#2310)**<br/>
|
**[ClickHouse release v23.10, 2023-11-02](#2310)**<br/>
|
||||||
**[ClickHouse release v23.9, 2023-09-28](#239)**<br/>
|
**[ClickHouse release v23.9, 2023-09-28](#239)**<br/>
|
||||||
**[ClickHouse release v23.8 LTS, 2023-08-31](#238)**<br/>
|
**[ClickHouse release v23.8 LTS, 2023-08-31](#238)**<br/>
|
||||||
@ -13,7 +14,218 @@
|
|||||||
|
|
||||||
# 2023 Changelog
|
# 2023 Changelog
|
||||||
|
|
||||||
### ClickHouse release 23.10, 2023-11-02
|
### <a id="2311"></a> ClickHouse release 23.11, 2023-12-06
|
||||||
|
|
||||||
|
#### Backward Incompatible Change
|
||||||
|
* The default ClickHouse server configuration file has enabled `access_management` (user manipulation by SQL queries) and `named_collection_control` (manipulation of named collection by SQL queries) for the `default` user by default. This closes [#56482](https://github.com/ClickHouse/ClickHouse/issues/56482). [#56619](https://github.com/ClickHouse/ClickHouse/pull/56619) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Multiple improvements for `RESPECT NULLS`/`IGNORE NULLS` for window functions. If you use them as aggregate functions and store the states of aggregate functions with these modifiers, they might become incompatible. [#57189](https://github.com/ClickHouse/ClickHouse/pull/57189) ([Raúl Marín](https://github.com/Algunenano)).
|
||||||
|
* Remove optimization `optimize_move_functions_out_of_any`. [#57190](https://github.com/ClickHouse/ClickHouse/pull/57190) ([Raúl Marín](https://github.com/Algunenano)).
|
||||||
|
* Formatters `%l`/`%k`/`%c` in function `parseDateTime` are now able to parse hours/months without leading zeros, e.g. `select parseDateTime('2023-11-26 8:14', '%F %k:%i')` now works. Set `parsedatetime_parse_without_leading_zeros = 0` to restore the previous behavior which required two digits. Function `formatDateTime` is now also able to print hours/months without leading zeros. This is controlled by setting `formatdatetime_format_without_leading_zeros` but off by default to not break existing use cases. [#55872](https://github.com/ClickHouse/ClickHouse/pull/55872) ([Azat Khuzhin](https://github.com/azat)).
|
||||||
|
* You can no longer use the aggregate function `avgWeighted` with arguments of type `Decimal`. Workaround: convert arguments to `Float64`. This closes [#43928](https://github.com/ClickHouse/ClickHouse/issues/43928). This closes [#31768](https://github.com/ClickHouse/ClickHouse/issues/31768). This closes [#56435](https://github.com/ClickHouse/ClickHouse/issues/56435). If you have used this function inside materialized views or projections with `Decimal` arguments, contact support@clickhouse.com. Fixed error in aggregate function `sumMap` and made it slower around 1.5..2 times. It does not matter because the function is garbage anyway. This closes [#54955](https://github.com/ClickHouse/ClickHouse/issues/54955). This closes [#53134](https://github.com/ClickHouse/ClickHouse/issues/53134). This closes [#55148](https://github.com/ClickHouse/ClickHouse/issues/55148). Fix a bug in function `groupArraySample` - it used the same random seed in case more than one aggregate state is generated in a query. [#56350](https://github.com/ClickHouse/ClickHouse/pull/56350) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
|
||||||
|
#### New Feature
|
||||||
|
* Added server setting `async_load_databases` for asynchronous loading of databases and tables. Speeds up the server start time. Applies to databases with `Ordinary`, `Atomic` and `Replicated` engines. Their tables load metadata asynchronously. Query to a table increases the priority of the load job and waits for it to be done. Added a new table `system.asynchronous_loader` for introspection. [#49351](https://github.com/ClickHouse/ClickHouse/pull/49351) ([Sergei Trifonov](https://github.com/serxa)).
|
||||||
|
* Add system table `blob_storage_log`. It allows auditing all the data written to S3 and other object storages. [#52918](https://github.com/ClickHouse/ClickHouse/pull/52918) ([vdimir](https://github.com/vdimir)).
|
||||||
|
* Use statistics to order prewhere conditions better. [#53240](https://github.com/ClickHouse/ClickHouse/pull/53240) ([Han Fei](https://github.com/hanfei1991)).
|
||||||
|
* Added support for compression in the Keeper's protocol. It can be enabled on the ClickHouse side by using this flag `use_compression` inside `zookeeper` section. Keep in mind that only ClickHouse Keeper supports compression, while Apache ZooKeeper does not. Resolves [#49507](https://github.com/ClickHouse/ClickHouse/issues/49507). [#54957](https://github.com/ClickHouse/ClickHouse/pull/54957) ([SmitaRKulkarni](https://github.com/SmitaRKulkarni)).
|
||||||
|
* Introduce the feature `storage_metadata_write_full_object_key`. If it is set as `true` then metadata files are written with the new format. With that format ClickHouse stores full remote object key in the metadata file which allows better flexibility and optimization. [#55566](https://github.com/ClickHouse/ClickHouse/pull/55566) ([Sema Checherinda](https://github.com/CheSema)).
|
||||||
|
* Add new settings and syntax to protect named collections' fields from being overridden. This is meant to prevent a malicious user from obtaining unauthorized access to secrets. [#55782](https://github.com/ClickHouse/ClickHouse/pull/55782) ([Salvatore Mesoraca](https://github.com/aiven-sal)).
|
||||||
|
* Add `hostname` column to all system log tables - it is useful if you make the system tables replicated, shared, or distributed. [#55894](https://github.com/ClickHouse/ClickHouse/pull/55894) ([Bharat Nallan](https://github.com/bharatnc)).
|
||||||
|
* Add `CHECK ALL TABLES` query. [#56022](https://github.com/ClickHouse/ClickHouse/pull/56022) ([vdimir](https://github.com/vdimir)).
|
||||||
|
* Added function `fromDaysSinceYearZero` which is similar to MySQL's `FROM_DAYS`. E.g. `SELECT fromDaysSinceYearZero(739136)` returns `2023-09-08`. [#56088](https://github.com/ClickHouse/ClickHouse/pull/56088) ([Joanna Hulboj](https://github.com/jh0x)).
|
||||||
|
* Add an external Python tool to view backups and to extract information from them without using ClickHouse. [#56268](https://github.com/ClickHouse/ClickHouse/pull/56268) ([Vitaly Baranov](https://github.com/vitlibar)).
|
||||||
|
* Implement a new setting called `preferred_optimize_projection_name`. If it is set to a non-empty string, the specified projection would be used if possible instead of choosing from all the candidates. [#56309](https://github.com/ClickHouse/ClickHouse/pull/56309) ([Yarik Briukhovetskyi](https://github.com/yariks5s)).
|
||||||
|
* Add 4-letter command for yielding/resigning leadership (https://github.com/ClickHouse/ClickHouse/issues/56352). [#56354](https://github.com/ClickHouse/ClickHouse/pull/56354) ([Pradeep Chhetri](https://github.com/chhetripradeep)). [#56620](https://github.com/ClickHouse/ClickHouse/pull/56620) ([Pradeep Chhetri](https://github.com/chhetripradeep)).
|
||||||
|
* Added a new SQL function, `arrayRandomSample(arr, k)` which returns a sample of k elements from the input array. Similar functionality could previously be achieved only with less convenient syntax, e.g. `SELECT arrayReduce('groupArraySample(3)', range(10))`. [#56416](https://github.com/ClickHouse/ClickHouse/pull/56416) ([Robert Schulze](https://github.com/rschu1ze)).
|
||||||
|
* Added support for `Float16` type data to use in `.npy` files. Closes [#56344](https://github.com/ClickHouse/ClickHouse/issues/56344). [#56424](https://github.com/ClickHouse/ClickHouse/pull/56424) ([Yarik Briukhovetskyi](https://github.com/yariks5s)).
|
||||||
|
* Added a system view `information_schema.statistics` for better compatibility with Tableau Online. [#56425](https://github.com/ClickHouse/ClickHouse/pull/56425) ([Serge Klochkov](https://github.com/slvrtrn)).
|
||||||
|
* Add `system.symbols` table useful for introspection of the binary. [#56548](https://github.com/ClickHouse/ClickHouse/pull/56548) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Configurable dashboards. Queries for charts are now loaded using a query, which by default uses a new `system.dashboards` table. [#56771](https://github.com/ClickHouse/ClickHouse/pull/56771) ([Sergei Trifonov](https://github.com/serxa)).
|
||||||
|
* Introduce `fileCluster` table function - it is useful if you mount a shared filesystem (NFS and similar) into the `user_files` directory. [#56868](https://github.com/ClickHouse/ClickHouse/pull/56868) ([Andrey Zvonov](https://github.com/zvonand)).
|
||||||
|
* Add `_size` virtual column with file size in bytes to `s3/file/hdfs/url/azureBlobStorage` engines. [#57126](https://github.com/ClickHouse/ClickHouse/pull/57126) ([Kruglov Pavel](https://github.com/Avogar)).
|
||||||
|
* Expose the number of errors for each error code occurred on a server since last restart from the Prometheus endpoint. [#57209](https://github.com/ClickHouse/ClickHouse/pull/57209) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)).
|
||||||
|
* ClickHouse keeper reports its running availability zone at `/keeper/availability-zone` path. This can be configured via `<availability_zone><value>us-west-1a</value></availability_zone>`. [#56715](https://github.com/ClickHouse/ClickHouse/pull/56715) ([Jianfei Hu](https://github.com/incfly)).
|
||||||
|
* Make ALTER materialized_view MODIFY QUERY non experimental and deprecate `allow_experimental_alter_materialized_view_structure` setting. Fixes [#15206](https://github.com/ClickHouse/ClickHouse/issues/15206). [#57311](https://github.com/ClickHouse/ClickHouse/pull/57311) ([alesapin](https://github.com/alesapin)).
|
||||||
|
* Setting `join_algorithm` respects specified order [#51745](https://github.com/ClickHouse/ClickHouse/pull/51745) ([vdimir](https://github.com/vdimir)).
|
||||||
|
* Add support for the [well-known Protobuf types](https://protobuf.dev/reference/protobuf/google.protobuf/) in the Protobuf format. [#56741](https://github.com/ClickHouse/ClickHouse/pull/56741) ([János Benjamin Antal](https://github.com/antaljanosbenjamin)).
|
||||||
|
|
||||||
|
#### Performance Improvement
|
||||||
|
* Adaptive timeouts for interacting with S3. The first attempt is made with low send and receive timeouts. [#56314](https://github.com/ClickHouse/ClickHouse/pull/56314) ([Sema Checherinda](https://github.com/CheSema)).
|
||||||
|
* Increase the default value of `max_concurrent_queries` from 100 to 1000. This makes sense when there is a large number of connecting clients, which are slowly sending or receiving data, so the server is not limited by CPU, or when the number of CPU cores is larger than 100. Also, enable the concurrency control by default, and set the desired number of query processing threads in total as twice the number of CPU cores. It improves performance in scenarios with a very large number of concurrent queries. [#46927](https://github.com/ClickHouse/ClickHouse/pull/46927) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Support parallel evaluation of window functions. Fixes [#34688](https://github.com/ClickHouse/ClickHouse/issues/34688). [#39631](https://github.com/ClickHouse/ClickHouse/pull/39631) ([Dmitry Novik](https://github.com/novikd)).
|
||||||
|
* `Numbers` table engine (of the `system.numbers` table) now analyzes the condition to generate the needed subset of data, like table's index. [#50909](https://github.com/ClickHouse/ClickHouse/pull/50909) ([JackyWoo](https://github.com/JackyWoo)).
|
||||||
|
* Improved the performance of filtering by `IN (...)` condition for `Merge` table engine. [#54905](https://github.com/ClickHouse/ClickHouse/pull/54905) ([Nikita Taranov](https://github.com/nickitat)).
|
||||||
|
* An improvement which takes place when the filesystem cache is full and there are big reads. [#55158](https://github.com/ClickHouse/ClickHouse/pull/55158) ([Kseniia Sumarokova](https://github.com/kssenii)).
|
||||||
|
* Add ability to disable checksums for S3 to avoid excessive pass over the file (this is controlled by the setting `s3_disable_checksum`). [#55559](https://github.com/ClickHouse/ClickHouse/pull/55559) ([Azat Khuzhin](https://github.com/azat)).
|
||||||
|
* Now we read synchronously from remote tables when data is in page cache (like we do for local tables). It is faster, it doesn't require synchronisation inside the thread pool, and doesn't hesitate to do `seek`-s on local FS, and reduces CPU wait. [#55841](https://github.com/ClickHouse/ClickHouse/pull/55841) ([Nikita Taranov](https://github.com/nickitat)).
|
||||||
|
* Optimization for getting value from `map`, `arrayElement`. It will bring about 30% speedup. - reduce the reserved memory - reduce the `resize` call. [#55957](https://github.com/ClickHouse/ClickHouse/pull/55957) ([lgbo](https://github.com/lgbo-ustc)).
|
||||||
|
* Optimization of multi-stage filtering with AVX-512. The performance experiments of the OnTime dataset on the ICX device (Intel Xeon Platinum 8380 CPU, 80 cores, 160 threads) show that this change could bring the improvements of 7.4%, 5.9%, 4.7%, 3.0%, and 4.6% to the QPS of the query Q2, Q3, Q4, Q5 and Q6 respectively while having no impact on others. [#56079](https://github.com/ClickHouse/ClickHouse/pull/56079) ([Zhiguo Zhou](https://github.com/ZhiguoZh)).
|
||||||
|
* Limit the number of threads busy inside the query profiler. If there are more - they will skip profiling. [#56105](https://github.com/ClickHouse/ClickHouse/pull/56105) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Decrease the amount of virtual function calls in window functions. [#56120](https://github.com/ClickHouse/ClickHouse/pull/56120) ([Maksim Kita](https://github.com/kitaisreal)).
|
||||||
|
* Allow recursive Tuple field pruning in ORC data format to speed up scaning. [#56122](https://github.com/ClickHouse/ClickHouse/pull/56122) ([李扬](https://github.com/taiyang-li)).
|
||||||
|
* Trivial count optimization for `Npy` data format: queries like `select count() from 'data.npy'` will work much more fast because of caching the results. [#56304](https://github.com/ClickHouse/ClickHouse/pull/56304) ([Yarik Briukhovetskyi](https://github.com/yariks5s)).
|
||||||
|
* Queries with aggregation and a large number of streams will use less amount of memory during the plan's construction. [#57074](https://github.com/ClickHouse/ClickHouse/pull/57074) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Improve performance of executing queries for use cases with many users and highly concurrent queries (>2000 QPS) by optimizing the access to ProcessList. [#57106](https://github.com/ClickHouse/ClickHouse/pull/57106) ([Andrej Hoos](https://github.com/adikus)).
|
||||||
|
* Trivial improvement on array join, reuse some intermediate results. [#57183](https://github.com/ClickHouse/ClickHouse/pull/57183) ([李扬](https://github.com/taiyang-li)).
|
||||||
|
* There are cases when stack unwinding was slow. Not anymore. [#57221](https://github.com/ClickHouse/ClickHouse/pull/57221) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Now we use default read pool for reading from external storage when `max_streams = 1`. It is beneficial when read prefetches are enabled. [#57334](https://github.com/ClickHouse/ClickHouse/pull/57334) ([Nikita Taranov](https://github.com/nickitat)).
|
||||||
|
* Keeper improvement: improve memory-usage during startup by delaying log preprocessing. [#55660](https://github.com/ClickHouse/ClickHouse/pull/55660) ([Antonio Andelic](https://github.com/antonio2368)).
|
||||||
|
* Improved performance of glob matching for `File` and `HDFS` storages. [#56141](https://github.com/ClickHouse/ClickHouse/pull/56141) ([Andrey Zvonov](https://github.com/zvonand)).
|
||||||
|
* Posting lists in experimental full text indexes are now compressed which reduces their size by 10-30%. [#56226](https://github.com/ClickHouse/ClickHouse/pull/56226) ([Harry Lee](https://github.com/HarryLeeIBM)).
|
||||||
|
* Parallelise `BackupEntriesCollector` in backups. [#56312](https://github.com/ClickHouse/ClickHouse/pull/56312) ([Kseniia Sumarokova](https://github.com/kssenii)).
|
||||||
|
|
||||||
|
#### Improvement
|
||||||
|
* Add a new `MergeTree` setting `add_implicit_sign_column_constraint_for_collapsing_engine` (disabled by default). When enabled, it adds an implicit CHECK constraint for `CollapsingMergeTree` tables that restricts the value of the `Sign` column to be only -1 or 1. [#56701](https://github.com/ClickHouse/ClickHouse/issues/56701). [#56986](https://github.com/ClickHouse/ClickHouse/pull/56986) ([Kevin Mingtarja](https://github.com/kevinmingtarja)).
|
||||||
|
* Enable adding new disk to storage configuration without restart. [#56367](https://github.com/ClickHouse/ClickHouse/pull/56367) ([Duc Canh Le](https://github.com/canhld94)).
|
||||||
|
* Support creating and materializing index in the same alter query, also support "modify TTL" and "materialize TTL" in the same query. Closes [#55651](https://github.com/ClickHouse/ClickHouse/issues/55651). [#56331](https://github.com/ClickHouse/ClickHouse/pull/56331) ([flynn](https://github.com/ucasfl)).
|
||||||
|
* Add a new table function named `fuzzJSON` with rows containing perturbed versions of the source JSON string with random variations. [#56490](https://github.com/ClickHouse/ClickHouse/pull/56490) ([Julia Kartseva](https://github.com/jkartseva)).
|
||||||
|
* Engine `Merge` filters the records according to the row policies of the underlying tables, so you don't have to create another row policy on a `Merge` table. [#50209](https://github.com/ClickHouse/ClickHouse/pull/50209) ([Ilya Golshtein](https://github.com/ilejn)).
|
||||||
|
* Add a setting `max_execution_time_leaf` to limit the execution time on shard for distributed query, and `timeout_overflow_mode_leaf` to control the behaviour if timeout happens. [#51823](https://github.com/ClickHouse/ClickHouse/pull/51823) ([Duc Canh Le](https://github.com/canhld94)).
|
||||||
|
* Add ClickHouse setting to disable tunneling for HTTPS requests over HTTP proxy. [#55033](https://github.com/ClickHouse/ClickHouse/pull/55033) ([Arthur Passos](https://github.com/arthurpassos)).
|
||||||
|
* Set `background_fetches_pool_size` to 16, background_schedule_pool_size to 512 that is better for production usage with frequent small insertions. [#54327](https://github.com/ClickHouse/ClickHouse/pull/54327) ([Denny Crane](https://github.com/den-crane)).
|
||||||
|
* While read data from a csv format file, and at end of line is `\r` , which not followed by `\n`, then we will enconter the exception as follows `Cannot parse CSV format: found \r (CR) not followed by \n (LF). Line must end by \n (LF) or \r\n (CR LF) or \n\r.` In clickhouse, the csv end of line must be `\n` or `\r\n` or `\n\r`, so the `\r` must be followed by `\n`, but in some suitation, the csv input data is abnormal, like above, `\r` is at end of line. [#54340](https://github.com/ClickHouse/ClickHouse/pull/54340) ([KevinyhZou](https://github.com/KevinyhZou)).
|
||||||
|
* Update Arrow library to release-13.0.0 that supports new encodings. Closes [#44505](https://github.com/ClickHouse/ClickHouse/issues/44505). [#54800](https://github.com/ClickHouse/ClickHouse/pull/54800) ([Kruglov Pavel](https://github.com/Avogar)).
|
||||||
|
* Improve performance of ON CLUSTER queries by removing heavy system calls to get all network interfaces when looking for local ip address in the DDL entry hosts list. [#54909](https://github.com/ClickHouse/ClickHouse/pull/54909) ([Duc Canh Le](https://github.com/canhld94)).
|
||||||
|
* Fixed accounting of memory allocated before attaching a thread to a query or a user. [#56089](https://github.com/ClickHouse/ClickHouse/pull/56089) ([Nikita Taranov](https://github.com/nickitat)).
|
||||||
|
* Add support for `LARGE_LIST` in Apache Arrow formats. [#56118](https://github.com/ClickHouse/ClickHouse/pull/56118) ([edef](https://github.com/edef1c)).
|
||||||
|
* Allow manual compaction of `EmbeddedRocksDB` via `OPTIMIZE` query. [#56225](https://github.com/ClickHouse/ClickHouse/pull/56225) ([Azat Khuzhin](https://github.com/azat)).
|
||||||
|
* Add ability to specify BlockBasedTableOptions for `EmbeddedRocksDB` tables. [#56264](https://github.com/ClickHouse/ClickHouse/pull/56264) ([Azat Khuzhin](https://github.com/azat)).
|
||||||
|
* `SHOW COLUMNS` now displays MySQL's equivalent data type name when the connection was made through the MySQL protocol. Previously, this was the case when setting `use_mysql_types_in_show_columns = 1`. The setting is retained but made obsolete. [#56277](https://github.com/ClickHouse/ClickHouse/pull/56277) ([Robert Schulze](https://github.com/rschu1ze)).
|
||||||
|
* Fixed possible `The local set of parts of table doesn't look like the set of parts in ZooKeeper` error if server was restarted just after `TRUNCATE` or `DROP PARTITION`. [#56282](https://github.com/ClickHouse/ClickHouse/pull/56282) ([Alexander Tokmakov](https://github.com/tavplubix)).
|
||||||
|
* Fixed handling of non-const query strings in functions `formatQuery`/ `formatQuerySingleLine`. Also added `OrNull` variants of both functions that return a NULL when a query cannot be parsed instead of throwing an exception. [#56327](https://github.com/ClickHouse/ClickHouse/pull/56327) ([Robert Schulze](https://github.com/rschu1ze)).
|
||||||
|
* Allow backup of materialized view with dropped inner table instead of failing the backup. [#56387](https://github.com/ClickHouse/ClickHouse/pull/56387) ([Kseniia Sumarokova](https://github.com/kssenii)).
|
||||||
|
* Queries to `system.replicas` initiate requests to ZooKeeper when certain columns are queried. When there are thousands of tables these requests might produce a considerable load on ZooKeeper. If there are multiple simultaneous queries to `system.replicas` they do same requests multiple times. The change is to "deduplicate" requests from concurrent queries. [#56420](https://github.com/ClickHouse/ClickHouse/pull/56420) ([Alexander Gololobov](https://github.com/davenger)).
|
||||||
|
* Fix translation to MySQL compatible query for querying external databases. [#56456](https://github.com/ClickHouse/ClickHouse/pull/56456) ([flynn](https://github.com/ucasfl)).
|
||||||
|
* Add support for backing up and restoring tables using `KeeperMap` engine. [#56460](https://github.com/ClickHouse/ClickHouse/pull/56460) ([Antonio Andelic](https://github.com/antonio2368)).
|
||||||
|
* 404 response for CompleteMultipartUpload has to be rechecked. Operation could be done on server even if client got timeout or other network errors. The next retry of CompleteMultipartUpload receives 404 response. If the object key exists that operation is considered as successful. [#56475](https://github.com/ClickHouse/ClickHouse/pull/56475) ([Sema Checherinda](https://github.com/CheSema)).
|
||||||
|
* Enable the HTTP OPTIONS method by default - it simplifies requesting ClickHouse from a web browser. [#56483](https://github.com/ClickHouse/ClickHouse/pull/56483) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* The value for `dns_max_consecutive_failures` was changed by mistake in [#46550](https://github.com/ClickHouse/ClickHouse/issues/46550) - this is reverted and adjusted to a better value. Also, increased the HTTP keep-alive timeout to a reasonable value from production. [#56485](https://github.com/ClickHouse/ClickHouse/pull/56485) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Load base backups lazily (a base backup won't be loaded until it's needed). Also add some log message and profile events for backups. [#56516](https://github.com/ClickHouse/ClickHouse/pull/56516) ([Vitaly Baranov](https://github.com/vitlibar)).
|
||||||
|
* Setting `query_cache_store_results_of_queries_with_nondeterministic_functions` (with values `false` or `true`) was marked obsolete. It was replaced by setting `query_cache_nondeterministic_function_handling`, a three-valued enum that controls how the query cache handles queries with non-deterministic functions: a) throw an exception (default behavior), b) save the non-deterministic query result regardless, or c) ignore, i.e. don't throw an exception and don't cache the result. [#56519](https://github.com/ClickHouse/ClickHouse/pull/56519) ([Robert Schulze](https://github.com/rschu1ze)).
|
||||||
|
* Rewrite equality with `is null` check in JOIN ON section. Experimental *Analyzer only*. [#56538](https://github.com/ClickHouse/ClickHouse/pull/56538) ([vdimir](https://github.com/vdimir)).
|
||||||
|
* Function`concat` now supports arbitrary argument types (instead of only String and FixedString arguments). This makes it behave more similar to MySQL `concat` implementation. For example, `SELECT concat('ab', 42)` now returns `ab42`. [#56540](https://github.com/ClickHouse/ClickHouse/pull/56540) ([Serge Klochkov](https://github.com/slvrtrn)).
|
||||||
|
* Allow getting cache configuration from 'named_collection' section in config or from SQL created named collections. [#56541](https://github.com/ClickHouse/ClickHouse/pull/56541) ([Kseniia Sumarokova](https://github.com/kssenii)).
|
||||||
|
* Update `query_masking_rules` when reloading the config ([#56449](https://github.com/ClickHouse/ClickHouse/issues/56449)). [#56573](https://github.com/ClickHouse/ClickHouse/pull/56573) ([Mikhail Koviazin](https://github.com/mkmkme)).
|
||||||
|
* PostgreSQL database engine: Make the removal of outdated tables less aggressive with unsuccessful postgres connection. [#56609](https://github.com/ClickHouse/ClickHouse/pull/56609) ([jsc0218](https://github.com/jsc0218)).
|
||||||
|
* It took too much time to connnect to PG when URL is not right, so the relevant query stucks there and get cancelled. [#56648](https://github.com/ClickHouse/ClickHouse/pull/56648) ([jsc0218](https://github.com/jsc0218)).
|
||||||
|
* Keeper improvement: disable compressed logs by default in Keeper. [#56763](https://github.com/ClickHouse/ClickHouse/pull/56763) ([Antonio Andelic](https://github.com/antonio2368)).
|
||||||
|
* Add config setting `wait_dictionaries_load_at_startup`. [#56782](https://github.com/ClickHouse/ClickHouse/pull/56782) ([Vitaly Baranov](https://github.com/vitlibar)).
|
||||||
|
* There was a potential vulnerability in previous ClickHouse versions: if a user has connected and unsuccessfully tried to authenticate with the "interserver secret" method, the server didn't terminate the connection immediately but continued to receive and ignore the leftover packets from the client. While these packets are ignored, they are still parsed, and if they use a compression method with another known vulnerability, it will lead to exploitation of it without authentication. This issue was found with [ClickHouse Bug Bounty Program](https://github.com/ClickHouse/ClickHouse/issues/38986) by https://twitter.com/malacupa. [#56794](https://github.com/ClickHouse/ClickHouse/pull/56794) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Fetching a part waits when that part is fully committed on remote replica. It is better not send part in PreActive state. In case of zero copy this is mandatory restriction. [#56808](https://github.com/ClickHouse/ClickHouse/pull/56808) ([Sema Checherinda](https://github.com/CheSema)).
|
||||||
|
* Fix possible postgresql logical replication conversion error when using experimental `MaterializedPostgreSQL`. [#53721](https://github.com/ClickHouse/ClickHouse/pull/53721) ([takakawa](https://github.com/takakawa)).
|
||||||
|
* Implement user-level setting `alter_move_to_space_execute_async` which allow to execute queries `ALTER TABLE ... MOVE PARTITION|PART TO DISK|VOLUME` asynchronously. The size of pool for background executions is controlled by `background_move_pool_size`. Default behavior is synchronous execution. Fixes [#47643](https://github.com/ClickHouse/ClickHouse/issues/47643). [#56809](https://github.com/ClickHouse/ClickHouse/pull/56809) ([alesapin](https://github.com/alesapin)).
|
||||||
|
* Able to filter by engine when scanning system.tables, avoid unnecessary (potentially time-consuming) connection. [#56813](https://github.com/ClickHouse/ClickHouse/pull/56813) ([jsc0218](https://github.com/jsc0218)).
|
||||||
|
* Show `total_bytes` and `total_rows` in system tables for RocksDB storage. [#56816](https://github.com/ClickHouse/ClickHouse/pull/56816) ([Aleksandr Musorin](https://github.com/AVMusorin)).
|
||||||
|
* Allow basic commands in ALTER for TEMPORARY tables. [#56892](https://github.com/ClickHouse/ClickHouse/pull/56892) ([Sergey](https://github.com/icuken)).
|
||||||
|
* LZ4 compression. Buffer compressed block in a rare case when out buffer capacity is not enough for writing compressed block directly to out's buffer. [#56938](https://github.com/ClickHouse/ClickHouse/pull/56938) ([Sema Checherinda](https://github.com/CheSema)).
|
||||||
|
* Add metrics for the number of queued jobs, which is useful for the IO thread pool. [#56958](https://github.com/ClickHouse/ClickHouse/pull/56958) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Add a setting for PostgreSQL table engine setting in the config file. Added a check for the setting Added documentation around the additional setting. [#56959](https://github.com/ClickHouse/ClickHouse/pull/56959) ([Peignon Melvyn](https://github.com/melvynator)).
|
||||||
|
* Function `concat` can now be called with a single argument, e.g., `SELECT concat('abc')`. This makes its behavior more consistent with MySQL's concat implementation. [#57000](https://github.com/ClickHouse/ClickHouse/pull/57000) ([Serge Klochkov](https://github.com/slvrtrn)).
|
||||||
|
* Signs all `x-amz-*` headers as required by AWS S3 docs. [#57001](https://github.com/ClickHouse/ClickHouse/pull/57001) ([Arthur Passos](https://github.com/arthurpassos)).
|
||||||
|
* Function `fromDaysSinceYearZero` (alias: `FROM_DAYS`) can now be used with unsigned and signed integer types (previously, it had to be an unsigned integer). This improve compatibility with 3rd party tools such as Tableau Online. [#57002](https://github.com/ClickHouse/ClickHouse/pull/57002) ([Serge Klochkov](https://github.com/slvrtrn)).
|
||||||
|
* Add `system.s3queue_log` to default config. [#57036](https://github.com/ClickHouse/ClickHouse/pull/57036) ([Kseniia Sumarokova](https://github.com/kssenii)).
|
||||||
|
* Change the default for `wait_dictionaries_load_at_startup` to true, and use this setting only if `dictionaries_lazy_load` is false. [#57133](https://github.com/ClickHouse/ClickHouse/pull/57133) ([Vitaly Baranov](https://github.com/vitlibar)).
|
||||||
|
* Check dictionary source type on creation even if `dictionaries_lazy_load` is enabled. [#57134](https://github.com/ClickHouse/ClickHouse/pull/57134) ([Vitaly Baranov](https://github.com/vitlibar)).
|
||||||
|
* Plan-level optimizations can now be enabled/disabled individually. Previously, it was only possible to disable them all. The setting which previously did that (`query_plan_enable_optimizations`) is retained and can still be used to disable all optimizations. [#57152](https://github.com/ClickHouse/ClickHouse/pull/57152) ([Robert Schulze](https://github.com/rschu1ze)).
|
||||||
|
* The server's exit code will correspond to the exception code. For example, if the server cannot start due to memory limit, it will exit with the code 241 = MEMORY_LIMIT_EXCEEDED. In previous versions, the exit code for exceptions was always 70 = Poco::Util::ExitCode::EXIT_SOFTWARE. [#57153](https://github.com/ClickHouse/ClickHouse/pull/57153) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Do not demangle and symbolize stack frames from `functional` C++ header. [#57201](https://github.com/ClickHouse/ClickHouse/pull/57201) ([Mike Kot](https://github.com/myrrc)).
|
||||||
|
* HTTP server page `/dashboard` now supports charts with multiple lines. [#57236](https://github.com/ClickHouse/ClickHouse/pull/57236) ([Sergei Trifonov](https://github.com/serxa)).
|
||||||
|
* The `max_memory_usage_in_client` command line option supports a string value with a suffix (K, M, G, etc). Closes [#56879](https://github.com/ClickHouse/ClickHouse/issues/56879). [#57273](https://github.com/ClickHouse/ClickHouse/pull/57273) ([Yarik Briukhovetskyi](https://github.com/yariks5s)).
|
||||||
|
* Bumped Intel QPL (used by codec `DEFLATE_QPL`) from v1.2.0 to v1.3.1 . Also fixed a bug in case of BOF (Block On Fault) = 0, changed to handle page faults by falling back to SW path. [#57291](https://github.com/ClickHouse/ClickHouse/pull/57291) ([jasperzhu](https://github.com/jinjunzh)).
|
||||||
|
* Increase default `replicated_deduplication_window` of MergeTree settings from 100 to 1k. [#57335](https://github.com/ClickHouse/ClickHouse/pull/57335) ([sichenzhao](https://github.com/sichenzhao)).
|
||||||
|
* Stop using `INCONSISTENT_METADATA_FOR_BACKUP` that much. If possible prefer to continue scanning instead of stopping and starting the scanning for backup from the beginning. [#57385](https://github.com/ClickHouse/ClickHouse/pull/57385) ([Vitaly Baranov](https://github.com/vitlibar)).
|
||||||
|
|
||||||
|
#### Build/Testing/Packaging Improvement
|
||||||
|
* Add SQLLogic test. [#56078](https://github.com/ClickHouse/ClickHouse/pull/56078) ([Han Fei](https://github.com/hanfei1991)).
|
||||||
|
* Make `clickhouse-local` and `clickhouse-client` available under short names (`ch`, `chl`, `chc`) for usability. [#56634](https://github.com/ClickHouse/ClickHouse/pull/56634) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Optimized build size further by removing unused code from external libraries. [#56786](https://github.com/ClickHouse/ClickHouse/pull/56786) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Add automatic check that there are no large translation units. [#56559](https://github.com/ClickHouse/ClickHouse/pull/56559) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Lower the size of the single-binary distribution. This closes [#55181](https://github.com/ClickHouse/ClickHouse/issues/55181). [#56617](https://github.com/ClickHouse/ClickHouse/pull/56617) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Information about the sizes of every translation unit and binary file after each build will be sent to the CI database in ClickHouse Cloud. This closes [#56107](https://github.com/ClickHouse/ClickHouse/issues/56107). [#56636](https://github.com/ClickHouse/ClickHouse/pull/56636) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Certain files of "Apache Arrow" library (which we use only for non-essential things like parsing the arrow format) were rebuilt all the time regardless of the build cache. This is fixed. [#56657](https://github.com/ClickHouse/ClickHouse/pull/56657) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Avoid recompiling translation units depending on the autogenerated source file about version. [#56660](https://github.com/ClickHouse/ClickHouse/pull/56660) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Tracing data of the linker invocations will be sent to the CI database in ClickHouse Cloud. [#56725](https://github.com/ClickHouse/ClickHouse/pull/56725) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Use DWARF 5 debug symbols for the clickhouse binary (was DWARF 4 previously). [#56770](https://github.com/ClickHouse/ClickHouse/pull/56770) ([Michael Kolupaev](https://github.com/al13n321)).
|
||||||
|
* Add a new build option `SANITIZE_COVERAGE`. If it is enabled, the code is instrumented to track the coverage. The collected information is available inside ClickHouse with: (1) a new function `coverage` that returns an array of unique addresses in the code found after the previous coverage reset; (2) `SYSTEM RESET COVERAGE` query that resets the accumulated data. This allows us to compare the coverage of different tests, including differential code coverage. Continuation of [#20539](https://github.com/ClickHouse/ClickHouse/issues/20539). [#56102](https://github.com/ClickHouse/ClickHouse/pull/56102) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Some of the stack frames might not be resolved when collecting stacks. In such cases the raw address might be helpful. [#56267](https://github.com/ClickHouse/ClickHouse/pull/56267) ([Alexander Gololobov](https://github.com/davenger)).
|
||||||
|
* Add an option to disable `libssh`. [#56333](https://github.com/ClickHouse/ClickHouse/pull/56333) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Enable temporary_data_in_cache in S3 tests in CI. [#48425](https://github.com/ClickHouse/ClickHouse/pull/48425) ([vdimir](https://github.com/vdimir)).
|
||||||
|
* Set the max memory usage for clickhouse-client (`1G`) in the CI. [#56873](https://github.com/ClickHouse/ClickHouse/pull/56873) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)).
|
||||||
|
|
||||||
|
#### Bug Fix (user-visible misbehavior in an official stable release)
|
||||||
|
* Fix exerimental Analyzer - insertion from select with subquery referencing insertion table should process only insertion block. [#50857](https://github.com/ClickHouse/ClickHouse/pull/50857) ([Yakov Olkhovskiy](https://github.com/yakov-olkhovskiy)).
|
||||||
|
* Fix a bug in `str_to_map` function. [#56423](https://github.com/ClickHouse/ClickHouse/pull/56423) ([Arthur Passos](https://github.com/arthurpassos)).
|
||||||
|
* Keeper `reconfig`: add timeout before yielding/taking leadership [#53481](https://github.com/ClickHouse/ClickHouse/pull/53481) ([Mike Kot](https://github.com/myrrc)).
|
||||||
|
* Fix incorrect header in grace hash join and filter pushdown [#53922](https://github.com/ClickHouse/ClickHouse/pull/53922) ([vdimir](https://github.com/vdimir)).
|
||||||
|
* Select from system tables when table based on table function. [#55540](https://github.com/ClickHouse/ClickHouse/pull/55540) ([MikhailBurdukov](https://github.com/MikhailBurdukov)).
|
||||||
|
* RFC: Fix "Cannot find column X in source stream" for Distributed queries with LIMIT BY [#55836](https://github.com/ClickHouse/ClickHouse/pull/55836) ([Azat Khuzhin](https://github.com/azat)).
|
||||||
|
* Fix 'Cannot read from file:' while running client in a background [#55976](https://github.com/ClickHouse/ClickHouse/pull/55976) ([Kruglov Pavel](https://github.com/Avogar)).
|
||||||
|
* Fix clickhouse-local exit on bad send_logs_level setting [#55994](https://github.com/ClickHouse/ClickHouse/pull/55994) ([Kruglov Pavel](https://github.com/Avogar)).
|
||||||
|
* Bug fix explain ast with parameterized view [#56004](https://github.com/ClickHouse/ClickHouse/pull/56004) ([SmitaRKulkarni](https://github.com/SmitaRKulkarni)).
|
||||||
|
* Fix a crash during table loading on startup [#56232](https://github.com/ClickHouse/ClickHouse/pull/56232) ([Nikolay Degterinsky](https://github.com/evillique)).
|
||||||
|
* Fix ClickHouse-sourced dictionaries with an explicit query [#56236](https://github.com/ClickHouse/ClickHouse/pull/56236) ([Nikolay Degterinsky](https://github.com/evillique)).
|
||||||
|
* Fix segfault in signal handler for Keeper [#56266](https://github.com/ClickHouse/ClickHouse/pull/56266) ([Antonio Andelic](https://github.com/antonio2368)).
|
||||||
|
* Fix incomplete query result for UNION in view() function. [#56274](https://github.com/ClickHouse/ClickHouse/pull/56274) ([Nikolai Kochetov](https://github.com/KochetovNicolai)).
|
||||||
|
* Fix inconsistency of "cast('0' as DateTime64(3))" and "cast('0' as Nullable(DateTime64(3)))" [#56286](https://github.com/ClickHouse/ClickHouse/pull/56286) ([李扬](https://github.com/taiyang-li)).
|
||||||
|
* Fix rare race condition related to Memory allocation failure [#56303](https://github.com/ClickHouse/ClickHouse/pull/56303) ([alesapin](https://github.com/alesapin)).
|
||||||
|
* Fix restore from backup with `flatten_nested` and `data_type_default_nullable` [#56306](https://github.com/ClickHouse/ClickHouse/pull/56306) ([Kseniia Sumarokova](https://github.com/kssenii)).
|
||||||
|
* Fix crash in case of adding a column with type Object(JSON) [#56307](https://github.com/ClickHouse/ClickHouse/pull/56307) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)).
|
||||||
|
* Fix crash in filterPushDown [#56380](https://github.com/ClickHouse/ClickHouse/pull/56380) ([vdimir](https://github.com/vdimir)).
|
||||||
|
* Fix restore from backup with mat view and dropped source table [#56383](https://github.com/ClickHouse/ClickHouse/pull/56383) ([Kseniia Sumarokova](https://github.com/kssenii)).
|
||||||
|
* Fix segfault during Kerberos initialization [#56401](https://github.com/ClickHouse/ClickHouse/pull/56401) ([Nikolay Degterinsky](https://github.com/evillique)).
|
||||||
|
* Fix buffer overflow in T64 [#56434](https://github.com/ClickHouse/ClickHouse/pull/56434) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Fix nullable primary key in final (2) [#56452](https://github.com/ClickHouse/ClickHouse/pull/56452) ([Amos Bird](https://github.com/amosbird)).
|
||||||
|
* Fix ON CLUSTER queries without database on initial node [#56484](https://github.com/ClickHouse/ClickHouse/pull/56484) ([Nikolay Degterinsky](https://github.com/evillique)).
|
||||||
|
* Fix startup failure due to TTL dependency [#56489](https://github.com/ClickHouse/ClickHouse/pull/56489) ([Nikolay Degterinsky](https://github.com/evillique)).
|
||||||
|
* Fix ALTER COMMENT queries ON CLUSTER [#56491](https://github.com/ClickHouse/ClickHouse/pull/56491) ([Nikolay Degterinsky](https://github.com/evillique)).
|
||||||
|
* Fix ALTER COLUMN with ALIAS [#56493](https://github.com/ClickHouse/ClickHouse/pull/56493) ([Nikolay Degterinsky](https://github.com/evillique)).
|
||||||
|
* Fix empty NAMED COLLECTIONs [#56494](https://github.com/ClickHouse/ClickHouse/pull/56494) ([Nikolay Degterinsky](https://github.com/evillique)).
|
||||||
|
* Fix two cases of projection analysis. [#56502](https://github.com/ClickHouse/ClickHouse/pull/56502) ([Amos Bird](https://github.com/amosbird)).
|
||||||
|
* Fix handling of aliases in query cache [#56545](https://github.com/ClickHouse/ClickHouse/pull/56545) ([Robert Schulze](https://github.com/rschu1ze)).
|
||||||
|
* Fix conversion from `Nullable(Enum)` to `Nullable(String)` [#56644](https://github.com/ClickHouse/ClickHouse/pull/56644) ([Nikolay Degterinsky](https://github.com/evillique)).
|
||||||
|
* More reliable log handling in Keeper [#56670](https://github.com/ClickHouse/ClickHouse/pull/56670) ([Antonio Andelic](https://github.com/antonio2368)).
|
||||||
|
* Fix configuration merge for nodes with substitution attributes [#56694](https://github.com/ClickHouse/ClickHouse/pull/56694) ([Konstantin Bogdanov](https://github.com/thevar1able)).
|
||||||
|
* Fix duplicate usage of table function input(). [#56695](https://github.com/ClickHouse/ClickHouse/pull/56695) ([Nikolai Kochetov](https://github.com/KochetovNicolai)).
|
||||||
|
* Fix: RabbitMQ OpenSSL dynamic loading issue [#56703](https://github.com/ClickHouse/ClickHouse/pull/56703) ([Igor Nikonov](https://github.com/devcrafter)).
|
||||||
|
* Fix crash in GCD codec in case when zeros present in data [#56704](https://github.com/ClickHouse/ClickHouse/pull/56704) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)).
|
||||||
|
* Fix 'mutex lock failed: Invalid argument' in clickhouse-local during insert into function [#56710](https://github.com/ClickHouse/ClickHouse/pull/56710) ([Kruglov Pavel](https://github.com/Avogar)).
|
||||||
|
* Fix Date text parsing in optimistic path [#56765](https://github.com/ClickHouse/ClickHouse/pull/56765) ([Kruglov Pavel](https://github.com/Avogar)).
|
||||||
|
* Fix crash in FPC codec [#56795](https://github.com/ClickHouse/ClickHouse/pull/56795) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* DatabaseReplicated: fix DDL query timeout after recovering a replica [#56796](https://github.com/ClickHouse/ClickHouse/pull/56796) ([Alexander Tokmakov](https://github.com/tavplubix)).
|
||||||
|
* Fix incorrect nullable columns reporting in MySQL binary protocol [#56799](https://github.com/ClickHouse/ClickHouse/pull/56799) ([Serge Klochkov](https://github.com/slvrtrn)).
|
||||||
|
* Support Iceberg metadata files for metastore tables [#56810](https://github.com/ClickHouse/ClickHouse/pull/56810) ([Kruglov Pavel](https://github.com/Avogar)).
|
||||||
|
* Fix TSAN report under transform [#56817](https://github.com/ClickHouse/ClickHouse/pull/56817) ([Raúl Marín](https://github.com/Algunenano)).
|
||||||
|
* Fix SET query and SETTINGS formatting [#56825](https://github.com/ClickHouse/ClickHouse/pull/56825) ([Nikolay Degterinsky](https://github.com/evillique)).
|
||||||
|
* Fix failure to start due to table dependency in joinGet [#56828](https://github.com/ClickHouse/ClickHouse/pull/56828) ([Nikolay Degterinsky](https://github.com/evillique)).
|
||||||
|
* Fix flattening existing Nested columns during ADD COLUMN [#56830](https://github.com/ClickHouse/ClickHouse/pull/56830) ([Nikolay Degterinsky](https://github.com/evillique)).
|
||||||
|
* Fix allow cr end of line for csv [#56901](https://github.com/ClickHouse/ClickHouse/pull/56901) ([KevinyhZou](https://github.com/KevinyhZou)).
|
||||||
|
* Fix `tryBase64Decode` with invalid input [#56913](https://github.com/ClickHouse/ClickHouse/pull/56913) ([Robert Schulze](https://github.com/rschu1ze)).
|
||||||
|
* Fix generating deep nested columns in CapnProto/Protobuf schemas [#56941](https://github.com/ClickHouse/ClickHouse/pull/56941) ([Kruglov Pavel](https://github.com/Avogar)).
|
||||||
|
* Prevent incompatible ALTER of projection columns [#56948](https://github.com/ClickHouse/ClickHouse/pull/56948) ([Amos Bird](https://github.com/amosbird)).
|
||||||
|
* Fix sqlite file path validation [#56984](https://github.com/ClickHouse/ClickHouse/pull/56984) ([San](https://github.com/santrancisco)).
|
||||||
|
* S3Queue: fix metadata reference increment [#56990](https://github.com/ClickHouse/ClickHouse/pull/56990) ([Kseniia Sumarokova](https://github.com/kssenii)).
|
||||||
|
* S3Queue minor fix [#56999](https://github.com/ClickHouse/ClickHouse/pull/56999) ([Kseniia Sumarokova](https://github.com/kssenii)).
|
||||||
|
* Fix file path validation for DatabaseFileSystem [#57029](https://github.com/ClickHouse/ClickHouse/pull/57029) ([San](https://github.com/santrancisco)).
|
||||||
|
* Fix `fuzzBits` with `ARRAY JOIN` [#57033](https://github.com/ClickHouse/ClickHouse/pull/57033) ([Antonio Andelic](https://github.com/antonio2368)).
|
||||||
|
* Fix Nullptr dereference in partial merge join with joined_subquery_re… [#57048](https://github.com/ClickHouse/ClickHouse/pull/57048) ([vdimir](https://github.com/vdimir)).
|
||||||
|
* Fix race condition in RemoteSource [#57052](https://github.com/ClickHouse/ClickHouse/pull/57052) ([Raúl Marín](https://github.com/Algunenano)).
|
||||||
|
* Implement `bitHammingDistance` for big integers [#57073](https://github.com/ClickHouse/ClickHouse/pull/57073) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* S3-style links bug fix [#57075](https://github.com/ClickHouse/ClickHouse/pull/57075) ([Yarik Briukhovetskyi](https://github.com/yariks5s)).
|
||||||
|
* Fix JSON_QUERY function with multiple numeric paths [#57096](https://github.com/ClickHouse/ClickHouse/pull/57096) ([KevinyhZou](https://github.com/KevinyhZou)).
|
||||||
|
* Fix buffer overflow in Gorilla codec [#57107](https://github.com/ClickHouse/ClickHouse/pull/57107) ([Nikolay Degterinsky](https://github.com/evillique)).
|
||||||
|
* Close interserver connection on any exception before authentication [#57142](https://github.com/ClickHouse/ClickHouse/pull/57142) ([Antonio Andelic](https://github.com/antonio2368)).
|
||||||
|
* Fix segfault after ALTER UPDATE with Nullable MATERIALIZED column [#57147](https://github.com/ClickHouse/ClickHouse/pull/57147) ([Nikolay Degterinsky](https://github.com/evillique)).
|
||||||
|
* Fix incorrect JOIN plan optimization with partially materialized normal projection [#57196](https://github.com/ClickHouse/ClickHouse/pull/57196) ([Amos Bird](https://github.com/amosbird)).
|
||||||
|
* Ignore comments when comparing column descriptions [#57259](https://github.com/ClickHouse/ClickHouse/pull/57259) ([Antonio Andelic](https://github.com/antonio2368)).
|
||||||
|
* Fix `ReadonlyReplica` metric for all cases [#57267](https://github.com/ClickHouse/ClickHouse/pull/57267) ([Antonio Andelic](https://github.com/antonio2368)).
|
||||||
|
* Background merges correctly use temporary data storage in the cache [#57275](https://github.com/ClickHouse/ClickHouse/pull/57275) ([vdimir](https://github.com/vdimir)).
|
||||||
|
* Keeper fix for changelog and snapshots [#57299](https://github.com/ClickHouse/ClickHouse/pull/57299) ([Antonio Andelic](https://github.com/antonio2368)).
|
||||||
|
* Ignore finished ON CLUSTER tasks if hostname changed [#57339](https://github.com/ClickHouse/ClickHouse/pull/57339) ([Alexander Tokmakov](https://github.com/tavplubix)).
|
||||||
|
* MergeTree mutations reuse source part index granularity [#57352](https://github.com/ClickHouse/ClickHouse/pull/57352) ([Maksim Kita](https://github.com/kitaisreal)).
|
||||||
|
* FS cache: add a limit for background download [#57424](https://github.com/ClickHouse/ClickHouse/pull/57424) ([Kseniia Sumarokova](https://github.com/kssenii)).
|
||||||
|
|
||||||
|
|
||||||
|
### <a id="2310"></a> ClickHouse release 23.10, 2023-11-02
|
||||||
|
|
||||||
#### Backward Incompatible Change
|
#### Backward Incompatible Change
|
||||||
* There is no longer an option to automatically remove broken data parts. This closes [#55174](https://github.com/ClickHouse/ClickHouse/issues/55174). [#55184](https://github.com/ClickHouse/ClickHouse/pull/55184) ([Alexey Milovidov](https://github.com/alexey-milovidov)). [#55557](https://github.com/ClickHouse/ClickHouse/pull/55557) ([Jihyuk Bok](https://github.com/tomahawk28)).
|
* There is no longer an option to automatically remove broken data parts. This closes [#55174](https://github.com/ClickHouse/ClickHouse/issues/55174). [#55184](https://github.com/ClickHouse/ClickHouse/pull/55184) ([Alexey Milovidov](https://github.com/alexey-milovidov)). [#55557](https://github.com/ClickHouse/ClickHouse/pull/55557) ([Jihyuk Bok](https://github.com/tomahawk28)).
|
||||||
@ -39,7 +251,7 @@
|
|||||||
* Allow to drop cache for Protobuf format with `SYSTEM DROP SCHEMA FORMAT CACHE [FOR Protobuf]`. [#55064](https://github.com/ClickHouse/ClickHouse/pull/55064) ([Aleksandr Musorin](https://github.com/AVMusorin)).
|
* Allow to drop cache for Protobuf format with `SYSTEM DROP SCHEMA FORMAT CACHE [FOR Protobuf]`. [#55064](https://github.com/ClickHouse/ClickHouse/pull/55064) ([Aleksandr Musorin](https://github.com/AVMusorin)).
|
||||||
* Add external HTTP Basic authenticator. [#55199](https://github.com/ClickHouse/ClickHouse/pull/55199) ([Aleksei Filatov](https://github.com/aalexfvk)).
|
* Add external HTTP Basic authenticator. [#55199](https://github.com/ClickHouse/ClickHouse/pull/55199) ([Aleksei Filatov](https://github.com/aalexfvk)).
|
||||||
* Added function `byteSwap` which reverses the bytes of unsigned integers. This is particularly useful for reversing values of types which are represented as unsigned integers internally such as IPv4. [#55211](https://github.com/ClickHouse/ClickHouse/pull/55211) ([Priyansh Agrawal](https://github.com/Priyansh121096)).
|
* Added function `byteSwap` which reverses the bytes of unsigned integers. This is particularly useful for reversing values of types which are represented as unsigned integers internally such as IPv4. [#55211](https://github.com/ClickHouse/ClickHouse/pull/55211) ([Priyansh Agrawal](https://github.com/Priyansh121096)).
|
||||||
* Added function `formatQuery()` which returns a formatted version (possibly spanning multiple lines) of a SQL query string. Also added function `formatQuerySingleLine()` which does the same but the returned string will not contain linebreaks. [#55239](https://github.com/ClickHouse/ClickHouse/pull/55239) ([Salvatore Mesoraca](https://github.com/aiven-sal)).
|
* Added function `formatQuery` which returns a formatted version (possibly spanning multiple lines) of a SQL query string. Also added function `formatQuerySingleLine` which does the same but the returned string will not contain linebreaks. [#55239](https://github.com/ClickHouse/ClickHouse/pull/55239) ([Salvatore Mesoraca](https://github.com/aiven-sal)).
|
||||||
* Added `DWARF` input format that reads debug symbols from an ELF executable/library/object file. [#55450](https://github.com/ClickHouse/ClickHouse/pull/55450) ([Michael Kolupaev](https://github.com/al13n321)).
|
* Added `DWARF` input format that reads debug symbols from an ELF executable/library/object file. [#55450](https://github.com/ClickHouse/ClickHouse/pull/55450) ([Michael Kolupaev](https://github.com/al13n321)).
|
||||||
* Allow to save unparsed records and errors in RabbitMQ, NATS and FileLog engines. Add virtual columns `_error` and `_raw_message`(for NATS and RabbitMQ), `_raw_record` (for FileLog) that are filled when ClickHouse fails to parse new record. The behaviour is controlled under storage settings `nats_handle_error_mode` for NATS, `rabbitmq_handle_error_mode` for RabbitMQ, `handle_error_mode` for FileLog similar to `kafka_handle_error_mode`. If it's set to `default`, en exception will be thrown when ClickHouse fails to parse a record, if it's set to `stream`, erorr and raw record will be saved into virtual columns. Closes [#36035](https://github.com/ClickHouse/ClickHouse/issues/36035). [#55477](https://github.com/ClickHouse/ClickHouse/pull/55477) ([Kruglov Pavel](https://github.com/Avogar)).
|
* Allow to save unparsed records and errors in RabbitMQ, NATS and FileLog engines. Add virtual columns `_error` and `_raw_message`(for NATS and RabbitMQ), `_raw_record` (for FileLog) that are filled when ClickHouse fails to parse new record. The behaviour is controlled under storage settings `nats_handle_error_mode` for NATS, `rabbitmq_handle_error_mode` for RabbitMQ, `handle_error_mode` for FileLog similar to `kafka_handle_error_mode`. If it's set to `default`, en exception will be thrown when ClickHouse fails to parse a record, if it's set to `stream`, erorr and raw record will be saved into virtual columns. Closes [#36035](https://github.com/ClickHouse/ClickHouse/issues/36035). [#55477](https://github.com/ClickHouse/ClickHouse/pull/55477) ([Kruglov Pavel](https://github.com/Avogar)).
|
||||||
* Keeper client improvement: add `get_all_children_number command` that returns number of all children nodes under a specific path. [#55485](https://github.com/ClickHouse/ClickHouse/pull/55485) ([guoxiaolong](https://github.com/guoxiaolongzte)).
|
* Keeper client improvement: add `get_all_children_number command` that returns number of all children nodes under a specific path. [#55485](https://github.com/ClickHouse/ClickHouse/pull/55485) ([guoxiaolong](https://github.com/guoxiaolongzte)).
|
||||||
@ -74,11 +286,11 @@
|
|||||||
* Reduced memory consumption during loading of hierarchical dictionaries. [#55838](https://github.com/ClickHouse/ClickHouse/pull/55838) ([Nikita Taranov](https://github.com/nickitat)).
|
* Reduced memory consumption during loading of hierarchical dictionaries. [#55838](https://github.com/ClickHouse/ClickHouse/pull/55838) ([Nikita Taranov](https://github.com/nickitat)).
|
||||||
* All dictionaries support setting `dictionary_use_async_executor`. [#55839](https://github.com/ClickHouse/ClickHouse/pull/55839) ([vdimir](https://github.com/vdimir)).
|
* All dictionaries support setting `dictionary_use_async_executor`. [#55839](https://github.com/ClickHouse/ClickHouse/pull/55839) ([vdimir](https://github.com/vdimir)).
|
||||||
* Prevent excesive memory usage when deserializing AggregateFunctionTopKGenericData. [#55947](https://github.com/ClickHouse/ClickHouse/pull/55947) ([Raúl Marín](https://github.com/Algunenano)).
|
* Prevent excesive memory usage when deserializing AggregateFunctionTopKGenericData. [#55947](https://github.com/ClickHouse/ClickHouse/pull/55947) ([Raúl Marín](https://github.com/Algunenano)).
|
||||||
* On a Keeper with lots of watches AsyncMetrics threads can consume 100% of CPU for noticable time in `DB::KeeperStorage::getSessionsWithWatchesCount()`. The fix is to avoid traversing heavy `watches` and `list_watches` sets. [#56054](https://github.com/ClickHouse/ClickHouse/pull/56054) ([Alexander Gololobov](https://github.com/davenger)).
|
* On a Keeper with lots of watches AsyncMetrics threads can consume 100% of CPU for noticable time in `DB::KeeperStorage::getSessionsWithWatchesCount`. The fix is to avoid traversing heavy `watches` and `list_watches` sets. [#56054](https://github.com/ClickHouse/ClickHouse/pull/56054) ([Alexander Gololobov](https://github.com/davenger)).
|
||||||
* Add setting `optimize_trivial_approximate_count_query` to use `count()` approximation for storage EmbeddedRocksDB. Enable trivial count for StorageJoin. [#55806](https://github.com/ClickHouse/ClickHouse/pull/55806) ([Duc Canh Le](https://github.com/canhld94)).
|
* Add setting `optimize_trivial_approximate_count_query` to use `count` approximation for storage EmbeddedRocksDB. Enable trivial count for StorageJoin. [#55806](https://github.com/ClickHouse/ClickHouse/pull/55806) ([Duc Canh Le](https://github.com/canhld94)).
|
||||||
|
|
||||||
#### Improvement
|
#### Improvement
|
||||||
* Functions `toDayOfWeek()` (MySQL alias: `DAYOFWEEK()`), `toYearWeek()` (`YEARWEEK()`) and `toWeek()` (`WEEK()`) now supports `String` arguments. This makes its behavior consistent with MySQL's behavior. [#55589](https://github.com/ClickHouse/ClickHouse/pull/55589) ([Robert Schulze](https://github.com/rschu1ze)).
|
* Functions `toDayOfWeek` (MySQL alias: `DAYOFWEEK`), `toYearWeek` (`YEARWEEK`) and `toWeek` (`WEEK`) now supports `String` arguments. This makes its behavior consistent with MySQL's behavior. [#55589](https://github.com/ClickHouse/ClickHouse/pull/55589) ([Robert Schulze](https://github.com/rschu1ze)).
|
||||||
* Introduced setting `date_time_overflow_behavior` with possible values `ignore`, `throw`, `saturate` that controls the overflow behavior when converting from Date, Date32, DateTime64, Integer or Float to Date, Date32, DateTime or DateTime64. [#55696](https://github.com/ClickHouse/ClickHouse/pull/55696) ([Andrey Zvonov](https://github.com/zvonand)).
|
* Introduced setting `date_time_overflow_behavior` with possible values `ignore`, `throw`, `saturate` that controls the overflow behavior when converting from Date, Date32, DateTime64, Integer or Float to Date, Date32, DateTime or DateTime64. [#55696](https://github.com/ClickHouse/ClickHouse/pull/55696) ([Andrey Zvonov](https://github.com/zvonand)).
|
||||||
* Implement query parameters support for `ALTER TABLE ... ACTION PARTITION [ID] {parameter_name:ParameterType}`. Merges [#49516](https://github.com/ClickHouse/ClickHouse/issues/49516). Closes [#49449](https://github.com/ClickHouse/ClickHouse/issues/49449). [#55604](https://github.com/ClickHouse/ClickHouse/pull/55604) ([alesapin](https://github.com/alesapin)).
|
* Implement query parameters support for `ALTER TABLE ... ACTION PARTITION [ID] {parameter_name:ParameterType}`. Merges [#49516](https://github.com/ClickHouse/ClickHouse/issues/49516). Closes [#49449](https://github.com/ClickHouse/ClickHouse/issues/49449). [#55604](https://github.com/ClickHouse/ClickHouse/pull/55604) ([alesapin](https://github.com/alesapin)).
|
||||||
* Print processor ids in a prettier manner in EXPLAIN. [#48852](https://github.com/ClickHouse/ClickHouse/pull/48852) ([Vlad Seliverstov](https://github.com/behebot)).
|
* Print processor ids in a prettier manner in EXPLAIN. [#48852](https://github.com/ClickHouse/ClickHouse/pull/48852) ([Vlad Seliverstov](https://github.com/behebot)).
|
||||||
@ -112,7 +324,7 @@
|
|||||||
* Functions `(add|subtract)(Year|Quarter|Month|Week|Day|Hour|Minute|Second|Millisecond|Microsecond|Nanosecond)` now support string-encoded date arguments, e.g. `SELECT addDays('2023-10-22', 1)`. This increases compatibility with MySQL and is needed by Tableau Online. [#55869](https://github.com/ClickHouse/ClickHouse/pull/55869) ([Robert Schulze](https://github.com/rschu1ze)).
|
* Functions `(add|subtract)(Year|Quarter|Month|Week|Day|Hour|Minute|Second|Millisecond|Microsecond|Nanosecond)` now support string-encoded date arguments, e.g. `SELECT addDays('2023-10-22', 1)`. This increases compatibility with MySQL and is needed by Tableau Online. [#55869](https://github.com/ClickHouse/ClickHouse/pull/55869) ([Robert Schulze](https://github.com/rschu1ze)).
|
||||||
* The setting `apply_deleted_mask` when disabled allows to read rows that where marked as deleted by lightweight DELETE queries. This is useful for debugging. [#55952](https://github.com/ClickHouse/ClickHouse/pull/55952) ([Alexander Gololobov](https://github.com/davenger)).
|
* The setting `apply_deleted_mask` when disabled allows to read rows that where marked as deleted by lightweight DELETE queries. This is useful for debugging. [#55952](https://github.com/ClickHouse/ClickHouse/pull/55952) ([Alexander Gololobov](https://github.com/davenger)).
|
||||||
* Allow skipping `null` values when serailizing Tuple to json objects, which makes it possible to keep compatiability with Spark's `to_json` function, which is also useful for gluten. [#55956](https://github.com/ClickHouse/ClickHouse/pull/55956) ([李扬](https://github.com/taiyang-li)).
|
* Allow skipping `null` values when serailizing Tuple to json objects, which makes it possible to keep compatiability with Spark's `to_json` function, which is also useful for gluten. [#55956](https://github.com/ClickHouse/ClickHouse/pull/55956) ([李扬](https://github.com/taiyang-li)).
|
||||||
* Functions `(add|sub)Date()` now support string-encoded date arguments, e.g. `SELECT addDate('2023-10-22 11:12:13', INTERVAL 5 MINUTE)`. The same support for string-encoded date arguments is added to the plus and minus operators, e.g. `SELECT '2023-10-23' + INTERVAL 1 DAY`. This increases compatibility with MySQL and is needed by Tableau Online. [#55960](https://github.com/ClickHouse/ClickHouse/pull/55960) ([Robert Schulze](https://github.com/rschu1ze)).
|
* Functions `(add|sub)Date` now support string-encoded date arguments, e.g. `SELECT addDate('2023-10-22 11:12:13', INTERVAL 5 MINUTE)`. The same support for string-encoded date arguments is added to the plus and minus operators, e.g. `SELECT '2023-10-23' + INTERVAL 1 DAY`. This increases compatibility with MySQL and is needed by Tableau Online. [#55960](https://github.com/ClickHouse/ClickHouse/pull/55960) ([Robert Schulze](https://github.com/rschu1ze)).
|
||||||
* Allow unquoted strings with CR (`\r`) in CSV format. Closes [#39930](https://github.com/ClickHouse/ClickHouse/issues/39930). [#56046](https://github.com/ClickHouse/ClickHouse/pull/56046) ([Kruglov Pavel](https://github.com/Avogar)).
|
* Allow unquoted strings with CR (`\r`) in CSV format. Closes [#39930](https://github.com/ClickHouse/ClickHouse/issues/39930). [#56046](https://github.com/ClickHouse/ClickHouse/pull/56046) ([Kruglov Pavel](https://github.com/Avogar)).
|
||||||
* Allow to run `clickhouse-keeper` using embedded config. [#56086](https://github.com/ClickHouse/ClickHouse/pull/56086) ([Maksim Kita](https://github.com/kitaisreal)).
|
* Allow to run `clickhouse-keeper` using embedded config. [#56086](https://github.com/ClickHouse/ClickHouse/pull/56086) ([Maksim Kita](https://github.com/kitaisreal)).
|
||||||
* Set limit of the maximum configuration value for `queued.min.messages` to avoid problem with start fetching data with Kafka. [#56121](https://github.com/ClickHouse/ClickHouse/pull/56121) ([Stas Morozov](https://github.com/r3b-fish)).
|
* Set limit of the maximum configuration value for `queued.min.messages` to avoid problem with start fetching data with Kafka. [#56121](https://github.com/ClickHouse/ClickHouse/pull/56121) ([Stas Morozov](https://github.com/r3b-fish)).
|
||||||
@ -133,7 +345,7 @@
|
|||||||
* Fixed bug of `match` function (regex) with pattern containing alternation produces incorrect key condition. Closes #53222. [#54696](https://github.com/ClickHouse/ClickHouse/pull/54696) ([Yakov Olkhovskiy](https://github.com/yakov-olkhovskiy)).
|
* Fixed bug of `match` function (regex) with pattern containing alternation produces incorrect key condition. Closes #53222. [#54696](https://github.com/ClickHouse/ClickHouse/pull/54696) ([Yakov Olkhovskiy](https://github.com/yakov-olkhovskiy)).
|
||||||
* Fix 'Cannot find column' in read-in-order optimization with ARRAY JOIN [#51746](https://github.com/ClickHouse/ClickHouse/pull/51746) ([Nikolai Kochetov](https://github.com/KochetovNicolai)).
|
* Fix 'Cannot find column' in read-in-order optimization with ARRAY JOIN [#51746](https://github.com/ClickHouse/ClickHouse/pull/51746) ([Nikolai Kochetov](https://github.com/KochetovNicolai)).
|
||||||
* Support missed experimental `Object(Nullable(json))` subcolumns in query. [#54052](https://github.com/ClickHouse/ClickHouse/pull/54052) ([zps](https://github.com/VanDarkholme7)).
|
* Support missed experimental `Object(Nullable(json))` subcolumns in query. [#54052](https://github.com/ClickHouse/ClickHouse/pull/54052) ([zps](https://github.com/VanDarkholme7)).
|
||||||
* Re-add fix for `accurateCastOrNull()` [#54629](https://github.com/ClickHouse/ClickHouse/pull/54629) ([Salvatore Mesoraca](https://github.com/aiven-sal)).
|
* Re-add fix for `accurateCastOrNull` [#54629](https://github.com/ClickHouse/ClickHouse/pull/54629) ([Salvatore Mesoraca](https://github.com/aiven-sal)).
|
||||||
* Fix detecting `DEFAULT` for columns of a Distributed table created without AS [#55060](https://github.com/ClickHouse/ClickHouse/pull/55060) ([Vitaly Baranov](https://github.com/vitlibar)).
|
* Fix detecting `DEFAULT` for columns of a Distributed table created without AS [#55060](https://github.com/ClickHouse/ClickHouse/pull/55060) ([Vitaly Baranov](https://github.com/vitlibar)).
|
||||||
* Proper cleanup in case of exception in ctor of ShellCommandSource [#55103](https://github.com/ClickHouse/ClickHouse/pull/55103) ([Alexander Gololobov](https://github.com/davenger)).
|
* Proper cleanup in case of exception in ctor of ShellCommandSource [#55103](https://github.com/ClickHouse/ClickHouse/pull/55103) ([Alexander Gololobov](https://github.com/davenger)).
|
||||||
* Fix deadlock in LDAP assigned role update [#55119](https://github.com/ClickHouse/ClickHouse/pull/55119) ([Julian Maicher](https://github.com/jmaicher)).
|
* Fix deadlock in LDAP assigned role update [#55119](https://github.com/ClickHouse/ClickHouse/pull/55119) ([Julian Maicher](https://github.com/jmaicher)).
|
||||||
@ -191,7 +403,7 @@
|
|||||||
* Add error handler to odbc-bridge [#56185](https://github.com/ClickHouse/ClickHouse/pull/56185) ([Yakov Olkhovskiy](https://github.com/yakov-olkhovskiy)).
|
* Add error handler to odbc-bridge [#56185](https://github.com/ClickHouse/ClickHouse/pull/56185) ([Yakov Olkhovskiy](https://github.com/yakov-olkhovskiy)).
|
||||||
|
|
||||||
|
|
||||||
### ClickHouse release 23.9, 2023-09-28
|
### <a id="239"></a> ClickHouse release 23.9, 2023-09-28
|
||||||
|
|
||||||
#### Backward Incompatible Change
|
#### Backward Incompatible Change
|
||||||
* Remove the `status_info` configuration option and dictionaries status from the default Prometheus handler. [#54090](https://github.com/ClickHouse/ClickHouse/pull/54090) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
* Remove the `status_info` configuration option and dictionaries status from the default Prometheus handler. [#54090](https://github.com/ClickHouse/ClickHouse/pull/54090) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
@ -213,7 +425,7 @@
|
|||||||
* Add function `decodeHTMLComponent`. [#54097](https://github.com/ClickHouse/ClickHouse/pull/54097) ([Bharat Nallan](https://github.com/bharatnc)).
|
* Add function `decodeHTMLComponent`. [#54097](https://github.com/ClickHouse/ClickHouse/pull/54097) ([Bharat Nallan](https://github.com/bharatnc)).
|
||||||
* Added `peak_threads_usage` to query_log table. [#54335](https://github.com/ClickHouse/ClickHouse/pull/54335) ([Alexey Gerasimchuck](https://github.com/Demilivor)).
|
* Added `peak_threads_usage` to query_log table. [#54335](https://github.com/ClickHouse/ClickHouse/pull/54335) ([Alexey Gerasimchuck](https://github.com/Demilivor)).
|
||||||
* Add `SHOW FUNCTIONS` support to clickhouse-client. [#54337](https://github.com/ClickHouse/ClickHouse/pull/54337) ([Julia Kartseva](https://github.com/wat-ze-hex)).
|
* Add `SHOW FUNCTIONS` support to clickhouse-client. [#54337](https://github.com/ClickHouse/ClickHouse/pull/54337) ([Julia Kartseva](https://github.com/wat-ze-hex)).
|
||||||
* Added function `toDaysSinceYearZero` with alias `TO_DAYS` (for compatibility with MySQL) which returns the number of days passed since `0001-01-01` (in Proleptic Gregorian Calendar). [#54479](https://github.com/ClickHouse/ClickHouse/pull/54479) ([Robert Schulze](https://github.com/rschu1ze)). Function `toDaysSinceYearZero()` now supports arguments of type `DateTime` and `DateTime64`. [#54856](https://github.com/ClickHouse/ClickHouse/pull/54856) ([Serge Klochkov](https://github.com/slvrtrn)).
|
* Added function `toDaysSinceYearZero` with alias `TO_DAYS` (for compatibility with MySQL) which returns the number of days passed since `0001-01-01` (in Proleptic Gregorian Calendar). [#54479](https://github.com/ClickHouse/ClickHouse/pull/54479) ([Robert Schulze](https://github.com/rschu1ze)). Function `toDaysSinceYearZero` now supports arguments of type `DateTime` and `DateTime64`. [#54856](https://github.com/ClickHouse/ClickHouse/pull/54856) ([Serge Klochkov](https://github.com/slvrtrn)).
|
||||||
* Added functions `YYYYMMDDtoDate`, `YYYYMMDDtoDate32`, `YYYYMMDDhhmmssToDateTime` and `YYYYMMDDhhmmssToDateTime64`. They convert a date or date with time encoded as integer (e.g. 20230911) into a native date or date with time. As such, they provide the opposite functionality of existing functions `YYYYMMDDToDate`, `YYYYMMDDToDateTime`, `YYYYMMDDhhmmddToDateTime`, `YYYYMMDDhhmmddToDateTime64`. [#54509](https://github.com/ClickHouse/ClickHouse/pull/54509) ([Quanfa Fu](https://github.com/dentiscalprum)) ([Robert Schulze](https://github.com/rschu1ze)).
|
* Added functions `YYYYMMDDtoDate`, `YYYYMMDDtoDate32`, `YYYYMMDDhhmmssToDateTime` and `YYYYMMDDhhmmssToDateTime64`. They convert a date or date with time encoded as integer (e.g. 20230911) into a native date or date with time. As such, they provide the opposite functionality of existing functions `YYYYMMDDToDate`, `YYYYMMDDToDateTime`, `YYYYMMDDhhmmddToDateTime`, `YYYYMMDDhhmmddToDateTime64`. [#54509](https://github.com/ClickHouse/ClickHouse/pull/54509) ([Quanfa Fu](https://github.com/dentiscalprum)) ([Robert Schulze](https://github.com/rschu1ze)).
|
||||||
* Add several string distance functions, including `byteHammingDistance`, `editDistance`. [#54935](https://github.com/ClickHouse/ClickHouse/pull/54935) ([flynn](https://github.com/ucasfl)).
|
* Add several string distance functions, including `byteHammingDistance`, `editDistance`. [#54935](https://github.com/ClickHouse/ClickHouse/pull/54935) ([flynn](https://github.com/ucasfl)).
|
||||||
* Allow specifying the expiration date and, optionally, the time for user credentials with `VALID UNTIL datetime` clause. [#51261](https://github.com/ClickHouse/ClickHouse/pull/51261) ([Nikolay Degterinsky](https://github.com/evillique)).
|
* Allow specifying the expiration date and, optionally, the time for user credentials with `VALID UNTIL datetime` clause. [#51261](https://github.com/ClickHouse/ClickHouse/pull/51261) ([Nikolay Degterinsky](https://github.com/evillique)).
|
||||||
@ -229,7 +441,7 @@
|
|||||||
* An optimization to rewrite `COUNT(DISTINCT ...)` and various `uniq` variants to `count` if it is selected from a subquery with GROUP BY. [#52082](https://github.com/ClickHouse/ClickHouse/pull/52082) [#52645](https://github.com/ClickHouse/ClickHouse/pull/52645) ([JackyWoo](https://github.com/JackyWoo)).
|
* An optimization to rewrite `COUNT(DISTINCT ...)` and various `uniq` variants to `count` if it is selected from a subquery with GROUP BY. [#52082](https://github.com/ClickHouse/ClickHouse/pull/52082) [#52645](https://github.com/ClickHouse/ClickHouse/pull/52645) ([JackyWoo](https://github.com/JackyWoo)).
|
||||||
* Remove manual calls to `mmap/mremap/munmap` and delegate all this work to `jemalloc` - and it slightly improves performance. [#52792](https://github.com/ClickHouse/ClickHouse/pull/52792) ([Nikita Taranov](https://github.com/nickitat)).
|
* Remove manual calls to `mmap/mremap/munmap` and delegate all this work to `jemalloc` - and it slightly improves performance. [#52792](https://github.com/ClickHouse/ClickHouse/pull/52792) ([Nikita Taranov](https://github.com/nickitat)).
|
||||||
* Fixed high in CPU consumption when working with NATS. [#54399](https://github.com/ClickHouse/ClickHouse/pull/54399) ([Vasilev Pyotr](https://github.com/vahpetr)).
|
* Fixed high in CPU consumption when working with NATS. [#54399](https://github.com/ClickHouse/ClickHouse/pull/54399) ([Vasilev Pyotr](https://github.com/vahpetr)).
|
||||||
* Since we use separate instructions for executing `toString()` with datetime argument, it is possible to improve performance a bit for non-datetime arguments and have some parts of the code cleaner. Follows up [#53680](https://github.com/ClickHouse/ClickHouse/issues/53680). [#54443](https://github.com/ClickHouse/ClickHouse/pull/54443) ([Yarik Briukhovetskyi](https://github.com/yariks5s)).
|
* Since we use separate instructions for executing `toString` with datetime argument, it is possible to improve performance a bit for non-datetime arguments and have some parts of the code cleaner. Follows up [#53680](https://github.com/ClickHouse/ClickHouse/issues/53680). [#54443](https://github.com/ClickHouse/ClickHouse/pull/54443) ([Yarik Briukhovetskyi](https://github.com/yariks5s)).
|
||||||
* Instead of serializing json elements into a `std::stringstream`, this PR try to put the serialization result into `ColumnString` direclty. [#54613](https://github.com/ClickHouse/ClickHouse/pull/54613) ([lgbo](https://github.com/lgbo-ustc)).
|
* Instead of serializing json elements into a `std::stringstream`, this PR try to put the serialization result into `ColumnString` direclty. [#54613](https://github.com/ClickHouse/ClickHouse/pull/54613) ([lgbo](https://github.com/lgbo-ustc)).
|
||||||
* Enable ORDER BY optimization for reading data in corresponding order from a MergeTree table in case that the table is behind a view. [#54628](https://github.com/ClickHouse/ClickHouse/pull/54628) ([Vitaly Baranov](https://github.com/vitlibar)).
|
* Enable ORDER BY optimization for reading data in corresponding order from a MergeTree table in case that the table is behind a view. [#54628](https://github.com/ClickHouse/ClickHouse/pull/54628) ([Vitaly Baranov](https://github.com/vitlibar)).
|
||||||
* Improve JSON SQL functions by reusing `GeneratorJSONPath` and removing several shared pointers. [#54735](https://github.com/ClickHouse/ClickHouse/pull/54735) ([lgbo](https://github.com/lgbo-ustc)).
|
* Improve JSON SQL functions by reusing `GeneratorJSONPath` and removing several shared pointers. [#54735](https://github.com/ClickHouse/ClickHouse/pull/54735) ([lgbo](https://github.com/lgbo-ustc)).
|
||||||
@ -479,7 +691,7 @@
|
|||||||
* The `domainRFC` function now supports IPv6 in square brackets. [#53506](https://github.com/ClickHouse/ClickHouse/pull/53506) ([Chen768959](https://github.com/Chen768959)).
|
* The `domainRFC` function now supports IPv6 in square brackets. [#53506](https://github.com/ClickHouse/ClickHouse/pull/53506) ([Chen768959](https://github.com/Chen768959)).
|
||||||
* Use longer timeout for S3 CopyObject requests, which are used in backups. [#53533](https://github.com/ClickHouse/ClickHouse/pull/53533) ([Michael Kolupaev](https://github.com/al13n321)).
|
* Use longer timeout for S3 CopyObject requests, which are used in backups. [#53533](https://github.com/ClickHouse/ClickHouse/pull/53533) ([Michael Kolupaev](https://github.com/al13n321)).
|
||||||
* Added server setting `aggregate_function_group_array_max_element_size`. This setting is used to limit array size for `groupArray` function at serialization. The default value is `16777215`. [#53550](https://github.com/ClickHouse/ClickHouse/pull/53550) ([Nikolai Kochetov](https://github.com/KochetovNicolai)).
|
* Added server setting `aggregate_function_group_array_max_element_size`. This setting is used to limit array size for `groupArray` function at serialization. The default value is `16777215`. [#53550](https://github.com/ClickHouse/ClickHouse/pull/53550) ([Nikolai Kochetov](https://github.com/KochetovNicolai)).
|
||||||
* `SCHEMA()` was added as alias for `DATABASE()` to improve MySQL compatibility. [#53587](https://github.com/ClickHouse/ClickHouse/pull/53587) ([Daniël van Eeden](https://github.com/dveeden)).
|
* `SCHEMA` was added as alias for `DATABASE` to improve MySQL compatibility. [#53587](https://github.com/ClickHouse/ClickHouse/pull/53587) ([Daniël van Eeden](https://github.com/dveeden)).
|
||||||
* Add asynchronous metrics about tables in the system database. For example, `TotalBytesOfMergeTreeTablesSystem`. This closes [#53603](https://github.com/ClickHouse/ClickHouse/issues/53603). [#53604](https://github.com/ClickHouse/ClickHouse/pull/53604) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
* Add asynchronous metrics about tables in the system database. For example, `TotalBytesOfMergeTreeTablesSystem`. This closes [#53603](https://github.com/ClickHouse/ClickHouse/issues/53603). [#53604](https://github.com/ClickHouse/ClickHouse/pull/53604) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
* SQL editor in the Play UI and Dashboard will not use Grammarly. [#53614](https://github.com/ClickHouse/ClickHouse/pull/53614) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
* SQL editor in the Play UI and Dashboard will not use Grammarly. [#53614](https://github.com/ClickHouse/ClickHouse/pull/53614) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
* As expert-level settings, it is now possible to (1) configure the size_ratio (i.e. the relative size of the protected queue) of the [index] mark/uncompressed caches, (2) configure the cache policy of the index mark and index uncompressed caches. [#53657](https://github.com/ClickHouse/ClickHouse/pull/53657) ([Robert Schulze](https://github.com/rschu1ze)).
|
* As expert-level settings, it is now possible to (1) configure the size_ratio (i.e. the relative size of the protected queue) of the [index] mark/uncompressed caches, (2) configure the cache policy of the index mark and index uncompressed caches. [#53657](https://github.com/ClickHouse/ClickHouse/pull/53657) ([Robert Schulze](https://github.com/rschu1ze)).
|
||||||
@ -741,7 +953,7 @@
|
|||||||
* Disable expression templates for time intervals [#52335](https://github.com/ClickHouse/ClickHouse/pull/52335) ([Alexander Tokmakov](https://github.com/tavplubix)).
|
* Disable expression templates for time intervals [#52335](https://github.com/ClickHouse/ClickHouse/pull/52335) ([Alexander Tokmakov](https://github.com/tavplubix)).
|
||||||
* Fix `apply_snapshot` in Keeper [#52358](https://github.com/ClickHouse/ClickHouse/pull/52358) ([Antonio Andelic](https://github.com/antonio2368)).
|
* Fix `apply_snapshot` in Keeper [#52358](https://github.com/ClickHouse/ClickHouse/pull/52358) ([Antonio Andelic](https://github.com/antonio2368)).
|
||||||
* Update build-osx.md [#52377](https://github.com/ClickHouse/ClickHouse/pull/52377) ([AlexBykovski](https://github.com/AlexBykovski)).
|
* Update build-osx.md [#52377](https://github.com/ClickHouse/ClickHouse/pull/52377) ([AlexBykovski](https://github.com/AlexBykovski)).
|
||||||
* Fix `countSubstrings()` hang with empty needle and a column haystack [#52409](https://github.com/ClickHouse/ClickHouse/pull/52409) ([Sergei Trifonov](https://github.com/serxa)).
|
* Fix `countSubstrings` hang with empty needle and a column haystack [#52409](https://github.com/ClickHouse/ClickHouse/pull/52409) ([Sergei Trifonov](https://github.com/serxa)).
|
||||||
* Fix normal projection with merge table [#52432](https://github.com/ClickHouse/ClickHouse/pull/52432) ([Amos Bird](https://github.com/amosbird)).
|
* Fix normal projection with merge table [#52432](https://github.com/ClickHouse/ClickHouse/pull/52432) ([Amos Bird](https://github.com/amosbird)).
|
||||||
* Fix possible double-free in Aggregator [#52439](https://github.com/ClickHouse/ClickHouse/pull/52439) ([Nikita Taranov](https://github.com/nickitat)).
|
* Fix possible double-free in Aggregator [#52439](https://github.com/ClickHouse/ClickHouse/pull/52439) ([Nikita Taranov](https://github.com/nickitat)).
|
||||||
* Fixed inserting into Buffer engine [#52440](https://github.com/ClickHouse/ClickHouse/pull/52440) ([Vasily Nemkov](https://github.com/Enmk)).
|
* Fixed inserting into Buffer engine [#52440](https://github.com/ClickHouse/ClickHouse/pull/52440) ([Vasily Nemkov](https://github.com/Enmk)).
|
||||||
@ -1585,7 +1797,7 @@
|
|||||||
* A couple of segfaults have been reported around `c-ares`. They were introduced in my previous pull requests. I have fixed them with the help of Alexander Tokmakov. [#45629](https://github.com/ClickHouse/ClickHouse/pull/45629) ([Arthur Passos](https://github.com/arthurpassos)).
|
* A couple of segfaults have been reported around `c-ares`. They were introduced in my previous pull requests. I have fixed them with the help of Alexander Tokmakov. [#45629](https://github.com/ClickHouse/ClickHouse/pull/45629) ([Arthur Passos](https://github.com/arthurpassos)).
|
||||||
* Fix key description when encountering duplicate primary keys. This can happen in projections. See [#45590](https://github.com/ClickHouse/ClickHouse/issues/45590) for details. [#45686](https://github.com/ClickHouse/ClickHouse/pull/45686) ([Amos Bird](https://github.com/amosbird)).
|
* Fix key description when encountering duplicate primary keys. This can happen in projections. See [#45590](https://github.com/ClickHouse/ClickHouse/issues/45590) for details. [#45686](https://github.com/ClickHouse/ClickHouse/pull/45686) ([Amos Bird](https://github.com/amosbird)).
|
||||||
* Set compression method and level for backup Closes [#45690](https://github.com/ClickHouse/ClickHouse/issues/45690). [#45737](https://github.com/ClickHouse/ClickHouse/pull/45737) ([Pradeep Chhetri](https://github.com/chhetripradeep)).
|
* Set compression method and level for backup Closes [#45690](https://github.com/ClickHouse/ClickHouse/issues/45690). [#45737](https://github.com/ClickHouse/ClickHouse/pull/45737) ([Pradeep Chhetri](https://github.com/chhetripradeep)).
|
||||||
* Should use `select_query_typed.limitByOffset()` instead of `select_query_typed.limitOffset()`. [#45817](https://github.com/ClickHouse/ClickHouse/pull/45817) ([刘陶峰](https://github.com/taofengliu)).
|
* Should use `select_query_typed.limitByOffset` instead of `select_query_typed.limitOffset`. [#45817](https://github.com/ClickHouse/ClickHouse/pull/45817) ([刘陶峰](https://github.com/taofengliu)).
|
||||||
* When use experimental analyzer, queries like `SELECT number FROM numbers(100) LIMIT 10 OFFSET 10;` get wrong results (empty result for this sql). That is caused by an unnecessary offset step added by planner. [#45822](https://github.com/ClickHouse/ClickHouse/pull/45822) ([刘陶峰](https://github.com/taofengliu)).
|
* When use experimental analyzer, queries like `SELECT number FROM numbers(100) LIMIT 10 OFFSET 10;` get wrong results (empty result for this sql). That is caused by an unnecessary offset step added by planner. [#45822](https://github.com/ClickHouse/ClickHouse/pull/45822) ([刘陶峰](https://github.com/taofengliu)).
|
||||||
* Backward compatibility - allow implicit narrowing conversion from UInt64 to IPv4 - required for "INSERT ... VALUES ..." expression. [#45865](https://github.com/ClickHouse/ClickHouse/pull/45865) ([Yakov Olkhovskiy](https://github.com/yakov-olkhovskiy)).
|
* Backward compatibility - allow implicit narrowing conversion from UInt64 to IPv4 - required for "INSERT ... VALUES ..." expression. [#45865](https://github.com/ClickHouse/ClickHouse/pull/45865) ([Yakov Olkhovskiy](https://github.com/yakov-olkhovskiy)).
|
||||||
* Bugfix IPv6 parser for mixed ip4 address with missed first octet (like `::.1.2.3`). [#45871](https://github.com/ClickHouse/ClickHouse/pull/45871) ([Yakov Olkhovskiy](https://github.com/yakov-olkhovskiy)).
|
* Bugfix IPv6 parser for mixed ip4 address with missed first octet (like `::.1.2.3`). [#45871](https://github.com/ClickHouse/ClickHouse/pull/45871) ([Yakov Olkhovskiy](https://github.com/yakov-olkhovskiy)).
|
||||||
|
@ -13,6 +13,7 @@ The following versions of ClickHouse server are currently being supported with s
|
|||||||
|
|
||||||
| Version | Supported |
|
| Version | Supported |
|
||||||
|:-|:-|
|
|:-|:-|
|
||||||
|
| 23.11 | ✔️ |
|
||||||
| 23.10 | ✔️ |
|
| 23.10 | ✔️ |
|
||||||
| 23.9 | ✔️ |
|
| 23.9 | ✔️ |
|
||||||
| 23.8 | ✔️ |
|
| 23.8 | ✔️ |
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
# NOTE: has nothing common with DBMS_TCP_PROTOCOL_VERSION,
|
# NOTE: has nothing common with DBMS_TCP_PROTOCOL_VERSION,
|
||||||
# only DBMS_TCP_PROTOCOL_VERSION should be incremented on protocol changes.
|
# only DBMS_TCP_PROTOCOL_VERSION should be incremented on protocol changes.
|
||||||
SET(VERSION_REVISION 54480)
|
SET(VERSION_REVISION 54481)
|
||||||
SET(VERSION_MAJOR 23)
|
SET(VERSION_MAJOR 23)
|
||||||
SET(VERSION_MINOR 11)
|
SET(VERSION_MINOR 12)
|
||||||
SET(VERSION_PATCH 1)
|
SET(VERSION_PATCH 1)
|
||||||
SET(VERSION_GITHASH 13adae0e42fd48de600486fc5d4b64d39f80c43e)
|
SET(VERSION_GITHASH 05bc8ef1e02b9c7332f08091775b255d191341bf)
|
||||||
SET(VERSION_DESCRIBE v23.11.1.1-testing)
|
SET(VERSION_DESCRIBE v23.12.1.1-testing)
|
||||||
SET(VERSION_STRING 23.11.1.1)
|
SET(VERSION_STRING 23.12.1.1)
|
||||||
# end of autochange
|
# end of autochange
|
||||||
|
1
contrib/CMakeLists.txt
vendored
1
contrib/CMakeLists.txt
vendored
@ -44,7 +44,6 @@ else ()
|
|||||||
endif ()
|
endif ()
|
||||||
add_contrib (miniselect-cmake miniselect)
|
add_contrib (miniselect-cmake miniselect)
|
||||||
add_contrib (pdqsort-cmake pdqsort)
|
add_contrib (pdqsort-cmake pdqsort)
|
||||||
add_contrib (pocketfft-cmake pocketfft)
|
|
||||||
add_contrib (crc32-vpmsum-cmake crc32-vpmsum)
|
add_contrib (crc32-vpmsum-cmake crc32-vpmsum)
|
||||||
add_contrib (sparsehash-c11-cmake sparsehash-c11)
|
add_contrib (sparsehash-c11-cmake sparsehash-c11)
|
||||||
add_contrib (abseil-cpp-cmake abseil-cpp)
|
add_contrib (abseil-cpp-cmake abseil-cpp)
|
||||||
|
1
contrib/pocketfft
vendored
1
contrib/pocketfft
vendored
@ -1 +0,0 @@
|
|||||||
Subproject commit 9efd4da52cf8d28d14531d14e43ad9d913807546
|
|
@ -1,10 +0,0 @@
|
|||||||
option (ENABLE_POCKETFFT "Enable pocketfft" ${ENABLE_LIBRARIES})
|
|
||||||
|
|
||||||
if (NOT ENABLE_POCKETFFT)
|
|
||||||
message(STATUS "Not using pocketfft")
|
|
||||||
return()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_library(_pocketfft INTERFACE)
|
|
||||||
target_include_directories(_pocketfft INTERFACE ${ClickHouse_SOURCE_DIR}/contrib/pocketfft)
|
|
||||||
add_library(ch_contrib::pocketfft ALIAS _pocketfft)
|
|
@ -34,7 +34,7 @@ RUN arch=${TARGETARCH:-amd64} \
|
|||||||
# lts / testing / prestable / etc
|
# lts / testing / prestable / etc
|
||||||
ARG REPO_CHANNEL="stable"
|
ARG REPO_CHANNEL="stable"
|
||||||
ARG REPOSITORY="https://packages.clickhouse.com/tgz/${REPO_CHANNEL}"
|
ARG REPOSITORY="https://packages.clickhouse.com/tgz/${REPO_CHANNEL}"
|
||||||
ARG VERSION="23.10.5.20"
|
ARG VERSION="23.11.1.2711"
|
||||||
ARG PACKAGES="clickhouse-keeper"
|
ARG PACKAGES="clickhouse-keeper"
|
||||||
|
|
||||||
# user/group precreated explicitly with fixed uid/gid on purpose.
|
# user/group precreated explicitly with fixed uid/gid on purpose.
|
||||||
|
@ -32,7 +32,7 @@ RUN arch=${TARGETARCH:-amd64} \
|
|||||||
# lts / testing / prestable / etc
|
# lts / testing / prestable / etc
|
||||||
ARG REPO_CHANNEL="stable"
|
ARG REPO_CHANNEL="stable"
|
||||||
ARG REPOSITORY="https://packages.clickhouse.com/tgz/${REPO_CHANNEL}"
|
ARG REPOSITORY="https://packages.clickhouse.com/tgz/${REPO_CHANNEL}"
|
||||||
ARG VERSION="23.10.5.20"
|
ARG VERSION="23.11.1.2711"
|
||||||
ARG PACKAGES="clickhouse-client clickhouse-server clickhouse-common-static"
|
ARG PACKAGES="clickhouse-client clickhouse-server clickhouse-common-static"
|
||||||
|
|
||||||
# user/group precreated explicitly with fixed uid/gid on purpose.
|
# user/group precreated explicitly with fixed uid/gid on purpose.
|
||||||
|
@ -30,7 +30,7 @@ RUN sed -i "s|http://archive.ubuntu.com|${apt_archive}|g" /etc/apt/sources.list
|
|||||||
|
|
||||||
ARG REPO_CHANNEL="stable"
|
ARG REPO_CHANNEL="stable"
|
||||||
ARG REPOSITORY="deb [signed-by=/usr/share/keyrings/clickhouse-keyring.gpg] https://packages.clickhouse.com/deb ${REPO_CHANNEL} main"
|
ARG REPOSITORY="deb [signed-by=/usr/share/keyrings/clickhouse-keyring.gpg] https://packages.clickhouse.com/deb ${REPO_CHANNEL} main"
|
||||||
ARG VERSION="23.10.5.20"
|
ARG VERSION="23.11.1.2711"
|
||||||
ARG PACKAGES="clickhouse-client clickhouse-server clickhouse-common-static"
|
ARG PACKAGES="clickhouse-client clickhouse-server clickhouse-common-static"
|
||||||
|
|
||||||
# set non-empty deb_location_url url to create a docker image
|
# set non-empty deb_location_url url to create a docker image
|
||||||
@ -83,7 +83,7 @@ RUN if ! clickhouse local -q "SELECT ''" > /dev/null 2>&1; then \
|
|||||||
&& GNUPGHOME="$GNUPGHOME" gpg --no-default-keyring \
|
&& GNUPGHOME="$GNUPGHOME" gpg --no-default-keyring \
|
||||||
--keyring /usr/share/keyrings/clickhouse-keyring.gpg \
|
--keyring /usr/share/keyrings/clickhouse-keyring.gpg \
|
||||||
--keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 8919F6BD2B48D754 \
|
--keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 8919F6BD2B48D754 \
|
||||||
&& rm -r "$GNUPGHOME" \
|
&& rm -rf "$GNUPGHOME" \
|
||||||
&& chmod +r /usr/share/keyrings/clickhouse-keyring.gpg \
|
&& chmod +r /usr/share/keyrings/clickhouse-keyring.gpg \
|
||||||
&& echo "${REPOSITORY}" > /etc/apt/sources.list.d/clickhouse.list \
|
&& echo "${REPOSITORY}" > /etc/apt/sources.list.d/clickhouse.list \
|
||||||
&& echo "installing from repository: ${REPOSITORY}" \
|
&& echo "installing from repository: ${REPOSITORY}" \
|
||||||
|
@ -20,7 +20,8 @@ RUN apt-get update --yes \
|
|||||||
RUN pip3 install \
|
RUN pip3 install \
|
||||||
numpy \
|
numpy \
|
||||||
pyodbc \
|
pyodbc \
|
||||||
deepdiff
|
deepdiff \
|
||||||
|
sqlglot
|
||||||
|
|
||||||
ARG odbc_repo="https://github.com/ClickHouse/clickhouse-odbc.git"
|
ARG odbc_repo="https://github.com/ClickHouse/clickhouse-odbc.git"
|
||||||
|
|
||||||
@ -35,7 +36,7 @@ RUN git clone --recursive ${odbc_repo} \
|
|||||||
&& odbcinst -i -s -l -f /clickhouse-odbc/packaging/odbc.ini.sample
|
&& odbcinst -i -s -l -f /clickhouse-odbc/packaging/odbc.ini.sample
|
||||||
|
|
||||||
ENV TZ=Europe/Amsterdam
|
ENV TZ=Europe/Amsterdam
|
||||||
ENV MAX_RUN_TIME=900
|
ENV MAX_RUN_TIME=9000
|
||||||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||||
|
|
||||||
ARG sqllogic_test_repo="https://github.com/gregrahn/sqllogictest.git"
|
ARG sqllogic_test_repo="https://github.com/gregrahn/sqllogictest.git"
|
||||||
|
@ -75,6 +75,20 @@ function run_tests()
|
|||||||
cat /test_output/statements-test/check_status.tsv >> /test_output/check_status.tsv
|
cat /test_output/statements-test/check_status.tsv >> /test_output/check_status.tsv
|
||||||
cat /test_output/statements-test/test_results.tsv >> /test_output/test_results.tsv
|
cat /test_output/statements-test/test_results.tsv >> /test_output/test_results.tsv
|
||||||
tar -zcvf statements-check.tar.gz statements-test 1>/dev/null
|
tar -zcvf statements-check.tar.gz statements-test 1>/dev/null
|
||||||
|
|
||||||
|
mkdir -p /test_output/complete-test
|
||||||
|
/clickhouse-tests/sqllogic/runner.py \
|
||||||
|
--log-file /test_output/runner-complete-test.log \
|
||||||
|
--log-level info \
|
||||||
|
complete-test \
|
||||||
|
--input-dir /sqllogictest \
|
||||||
|
--out-dir /test_output/complete-test \
|
||||||
|
2>&1 \
|
||||||
|
| ts '%Y-%m-%d %H:%M:%S'
|
||||||
|
|
||||||
|
cat /test_output/complete-test/check_status.tsv >> /test_output/check_status.tsv
|
||||||
|
cat /test_output/complete-test/test_results.tsv >> /test_output/test_results.tsv
|
||||||
|
tar -zcvf complete-check.tar.gz complete-test 1>/dev/null
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,6 +191,12 @@ sudo cat /etc/clickhouse-server/config.d/logger_trace.xml \
|
|||||||
> /etc/clickhouse-server/config.d/logger_trace.xml.tmp
|
> /etc/clickhouse-server/config.d/logger_trace.xml.tmp
|
||||||
mv /etc/clickhouse-server/config.d/logger_trace.xml.tmp /etc/clickhouse-server/config.d/logger_trace.xml
|
mv /etc/clickhouse-server/config.d/logger_trace.xml.tmp /etc/clickhouse-server/config.d/logger_trace.xml
|
||||||
|
|
||||||
|
# Randomize async_load_databases
|
||||||
|
if [ $(( $(date +%-d) % 2 )) -eq 1 ]; then
|
||||||
|
sudo echo "<clickhouse><async_load_databases>true</async_load_databases></clickhouse>" \
|
||||||
|
> /etc/clickhouse-server/config.d/enable_async_load_databases.xml
|
||||||
|
fi
|
||||||
|
|
||||||
start
|
start
|
||||||
|
|
||||||
stress --hung-check --drop-databases --output-folder test_output --skip-func-tests "$SKIP_TESTS_OPTION" --global-time-limit 1200 \
|
stress --hung-check --drop-databases --output-folder test_output --skip-func-tests "$SKIP_TESTS_OPTION" --global-time-limit 1200 \
|
||||||
|
525
docs/changelogs/v23.11.1.2711-stable.md
Normal file
525
docs/changelogs/v23.11.1.2711-stable.md
Normal file
@ -0,0 +1,525 @@
|
|||||||
|
---
|
||||||
|
sidebar_position: 1
|
||||||
|
sidebar_label: 2023
|
||||||
|
---
|
||||||
|
|
||||||
|
# 2023 Changelog
|
||||||
|
|
||||||
|
### ClickHouse release v23.11.1.2711-stable (05bc8ef1e02) FIXME as compared to v23.10.1.1976-stable (13adae0e42f)
|
||||||
|
|
||||||
|
#### Backward Incompatible Change
|
||||||
|
* Formatters `%l`/`%k`/`%c` in function `parseDateTime()` are now able to parse hours/months without leading zeros, e.g. `select parseDateTime('2023-11-26 8:14', '%F %k:%i')` now works. Set `parsedatetime_parse_without_leading_zeros = 0` to restore the previous behavior which required two digits. Function `formatDateTime` is now also able to print hours/months without leading zeros. This is controlled by setting `formatdatetime_format_without_leading_zeros` but off by default to not break existing use cases. [#55872](https://github.com/ClickHouse/ClickHouse/pull/55872) ([Azat Khuzhin](https://github.com/azat)).
|
||||||
|
* You can no longer use the aggregate function `avgWeighted` with arguments of type `Decimal`. Workaround: convert arguments to `Float64`. This closes [#43928](https://github.com/ClickHouse/ClickHouse/issues/43928). This closes [#31768](https://github.com/ClickHouse/ClickHouse/issues/31768). This closes [#56435](https://github.com/ClickHouse/ClickHouse/issues/56435). If you have used this function inside materialized views or projections with `Decimal` arguments, contact support@clickhouse.com. Fixed error in aggregate function `sumMap` and made it slower around 1.5..2 times. It does not matter because the function is garbage anyway. This closes [#54955](https://github.com/ClickHouse/ClickHouse/issues/54955). This closes [#53134](https://github.com/ClickHouse/ClickHouse/issues/53134). This closes [#55148](https://github.com/ClickHouse/ClickHouse/issues/55148). Fix a bug in function `groupArraySample` - it used the same random seed in case more than one aggregate state is generated in a query. [#56350](https://github.com/ClickHouse/ClickHouse/pull/56350) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* The default ClickHouse server configuration file has enabled `access_management` (user manipulation by SQL queries) and `named_collection_control` (manipulation of named collection by SQL queries) for the `default` user by default. This closes [#56482](https://github.com/ClickHouse/ClickHouse/issues/56482). [#56619](https://github.com/ClickHouse/ClickHouse/pull/56619) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Multiple improvements for RESPECT/IGNORE NULLS. [#57189](https://github.com/ClickHouse/ClickHouse/pull/57189) ([Raúl Marín](https://github.com/Algunenano)).
|
||||||
|
* Remove optimization optimize_move_functions_out_of_any. [#57190](https://github.com/ClickHouse/ClickHouse/pull/57190) ([Raúl Marín](https://github.com/Algunenano)).
|
||||||
|
|
||||||
|
#### New Feature
|
||||||
|
* Added server setting `async_load_databases` for asynchronous loading of databases and tables. Speeds up the server start time. Applies to databases with Ordinary, Atomic and Replicated engines. Their tables load metadata asynchronously. Query to a table increases the priority of the load job and waits for it to be done. Added table `system.async_loader`. [#49351](https://github.com/ClickHouse/ClickHouse/pull/49351) ([Sergei Trifonov](https://github.com/serxa)).
|
||||||
|
* 1. Add function `extractPlainRanges` to `KeyCondition`. 2. Add some useful functions to `Range` 3. Add `PlainRanges` who represent a serious of ranges that ordered and no overlapping. 4. Add `NumbersRangedSource` who can accurately return user selected numbers. [#50909](https://github.com/ClickHouse/ClickHouse/pull/50909) ([JackyWoo](https://github.com/JackyWoo)).
|
||||||
|
* Add system table `blob_storage_log`. [#52918](https://github.com/ClickHouse/ClickHouse/pull/52918) ([vdimir](https://github.com/vdimir)).
|
||||||
|
* Use statistic to order prewhere conditions better. [#53240](https://github.com/ClickHouse/ClickHouse/pull/53240) ([Han Fei](https://github.com/hanfei1991)).
|
||||||
|
* Added a new aggregation function `groupArraySorted(n)(value)` which returns an array with the n first values from a field value sorted by itself. [#53562](https://github.com/ClickHouse/ClickHouse/pull/53562) ([Yarik Briukhovetskyi](https://github.com/yariks5s)).
|
||||||
|
* Added support for compression in keeper protocol. Can be enabled on clickhouse by using this flag `use_compression` inside `zookeeper`. resolves [#49507](https://github.com/ClickHouse/ClickHouse/issues/49507). [#54957](https://github.com/ClickHouse/ClickHouse/pull/54957) ([SmitaRKulkarni](https://github.com/SmitaRKulkarni)).
|
||||||
|
* Add ClickHouse setting to disable tunneling for HTTPS requests over HTTP proxy. [#55033](https://github.com/ClickHouse/ClickHouse/pull/55033) ([Arthur Passos](https://github.com/arthurpassos)).
|
||||||
|
* Introduce the feature `storage_metadata_write_full_object_key`. If it is set as `true` then metadata files are written with new format VERSION_FULL_OBJECT_KEY. With that format CH stores full remote object key in the metadata file. [#55566](https://github.com/ClickHouse/ClickHouse/pull/55566) ([Sema Checherinda](https://github.com/CheSema)).
|
||||||
|
* Add new settings and syntax to protect named collections' fields from being overridden. This is meant to prevent a malicious user from obtaining unauthorized access to secrets. [#55782](https://github.com/ClickHouse/ClickHouse/pull/55782) ([Salvatore Mesoraca](https://github.com/aiven-sal)).
|
||||||
|
* Add `hostname` column to all system log tables;. [#55894](https://github.com/ClickHouse/ClickHouse/pull/55894) ([Bharat Nallan](https://github.com/bharatnc)).
|
||||||
|
* Add `CHECK ALL TABLES` query. [#56022](https://github.com/ClickHouse/ClickHouse/pull/56022) ([vdimir](https://github.com/vdimir)).
|
||||||
|
* Added function `fromDaysSinceYearZero()` which is similar to MySQL's `FROM_DAYS`. E.g. `SELECT fromDaysSinceYearZero(739136)` returns `2023-09-08`. [#56088](https://github.com/ClickHouse/ClickHouse/pull/56088) ([Joanna Hulboj](https://github.com/jh0x)).
|
||||||
|
* Implemented series period detect method using FFT in pocketFFT lib. [#56171](https://github.com/ClickHouse/ClickHouse/pull/56171) ([Bhavna Jindal](https://github.com/bhavnajindal)).
|
||||||
|
* Add an external Python tool to view backups and to extract information from them without using ClickHouse. [#56268](https://github.com/ClickHouse/ClickHouse/pull/56268) ([Vitaly Baranov](https://github.com/vitlibar)).
|
||||||
|
* ... [#56275](https://github.com/ClickHouse/ClickHouse/pull/56275) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* This pull request implements new setting called `preferred_projection_name`. If it is set to a non-empty string, the specified projection would be used if possible. [#56309](https://github.com/ClickHouse/ClickHouse/pull/56309) ([Yarik Briukhovetskyi](https://github.com/yariks5s)).
|
||||||
|
* S3 adaptive timeout means that first attempt made with low send and receive timeouts. [#56314](https://github.com/ClickHouse/ClickHouse/pull/56314) ([Sema Checherinda](https://github.com/CheSema)).
|
||||||
|
* Add 4-letter command for yielding/resigning leadership (https://github.com/ClickHouse/ClickHouse/issues/56352). [#56354](https://github.com/ClickHouse/ClickHouse/pull/56354) ([Pradeep Chhetri](https://github.com/chhetripradeep)).
|
||||||
|
* Added a new SQL function, "arrayRandomSample(arr, k)" which returns a sample of k elements from the input array. Similar functionality could previously be achieved only with less convenient syntax, e.g. "SELECT arrayReduce('groupArraySample(3)', range(10))". [#56416](https://github.com/ClickHouse/ClickHouse/pull/56416) ([Robert Schulze](https://github.com/rschu1ze)).
|
||||||
|
* Added support for `float16` type data to use in `.npy` files. Closes [#56344](https://github.com/ClickHouse/ClickHouse/issues/56344). [#56424](https://github.com/ClickHouse/ClickHouse/pull/56424) ([Yarik Briukhovetskyi](https://github.com/yariks5s)).
|
||||||
|
* Added system view `information_schema.statistics` for better compatibility with Tableau Online. [#56425](https://github.com/ClickHouse/ClickHouse/pull/56425) ([Serge Klochkov](https://github.com/slvrtrn)).
|
||||||
|
* Add function `getClientHTTPHeader` for fetching values header values set in the HTTP request. [#56488](https://github.com/ClickHouse/ClickHouse/pull/56488) ([凌涛](https://github.com/lingtaolf)).
|
||||||
|
* Add a new table function named `fuzzJSON` with rows containing perturbed versions of the source JSON string with random variations. [#56490](https://github.com/ClickHouse/ClickHouse/pull/56490) ([Julia Kartseva](https://github.com/jkartseva)).
|
||||||
|
* Add `system.symbols` table useful for introspection of the binary. [#56548](https://github.com/ClickHouse/ClickHouse/pull/56548) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Add 4-letter command for yielding/resigning leadership. [#56620](https://github.com/ClickHouse/ClickHouse/pull/56620) ([Pradeep Chhetri](https://github.com/chhetripradeep)).
|
||||||
|
* Configurable dashboards. Queries for charts are now loaded using a query, which by default uses a new `system.dashboards` table. [#56771](https://github.com/ClickHouse/ClickHouse/pull/56771) ([Sergei Trifonov](https://github.com/serxa)).
|
||||||
|
* Introduce `fileCluster` table function. [#56868](https://github.com/ClickHouse/ClickHouse/pull/56868) ([Andrey Zvonov](https://github.com/zvonand)).
|
||||||
|
* Add `_size` virtual column with file size in bytes to `s3/file/hdfs/url/azureBlobStorage` engines. [#57126](https://github.com/ClickHouse/ClickHouse/pull/57126) ([Kruglov Pavel](https://github.com/Avogar)).
|
||||||
|
* Expose the number of errors occurred on a server since last restart from the Prometheus endpoint. [#57209](https://github.com/ClickHouse/ClickHouse/pull/57209) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)).
|
||||||
|
* Added a new SQL function `sqid` to generate Sqids (https://sqids.org/), example: `SELECT sqid(125, 126)`. [#57442](https://github.com/ClickHouse/ClickHouse/pull/57442) ([awakeljw](https://github.com/awakeljw)).
|
||||||
|
|
||||||
|
#### Performance Improvement
|
||||||
|
* Support window functions parallel evaluation. Fixes [#34688](https://github.com/ClickHouse/ClickHouse/issues/34688). [#39631](https://github.com/ClickHouse/ClickHouse/pull/39631) ([Dmitry Novik](https://github.com/novikd)).
|
||||||
|
* Increase the default value of `max_concurrent_queries` from 100 to 1000. This makes sense when there is a large number of connecting clients, which are slowly sending or receiving data, so the server is not limited by CPU, or when the number of CPU cores is larger than 100. Also, enable the concurrency control by default, and set the desired number of query processing threads in total as twice the number of CPU cores. It improves performance in scenarios with a very large number of concurrent queries. [#46927](https://github.com/ClickHouse/ClickHouse/pull/46927) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Fixed filtering by `IN(...)` condition for `Merge` table engine. [#54905](https://github.com/ClickHouse/ClickHouse/pull/54905) ([Nikita Taranov](https://github.com/nickitat)).
|
||||||
|
* An improvement which takes place when cache is full and there are big reads. [#55158](https://github.com/ClickHouse/ClickHouse/pull/55158) ([Kseniia Sumarokova](https://github.com/kssenii)).
|
||||||
|
* Add ability to disable checksums for S3 to avoid excessive input file read (this new behavior could be enabled with `s3_disable_checksum=true`). [#55559](https://github.com/ClickHouse/ClickHouse/pull/55559) ([Azat Khuzhin](https://github.com/azat)).
|
||||||
|
* Now we read synchronously from remote tables when data is in page cache (like we do for local tables). It is faster, doesn't require synchronisation inside thread pool, doesn't hesitate to do `seek`-s on local fs and reduces cpu wait. [#55841](https://github.com/ClickHouse/ClickHouse/pull/55841) ([Nikita Taranov](https://github.com/nickitat)).
|
||||||
|
* ... This PR follows [#55929](https://github.com/ClickHouse/ClickHouse/issues/55929), it will bring about 30% speedup. - reduce the reserved memory - reduce the `resize` call. [#55957](https://github.com/ClickHouse/ClickHouse/pull/55957) ([lgbo](https://github.com/lgbo-ustc)).
|
||||||
|
* The performance experiments of **OnTime** on the ICX device (Intel Xeon Platinum 8380 CPU, 80 cores, 160 threads) show that this change could bring the improvements of **7.4%, 5.9%, 4.7%, 3.0%, and 4.6%** to the QPS of the query Q2, Q3, Q4, Q5 and Q6 respectively while having no impact on others. [#56079](https://github.com/ClickHouse/ClickHouse/pull/56079) ([Zhiguo Zhou](https://github.com/ZhiguoZh)).
|
||||||
|
* Limit the number of threads busy inside the query profiler. If there are more - they will skip profiling. [#56105](https://github.com/ClickHouse/ClickHouse/pull/56105) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* WindowTransform decrease amount of virtual function calls. [#56120](https://github.com/ClickHouse/ClickHouse/pull/56120) ([Maksim Kita](https://github.com/kitaisreal)).
|
||||||
|
* Allow recursive tuple field pruning in ORC to speed up scaning. [#56122](https://github.com/ClickHouse/ClickHouse/pull/56122) ([李扬](https://github.com/taiyang-li)).
|
||||||
|
* This pull request provides countRows support for Npy data format. Now with setting `optimize_count_from_files=1` queries like `select count() from file(data.npy)` will work much more fast because of caching the results. [#56304](https://github.com/ClickHouse/ClickHouse/pull/56304) ([Yarik Briukhovetskyi](https://github.com/yariks5s)).
|
||||||
|
* Queries with aggregation and a large number of streams will use less amount of memory during the plan's construction. [#57074](https://github.com/ClickHouse/ClickHouse/pull/57074) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Improve performance of executing queries for use cases with many users. [#57106](https://github.com/ClickHouse/ClickHouse/pull/57106) ([Andrej Hoos](https://github.com/adikus)).
|
||||||
|
* Trivial improvement on array join, reuse some intermediate results. [#57183](https://github.com/ClickHouse/ClickHouse/pull/57183) ([李扬](https://github.com/taiyang-li)).
|
||||||
|
* There are cases when stack unwinding was slow. [#57221](https://github.com/ClickHouse/ClickHouse/pull/57221) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Now we use default read pool for reading from external storage when `max_streams = 1`. It is beneficial when read prefetches are enabled. [#57334](https://github.com/ClickHouse/ClickHouse/pull/57334) ([Nikita Taranov](https://github.com/nickitat)).
|
||||||
|
|
||||||
|
#### Improvement
|
||||||
|
* Engine `Merge` filters the records according to the row policies of the underlying tables. [#50209](https://github.com/ClickHouse/ClickHouse/pull/50209) ([Ilya Golshtein](https://github.com/ilejn)).
|
||||||
|
* Add a setting `max_execution_time_leaf` to limit the execution time on shard for distributed query, and `timeout_overflow_mode_leaf` to control the behaviour if timeout happens. [#51823](https://github.com/ClickHouse/ClickHouse/pull/51823) ([Duc Canh Le](https://github.com/canhld94)).
|
||||||
|
* Fix possible postgresql logical replication conversion_error when using MaterializedPostgreSQL. [#53721](https://github.com/ClickHouse/ClickHouse/pull/53721) ([takakawa](https://github.com/takakawa)).
|
||||||
|
* Set `background_fetches_pool_size` to 16, background_schedule_pool_size to 512 that is better for production usage with frequent small insertions. [#54327](https://github.com/ClickHouse/ClickHouse/pull/54327) ([Denny Crane](https://github.com/den-crane)).
|
||||||
|
* While read data from a csv format file, and at end of line is'\r' , which not followed by '\n', then we will enconter the exception as below ``` Cannot parse CSV format: found \r (CR) not followed by \n (LF). Line must end by \n (LF) or \r\n (CR LF) or \n\r.: ``` In clickhouse, the csv end of line must be \n or \r\n or \n\r, so the \r must be followed by \n , but in some suitation, the csv input data is abnormal, like above, \r is at end of line. [#54340](https://github.com/ClickHouse/ClickHouse/pull/54340) ([KevinyhZou](https://github.com/KevinyhZou)).
|
||||||
|
* Update arrow library to release-13.0.0 that supports new encodings. Closes [#44505](https://github.com/ClickHouse/ClickHouse/issues/44505). [#54800](https://github.com/ClickHouse/ClickHouse/pull/54800) ([Kruglov Pavel](https://github.com/Avogar)).
|
||||||
|
* Improve performance of ON CLUSTER queries by removing heavy system calls to get all network interfaces when looking for local ip address in the DDL entry hosts list. [#54909](https://github.com/ClickHouse/ClickHouse/pull/54909) ([Duc Canh Le](https://github.com/canhld94)).
|
||||||
|
* Keeper improvement: improve memory-usage during startup by delaying log preprocessing. [#55660](https://github.com/ClickHouse/ClickHouse/pull/55660) ([Antonio Andelic](https://github.com/antonio2368)).
|
||||||
|
* Fixed accounting of memory allocated before attaching thread to a query or a user. [#56089](https://github.com/ClickHouse/ClickHouse/pull/56089) ([Nikita Taranov](https://github.com/nickitat)).
|
||||||
|
* ClickHouse keeper reports its running availability zone at `/keeper/availability-zone` path, when running on AWS environment. [#56104](https://github.com/ClickHouse/ClickHouse/pull/56104) ([Jianfei Hu](https://github.com/incfly)).
|
||||||
|
* Add support for LARGE_LIST with Arrow. [#56118](https://github.com/ClickHouse/ClickHouse/pull/56118) ([edef](https://github.com/edef1c)).
|
||||||
|
* Improved performance of glob matching for `file` and `hdfs` storages. [#56141](https://github.com/ClickHouse/ClickHouse/pull/56141) ([Andrey Zvonov](https://github.com/zvonand)).
|
||||||
|
* Allow manual compaction of `EmbeddedRocksDB` via `OPTIMIZE` query. [#56225](https://github.com/ClickHouse/ClickHouse/pull/56225) ([Azat Khuzhin](https://github.com/azat)).
|
||||||
|
* Posting lists in inverted indexes are now compressed which reduces their size by 10-30%. [#56226](https://github.com/ClickHouse/ClickHouse/pull/56226) ([Harry Lee](https://github.com/HarryLeeIBM)).
|
||||||
|
* Add ability to specify BlockBasedTableOptions for EmbeddedRocksDB. [#56264](https://github.com/ClickHouse/ClickHouse/pull/56264) ([Azat Khuzhin](https://github.com/azat)).
|
||||||
|
* `SHOW COLUMNS` now displays MySQL's equivalent data type name when the connection was made through the MySQL protocol. Previously, this was the case when setting `use_mysql_types_in_show_columns = 1`. The setting is retained but made obsolete. [#56277](https://github.com/ClickHouse/ClickHouse/pull/56277) ([Robert Schulze](https://github.com/rschu1ze)).
|
||||||
|
* Fixed possible `The local set of parts of table doesn't look like the set of parts in ZooKeeper` error if server was restarted just after `TRUNCATE` or `DROP PARTITION`. [#56282](https://github.com/ClickHouse/ClickHouse/pull/56282) ([Alexander Tokmakov](https://github.com/tavplubix)).
|
||||||
|
* Parallelise `BackupEntriesCollector`. [#56312](https://github.com/ClickHouse/ClickHouse/pull/56312) ([Kseniia Sumarokova](https://github.com/kssenii)).
|
||||||
|
* Fixed handling of non-const query strings in functions `formatQuery()`/ `formatQuerySingleLine()`. Also added `OrNull` variants of both functions that return a NULL when a query cannot be parsed instead of throwing an exception. [#56327](https://github.com/ClickHouse/ClickHouse/pull/56327) ([Robert Schulze](https://github.com/rschu1ze)).
|
||||||
|
* Support create and materialized index in the same alter query, also support modity TTL and materialize TTL in the same query. Closes [#55651](https://github.com/ClickHouse/ClickHouse/issues/55651). [#56331](https://github.com/ClickHouse/ClickHouse/pull/56331) ([flynn](https://github.com/ucasfl)).
|
||||||
|
* Enable adding new disk to storage configuration without restart. [#56367](https://github.com/ClickHouse/ClickHouse/pull/56367) ([Duc Canh Le](https://github.com/canhld94)).
|
||||||
|
* Allow backup of materialized view with dropped inner table instead of failing the backup. [#56387](https://github.com/ClickHouse/ClickHouse/pull/56387) ([Kseniia Sumarokova](https://github.com/kssenii)).
|
||||||
|
* Queries to `system.replicas` initiate requests to ZooKeeper when certain columns are queried. When there are thousands of tables these requests might produce a considerable load on ZooKeeper. If there are multiple simultaneous queries to `system.replicas` they do same requests multiple times. The change is to "deduplicate" requests from concurrent queries. [#56420](https://github.com/ClickHouse/ClickHouse/pull/56420) ([Alexander Gololobov](https://github.com/davenger)).
|
||||||
|
* Add transition from reading key to reading quoted key when double quotes are found. [#56423](https://github.com/ClickHouse/ClickHouse/pull/56423) ([Arthur Passos](https://github.com/arthurpassos)).
|
||||||
|
* Fix transfer query to MySQL compatible query. [#56456](https://github.com/ClickHouse/ClickHouse/pull/56456) ([flynn](https://github.com/ucasfl)).
|
||||||
|
* Add support for backing up and restoring tables using KeeperMap engine. [#56460](https://github.com/ClickHouse/ClickHouse/pull/56460) ([Antonio Andelic](https://github.com/antonio2368)).
|
||||||
|
* 404 response for CompleteMultipartUpload has to be rechecked. Operation could be done on server even if client got timeout or other network errors. The next retry of CompleteMultipartUpload receives 404 response. If the object key exists that operation is considered as successful. [#56475](https://github.com/ClickHouse/ClickHouse/pull/56475) ([Sema Checherinda](https://github.com/CheSema)).
|
||||||
|
* Enable the HTTP OPTIONS method by default - it simplifies requesting ClickHouse from a web browser. [#56483](https://github.com/ClickHouse/ClickHouse/pull/56483) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* The value for `dns_max_consecutive_failures` was changed by mistake in [#46550](https://github.com/ClickHouse/ClickHouse/issues/46550) - this is reverted and adjusted to a better value. Also, increased the HTTP keep-alive timeout to a reasonable value from production. [#56485](https://github.com/ClickHouse/ClickHouse/pull/56485) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Load base backups lazily (a base backup won't be loaded until it's needed). Also add some log message and profile events for backups. [#56516](https://github.com/ClickHouse/ClickHouse/pull/56516) ([Vitaly Baranov](https://github.com/vitlibar)).
|
||||||
|
* Setting `query_cache_store_results_of_queries_with_nondeterministic_functions` (with values `false` or `true`) was marked obsolete. It was replaced by setting `query_cache_nondeterministic_function_handling`, a three-valued enum that controls how the query cache handles queries with non-deterministic functions: a) throw an exception (default behavior), b) save the non-deterministic query result regardless, or c) ignore, i.e. don't throw an exception and don't cache the result. [#56519](https://github.com/ClickHouse/ClickHouse/pull/56519) ([Robert Schulze](https://github.com/rschu1ze)).
|
||||||
|
* Rewrite equality with `is null` check in JOIN ON section. *Analyzer only*. [#56538](https://github.com/ClickHouse/ClickHouse/pull/56538) ([vdimir](https://github.com/vdimir)).
|
||||||
|
* Function`concat` now supports arbitrary argument types (instead of only String and FixedString arguments). This makes it behave more similar to MySQL `concat` implementation. For example, `SELECT concat('ab', 42)` now returns `ab42`. [#56540](https://github.com/ClickHouse/ClickHouse/pull/56540) ([Serge Klochkov](https://github.com/slvrtrn)).
|
||||||
|
* Allow getting cache configuration from 'named_collection' section in config or from sql created named collection. [#56541](https://github.com/ClickHouse/ClickHouse/pull/56541) ([Kseniia Sumarokova](https://github.com/kssenii)).
|
||||||
|
* Update `query_masking_rules` when reloading the config ([#56449](https://github.com/ClickHouse/ClickHouse/issues/56449)). [#56573](https://github.com/ClickHouse/ClickHouse/pull/56573) ([Mikhail Koviazin](https://github.com/mkmkme)).
|
||||||
|
* Make removeoutdatedtables() less aggressive with unsuccessful postgres connection. [#56609](https://github.com/ClickHouse/ClickHouse/pull/56609) ([jsc0218](https://github.com/jsc0218)).
|
||||||
|
* Currenting setting takes too much time to connnect to PG when URL is not right, so the relevant query stucks there and get cancelled. [#56648](https://github.com/ClickHouse/ClickHouse/pull/56648) ([jsc0218](https://github.com/jsc0218)).
|
||||||
|
* ClickHouse keeper reports its running availability zone at `/keeper/availability-zone` path. This can be configured via `<availability_zone><value>us-west-1a</value></availability_zone>`. [#56715](https://github.com/ClickHouse/ClickHouse/pull/56715) ([Jianfei Hu](https://github.com/incfly)).
|
||||||
|
* Do not allow tables on different replicas have different aggregate functions in SimpleAggregateFunction columns. [#56724](https://github.com/ClickHouse/ClickHouse/pull/56724) ([Duc Canh Le](https://github.com/canhld94)).
|
||||||
|
* Add support for the [well-known Protobuf types](https://protobuf.dev/reference/protobuf/google.protobuf/) in the Protobuf format. [#56741](https://github.com/ClickHouse/ClickHouse/pull/56741) ([János Benjamin Antal](https://github.com/antaljanosbenjamin)).
|
||||||
|
* Keeper improvement: disable compressed logs by default in Keeper. [#56763](https://github.com/ClickHouse/ClickHouse/pull/56763) ([Antonio Andelic](https://github.com/antonio2368)).
|
||||||
|
* Add config setting `wait_dictionaries_load_at_startup`:. [#56782](https://github.com/ClickHouse/ClickHouse/pull/56782) ([Vitaly Baranov](https://github.com/vitlibar)).
|
||||||
|
* There was a potential vulnerability in previous ClickHouse versions: if a user has connected and unsuccessfully tried to authenticate with the "interserver secret" method, the server didn't terminate the connection immediately but continued to receive and ignore the leftover packets from the client. While these packets are ignored, they are still parsed, and if they use a compression method with another known vulnerability, it will lead to exploitation of it without authentication. This issue was found with [ClickHouse Bug Bounty Program](https://github.com/ClickHouse/ClickHouse/issues/38986) by https://twitter.com/malacupa. [#56794](https://github.com/ClickHouse/ClickHouse/pull/56794) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Fetching a part waits when that part is fully committed on remote replica. It is better not send part in PreActive state. In case of zero copy this is mandatory restriction. [#56808](https://github.com/ClickHouse/ClickHouse/pull/56808) ([Sema Checherinda](https://github.com/CheSema)).
|
||||||
|
* Implement user-level setting `alter_move_to_space_execute_async` which allow to execute queries `ALTER TABLE ... MOVE PARTITION|PART TO DISK|VOLUME` asynchronously. The size of pool for background executions is controlled by `background_move_pool_size`. Default behavior is synchronous execution. Fixes [#47643](https://github.com/ClickHouse/ClickHouse/issues/47643). [#56809](https://github.com/ClickHouse/ClickHouse/pull/56809) ([alesapin](https://github.com/alesapin)).
|
||||||
|
* Able to filter by engine when scanning system.tables, avoid unnecessary (potentially time-consuming) connection. [#56813](https://github.com/ClickHouse/ClickHouse/pull/56813) ([jsc0218](https://github.com/jsc0218)).
|
||||||
|
* Show `total_bytes` and `total_rows` in system tables for RocksDB storage. [#56816](https://github.com/ClickHouse/ClickHouse/pull/56816) ([Aleksandr Musorin](https://github.com/AVMusorin)).
|
||||||
|
* Allow basic commands in ALTER for TEMPORARY tables. [#56892](https://github.com/ClickHouse/ClickHouse/pull/56892) ([Sergey](https://github.com/icuken)).
|
||||||
|
* Lz4 compression. Buffer compressed block in a rare case when out buffer capacity is not enough for writing compressed block directly to out's buffer. [#56938](https://github.com/ClickHouse/ClickHouse/pull/56938) ([Sema Checherinda](https://github.com/CheSema)).
|
||||||
|
* Add metrics for the number of queued jobs, which is useful for the IO thread pool. [#56958](https://github.com/ClickHouse/ClickHouse/pull/56958) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Add a setting for PostgreSQL table engine setting in the config file Added a check for the setting Added documentation around the additional setting. [#56959](https://github.com/ClickHouse/ClickHouse/pull/56959) ([Peignon Melvyn](https://github.com/melvynator)).
|
||||||
|
* Run interpreter with `only_analyze` flag in getsampleblock method. [#56972](https://github.com/ClickHouse/ClickHouse/pull/56972) ([Mikhail Artemenko](https://github.com/Michicosun)).
|
||||||
|
* Add a new `MergeTree` setting `add_implicit_sign_column_constraint_for_collapsing_engine` (disabled by default). When enabled, it adds an implicit CHECK constraint for `CollapsingMergeTree` tables that restricts the value of the `Sign` column to be only -1 or 1. [#56701](https://github.com/ClickHouse/ClickHouse/issues/56701). [#56986](https://github.com/ClickHouse/ClickHouse/pull/56986) ([Kevin Mingtarja](https://github.com/kevinmingtarja)).
|
||||||
|
* Function `concat()` can now be called with a single argument, e.g., `SELECT concat('abc')`. This makes its behavior more consistent with MySQL's concat implementation. [#57000](https://github.com/ClickHouse/ClickHouse/pull/57000) ([Serge Klochkov](https://github.com/slvrtrn)).
|
||||||
|
* Signs all `x-amz-*` headers as required by AWS S3 docs. [#57001](https://github.com/ClickHouse/ClickHouse/pull/57001) ([Arthur Passos](https://github.com/arthurpassos)).
|
||||||
|
* Function `fromDaysSinceYearZero` (alias: `FROM_DAYS`) can now be used with unsigned and signed integer types (previously, it had to be an unsigned integer). This improve compatibility with 3rd party tools such as Tableau Online. [#57002](https://github.com/ClickHouse/ClickHouse/pull/57002) ([Serge Klochkov](https://github.com/slvrtrn)).
|
||||||
|
* Add system.s3queue_log to default config. [#57036](https://github.com/ClickHouse/ClickHouse/pull/57036) ([Kseniia Sumarokova](https://github.com/kssenii)).
|
||||||
|
* Change the default for `wait_dictionaries_load_at_startup` to true, and use this setting only if `dictionaries_lazy_load` is false. [#57133](https://github.com/ClickHouse/ClickHouse/pull/57133) ([Vitaly Baranov](https://github.com/vitlibar)).
|
||||||
|
* Check dictionary source type on creation even if `dictionaries_lazy_load` is enabled. [#57134](https://github.com/ClickHouse/ClickHouse/pull/57134) ([Vitaly Baranov](https://github.com/vitlibar)).
|
||||||
|
* Plan-level optimizations can now be enabled/disabled individually. Previously, it was only possible to disable them all. The setting which previously did that (`query_plan_enable_optimizations`) is retained and can still be used to disable all optimizations. [#57152](https://github.com/ClickHouse/ClickHouse/pull/57152) ([Robert Schulze](https://github.com/rschu1ze)).
|
||||||
|
* The server's exit code will correspond to the exception code. For example, if the server cannot start due to memory limit, it will exit with the code 241 = MEMORY_LIMIT_EXCEEDED. In previous versions, the exit code for exceptions was always 70 = Poco::Util::ExitCode::EXIT_SOFTWARE. [#57153](https://github.com/ClickHouse/ClickHouse/pull/57153) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Do not demangle and symbolize stack frames from __functional c++ header. [#57201](https://github.com/ClickHouse/ClickHouse/pull/57201) ([Mike Kot](https://github.com/myrrc)).
|
||||||
|
* It is now possible to refer to ALIAS column in index (non-primary-key) definitions (issue [#55650](https://github.com/ClickHouse/ClickHouse/issues/55650)). Example: `CREATE TABLE tab(col UInt32, col_alias ALIAS col + 1, INDEX idx (col_alias) TYPE minmax) ENGINE = MergeTree ORDER BY col;`. [#57220](https://github.com/ClickHouse/ClickHouse/pull/57220) ([flynn](https://github.com/ucasfl)).
|
||||||
|
* HTTP server page `/dashboard` now supports charts with multiple lines. [#57236](https://github.com/ClickHouse/ClickHouse/pull/57236) ([Sergei Trifonov](https://github.com/serxa)).
|
||||||
|
* This pr gives possibility to use suffixes (K, M, G, T, E) along with the amount of memory to be used. Closes [#56879](https://github.com/ClickHouse/ClickHouse/issues/56879). [#57273](https://github.com/ClickHouse/ClickHouse/pull/57273) ([Yarik Briukhovetskyi](https://github.com/yariks5s)).
|
||||||
|
* Bumped Intel QPL (used by codec `DEFLATE_QPL`) from v1.2.0 to v1.3.1 . Also fixed a bug in case of BOF (Block On Fault) = 0, changed to handle page faults by falling back to SW path. [#57291](https://github.com/ClickHouse/ClickHouse/pull/57291) ([jasperzhu](https://github.com/jinjunzh)).
|
||||||
|
* Make alter materialized view non experimental and deprecate `allow_experimental_alter_materialized_view_structure` setting. Fixes [#15206](https://github.com/ClickHouse/ClickHouse/issues/15206). [#57311](https://github.com/ClickHouse/ClickHouse/pull/57311) ([alesapin](https://github.com/alesapin)).
|
||||||
|
* Increase default `replicated_deduplication_window` of MergeTree settings from 100 to 1k. [#57335](https://github.com/ClickHouse/ClickHouse/pull/57335) ([sichenzhao](https://github.com/sichenzhao)).
|
||||||
|
* Stop using `INCONSISTENT_METADATA_FOR_BACKUP` that much. If possible prefer to continue scanning instead of stopping and starting the scanning for backup from the beginning. [#57385](https://github.com/ClickHouse/ClickHouse/pull/57385) ([Vitaly Baranov](https://github.com/vitlibar)).
|
||||||
|
* Introduce the limit for the maximum number of table projections (default 25). [#57491](https://github.com/ClickHouse/ClickHouse/pull/57491) ([Julia Kartseva](https://github.com/jkartseva)).
|
||||||
|
* Enable `async_block_ids_cache` by default for `async_inserts` deduplication. [#57513](https://github.com/ClickHouse/ClickHouse/pull/57513) ([alesapin](https://github.com/alesapin)).
|
||||||
|
|
||||||
|
#### Build/Testing/Packaging Improvement
|
||||||
|
* Enable temporary_data_in_cache in s3 tests in CI. [#48425](https://github.com/ClickHouse/ClickHouse/pull/48425) ([vdimir](https://github.com/vdimir)).
|
||||||
|
* Run sqllogic test. [#56078](https://github.com/ClickHouse/ClickHouse/pull/56078) ([Han Fei](https://github.com/hanfei1991)).
|
||||||
|
* Add a new build option `SANITIZE_COVERAGE`. If it is enabled, the code is instrumented to track the coverage. The collected information is available inside ClickHouse with: (1) a new function `coverage` that returns an array of unique addresses in the code found after the previous coverage reset; (2) `SYSTEM RESET COVERAGE` query that resets the accumulated data. This allows us to compare the coverage of different tests, including differential code coverage. Continuation of [#20539](https://github.com/ClickHouse/ClickHouse/issues/20539). [#56102](https://github.com/ClickHouse/ClickHouse/pull/56102) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* In [#54043](https://github.com/ClickHouse/ClickHouse/issues/54043) the setup plan started to appear in the logs. It should be only in the `runner_get_all_tests.log` only. As well, send the failed infrastructure event to CI db. [#56214](https://github.com/ClickHouse/ClickHouse/pull/56214) ([Mikhail f. Shiryaev](https://github.com/Felixoid)).
|
||||||
|
* Some of the stack frames might not be resolved when collecting stacks. In such cases the raw address might be helpful. [#56267](https://github.com/ClickHouse/ClickHouse/pull/56267) ([Alexander Gololobov](https://github.com/davenger)).
|
||||||
|
* Add an option to disable libssh. [#56333](https://github.com/ClickHouse/ClickHouse/pull/56333) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Add automatic check that there are no large translation units. [#56559](https://github.com/ClickHouse/ClickHouse/pull/56559) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Lower the size of the single-binary distribution. This closes [#55181](https://github.com/ClickHouse/ClickHouse/issues/55181). [#56617](https://github.com/ClickHouse/ClickHouse/pull/56617) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Make `clickhouse-local` and `clickhouse-client` available under short names (`ch`, `chl`, `chc`) for usability. [#56634](https://github.com/ClickHouse/ClickHouse/pull/56634) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Information about the sizes of every translation unit and binary file after each build will be sent to the CI database in ClickHouse Cloud. This closes [#56107](https://github.com/ClickHouse/ClickHouse/issues/56107). [#56636](https://github.com/ClickHouse/ClickHouse/pull/56636) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Certain files of "Apache Arrow" library (which we use only for non-essential things like parsing the arrow format) were rebuilt all the time regardless of the build cache. This is fixed. [#56657](https://github.com/ClickHouse/ClickHouse/pull/56657) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Avoid recompiling translation units depending on the autogenerated source file about version. [#56660](https://github.com/ClickHouse/ClickHouse/pull/56660) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Do not fetch changed submodules in the builder container. [#56689](https://github.com/ClickHouse/ClickHouse/pull/56689) ([Mikhail f. Shiryaev](https://github.com/Felixoid)).
|
||||||
|
* Tracing data of the linker invocations will be sent to the CI database in ClickHouse Cloud. [#56725](https://github.com/ClickHouse/ClickHouse/pull/56725) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Use DWARF 5 debug symbols for the clickhouse binary (was DWARF 4 previously). [#56770](https://github.com/ClickHouse/ClickHouse/pull/56770) ([Michael Kolupaev](https://github.com/al13n321)).
|
||||||
|
* Optimized build size further by removing unused code from external libraries. [#56786](https://github.com/ClickHouse/ClickHouse/pull/56786) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Set memory usage for client (`1G`) to address problems like this: https://s3.amazonaws.com/clickhouse-test-reports/0/f1bf3f1fc39f520871ec878d815e515e12fd3e7b/fuzzer_astfuzzertsan/report.html. [#56873](https://github.com/ClickHouse/ClickHouse/pull/56873) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)).
|
||||||
|
* There was an attempt to have the proper listing in [#44311](https://github.com/ClickHouse/ClickHouse/issues/44311), but the fix itself was in the wrong place, so it's still broken. See an [example](https://github.com/ClickHouse/ClickHouse/actions/runs/6897342568/job/18781001022#step:8:25). [#56989](https://github.com/ClickHouse/ClickHouse/pull/56989) ([Mikhail f. Shiryaev](https://github.com/Felixoid)).
|
||||||
|
* Fixed the memory leak in integration test of postgres dictionary. The case of network partition is not correctly handled at the time of the repo pulled years ago. [#57231](https://github.com/ClickHouse/ClickHouse/pull/57231) ([jsc0218](https://github.com/jsc0218)).
|
||||||
|
* Fix a test filename typo. [#57272](https://github.com/ClickHouse/ClickHouse/pull/57272) ([jsc0218](https://github.com/jsc0218)).
|
||||||
|
* Fix issue caught in https://github.com/docker-library/official-images/pull/15846. [#57571](https://github.com/ClickHouse/ClickHouse/pull/57571) ([Mikhail f. Shiryaev](https://github.com/Felixoid)).
|
||||||
|
|
||||||
|
#### Bug Fix (user-visible misbehavior in an official stable release)
|
||||||
|
|
||||||
|
* Fix analyzer - insertion from select with subquery referencing insertion table should process only insertion block. [#50857](https://github.com/ClickHouse/ClickHouse/pull/50857) ([Yakov Olkhovskiy](https://github.com/yakov-olkhovskiy)).
|
||||||
|
* Setting JoinAlgorithm respect specified order [#51745](https://github.com/ClickHouse/ClickHouse/pull/51745) ([vdimir](https://github.com/vdimir)).
|
||||||
|
* Keeper `reconfig`: add timeout before yielding/taking leadership [#53481](https://github.com/ClickHouse/ClickHouse/pull/53481) ([Mike Kot](https://github.com/myrrc)).
|
||||||
|
* Fix incorrect header in grace hash join and filter pushdown [#53922](https://github.com/ClickHouse/ClickHouse/pull/53922) ([vdimir](https://github.com/vdimir)).
|
||||||
|
* Select from system tables when table based on table function. [#55540](https://github.com/ClickHouse/ClickHouse/pull/55540) ([MikhailBurdukov](https://github.com/MikhailBurdukov)).
|
||||||
|
* RFC: Fix "Cannot find column X in source stream" for Distributed queries with LIMIT BY [#55836](https://github.com/ClickHouse/ClickHouse/pull/55836) ([Azat Khuzhin](https://github.com/azat)).
|
||||||
|
* Fix 'Cannot read from file:' while running client in a background [#55976](https://github.com/ClickHouse/ClickHouse/pull/55976) ([Kruglov Pavel](https://github.com/Avogar)).
|
||||||
|
* Fix clickhouse-local exit on bad send_logs_level setting [#55994](https://github.com/ClickHouse/ClickHouse/pull/55994) ([Kruglov Pavel](https://github.com/Avogar)).
|
||||||
|
* Bug fix explain ast with parameterized view [#56004](https://github.com/ClickHouse/ClickHouse/pull/56004) ([SmitaRKulkarni](https://github.com/SmitaRKulkarni)).
|
||||||
|
* Fix a crash during table loading on startup [#56232](https://github.com/ClickHouse/ClickHouse/pull/56232) ([Nikolay Degterinsky](https://github.com/evillique)).
|
||||||
|
* Fix ClickHouse-sourced dictionaries with an explicit query [#56236](https://github.com/ClickHouse/ClickHouse/pull/56236) ([Nikolay Degterinsky](https://github.com/evillique)).
|
||||||
|
* Fix segfault in signal handler for Keeper [#56266](https://github.com/ClickHouse/ClickHouse/pull/56266) ([Antonio Andelic](https://github.com/antonio2368)).
|
||||||
|
* Fix incomplete query result for UNION in view() function. [#56274](https://github.com/ClickHouse/ClickHouse/pull/56274) ([Nikolai Kochetov](https://github.com/KochetovNicolai)).
|
||||||
|
* Fix inconsistency of "cast('0' as DateTime64(3))" and "cast('0' as Nullable(DateTime64(3)))" [#56286](https://github.com/ClickHouse/ClickHouse/pull/56286) ([李扬](https://github.com/taiyang-li)).
|
||||||
|
* Fix rare race condition related to Memory allocation failure [#56303](https://github.com/ClickHouse/ClickHouse/pull/56303) ([alesapin](https://github.com/alesapin)).
|
||||||
|
* Fix restore from backup with `flatten_nested` and `data_type_default_nullable` [#56306](https://github.com/ClickHouse/ClickHouse/pull/56306) ([Kseniia Sumarokova](https://github.com/kssenii)).
|
||||||
|
* Fix crash in case of adding a column with type Object(JSON) [#56307](https://github.com/ClickHouse/ClickHouse/pull/56307) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)).
|
||||||
|
* Fix crash in filterPushDown [#56380](https://github.com/ClickHouse/ClickHouse/pull/56380) ([vdimir](https://github.com/vdimir)).
|
||||||
|
* Fix restore from backup with mat view and dropped source table [#56383](https://github.com/ClickHouse/ClickHouse/pull/56383) ([Kseniia Sumarokova](https://github.com/kssenii)).
|
||||||
|
* Fix segfault during Kerberos initialization [#56401](https://github.com/ClickHouse/ClickHouse/pull/56401) ([Nikolay Degterinsky](https://github.com/evillique)).
|
||||||
|
* Fix buffer overflow in T64 [#56434](https://github.com/ClickHouse/ClickHouse/pull/56434) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Fix nullable primary key in final (2) [#56452](https://github.com/ClickHouse/ClickHouse/pull/56452) ([Amos Bird](https://github.com/amosbird)).
|
||||||
|
* Fix ON CLUSTER queries without database on initial node [#56484](https://github.com/ClickHouse/ClickHouse/pull/56484) ([Nikolay Degterinsky](https://github.com/evillique)).
|
||||||
|
* Fix startup failure due to TTL dependency [#56489](https://github.com/ClickHouse/ClickHouse/pull/56489) ([Nikolay Degterinsky](https://github.com/evillique)).
|
||||||
|
* Fix ALTER COMMENT queries ON CLUSTER [#56491](https://github.com/ClickHouse/ClickHouse/pull/56491) ([Nikolay Degterinsky](https://github.com/evillique)).
|
||||||
|
* Fix ALTER COLUMN with ALIAS [#56493](https://github.com/ClickHouse/ClickHouse/pull/56493) ([Nikolay Degterinsky](https://github.com/evillique)).
|
||||||
|
* Fix empty NAMED COLLECTIONs [#56494](https://github.com/ClickHouse/ClickHouse/pull/56494) ([Nikolay Degterinsky](https://github.com/evillique)).
|
||||||
|
* Fix two cases of projection analysis. [#56502](https://github.com/ClickHouse/ClickHouse/pull/56502) ([Amos Bird](https://github.com/amosbird)).
|
||||||
|
* Fix handling of aliases in query cache [#56545](https://github.com/ClickHouse/ClickHouse/pull/56545) ([Robert Schulze](https://github.com/rschu1ze)).
|
||||||
|
* Fix conversion from `Nullable(Enum)` to `Nullable(String)` [#56644](https://github.com/ClickHouse/ClickHouse/pull/56644) ([Nikolay Degterinsky](https://github.com/evillique)).
|
||||||
|
* More reliable log handling in Keeper [#56670](https://github.com/ClickHouse/ClickHouse/pull/56670) ([Antonio Andelic](https://github.com/antonio2368)).
|
||||||
|
* Fix configuration merge for nodes with substitution attributes [#56694](https://github.com/ClickHouse/ClickHouse/pull/56694) ([Konstantin Bogdanov](https://github.com/thevar1able)).
|
||||||
|
* Fix duplicate usage of table function input(). [#56695](https://github.com/ClickHouse/ClickHouse/pull/56695) ([Nikolai Kochetov](https://github.com/KochetovNicolai)).
|
||||||
|
* Fix: RabbitMQ OpenSSL dynamic loading issue [#56703](https://github.com/ClickHouse/ClickHouse/pull/56703) ([Igor Nikonov](https://github.com/devcrafter)).
|
||||||
|
* Fix crash in GCD codec in case when zeros present in data [#56704](https://github.com/ClickHouse/ClickHouse/pull/56704) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)).
|
||||||
|
* Fix 'mutex lock failed: Invalid argument' in clickhouse-local during insert into function [#56710](https://github.com/ClickHouse/ClickHouse/pull/56710) ([Kruglov Pavel](https://github.com/Avogar)).
|
||||||
|
* Fix Date text parsing in optimistic path [#56765](https://github.com/ClickHouse/ClickHouse/pull/56765) ([Kruglov Pavel](https://github.com/Avogar)).
|
||||||
|
* Fix crash in FPC codec [#56795](https://github.com/ClickHouse/ClickHouse/pull/56795) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* DatabaseReplicated: fix DDL query timeout after recovering a replica [#56796](https://github.com/ClickHouse/ClickHouse/pull/56796) ([Alexander Tokmakov](https://github.com/tavplubix)).
|
||||||
|
* Fix incorrect nullable columns reporting in MySQL binary protocol [#56799](https://github.com/ClickHouse/ClickHouse/pull/56799) ([Serge Klochkov](https://github.com/slvrtrn)).
|
||||||
|
* Support Iceberg metadata files for metastore tables [#56810](https://github.com/ClickHouse/ClickHouse/pull/56810) ([Kruglov Pavel](https://github.com/Avogar)).
|
||||||
|
* Fix TSAN report under transform [#56817](https://github.com/ClickHouse/ClickHouse/pull/56817) ([Raúl Marín](https://github.com/Algunenano)).
|
||||||
|
* Fix SET query and SETTINGS formatting [#56825](https://github.com/ClickHouse/ClickHouse/pull/56825) ([Nikolay Degterinsky](https://github.com/evillique)).
|
||||||
|
* Fix failure to start due to table dependency in joinGet [#56828](https://github.com/ClickHouse/ClickHouse/pull/56828) ([Nikolay Degterinsky](https://github.com/evillique)).
|
||||||
|
* Fix flattening existing Nested columns during ADD COLUMN [#56830](https://github.com/ClickHouse/ClickHouse/pull/56830) ([Nikolay Degterinsky](https://github.com/evillique)).
|
||||||
|
* Fix allow cr end of line for csv [#56901](https://github.com/ClickHouse/ClickHouse/pull/56901) ([KevinyhZou](https://github.com/KevinyhZou)).
|
||||||
|
* Fix `tryBase64Decode()` with invalid input [#56913](https://github.com/ClickHouse/ClickHouse/pull/56913) ([Robert Schulze](https://github.com/rschu1ze)).
|
||||||
|
* Fix generating deep nested columns in CapnProto/Protobuf schemas [#56941](https://github.com/ClickHouse/ClickHouse/pull/56941) ([Kruglov Pavel](https://github.com/Avogar)).
|
||||||
|
* Prevent incompatible ALTER of projection columns [#56948](https://github.com/ClickHouse/ClickHouse/pull/56948) ([Amos Bird](https://github.com/amosbird)).
|
||||||
|
* Fix sqlite file path validation [#56984](https://github.com/ClickHouse/ClickHouse/pull/56984) ([San](https://github.com/santrancisco)).
|
||||||
|
* S3Queue: fix metadata reference increment [#56990](https://github.com/ClickHouse/ClickHouse/pull/56990) ([Kseniia Sumarokova](https://github.com/kssenii)).
|
||||||
|
* S3Queue minor fix [#56999](https://github.com/ClickHouse/ClickHouse/pull/56999) ([Kseniia Sumarokova](https://github.com/kssenii)).
|
||||||
|
* Fix file path validation for DatabaseFileSystem [#57029](https://github.com/ClickHouse/ClickHouse/pull/57029) ([San](https://github.com/santrancisco)).
|
||||||
|
* Fix `fuzzBits` with `ARRAY JOIN` [#57033](https://github.com/ClickHouse/ClickHouse/pull/57033) ([Antonio Andelic](https://github.com/antonio2368)).
|
||||||
|
* Fix Nullptr dereference in partial merge join with joined_subquery_re… [#57048](https://github.com/ClickHouse/ClickHouse/pull/57048) ([vdimir](https://github.com/vdimir)).
|
||||||
|
* Fix race condition in RemoteSource [#57052](https://github.com/ClickHouse/ClickHouse/pull/57052) ([Raúl Marín](https://github.com/Algunenano)).
|
||||||
|
* Implement `bitHammingDistance` for big integers [#57073](https://github.com/ClickHouse/ClickHouse/pull/57073) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* S3-style links bug fix [#57075](https://github.com/ClickHouse/ClickHouse/pull/57075) ([Yarik Briukhovetskyi](https://github.com/yariks5s)).
|
||||||
|
* Fix JSON_QUERY function with multiple numeric paths [#57096](https://github.com/ClickHouse/ClickHouse/pull/57096) ([KevinyhZou](https://github.com/KevinyhZou)).
|
||||||
|
* Fix buffer overflow in Gorilla codec [#57107](https://github.com/ClickHouse/ClickHouse/pull/57107) ([Nikolay Degterinsky](https://github.com/evillique)).
|
||||||
|
* Close interserver connection on any exception before authentication [#57142](https://github.com/ClickHouse/ClickHouse/pull/57142) ([Antonio Andelic](https://github.com/antonio2368)).
|
||||||
|
* Fix segfault after ALTER UPDATE with Nullable MATERIALIZED column [#57147](https://github.com/ClickHouse/ClickHouse/pull/57147) ([Nikolay Degterinsky](https://github.com/evillique)).
|
||||||
|
* Fix incorrect JOIN plan optimization with partially materialized normal projection [#57196](https://github.com/ClickHouse/ClickHouse/pull/57196) ([Amos Bird](https://github.com/amosbird)).
|
||||||
|
* Ignore comments when comparing column descriptions [#57259](https://github.com/ClickHouse/ClickHouse/pull/57259) ([Antonio Andelic](https://github.com/antonio2368)).
|
||||||
|
* Fix `ReadonlyReplica` metric for all cases [#57267](https://github.com/ClickHouse/ClickHouse/pull/57267) ([Antonio Andelic](https://github.com/antonio2368)).
|
||||||
|
* Background merges correctly use temporary data storage in the cache [#57275](https://github.com/ClickHouse/ClickHouse/pull/57275) ([vdimir](https://github.com/vdimir)).
|
||||||
|
* Keeper fix for changelog and snapshots [#57299](https://github.com/ClickHouse/ClickHouse/pull/57299) ([Antonio Andelic](https://github.com/antonio2368)).
|
||||||
|
* Ignore finished ON CLUSTER tasks if hostname changed [#57339](https://github.com/ClickHouse/ClickHouse/pull/57339) ([Alexander Tokmakov](https://github.com/tavplubix)).
|
||||||
|
* MergeTree mutations reuse source part index granularity [#57352](https://github.com/ClickHouse/ClickHouse/pull/57352) ([Maksim Kita](https://github.com/kitaisreal)).
|
||||||
|
* Fix function jsonMergePatch for partially const columns [#57379](https://github.com/ClickHouse/ClickHouse/pull/57379) ([Nikolay Degterinsky](https://github.com/evillique)).
|
||||||
|
* Fix ubsan error in `Arena` [#57407](https://github.com/ClickHouse/ClickHouse/pull/57407) ([Nikita Taranov](https://github.com/nickitat)).
|
||||||
|
* fs cache: add limit for background download [#57424](https://github.com/ClickHouse/ClickHouse/pull/57424) ([Kseniia Sumarokova](https://github.com/kssenii)).
|
||||||
|
* bugfix: correctly parse SYSTEM STOP LISTEN TCP SECURE [#57483](https://github.com/ClickHouse/ClickHouse/pull/57483) ([joelynch](https://github.com/joelynch)).
|
||||||
|
|
||||||
|
#### NO CL ENTRY
|
||||||
|
|
||||||
|
* NO CL ENTRY: 'Revert "Add function `arrayRandomSample()`"'. [#56399](https://github.com/ClickHouse/ClickHouse/pull/56399) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* NO CL ENTRY: 'Update README.md'. [#56549](https://github.com/ClickHouse/ClickHouse/pull/56549) ([Tyler Hannan](https://github.com/tylerhannan)).
|
||||||
|
* NO CL ENTRY: 'Revert "FunctionSleep exception message fix"'. [#56591](https://github.com/ClickHouse/ClickHouse/pull/56591) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* NO CL ENTRY: 'Revert "Inserting only non-duplicate chunks in MV"'. [#56598](https://github.com/ClickHouse/ClickHouse/pull/56598) ([Maksim Kita](https://github.com/kitaisreal)).
|
||||||
|
* NO CL ENTRY: 'Add new header for README with updated logo'. [#56607](https://github.com/ClickHouse/ClickHouse/pull/56607) ([Justin de Guzman](https://github.com/justindeguzman)).
|
||||||
|
* NO CL ENTRY: 'Revert "Add /keeper/availability-zone node to allow server load balancing within AZ."'. [#56610](https://github.com/ClickHouse/ClickHouse/pull/56610) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* NO CL ENTRY: 'Revert "Add 4-letter command for yielding/resigning leadership"'. [#56611](https://github.com/ClickHouse/ClickHouse/pull/56611) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* NO CL ENTRY: 'fix(docs): correct default value for output_format_parquet_compression_method to 'lz4''. [#56614](https://github.com/ClickHouse/ClickHouse/pull/56614) ([james-seymour-cubiko](https://github.com/james-seymour-cubiko)).
|
||||||
|
* NO CL ENTRY: 'Update except.md'. [#56651](https://github.com/ClickHouse/ClickHouse/pull/56651) ([rondo_1895](https://github.com/yangguang1991)).
|
||||||
|
* NO CL ENTRY: 'Revert "Add a setting max_execution_time_leaf to limit the execution time on shard for distributed query"'. [#56702](https://github.com/ClickHouse/ClickHouse/pull/56702) ([Alexander Tokmakov](https://github.com/tavplubix)).
|
||||||
|
* NO CL ENTRY: 'Revert "Better except for SSL authentication failure"'. [#56844](https://github.com/ClickHouse/ClickHouse/pull/56844) ([Antonio Andelic](https://github.com/antonio2368)).
|
||||||
|
* NO CL ENTRY: 'Revert "s3 adaptive timeouts"'. [#56992](https://github.com/ClickHouse/ClickHouse/pull/56992) ([Alexander Tokmakov](https://github.com/tavplubix)).
|
||||||
|
* NO CL ENTRY: 'Revert "Revert "s3 adaptive timeouts""'. [#56994](https://github.com/ClickHouse/ClickHouse/pull/56994) ([Sema Checherinda](https://github.com/CheSema)).
|
||||||
|
* NO CL ENTRY: 'Revert "Resubmit 01600_parts_types_metrics test (possibly without flakiness)"'. [#57163](https://github.com/ClickHouse/ClickHouse/pull/57163) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* NO CL ENTRY: 'Revert "Mark select() as harmful function"'. [#57195](https://github.com/ClickHouse/ClickHouse/pull/57195) ([Alexander Tokmakov](https://github.com/tavplubix)).
|
||||||
|
* NO CL ENTRY: 'Revert "Update Sentry"'. [#57229](https://github.com/ClickHouse/ClickHouse/pull/57229) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* NO CL ENTRY: 'Revert "Add debugging info for 01600_parts_types_metrics on failures"'. [#57232](https://github.com/ClickHouse/ClickHouse/pull/57232) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* NO CL ENTRY: 'Revert "Update date-time-functions.md"'. [#57329](https://github.com/ClickHouse/ClickHouse/pull/57329) ([Denny Crane](https://github.com/den-crane)).
|
||||||
|
* NO CL ENTRY: 'Revert "add function getClientHTTPHeader"'. [#57510](https://github.com/ClickHouse/ClickHouse/pull/57510) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* NO CL ENTRY: 'Revert "Add `sqid()` function"'. [#57511](https://github.com/ClickHouse/ClickHouse/pull/57511) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* NO CL ENTRY: 'Revert "Add new aggregation function groupArraySorted()"'. [#57519](https://github.com/ClickHouse/ClickHouse/pull/57519) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* NO CL ENTRY: 'Revert "Implemented series period detect method using pocketfft lib"'. [#57536](https://github.com/ClickHouse/ClickHouse/pull/57536) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* NO CL ENTRY: 'Revert "Support use alias column in indices"'. [#57537](https://github.com/ClickHouse/ClickHouse/pull/57537) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
|
||||||
|
#### NOT FOR CHANGELOG / INSIGNIFICANT
|
||||||
|
|
||||||
|
* Remove useless "install" from CMake (step 1) [#36589](https://github.com/ClickHouse/ClickHouse/pull/36589) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Analyzer support 'is not distinct from' in join on section [#54068](https://github.com/ClickHouse/ClickHouse/pull/54068) ([vdimir](https://github.com/vdimir)).
|
||||||
|
* Refactor merge join transform [#55007](https://github.com/ClickHouse/ClickHouse/pull/55007) ([Alex Cheng](https://github.com/Alex-Cheng)).
|
||||||
|
* Add function jaccardIndex back with better performance [#55126](https://github.com/ClickHouse/ClickHouse/pull/55126) ([vdimir](https://github.com/vdimir)).
|
||||||
|
* Use more thread pools in BACKUP/RESTORE to avoid its hanging in tests [#55216](https://github.com/ClickHouse/ClickHouse/pull/55216) ([Vitaly Baranov](https://github.com/vitlibar)).
|
||||||
|
* Parallel replicas: progress bar [#55574](https://github.com/ClickHouse/ClickHouse/pull/55574) ([Igor Nikonov](https://github.com/devcrafter)).
|
||||||
|
* Analyzer: Fix result type after IfConstantConditionPass [#55951](https://github.com/ClickHouse/ClickHouse/pull/55951) ([Dmitry Novik](https://github.com/novikd)).
|
||||||
|
* RemoteSource: remove unnecessary flag [#55980](https://github.com/ClickHouse/ClickHouse/pull/55980) ([Igor Nikonov](https://github.com/devcrafter)).
|
||||||
|
* Fix `REPLICA_ALREADY_EXISTS` for ReplicatedMergeTree [#56000](https://github.com/ClickHouse/ClickHouse/pull/56000) ([Nikolay Degterinsky](https://github.com/evillique)).
|
||||||
|
* Rework [#52159](https://github.com/ClickHouse/ClickHouse/issues/52159) to avoid coredump generation [#56039](https://github.com/ClickHouse/ClickHouse/pull/56039) ([Raúl Marín](https://github.com/Algunenano)).
|
||||||
|
* Bump gRPC to v1.47.5 [#56059](https://github.com/ClickHouse/ClickHouse/pull/56059) ([Robert Schulze](https://github.com/rschu1ze)).
|
||||||
|
* See what happens if we use less different docker images in integration tests [#56082](https://github.com/ClickHouse/ClickHouse/pull/56082) ([Raúl Marín](https://github.com/Algunenano)).
|
||||||
|
* Add missing zookeeper retries in StorageReplicatedMergeTree::backupData [#56131](https://github.com/ClickHouse/ClickHouse/pull/56131) ([Kseniia Sumarokova](https://github.com/kssenii)).
|
||||||
|
* Better process broken parts on table start for replicated tables [#56142](https://github.com/ClickHouse/ClickHouse/pull/56142) ([alesapin](https://github.com/alesapin)).
|
||||||
|
* Add more details to "Data after merge is not byte-identical to data on another replicas" [#56164](https://github.com/ClickHouse/ClickHouse/pull/56164) ([Azat Khuzhin](https://github.com/azat)).
|
||||||
|
* Revert "Revert "Fix output/input of Arrow dictionary column"" [#56167](https://github.com/ClickHouse/ClickHouse/pull/56167) ([Kruglov Pavel](https://github.com/Avogar)).
|
||||||
|
* Add a log message for DatabaseReplicated [#56215](https://github.com/ClickHouse/ClickHouse/pull/56215) ([Alexander Tokmakov](https://github.com/tavplubix)).
|
||||||
|
* Correct aggregate function cross tab accessors to be endianness-independent. [#56223](https://github.com/ClickHouse/ClickHouse/pull/56223) ([Austin Kothig](https://github.com/kothiga)).
|
||||||
|
* Fix client suggestions for user without grants [#56234](https://github.com/ClickHouse/ClickHouse/pull/56234) ([Nikolay Degterinsky](https://github.com/evillique)).
|
||||||
|
* Fix link to failed check report in status commit [#56243](https://github.com/ClickHouse/ClickHouse/pull/56243) ([vdimir](https://github.com/vdimir)).
|
||||||
|
* Analyzer: fix 01019_alter_materialized_view_consistent [#56246](https://github.com/ClickHouse/ClickHouse/pull/56246) ([vdimir](https://github.com/vdimir)).
|
||||||
|
* Properly process aliases for aggregation-by-partition optimization. [#56254](https://github.com/ClickHouse/ClickHouse/pull/56254) ([Nikolai Kochetov](https://github.com/KochetovNicolai)).
|
||||||
|
* deltalake: Do not raise errors when processing add and remove actions [#56260](https://github.com/ClickHouse/ClickHouse/pull/56260) ([joelynch](https://github.com/joelynch)).
|
||||||
|
* Fix rare logical error in Replicated database [#56272](https://github.com/ClickHouse/ClickHouse/pull/56272) ([Alexander Tokmakov](https://github.com/tavplubix)).
|
||||||
|
* Update version_date.tsv and changelogs after v23.10.1.1976-stable [#56278](https://github.com/ClickHouse/ClickHouse/pull/56278) ([robot-clickhouse](https://github.com/robot-clickhouse)).
|
||||||
|
* Add assertion that `SizePredictor` is set if `preferred_block_size_bytes` is set [#56302](https://github.com/ClickHouse/ClickHouse/pull/56302) ([Nikita Taranov](https://github.com/nickitat)).
|
||||||
|
* Implement digest helpers for different objects [#56305](https://github.com/ClickHouse/ClickHouse/pull/56305) ([Mikhail f. Shiryaev](https://github.com/Felixoid)).
|
||||||
|
* Removed stale events from README [#56311](https://github.com/ClickHouse/ClickHouse/pull/56311) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)).
|
||||||
|
* Fix more tests with analyzer. [#56315](https://github.com/ClickHouse/ClickHouse/pull/56315) ([Nikolai Kochetov](https://github.com/KochetovNicolai)).
|
||||||
|
* Change some exception codes [#56316](https://github.com/ClickHouse/ClickHouse/pull/56316) ([Alexander Tokmakov](https://github.com/tavplubix)).
|
||||||
|
* Fix using table shared id during backup and improve logs. [#56339](https://github.com/ClickHouse/ClickHouse/pull/56339) ([Vitaly Baranov](https://github.com/vitlibar)).
|
||||||
|
* Print info while decompressing the binary [#56360](https://github.com/ClickHouse/ClickHouse/pull/56360) ([Antonio Andelic](https://github.com/antonio2368)).
|
||||||
|
* remove unstable test test_heavy_insert_select_check_memory [#56369](https://github.com/ClickHouse/ClickHouse/pull/56369) ([Sema Checherinda](https://github.com/CheSema)).
|
||||||
|
* Update test_storage_s3_queue/test.py [#56370](https://github.com/ClickHouse/ClickHouse/pull/56370) ([Kseniia Sumarokova](https://github.com/kssenii)).
|
||||||
|
* Update 02735_system_zookeeper_connection.sql [#56374](https://github.com/ClickHouse/ClickHouse/pull/56374) ([Alexander Tokmakov](https://github.com/tavplubix)).
|
||||||
|
* Cleanup convenience functions in IDataType [#56375](https://github.com/ClickHouse/ClickHouse/pull/56375) ([Robert Schulze](https://github.com/rschu1ze)).
|
||||||
|
* Update test_storage_s3_queue [#56376](https://github.com/ClickHouse/ClickHouse/pull/56376) ([Kseniia Sumarokova](https://github.com/kssenii)).
|
||||||
|
* Minor improvements for S3Queue [#56377](https://github.com/ClickHouse/ClickHouse/pull/56377) ([Kseniia Sumarokova](https://github.com/kssenii)).
|
||||||
|
* Add obsolete setting back [#56382](https://github.com/ClickHouse/ClickHouse/pull/56382) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)).
|
||||||
|
* Rewrite jobs to use callable workflow [#56385](https://github.com/ClickHouse/ClickHouse/pull/56385) ([Mikhail f. Shiryaev](https://github.com/Felixoid)).
|
||||||
|
* Update stress.py [#56388](https://github.com/ClickHouse/ClickHouse/pull/56388) ([Alexander Tokmakov](https://github.com/tavplubix)).
|
||||||
|
* Fix rocksdb with analyzer. [#56391](https://github.com/ClickHouse/ClickHouse/pull/56391) ([Nikolai Kochetov](https://github.com/KochetovNicolai)).
|
||||||
|
* Option to check particular file with utils/check-style/check-doc-aspell [#56394](https://github.com/ClickHouse/ClickHouse/pull/56394) ([vdimir](https://github.com/vdimir)).
|
||||||
|
* Add a metric for suspicious parts in ZooKeeper [#56395](https://github.com/ClickHouse/ClickHouse/pull/56395) ([Alexander Tokmakov](https://github.com/tavplubix)).
|
||||||
|
* Fix 02404_memory_bound_merging with analyzer. [#56419](https://github.com/ClickHouse/ClickHouse/pull/56419) ([Nikolai Kochetov](https://github.com/KochetovNicolai)).
|
||||||
|
* move storage_metadata_write_full_object_key setting to the server scope [#56421](https://github.com/ClickHouse/ClickHouse/pull/56421) ([Sema Checherinda](https://github.com/CheSema)).
|
||||||
|
* Make autoscaling more responsive [#56422](https://github.com/ClickHouse/ClickHouse/pull/56422) ([Mikhail f. Shiryaev](https://github.com/Felixoid)).
|
||||||
|
* Fix `test_attach_without_fetching` [#56429](https://github.com/ClickHouse/ClickHouse/pull/56429) ([Alexander Tokmakov](https://github.com/tavplubix)).
|
||||||
|
* Use `pcg` + `randomSeed()` instead of `std::mt19937`/`std::random_device` [#56430](https://github.com/ClickHouse/ClickHouse/pull/56430) ([Robert Schulze](https://github.com/rschu1ze)).
|
||||||
|
* Fix test `02725_database_hdfs.sh` [#56457](https://github.com/ClickHouse/ClickHouse/pull/56457) ([Kseniia Sumarokova](https://github.com/kssenii)).
|
||||||
|
* Update the AMI receipt [#56459](https://github.com/ClickHouse/ClickHouse/pull/56459) ([Mikhail f. Shiryaev](https://github.com/Felixoid)).
|
||||||
|
* Make IMergeTreeDataPart::getState() inlinable [#56461](https://github.com/ClickHouse/ClickHouse/pull/56461) ([Alexander Gololobov](https://github.com/davenger)).
|
||||||
|
* Update version_date.tsv and changelogs after v23.10.2.13-stable [#56467](https://github.com/ClickHouse/ClickHouse/pull/56467) ([robot-clickhouse](https://github.com/robot-clickhouse)).
|
||||||
|
* Update version_date.tsv and changelogs after v23.9.4.11-stable [#56468](https://github.com/ClickHouse/ClickHouse/pull/56468) ([robot-clickhouse](https://github.com/robot-clickhouse)).
|
||||||
|
* Update version_date.tsv and changelogs after v23.8.6.16-lts [#56469](https://github.com/ClickHouse/ClickHouse/pull/56469) ([robot-clickhouse](https://github.com/robot-clickhouse)).
|
||||||
|
* Update version_date.tsv and changelogs after v23.3.16.7-lts [#56470](https://github.com/ClickHouse/ClickHouse/pull/56470) ([robot-clickhouse](https://github.com/robot-clickhouse)).
|
||||||
|
* Disable randomization of allow_experimental_block_number_column flag [#56474](https://github.com/ClickHouse/ClickHouse/pull/56474) ([SmitaRKulkarni](https://github.com/SmitaRKulkarni)).
|
||||||
|
* Parallel clone sparse/shallow submodules [#56479](https://github.com/ClickHouse/ClickHouse/pull/56479) ([Robert Schulze](https://github.com/rschu1ze)).
|
||||||
|
* Fix default port for Replicated database cluster [#56486](https://github.com/ClickHouse/ClickHouse/pull/56486) ([Nikolay Degterinsky](https://github.com/evillique)).
|
||||||
|
* Updated compression to LZ4 [#56497](https://github.com/ClickHouse/ClickHouse/pull/56497) ([SmitaRKulkarni](https://github.com/SmitaRKulkarni)).
|
||||||
|
* Analyzer remove unused projection columns [#56499](https://github.com/ClickHouse/ClickHouse/pull/56499) ([Maksim Kita](https://github.com/kitaisreal)).
|
||||||
|
* FunctionSleep exception message fix [#56500](https://github.com/ClickHouse/ClickHouse/pull/56500) ([Maksim Kita](https://github.com/kitaisreal)).
|
||||||
|
* Continue rewriting workflows to reusable tests [#56501](https://github.com/ClickHouse/ClickHouse/pull/56501) ([Mikhail f. Shiryaev](https://github.com/Felixoid)).
|
||||||
|
* Analyzer special functions projection names fix [#56514](https://github.com/ClickHouse/ClickHouse/pull/56514) ([Maksim Kita](https://github.com/kitaisreal)).
|
||||||
|
* CTE invalid query analysis add test [#56517](https://github.com/ClickHouse/ClickHouse/pull/56517) ([Maksim Kita](https://github.com/kitaisreal)).
|
||||||
|
* Fix compilation of BackupsWorker.cpp [#56518](https://github.com/ClickHouse/ClickHouse/pull/56518) ([Vitaly Baranov](https://github.com/vitlibar)).
|
||||||
|
* Analyzer MoveFunctionsOutOfAnyPass refactoring [#56520](https://github.com/ClickHouse/ClickHouse/pull/56520) ([Maksim Kita](https://github.com/kitaisreal)).
|
||||||
|
* Analyzer support EXPLAIN ESTIMATE [#56522](https://github.com/ClickHouse/ClickHouse/pull/56522) ([Maksim Kita](https://github.com/kitaisreal)).
|
||||||
|
* Analyzer log used row policies [#56531](https://github.com/ClickHouse/ClickHouse/pull/56531) ([Maksim Kita](https://github.com/kitaisreal)).
|
||||||
|
* Analyzer ORDER BY read in order query plan add test [#56532](https://github.com/ClickHouse/ClickHouse/pull/56532) ([Maksim Kita](https://github.com/kitaisreal)).
|
||||||
|
* ReplicatedMergeTree: check shutdown flags in retry loops [#56533](https://github.com/ClickHouse/ClickHouse/pull/56533) ([Alexander Tokmakov](https://github.com/tavplubix)).
|
||||||
|
* Fix race between REPLACE_RANGE and GET_PART (set actual part name when fetching) [#56536](https://github.com/ClickHouse/ClickHouse/pull/56536) ([Nikolai Kochetov](https://github.com/KochetovNicolai)).
|
||||||
|
* Bump gRPC to v1.54.3 [#56543](https://github.com/ClickHouse/ClickHouse/pull/56543) ([Robert Schulze](https://github.com/rschu1ze)).
|
||||||
|
* Fix flaky LDAP integration tests [#56544](https://github.com/ClickHouse/ClickHouse/pull/56544) ([Julian Maicher](https://github.com/jmaicher)).
|
||||||
|
* Remove useless using [#56546](https://github.com/ClickHouse/ClickHouse/pull/56546) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Better warning message [#56547](https://github.com/ClickHouse/ClickHouse/pull/56547) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Allow `chassert` to guide the static analyzer [#56552](https://github.com/ClickHouse/ClickHouse/pull/56552) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Remove C++ templates [#56556](https://github.com/ClickHouse/ClickHouse/pull/56556) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Fix `test_keeper_four_word_command/test.py::test_cmd_crst` [#56570](https://github.com/ClickHouse/ClickHouse/pull/56570) ([Antonio Andelic](https://github.com/antonio2368)).
|
||||||
|
* Delete unnecessary file from tests [#56572](https://github.com/ClickHouse/ClickHouse/pull/56572) ([vdimir](https://github.com/vdimir)).
|
||||||
|
* Analyzer: fix logical error with set in array join [#56587](https://github.com/ClickHouse/ClickHouse/pull/56587) ([vdimir](https://github.com/vdimir)).
|
||||||
|
* hide VERSION_INLINE_DATA under feature flag [#56594](https://github.com/ClickHouse/ClickHouse/pull/56594) ([Sema Checherinda](https://github.com/CheSema)).
|
||||||
|
* Fix 02554_fix_grouping_sets_predicate_push_down with analyzer. [#56595](https://github.com/ClickHouse/ClickHouse/pull/56595) ([Nikolai Kochetov](https://github.com/KochetovNicolai)).
|
||||||
|
* Add "FunctionSleep exception message fix" again [#56597](https://github.com/ClickHouse/ClickHouse/pull/56597) ([Raúl Marín](https://github.com/Algunenano)).
|
||||||
|
* Update version_date.tsv and changelogs after v23.10.3.5-stable [#56606](https://github.com/ClickHouse/ClickHouse/pull/56606) ([robot-clickhouse](https://github.com/robot-clickhouse)).
|
||||||
|
* Remove bad test [#56612](https://github.com/ClickHouse/ClickHouse/pull/56612) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Symbolize `trace_log` for exporting [#56613](https://github.com/ClickHouse/ClickHouse/pull/56613) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Add indices to exported system logs [#56615](https://github.com/ClickHouse/ClickHouse/pull/56615) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Remove dependencies [#56616](https://github.com/ClickHouse/ClickHouse/pull/56616) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* WIP: Add test describing MV deduplication issues [#56621](https://github.com/ClickHouse/ClickHouse/pull/56621) ([Jordi Villar](https://github.com/jrdi)).
|
||||||
|
* Add test for ROW POLICY ON CLUSTER [#56623](https://github.com/ClickHouse/ClickHouse/pull/56623) ([Nikolay Degterinsky](https://github.com/evillique)).
|
||||||
|
* Enable --secure flag for clickhouse-client for hostnames pointing to clickhouse cloud [#56638](https://github.com/ClickHouse/ClickHouse/pull/56638) ([Pradeep Chhetri](https://github.com/chhetripradeep)).
|
||||||
|
* Continue with work from [#56621](https://github.com/ClickHouse/ClickHouse/issues/56621) [#56641](https://github.com/ClickHouse/ClickHouse/pull/56641) ([Jordi Villar](https://github.com/jrdi)).
|
||||||
|
* Switch to SSL port for clickhouse-client for hostnames pointing to clickhouse cloud [#56649](https://github.com/ClickHouse/ClickHouse/pull/56649) ([Pradeep Chhetri](https://github.com/chhetripradeep)).
|
||||||
|
* Remove garbage from libssh [#56654](https://github.com/ClickHouse/ClickHouse/pull/56654) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Delete a file [#56655](https://github.com/ClickHouse/ClickHouse/pull/56655) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Delete a file (2) [#56656](https://github.com/ClickHouse/ClickHouse/pull/56656) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Remove some entries from `analyzer_tech_debt.txt` [#56658](https://github.com/ClickHouse/ClickHouse/pull/56658) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Miscellaneous [#56662](https://github.com/ClickHouse/ClickHouse/pull/56662) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Bump gRPC to v1.55.4 and protobuf to v22.5 [#56664](https://github.com/ClickHouse/ClickHouse/pull/56664) ([Robert Schulze](https://github.com/rschu1ze)).
|
||||||
|
* Small refactoring of AST hash calculation (follow-up to [#56545](https://github.com/ClickHouse/ClickHouse/issues/56545)) [#56665](https://github.com/ClickHouse/ClickHouse/pull/56665) ([Robert Schulze](https://github.com/rschu1ze)).
|
||||||
|
* Analyzer: filtering by virtual columns for StorageS3 [#56668](https://github.com/ClickHouse/ClickHouse/pull/56668) ([vdimir](https://github.com/vdimir)).
|
||||||
|
* Add back flaky tests to analyzer_tech_debt.txt [#56669](https://github.com/ClickHouse/ClickHouse/pull/56669) ([Raúl Marín](https://github.com/Algunenano)).
|
||||||
|
* gRPC: remove build dependency on systemd [#56671](https://github.com/ClickHouse/ClickHouse/pull/56671) ([Raúl Marín](https://github.com/Algunenano)).
|
||||||
|
* Remove unused code [#56677](https://github.com/ClickHouse/ClickHouse/pull/56677) ([Kseniia Sumarokova](https://github.com/kssenii)).
|
||||||
|
* Fix missing argument for style_check.py in master workflow [#56691](https://github.com/ClickHouse/ClickHouse/pull/56691) ([Mikhail f. Shiryaev](https://github.com/Felixoid)).
|
||||||
|
* Fix unexpected parts handling [#56693](https://github.com/ClickHouse/ClickHouse/pull/56693) ([Alexander Tokmakov](https://github.com/tavplubix)).
|
||||||
|
* Revert "Revert "Add a setting max_execution_time_leaf to limit the execution time on shard for distributed query"" [#56707](https://github.com/ClickHouse/ClickHouse/pull/56707) ([Kruglov Pavel](https://github.com/Avogar)).
|
||||||
|
* Fix use_structure_from_insertion_table_in_table_functions with new Analyzer [#56708](https://github.com/ClickHouse/ClickHouse/pull/56708) ([Kruglov Pavel](https://github.com/Avogar)).
|
||||||
|
* Disable settings randomisation for `02896_memory_accounting_for_user.sh` [#56709](https://github.com/ClickHouse/ClickHouse/pull/56709) ([Nikita Taranov](https://github.com/nickitat)).
|
||||||
|
* Light autogenerated file [#56720](https://github.com/ClickHouse/ClickHouse/pull/56720) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Less CMake checks [#56721](https://github.com/ClickHouse/ClickHouse/pull/56721) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Remove orphan header files [#56722](https://github.com/ClickHouse/ClickHouse/pull/56722) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Try to fix hang in 01104_distributed_numbers_test [#56764](https://github.com/ClickHouse/ClickHouse/pull/56764) ([Nikolai Kochetov](https://github.com/KochetovNicolai)).
|
||||||
|
* Test RabbitMQ with secure connection [#56767](https://github.com/ClickHouse/ClickHouse/pull/56767) ([Igor Nikonov](https://github.com/devcrafter)).
|
||||||
|
* Fix flaky test_replicated_merge_tree_encryption_codec. [#56768](https://github.com/ClickHouse/ClickHouse/pull/56768) ([Vitaly Baranov](https://github.com/vitlibar)).
|
||||||
|
* fix typo in ClickHouseDictionarySource [#56776](https://github.com/ClickHouse/ClickHouse/pull/56776) ([Mikhail Koviazin](https://github.com/mkmkme)).
|
||||||
|
* Fix pygithub [#56778](https://github.com/ClickHouse/ClickHouse/pull/56778) ([Mikhail f. Shiryaev](https://github.com/Felixoid)).
|
||||||
|
* Add test for avoided recursion [#56785](https://github.com/ClickHouse/ClickHouse/pull/56785) ([Mikhail f. Shiryaev](https://github.com/Felixoid)).
|
||||||
|
* Fix randomization of Keeper configs in stress tests [#56788](https://github.com/ClickHouse/ClickHouse/pull/56788) ([Antonio Andelic](https://github.com/antonio2368)).
|
||||||
|
* Try fix `No user in current context, it's a bug` [#56789](https://github.com/ClickHouse/ClickHouse/pull/56789) ([Antonio Andelic](https://github.com/antonio2368)).
|
||||||
|
* Update avg_weighted.xml [#56797](https://github.com/ClickHouse/ClickHouse/pull/56797) ([Alexander Tokmakov](https://github.com/tavplubix)).
|
||||||
|
* Better except for SSL authentication failure [#56811](https://github.com/ClickHouse/ClickHouse/pull/56811) ([Nikolay Degterinsky](https://github.com/evillique)).
|
||||||
|
* More stable `test_keeper_reconfig_replace_leader` [#56835](https://github.com/ClickHouse/ClickHouse/pull/56835) ([Antonio Andelic](https://github.com/antonio2368)).
|
||||||
|
* Add cancellation hook for moving background operation [#56846](https://github.com/ClickHouse/ClickHouse/pull/56846) ([Aleksei Filatov](https://github.com/aalexfvk)).
|
||||||
|
* Updated comment in universal.sh [#56852](https://github.com/ClickHouse/ClickHouse/pull/56852) ([Robert Schulze](https://github.com/rschu1ze)).
|
||||||
|
* Bump gRPC to v1.59 and protobuf to v24.4 [#56853](https://github.com/ClickHouse/ClickHouse/pull/56853) ([Robert Schulze](https://github.com/rschu1ze)).
|
||||||
|
* Better exception messages [#56854](https://github.com/ClickHouse/ClickHouse/pull/56854) ([Antonio Andelic](https://github.com/antonio2368)).
|
||||||
|
* Sparse checkout: Use `--remote` for `git submodule update` [#56857](https://github.com/ClickHouse/ClickHouse/pull/56857) ([Aleksandr Musorin](https://github.com/AVMusorin)).
|
||||||
|
* Fix `test_keeper_broken_logs` [#56858](https://github.com/ClickHouse/ClickHouse/pull/56858) ([Antonio Andelic](https://github.com/antonio2368)).
|
||||||
|
* CMake: Small cleanup in cpu_features.cmake [#56861](https://github.com/ClickHouse/ClickHouse/pull/56861) ([Robert Schulze](https://github.com/rschu1ze)).
|
||||||
|
* Planner support transactions [#56867](https://github.com/ClickHouse/ClickHouse/pull/56867) ([Maksim Kita](https://github.com/kitaisreal)).
|
||||||
|
* Improve diagnostics in test 02908_many_requests_to_system_replicas [#56869](https://github.com/ClickHouse/ClickHouse/pull/56869) ([Alexander Gololobov](https://github.com/davenger)).
|
||||||
|
* Update 01052_window_view_proc_tumble_to_now.sh [#56870](https://github.com/ClickHouse/ClickHouse/pull/56870) ([Kseniia Sumarokova](https://github.com/kssenii)).
|
||||||
|
* Call cache check a bit more often [#56872](https://github.com/ClickHouse/ClickHouse/pull/56872) ([Kseniia Sumarokova](https://github.com/kssenii)).
|
||||||
|
* Update test_storage_s3_queue/test.py [#56874](https://github.com/ClickHouse/ClickHouse/pull/56874) ([Kseniia Sumarokova](https://github.com/kssenii)).
|
||||||
|
* Fix perf tests report when there are no tests [#56881](https://github.com/ClickHouse/ClickHouse/pull/56881) ([Alexander Tokmakov](https://github.com/tavplubix)).
|
||||||
|
* Remove ctest [#56894](https://github.com/ClickHouse/ClickHouse/pull/56894) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Simpler CMake [#56898](https://github.com/ClickHouse/ClickHouse/pull/56898) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* test for [#56790](https://github.com/ClickHouse/ClickHouse/issues/56790) [#56899](https://github.com/ClickHouse/ClickHouse/pull/56899) ([Denny Crane](https://github.com/den-crane)).
|
||||||
|
* Allow delegate disk to handle retries for createDirectories [#56905](https://github.com/ClickHouse/ClickHouse/pull/56905) ([Alexander Gololobov](https://github.com/davenger)).
|
||||||
|
* Update version_date.tsv and changelogs after v23.10.4.25-stable [#56906](https://github.com/ClickHouse/ClickHouse/pull/56906) ([robot-clickhouse](https://github.com/robot-clickhouse)).
|
||||||
|
* Update version_date.tsv and changelogs after v23.3.17.13-lts [#56907](https://github.com/ClickHouse/ClickHouse/pull/56907) ([robot-clickhouse](https://github.com/robot-clickhouse)).
|
||||||
|
* Update version_date.tsv and changelogs after v23.8.7.24-lts [#56908](https://github.com/ClickHouse/ClickHouse/pull/56908) ([robot-clickhouse](https://github.com/robot-clickhouse)).
|
||||||
|
* Update version_date.tsv and changelogs after v23.9.5.29-stable [#56909](https://github.com/ClickHouse/ClickHouse/pull/56909) ([robot-clickhouse](https://github.com/robot-clickhouse)).
|
||||||
|
* Remove outdated instructions [#56911](https://github.com/ClickHouse/ClickHouse/pull/56911) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Avoid dependencies with no fixed versions [#56914](https://github.com/ClickHouse/ClickHouse/pull/56914) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Fix race on zk_log initialization [#56915](https://github.com/ClickHouse/ClickHouse/pull/56915) ([Alexander Gololobov](https://github.com/davenger)).
|
||||||
|
* Check what will happen if I remove some lines [#56916](https://github.com/ClickHouse/ClickHouse/pull/56916) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Update fasttest [#56919](https://github.com/ClickHouse/ClickHouse/pull/56919) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Make some tests independent of macro settings [#56927](https://github.com/ClickHouse/ClickHouse/pull/56927) ([Raúl Marín](https://github.com/Algunenano)).
|
||||||
|
* Fix flaky 02494_query_cache_events [#56935](https://github.com/ClickHouse/ClickHouse/pull/56935) ([Robert Schulze](https://github.com/rschu1ze)).
|
||||||
|
* Add CachedReadBufferReadFromCache{Hits,Misses} profile events [#56936](https://github.com/ClickHouse/ClickHouse/pull/56936) ([Jordi Villar](https://github.com/jrdi)).
|
||||||
|
* Send fatal logs by default in clickhouse-local [#56956](https://github.com/ClickHouse/ClickHouse/pull/56956) ([Nikolay Degterinsky](https://github.com/evillique)).
|
||||||
|
* Resubmit: Better except for SSL authentication [#56957](https://github.com/ClickHouse/ClickHouse/pull/56957) ([Nikolay Degterinsky](https://github.com/evillique)).
|
||||||
|
* Fix `test_keeper_auth` [#56960](https://github.com/ClickHouse/ClickHouse/pull/56960) ([Antonio Andelic](https://github.com/antonio2368)).
|
||||||
|
* Fewer concurrent requests in 02908_many_requests_to_system_replicas [#56968](https://github.com/ClickHouse/ClickHouse/pull/56968) ([Alexander Gololobov](https://github.com/davenger)).
|
||||||
|
* Own CMake for GRPC [#56971](https://github.com/ClickHouse/ClickHouse/pull/56971) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Fix build in Backups/BackupIO_S3.cpp [#56974](https://github.com/ClickHouse/ClickHouse/pull/56974) ([Robert Schulze](https://github.com/rschu1ze)).
|
||||||
|
* Add exclude for tryBase64Decode to backward compat test (follow-up to [#56913](https://github.com/ClickHouse/ClickHouse/issues/56913)) [#56975](https://github.com/ClickHouse/ClickHouse/pull/56975) ([Robert Schulze](https://github.com/rschu1ze)).
|
||||||
|
* Prefer sccache to ccache by default [#56980](https://github.com/ClickHouse/ClickHouse/pull/56980) ([Igor Nikonov](https://github.com/devcrafter)).
|
||||||
|
* update 02003_memory_limit_in_client.sh [#56981](https://github.com/ClickHouse/ClickHouse/pull/56981) ([Bharat Nallan](https://github.com/bharatnc)).
|
||||||
|
* Make check for the limited cmake dependencies the part of sparse checkout [#56991](https://github.com/ClickHouse/ClickHouse/pull/56991) ([Mikhail f. Shiryaev](https://github.com/Felixoid)).
|
||||||
|
* Fix flaky and slow tests. [#56993](https://github.com/ClickHouse/ClickHouse/pull/56993) ([Amos Bird](https://github.com/amosbird)).
|
||||||
|
* Fix dropping tables in test_create_or_drop_tables_during_backup [#57007](https://github.com/ClickHouse/ClickHouse/pull/57007) ([Vitaly Baranov](https://github.com/vitlibar)).
|
||||||
|
* Enable Analyzer in Stress and Fuzz tests [#57008](https://github.com/ClickHouse/ClickHouse/pull/57008) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Run CI for PRs with missing documentation [#57018](https://github.com/ClickHouse/ClickHouse/pull/57018) ([Michael Kolupaev](https://github.com/al13n321)).
|
||||||
|
* test_s3_engine_heavy_write_check_mem: turn test off [#57025](https://github.com/ClickHouse/ClickHouse/pull/57025) ([Sema Checherinda](https://github.com/CheSema)).
|
||||||
|
* NamedCollections: make exception message more informative. [#57031](https://github.com/ClickHouse/ClickHouse/pull/57031) ([Salvatore Mesoraca](https://github.com/aiven-sal)).
|
||||||
|
* Avoid returning biggest resolution when fpr > 0.283 [#57034](https://github.com/ClickHouse/ClickHouse/pull/57034) ([Jordi Villar](https://github.com/jrdi)).
|
||||||
|
* Fix: suppress TSAN in RabbitMQ test [#57040](https://github.com/ClickHouse/ClickHouse/pull/57040) ([Igor Nikonov](https://github.com/devcrafter)).
|
||||||
|
* Small Keeper fixes [#57047](https://github.com/ClickHouse/ClickHouse/pull/57047) ([Antonio Andelic](https://github.com/antonio2368)).
|
||||||
|
* Parallel replicas: cleanup, narrow dependency [#57054](https://github.com/ClickHouse/ClickHouse/pull/57054) ([Igor Nikonov](https://github.com/devcrafter)).
|
||||||
|
* Fix gRPC build on macOS [#57061](https://github.com/ClickHouse/ClickHouse/pull/57061) ([Robert Schulze](https://github.com/rschu1ze)).
|
||||||
|
* Better comment for ITransformingStep::transformPipeline [#57062](https://github.com/ClickHouse/ClickHouse/pull/57062) ([Nikolai Kochetov](https://github.com/KochetovNicolai)).
|
||||||
|
* Fix `Duplicate set` for StorageSet with analyzer. [#57063](https://github.com/ClickHouse/ClickHouse/pull/57063) ([Nikolai Kochetov](https://github.com/KochetovNicolai)).
|
||||||
|
* Better metadata path [#57083](https://github.com/ClickHouse/ClickHouse/pull/57083) ([Nikolay Degterinsky](https://github.com/evillique)).
|
||||||
|
* Analyzer fuzzer 3 (aggregate_functions_null_for_empty for projections) [#57099](https://github.com/ClickHouse/ClickHouse/pull/57099) ([Nikolai Kochetov](https://github.com/KochetovNicolai)).
|
||||||
|
* Update numbers.md [#57100](https://github.com/ClickHouse/ClickHouse/pull/57100) ([konruvikt](https://github.com/konruvikt)).
|
||||||
|
* Fix FunctionNode::toASTImpl [#57102](https://github.com/ClickHouse/ClickHouse/pull/57102) ([vdimir](https://github.com/vdimir)).
|
||||||
|
* Analyzer fuzzer 5 [#57103](https://github.com/ClickHouse/ClickHouse/pull/57103) ([Nikolai Kochetov](https://github.com/KochetovNicolai)).
|
||||||
|
* Cancel PipelineExecutor properly in case of exception in spawnThreads [#57104](https://github.com/ClickHouse/ClickHouse/pull/57104) ([Kruglov Pavel](https://github.com/Avogar)).
|
||||||
|
* Allow HashedDictionary/FunctionsConversion as large TU [#57108](https://github.com/ClickHouse/ClickHouse/pull/57108) ([Azat Khuzhin](https://github.com/azat)).
|
||||||
|
* Disable checksums for builds with fuzzer [#57122](https://github.com/ClickHouse/ClickHouse/pull/57122) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Analyzer: Fix logical error in LogicalExpressionOptimizerVisitor [#57123](https://github.com/ClickHouse/ClickHouse/pull/57123) ([vdimir](https://github.com/vdimir)).
|
||||||
|
* Split HashedDictionary CU [#57124](https://github.com/ClickHouse/ClickHouse/pull/57124) ([Azat Khuzhin](https://github.com/azat)).
|
||||||
|
* Cancel executor in ~CreatingSetsTransform [#57125](https://github.com/ClickHouse/ClickHouse/pull/57125) ([Nikolai Kochetov](https://github.com/KochetovNicolai)).
|
||||||
|
* Fix system.*_log in artifacts on CI [#57128](https://github.com/ClickHouse/ClickHouse/pull/57128) ([Azat Khuzhin](https://github.com/azat)).
|
||||||
|
* Fix something in ReplicatedMergeTree [#57129](https://github.com/ClickHouse/ClickHouse/pull/57129) ([Alexander Tokmakov](https://github.com/tavplubix)).
|
||||||
|
* Do not symbolize traces for debug/sanitizer builds for sending to cloud [#57130](https://github.com/ClickHouse/ClickHouse/pull/57130) ([Azat Khuzhin](https://github.com/azat)).
|
||||||
|
* Resubmit 01600_parts_types_metrics test (possibly without flakiness) [#57131](https://github.com/ClickHouse/ClickHouse/pull/57131) ([Azat Khuzhin](https://github.com/azat)).
|
||||||
|
* Follow up to [#56541](https://github.com/ClickHouse/ClickHouse/issues/56541) [#57141](https://github.com/ClickHouse/ClickHouse/pull/57141) ([Kseniia Sumarokova](https://github.com/kssenii)).
|
||||||
|
* Allow to disable reorder-functions-after-sorting optimization [#57144](https://github.com/ClickHouse/ClickHouse/pull/57144) ([Robert Schulze](https://github.com/rschu1ze)).
|
||||||
|
* Fix bad test `00002_log_and_exception_messages_formatting` [#57145](https://github.com/ClickHouse/ClickHouse/pull/57145) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Fix test test_replicated_merge_tree_encryption_codec/test.py::test_different_keys [#57146](https://github.com/ClickHouse/ClickHouse/pull/57146) ([Vitaly Baranov](https://github.com/vitlibar)).
|
||||||
|
* Remove partial results from build matrix for stress tests [#57150](https://github.com/ClickHouse/ClickHouse/pull/57150) ([Azat Khuzhin](https://github.com/azat)).
|
||||||
|
* Minor changes in test_check_table [#57154](https://github.com/ClickHouse/ClickHouse/pull/57154) ([vdimir](https://github.com/vdimir)).
|
||||||
|
* Fix 02903_rmt_retriable_merge_exception flakiness for replicated database [#57155](https://github.com/ClickHouse/ClickHouse/pull/57155) ([Azat Khuzhin](https://github.com/azat)).
|
||||||
|
* Mark select() as harmful function [#57156](https://github.com/ClickHouse/ClickHouse/pull/57156) ([Igor Nikonov](https://github.com/devcrafter)).
|
||||||
|
* Improve the cherry-pick PR description [#57167](https://github.com/ClickHouse/ClickHouse/pull/57167) ([Mikhail f. Shiryaev](https://github.com/Felixoid)).
|
||||||
|
* Add debugging info for 01600_parts_types_metrics on failures [#57170](https://github.com/ClickHouse/ClickHouse/pull/57170) ([Azat Khuzhin](https://github.com/azat)).
|
||||||
|
* Tiny improvement security [#57171](https://github.com/ClickHouse/ClickHouse/pull/57171) ([Mikhail f. Shiryaev](https://github.com/Felixoid)).
|
||||||
|
* Update blob_storage_log.md [#57187](https://github.com/ClickHouse/ClickHouse/pull/57187) ([vdimir](https://github.com/vdimir)).
|
||||||
|
* [RFC] Set log_comment to the file name while processing files in client [#57191](https://github.com/ClickHouse/ClickHouse/pull/57191) ([Azat Khuzhin](https://github.com/azat)).
|
||||||
|
* Add test for [#5323](https://github.com/ClickHouse/ClickHouse/issues/5323) [#57192](https://github.com/ClickHouse/ClickHouse/pull/57192) ([Raúl Marín](https://github.com/Algunenano)).
|
||||||
|
* Analyzer fuzzer 6 (arrayJoin) [#57198](https://github.com/ClickHouse/ClickHouse/pull/57198) ([Nikolai Kochetov](https://github.com/KochetovNicolai)).
|
||||||
|
* Add test for [#47366](https://github.com/ClickHouse/ClickHouse/issues/47366) [#57200](https://github.com/ClickHouse/ClickHouse/pull/57200) ([Raúl Marín](https://github.com/Algunenano)).
|
||||||
|
* Add test for [#51321](https://github.com/ClickHouse/ClickHouse/issues/51321) [#57202](https://github.com/ClickHouse/ClickHouse/pull/57202) ([Raúl Marín](https://github.com/Algunenano)).
|
||||||
|
* Fix possible crash (in Rust) of fuzzy finder in client [#57204](https://github.com/ClickHouse/ClickHouse/pull/57204) ([Azat Khuzhin](https://github.com/azat)).
|
||||||
|
* fix zero-copy locks leaking [#57205](https://github.com/ClickHouse/ClickHouse/pull/57205) ([Sema Checherinda](https://github.com/CheSema)).
|
||||||
|
* Fix test_distributed_storage_configuration flakiness [#57206](https://github.com/ClickHouse/ClickHouse/pull/57206) ([Azat Khuzhin](https://github.com/azat)).
|
||||||
|
* Update Sentry [#57222](https://github.com/ClickHouse/ClickHouse/pull/57222) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Update version_date.tsv and changelogs after v23.10.5.20-stable [#57223](https://github.com/ClickHouse/ClickHouse/pull/57223) ([robot-clickhouse](https://github.com/robot-clickhouse)).
|
||||||
|
* Update version_date.tsv and changelogs after v23.9.6.20-stable [#57224](https://github.com/ClickHouse/ClickHouse/pull/57224) ([robot-clickhouse](https://github.com/robot-clickhouse)).
|
||||||
|
* Update version_date.tsv and changelogs after v23.3.18.15-lts [#57225](https://github.com/ClickHouse/ClickHouse/pull/57225) ([robot-clickhouse](https://github.com/robot-clickhouse)).
|
||||||
|
* Update version_date.tsv and changelogs after v23.8.8.20-lts [#57226](https://github.com/ClickHouse/ClickHouse/pull/57226) ([robot-clickhouse](https://github.com/robot-clickhouse)).
|
||||||
|
* Change cursor style for overwrite mode (INS) to blinking in client [#57227](https://github.com/ClickHouse/ClickHouse/pull/57227) ([Azat Khuzhin](https://github.com/azat)).
|
||||||
|
* Remove test `01280_ttl_where_group_by` [#57230](https://github.com/ClickHouse/ClickHouse/pull/57230) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Fix docs [#57234](https://github.com/ClickHouse/ClickHouse/pull/57234) ([Nikolay Degterinsky](https://github.com/evillique)).
|
||||||
|
* Remove addBatchSinglePlaceFromInterval [#57258](https://github.com/ClickHouse/ClickHouse/pull/57258) ([Raúl Marín](https://github.com/Algunenano)).
|
||||||
|
* Add some additional groups to CI [#57260](https://github.com/ClickHouse/ClickHouse/pull/57260) ([alesapin](https://github.com/alesapin)).
|
||||||
|
* Analyzer: fix result type of aggregate function with NULL [#57265](https://github.com/ClickHouse/ClickHouse/pull/57265) ([vdimir](https://github.com/vdimir)).
|
||||||
|
* Ignore memory exception in Keeper asio workers [#57268](https://github.com/ClickHouse/ClickHouse/pull/57268) ([Antonio Andelic](https://github.com/antonio2368)).
|
||||||
|
* Fix code reports [#57301](https://github.com/ClickHouse/ClickHouse/pull/57301) ([Raúl Marín](https://github.com/Algunenano)).
|
||||||
|
* Follow up recommendations from [#57167](https://github.com/ClickHouse/ClickHouse/issues/57167) [#57302](https://github.com/ClickHouse/ClickHouse/pull/57302) ([Mikhail f. Shiryaev](https://github.com/Felixoid)).
|
||||||
|
* Add back flaky tests to analyzer_tech_debt.txt [#57307](https://github.com/ClickHouse/ClickHouse/pull/57307) ([Raúl Marín](https://github.com/Algunenano)).
|
||||||
|
* Lower level for annoying S3 log [#57312](https://github.com/ClickHouse/ClickHouse/pull/57312) ([Antonio Andelic](https://github.com/antonio2368)).
|
||||||
|
* Add regression test for skim (Rust) crash on pasting certain input [#57313](https://github.com/ClickHouse/ClickHouse/pull/57313) ([Azat Khuzhin](https://github.com/azat)).
|
||||||
|
* Remove unused Strings from MergeTreeData [#57318](https://github.com/ClickHouse/ClickHouse/pull/57318) ([Mikhail Koviazin](https://github.com/mkmkme)).
|
||||||
|
* Address 02668_ulid_decoding flakiness [#57320](https://github.com/ClickHouse/ClickHouse/pull/57320) ([Raúl Marín](https://github.com/Algunenano)).
|
||||||
|
* DiskWeb fix [#57322](https://github.com/ClickHouse/ClickHouse/pull/57322) ([Kseniia Sumarokova](https://github.com/kssenii)).
|
||||||
|
* Update README.md [#57325](https://github.com/ClickHouse/ClickHouse/pull/57325) ([Tyler Hannan](https://github.com/tylerhannan)).
|
||||||
|
* Add information about new _size virtual column in file/s3/url/hdfs/azure table functions [#57328](https://github.com/ClickHouse/ClickHouse/pull/57328) ([Kruglov Pavel](https://github.com/Avogar)).
|
||||||
|
* Follow-up to [#56490](https://github.com/ClickHouse/ClickHouse/issues/56490): Fix build with `cmake -DENABLE_LIBRARIES=0` [#57330](https://github.com/ClickHouse/ClickHouse/pull/57330) ([Robert Schulze](https://github.com/rschu1ze)).
|
||||||
|
* Mark a setting obsolete [#57336](https://github.com/ClickHouse/ClickHouse/pull/57336) ([Alexander Tokmakov](https://github.com/tavplubix)).
|
||||||
|
* Always renew ZK client in `WithRetries` [#57357](https://github.com/ClickHouse/ClickHouse/pull/57357) ([Antonio Andelic](https://github.com/antonio2368)).
|
||||||
|
* Shutdown disks after tables [#57358](https://github.com/ClickHouse/ClickHouse/pull/57358) ([Alexander Gololobov](https://github.com/davenger)).
|
||||||
|
* Update DDLTask.cpp [#57369](https://github.com/ClickHouse/ClickHouse/pull/57369) ([Alexander Tokmakov](https://github.com/tavplubix)).
|
||||||
|
* verbose exception messages for StorageFuzzJSON [#57372](https://github.com/ClickHouse/ClickHouse/pull/57372) ([Julia Kartseva](https://github.com/jkartseva)).
|
||||||
|
* Initialize only required disks in clickhouse-disks [#57387](https://github.com/ClickHouse/ClickHouse/pull/57387) ([Nikolay Degterinsky](https://github.com/evillique)).
|
||||||
|
* Allow wildcards in directories for partitioned write with File storage [#57391](https://github.com/ClickHouse/ClickHouse/pull/57391) ([Nikolay Degterinsky](https://github.com/evillique)).
|
||||||
|
* Add tests for 43202 [#57404](https://github.com/ClickHouse/ClickHouse/pull/57404) ([Raúl Marín](https://github.com/Algunenano)).
|
||||||
|
* Consider whole check failure in bugfix validate check as an error [#57413](https://github.com/ClickHouse/ClickHouse/pull/57413) ([vdimir](https://github.com/vdimir)).
|
||||||
|
* Change type of s3_cache in test_encrypted_disk [#57416](https://github.com/ClickHouse/ClickHouse/pull/57416) ([vdimir](https://github.com/vdimir)).
|
||||||
|
* Add extra debug information on replication consistency errors [#57419](https://github.com/ClickHouse/ClickHouse/pull/57419) ([Raúl Marín](https://github.com/Algunenano)).
|
||||||
|
* Don't print server revision in client on connect [#57435](https://github.com/ClickHouse/ClickHouse/pull/57435) ([Nikita Taranov](https://github.com/nickitat)).
|
||||||
|
* Adding Sydney Meetup [#57457](https://github.com/ClickHouse/ClickHouse/pull/57457) ([Tyler Hannan](https://github.com/tylerhannan)).
|
||||||
|
* Fix adjusting log_comment in case of multiple files passed [#57464](https://github.com/ClickHouse/ClickHouse/pull/57464) ([Azat Khuzhin](https://github.com/azat)).
|
||||||
|
* Fix flaky test 02697_stop_reading_on_first_cancel.sh [#57481](https://github.com/ClickHouse/ClickHouse/pull/57481) ([Raúl Marín](https://github.com/Algunenano)).
|
||||||
|
* Tiny refactoring around cache [#57482](https://github.com/ClickHouse/ClickHouse/pull/57482) ([Kseniia Sumarokova](https://github.com/kssenii)).
|
||||||
|
* Decrease default value for `filesystem_prefetch_min_bytes_for_single_read_task` [#57489](https://github.com/ClickHouse/ClickHouse/pull/57489) ([Nikita Taranov](https://github.com/nickitat)).
|
||||||
|
* Remove bad test [#57494](https://github.com/ClickHouse/ClickHouse/pull/57494) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Add changelog for 23.11 [#57517](https://github.com/ClickHouse/ClickHouse/pull/57517) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Simple cleanup in distributed (while dealing with parallel replicas) [#57518](https://github.com/ClickHouse/ClickHouse/pull/57518) ([Igor Nikonov](https://github.com/devcrafter)).
|
||||||
|
* Remove a feature. [#57521](https://github.com/ClickHouse/ClickHouse/pull/57521) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* `S3Queue` is production ready [#57548](https://github.com/ClickHouse/ClickHouse/pull/57548) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
* Revert "Merge pull request [#56724](https://github.com/ClickHouse/ClickHouse/issues/56724) from canhld94/ch_replicated_column_mismatch" [#57576](https://github.com/ClickHouse/ClickHouse/pull/57576) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
|
||||||
|
|
@ -4,16 +4,9 @@ sidebar_position: 181
|
|||||||
sidebar_label: S3Queue
|
sidebar_label: S3Queue
|
||||||
---
|
---
|
||||||
|
|
||||||
# [experimental] S3Queue Table Engine
|
# S3Queue Table Engine
|
||||||
This engine provides integration with [Amazon S3](https://aws.amazon.com/s3/) ecosystem and allows streaming import. This engine is similar to the [Kafka](../../../engines/table-engines/integrations/kafka.md), [RabbitMQ](../../../engines/table-engines/integrations/rabbitmq.md) engines, but provides S3-specific features.
|
This engine provides integration with [Amazon S3](https://aws.amazon.com/s3/) ecosystem and allows streaming import. This engine is similar to the [Kafka](../../../engines/table-engines/integrations/kafka.md), [RabbitMQ](../../../engines/table-engines/integrations/rabbitmq.md) engines, but provides S3-specific features.
|
||||||
|
|
||||||
:::note
|
|
||||||
This table engine is experimental. To use it, set `allow_experimental_s3queue` to 1 by using the `SET` command:
|
|
||||||
```sql
|
|
||||||
SET allow_experimental_s3queue=1
|
|
||||||
```
|
|
||||||
:::
|
|
||||||
|
|
||||||
## Create Table {#creating-a-table}
|
## Create Table {#creating-a-table}
|
||||||
|
|
||||||
``` sql
|
``` sql
|
||||||
|
@ -865,10 +865,10 @@ Tags:
|
|||||||
- `disk` — a disk within a volume.
|
- `disk` — a disk within a volume.
|
||||||
- `max_data_part_size_bytes` — the maximum size of a part that can be stored on any of the volume’s disks. If the a size of a merged part estimated to be bigger than `max_data_part_size_bytes` then this part will be written to a next volume. Basically this feature allows to keep new/small parts on a hot (SSD) volume and move them to a cold (HDD) volume when they reach large size. Do not use this setting if your policy has only one volume.
|
- `max_data_part_size_bytes` — the maximum size of a part that can be stored on any of the volume’s disks. If the a size of a merged part estimated to be bigger than `max_data_part_size_bytes` then this part will be written to a next volume. Basically this feature allows to keep new/small parts on a hot (SSD) volume and move them to a cold (HDD) volume when they reach large size. Do not use this setting if your policy has only one volume.
|
||||||
- `move_factor` — when the amount of available space gets lower than this factor, data automatically starts to move on the next volume if any (by default, 0.1). ClickHouse sorts existing parts by size from largest to smallest (in descending order) and selects parts with the total size that is sufficient to meet the `move_factor` condition. If the total size of all parts is insufficient, all parts will be moved.
|
- `move_factor` — when the amount of available space gets lower than this factor, data automatically starts to move on the next volume if any (by default, 0.1). ClickHouse sorts existing parts by size from largest to smallest (in descending order) and selects parts with the total size that is sufficient to meet the `move_factor` condition. If the total size of all parts is insufficient, all parts will be moved.
|
||||||
- `prefer_not_to_merge` — Disables merging of data parts on this volume. When this setting is enabled, merging data on this volume is not allowed. This allows controlling how ClickHouse works with slow disks.
|
|
||||||
- `perform_ttl_move_on_insert` — Disables TTL move on data part INSERT. By default (if enabled) if we insert a data part that already expired by the TTL move rule it immediately goes to a volume/disk declared in move rule. This can significantly slowdown insert in case if destination volume/disk is slow (e.g. S3). If disabled then already expired data part is written into a default volume and then right after moved to TTL volume.
|
- `perform_ttl_move_on_insert` — Disables TTL move on data part INSERT. By default (if enabled) if we insert a data part that already expired by the TTL move rule it immediately goes to a volume/disk declared in move rule. This can significantly slowdown insert in case if destination volume/disk is slow (e.g. S3). If disabled then already expired data part is written into a default volume and then right after moved to TTL volume.
|
||||||
- `load_balancing` - Policy for disk balancing, `round_robin` or `least_used`.
|
- `load_balancing` - Policy for disk balancing, `round_robin` or `least_used`.
|
||||||
- `least_used_ttl_ms` - Configure timeout (in milliseconds) for the updating available space on all disks (`0` - update always, `-1` - never update, default is `60000`). Note, if the disk can be used by ClickHouse only and is not subject to a online filesystem resize/shrink you can use `-1`, in all other cases it is not recommended, since eventually it will lead to incorrect space distribution.
|
- `least_used_ttl_ms` - Configure timeout (in milliseconds) for the updating available space on all disks (`0` - update always, `-1` - never update, default is `60000`). Note, if the disk can be used by ClickHouse only and is not subject to a online filesystem resize/shrink you can use `-1`, in all other cases it is not recommended, since eventually it will lead to incorrect space distribution.
|
||||||
|
- `prefer_not_to_merge` — You should not use this setting. Disables merging of data parts on this volume (this is harmful and leads to performance degradation). When this setting is enabled (don't do it), merging data on this volume is not allowed (which is bad). This allows (but you don't need it) controlling (if you want to control something, you're making a mistake) how ClickHouse works with slow disks (but ClickHouse knows better, so please don't use this setting).
|
||||||
|
|
||||||
Configuration examples:
|
Configuration examples:
|
||||||
|
|
||||||
@ -905,7 +905,6 @@ Configuration examples:
|
|||||||
</main>
|
</main>
|
||||||
<external>
|
<external>
|
||||||
<disk>external</disk>
|
<disk>external</disk>
|
||||||
<prefer_not_to_merge>true</prefer_not_to_merge>
|
|
||||||
</external>
|
</external>
|
||||||
</volumes>
|
</volumes>
|
||||||
</small_jbod_with_external_no_merges>
|
</small_jbod_with_external_no_merges>
|
||||||
|
@ -81,7 +81,7 @@ It is recommended to use official pre-compiled `deb` packages for Debian or Ubun
|
|||||||
sudo apt-get install -y apt-transport-https ca-certificates dirmngr
|
sudo apt-get install -y apt-transport-https ca-certificates dirmngr
|
||||||
GNUPGHOME=$(mktemp -d)
|
GNUPGHOME=$(mktemp -d)
|
||||||
sudo GNUPGHOME="$GNUPGHOME" gpg --no-default-keyring --keyring /usr/share/keyrings/clickhouse-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 8919F6BD2B48D754
|
sudo GNUPGHOME="$GNUPGHOME" gpg --no-default-keyring --keyring /usr/share/keyrings/clickhouse-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 8919F6BD2B48D754
|
||||||
sudo rm -r "$GNUPGHOME"
|
sudo rm -rf "$GNUPGHOME"
|
||||||
sudo chmod +r /usr/share/keyrings/clickhouse-keyring.gpg
|
sudo chmod +r /usr/share/keyrings/clickhouse-keyring.gpg
|
||||||
|
|
||||||
echo "deb [signed-by=/usr/share/keyrings/clickhouse-keyring.gpg] https://packages.clickhouse.com/deb stable main" | sudo tee \
|
echo "deb [signed-by=/usr/share/keyrings/clickhouse-keyring.gpg] https://packages.clickhouse.com/deb stable main" | sudo tee \
|
||||||
|
@ -15,6 +15,27 @@ You can monitor:
|
|||||||
- Utilization of hardware resources.
|
- Utilization of hardware resources.
|
||||||
- ClickHouse server metrics.
|
- ClickHouse server metrics.
|
||||||
|
|
||||||
|
## Built-in observability dashboard
|
||||||
|
|
||||||
|
<img width="400" alt="Screenshot 2023-11-12 at 6 08 58 PM" src="https://github.com/ClickHouse/ClickHouse/assets/3936029/2bd10011-4a47-4b94-b836-d44557c7fdc1" />
|
||||||
|
|
||||||
|
ClickHouse comes with a built-in observability dashboard feature which can be accessed by `$HOST:$PORT/dashboard` (requires user and password) that shows the following metrics:
|
||||||
|
- Queries/second
|
||||||
|
- CPU usage (cores)
|
||||||
|
- Queries running
|
||||||
|
- Merges running
|
||||||
|
- Selected bytes/second
|
||||||
|
- IO wait
|
||||||
|
- CPU wait
|
||||||
|
- OS CPU Usage (userspace)
|
||||||
|
- OS CPU Usage (kernel)
|
||||||
|
- Read from disk
|
||||||
|
- Read from filesystem
|
||||||
|
- Memory (tracked)
|
||||||
|
- Inserted rows/second
|
||||||
|
- Total MergeTree parts
|
||||||
|
- Max parts for partition
|
||||||
|
|
||||||
## Resource Utilization {#resource-utilization}
|
## Resource Utilization {#resource-utilization}
|
||||||
|
|
||||||
ClickHouse also monitors the state of hardware resources by itself such as:
|
ClickHouse also monitors the state of hardware resources by itself such as:
|
||||||
|
@ -1646,6 +1646,45 @@ Default value: `0.5`.
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## async_load_databases {#async_load_databases}
|
||||||
|
|
||||||
|
Asynchronous loading of databases and tables.
|
||||||
|
|
||||||
|
If `true` all non-system databases with `Ordinary`, `Atomic` and `Replicated` engine will be loaded asynchronously after the ClickHouse server start up. See `system.async_loader` table, `tables_loader_background_pool_size` and `tables_loader_foreground_pool_size` server settings. Any query that tries to access a table, that is not yet loaded, will wait for exactly this table to be started up. If load job fails, query will rethrow an error (instead of shutting down the whole server in case of `async_load_databases = false`). The table that is waited for by at least one query will be loaded with higher priority. DDL queries on a database will wait for exactly that database to be started up.
|
||||||
|
|
||||||
|
If `false`, all databases are loaded when the server starts.
|
||||||
|
|
||||||
|
The default is `false`.
|
||||||
|
|
||||||
|
**Example**
|
||||||
|
|
||||||
|
``` xml
|
||||||
|
<async_load_databases>true</async_load_databases>
|
||||||
|
```
|
||||||
|
|
||||||
|
## tables_loader_foreground_pool_size {#tables_loader_foreground_pool_size}
|
||||||
|
|
||||||
|
Sets the number of threads performing load jobs in foreground pool. The foreground pool is used for loading table synchronously before server start listening on a port and for loading tables that are waited for. Foreground pool has higher priority than background pool. It means that no job starts in background pool while there are jobs running in foreground pool.
|
||||||
|
|
||||||
|
Possible values:
|
||||||
|
|
||||||
|
- Any positive integer.
|
||||||
|
- Zero. Use all available CPUs.
|
||||||
|
|
||||||
|
Default value: 0.
|
||||||
|
|
||||||
|
|
||||||
|
## tables_loader_background_pool_size {#tables_loader_background_pool_size}
|
||||||
|
|
||||||
|
Sets the number of threads performing asynchronous load jobs in background pool. The background pool is used for loading tables asynchronously after server start in case there are no queries waiting for the table. It could be beneficial to keep low number of threads in background pool if there are a lot of tables. It will reserve CPU resources for concurrent query execution.
|
||||||
|
|
||||||
|
Possible values:
|
||||||
|
|
||||||
|
- Any positive integer.
|
||||||
|
- Zero. Use all available CPUs.
|
||||||
|
|
||||||
|
Default value: 0.
|
||||||
|
|
||||||
|
|
||||||
## merge_tree {#merge_tree}
|
## merge_tree {#merge_tree}
|
||||||
|
|
||||||
|
54
docs/en/operations/system-tables/async_loader.md
Normal file
54
docs/en/operations/system-tables/async_loader.md
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
---
|
||||||
|
slug: /en/operations/system-tables/async_loader
|
||||||
|
---
|
||||||
|
# async_loader
|
||||||
|
|
||||||
|
Contains information and status for recent asynchronous jobs (e.g. for tables loading). The table contains a row for every job. There is a tool for visualizing information from this table `utils/async_loader_graph`.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
``` sql
|
||||||
|
SELECT *
|
||||||
|
FROM system.async_loader
|
||||||
|
FORMAT Vertical
|
||||||
|
LIMIT 1
|
||||||
|
```
|
||||||
|
|
||||||
|
``` text
|
||||||
|
```
|
||||||
|
|
||||||
|
Columns:
|
||||||
|
|
||||||
|
- `job` (`String`) - Job name (may be not unique).
|
||||||
|
- `job_id` (`UInt64`) - Unique ID of the job.
|
||||||
|
- `dependencies` (`Array(UInt64)`) - List of IDs of jobs that should be done before this job.
|
||||||
|
- `dependencies_left` (`UInt64`) - Current number of dependencies left to be done.
|
||||||
|
- `status` (`Enum`) - Current load status of a job:
|
||||||
|
`PENDING`: Load job is not started yet.
|
||||||
|
`OK`: Load job executed and was successful.
|
||||||
|
`FAILED`: Load job executed and failed.
|
||||||
|
`CANCELED`: Load job is not going to be executed due to removal or dependency failure.
|
||||||
|
|
||||||
|
A pending job might be in one of the following states:
|
||||||
|
- `is_executing` (`UInt8`) - The job is currently being executed by a worker.
|
||||||
|
- `is_blocked` (`UInt8`) - The job waits for its dependencies to be done.
|
||||||
|
- `is_ready` (`UInt8`) - The job is ready to be executed and waits for a worker.
|
||||||
|
- `elapsed` (`Float64`) - Seconds elapsed since start of execution. Zero if job is not started. Total execution time if job finished.
|
||||||
|
|
||||||
|
Every job has a pool associated with it and is started in this pool. Each pool has a constant priority and a mutable maximum number of workers. Higher priority (lower `priority` value) jobs are run first. No job with lower priority is started while there is at least one higher priority job ready or executing. Job priority can be elevated (but cannot be lowered) by prioritizing it. For example jobs for a table loading and startup will be prioritized if incoming query required this table. It is possible prioritize a job during its execution, but job is not moved from its `execution_pool` to newly assigned `pool`. The job uses `pool` for creating new jobs to avoid priority inversion. Already started jobs are not preempted by higher priority jobs and always run to completion after start.
|
||||||
|
- `pool_id` (`UInt64`) - ID of a pool currently assigned to the job.
|
||||||
|
- `pool` (`String`) - Name of `pool_id` pool.
|
||||||
|
- `priority` (`Int64`) - Priority of `pool_id` pool.
|
||||||
|
- `execution_pool_id` (`UInt64`) - ID of a pool the job is executed in. Equals initially assigned pool before execution starts.
|
||||||
|
- `execution_pool` (`String`) - Name of `execution_pool_id` pool.
|
||||||
|
- `execution_priority` (`Int64`) - Priority of `execution_pool_id` pool.
|
||||||
|
|
||||||
|
- `ready_seqno` (`Nullable(UInt64)`) - Not null for ready jobs. Worker pulls the next job to be executed from a ready queue of its pool. If there are multiple ready jobs, then job with the lowest value of `ready_seqno` is picked.
|
||||||
|
- `waiters` (`UInt64`) - The number of threads waiting on this job.
|
||||||
|
- `exception` (`Nullable(String)`) - Not null for failed and canceled jobs. Holds error message raised during query execution or error leading to cancelling of this job along with dependency failure chain of job names.
|
||||||
|
|
||||||
|
Time instants during job lifetime:
|
||||||
|
- `schedule_time` (`DateTime64`) - Time when job was created and scheduled to be executed (usually with all its dependencies).
|
||||||
|
- `enqueue_time` (`Nullable(DateTime64)`) - Time when job became ready and was enqueued into a ready queue of it's pool. Null if the job is not ready yet.
|
||||||
|
- `start_time` (`Nullable(DateTime64)`) - Time when worker dequeues the job from ready queue and start its execution. Null if the job is not started yet.
|
||||||
|
- `finish_time` (`Nullable(DateTime64)`) - Time when job execution is finished. Null if the job is not finished yet.
|
@ -13,6 +13,7 @@ ClickHouse does not delete data from the table automatically. See [Introduction]
|
|||||||
|
|
||||||
Columns:
|
Columns:
|
||||||
|
|
||||||
|
- `hostname` ([LowCardinality(String)](../../sql-reference/data-types/string.md)) — Hostname of the server executing the query.
|
||||||
- `event_date` ([Date](../../sql-reference/data-types/date.md)) — The date when the async insert happened.
|
- `event_date` ([Date](../../sql-reference/data-types/date.md)) — The date when the async insert happened.
|
||||||
- `event_time` ([DateTime](../../sql-reference/data-types/datetime.md)) — The date and time when the async insert finished execution.
|
- `event_time` ([DateTime](../../sql-reference/data-types/datetime.md)) — The date and time when the async insert finished execution.
|
||||||
- `event_time_microseconds` ([DateTime64](../../sql-reference/data-types/datetime64.md)) — The date and time when the async insert finished execution with microseconds precision.
|
- `event_time_microseconds` ([DateTime64](../../sql-reference/data-types/datetime64.md)) — The date and time when the async insert finished execution with microseconds precision.
|
||||||
@ -42,6 +43,7 @@ SELECT * FROM system.asynchronous_insert_log LIMIT 1 \G;
|
|||||||
Result:
|
Result:
|
||||||
|
|
||||||
``` text
|
``` text
|
||||||
|
hostname: clickhouse.eu-central1.internal
|
||||||
event_date: 2023-06-08
|
event_date: 2023-06-08
|
||||||
event_time: 2023-06-08 10:08:53
|
event_time: 2023-06-08 10:08:53
|
||||||
event_time_microseconds: 2023-06-08 10:08:53.199516
|
event_time_microseconds: 2023-06-08 10:08:53.199516
|
||||||
|
@ -7,6 +7,7 @@ Contains the historical values for `system.asynchronous_metrics`, which are save
|
|||||||
|
|
||||||
Columns:
|
Columns:
|
||||||
|
|
||||||
|
- `hostname` ([LowCardinality(String)](../../sql-reference/data-types/string.md)) — Hostname of the server executing the query.
|
||||||
- `event_date` ([Date](../../sql-reference/data-types/date.md)) — Event date.
|
- `event_date` ([Date](../../sql-reference/data-types/date.md)) — Event date.
|
||||||
- `event_time` ([DateTime](../../sql-reference/data-types/datetime.md)) — Event time.
|
- `event_time` ([DateTime](../../sql-reference/data-types/datetime.md)) — Event time.
|
||||||
- `name` ([String](../../sql-reference/data-types/string.md)) — Metric name.
|
- `name` ([String](../../sql-reference/data-types/string.md)) — Metric name.
|
||||||
@ -15,22 +16,33 @@ Columns:
|
|||||||
**Example**
|
**Example**
|
||||||
|
|
||||||
``` sql
|
``` sql
|
||||||
SELECT * FROM system.asynchronous_metric_log LIMIT 10
|
SELECT * FROM system.asynchronous_metric_log LIMIT 3 \G
|
||||||
```
|
```
|
||||||
|
|
||||||
``` text
|
``` text
|
||||||
┌─event_date─┬──────────event_time─┬─name─────────────────────────────────────┬─────value─┐
|
Row 1:
|
||||||
│ 2020-09-05 │ 2020-09-05 15:56:30 │ CPUFrequencyMHz_0 │ 2120.9 │
|
──────
|
||||||
│ 2020-09-05 │ 2020-09-05 15:56:30 │ jemalloc.arenas.all.pmuzzy │ 743 │
|
hostname: clickhouse.eu-central1.internal
|
||||||
│ 2020-09-05 │ 2020-09-05 15:56:30 │ jemalloc.arenas.all.pdirty │ 26288 │
|
event_date: 2023-11-14
|
||||||
│ 2020-09-05 │ 2020-09-05 15:56:30 │ jemalloc.background_thread.run_intervals │ 0 │
|
event_time: 2023-11-14 14:39:07
|
||||||
│ 2020-09-05 │ 2020-09-05 15:56:30 │ jemalloc.background_thread.num_runs │ 0 │
|
metric: AsynchronousHeavyMetricsCalculationTimeSpent
|
||||||
│ 2020-09-05 │ 2020-09-05 15:56:30 │ jemalloc.retained │ 60694528 │
|
value: 0.001
|
||||||
│ 2020-09-05 │ 2020-09-05 15:56:30 │ jemalloc.mapped │ 303161344 │
|
|
||||||
│ 2020-09-05 │ 2020-09-05 15:56:30 │ jemalloc.resident │ 260931584 │
|
Row 2:
|
||||||
│ 2020-09-05 │ 2020-09-05 15:56:30 │ jemalloc.metadata │ 12079488 │
|
──────
|
||||||
│ 2020-09-05 │ 2020-09-05 15:56:30 │ jemalloc.allocated │ 133756128 │
|
hostname: clickhouse.eu-central1.internal
|
||||||
└────────────┴─────────────────────┴──────────────────────────────────────────┴───────────┘
|
event_date: 2023-11-14
|
||||||
|
event_time: 2023-11-14 14:39:08
|
||||||
|
metric: AsynchronousHeavyMetricsCalculationTimeSpent
|
||||||
|
value: 0
|
||||||
|
|
||||||
|
Row 3:
|
||||||
|
──────
|
||||||
|
hostname: clickhouse.eu-central1.internal
|
||||||
|
event_date: 2023-11-14
|
||||||
|
event_time: 2023-11-14 14:39:09
|
||||||
|
metric: AsynchronousHeavyMetricsCalculationTimeSpent
|
||||||
|
value: 0
|
||||||
```
|
```
|
||||||
|
|
||||||
**See Also**
|
**See Also**
|
||||||
|
@ -7,6 +7,7 @@ Contains logging entries with the information about `BACKUP` and `RESTORE` opera
|
|||||||
|
|
||||||
Columns:
|
Columns:
|
||||||
|
|
||||||
|
- `hostname` ([LowCardinality(String)](../../sql-reference/data-types/string.md)) — Hostname of the server executing the query.
|
||||||
- `event_date` ([Date](../../sql-reference/data-types/date.md)) — Date of the entry.
|
- `event_date` ([Date](../../sql-reference/data-types/date.md)) — Date of the entry.
|
||||||
- `event_time_microseconds` ([DateTime64](../../sql-reference/data-types/datetime64.md)) — Time of the entry with microseconds precision.
|
- `event_time_microseconds` ([DateTime64](../../sql-reference/data-types/datetime64.md)) — Time of the entry with microseconds precision.
|
||||||
- `id` ([String](../../sql-reference/data-types/string.md)) — Identifier of the backup or restore operation.
|
- `id` ([String](../../sql-reference/data-types/string.md)) — Identifier of the backup or restore operation.
|
||||||
@ -45,6 +46,7 @@ SELECT * FROM system.backup_log WHERE id = 'e5b74ecb-f6f1-426a-80be-872f90043885
|
|||||||
```response
|
```response
|
||||||
Row 1:
|
Row 1:
|
||||||
──────
|
──────
|
||||||
|
hostname: clickhouse.eu-central1.internal
|
||||||
event_date: 2023-08-19
|
event_date: 2023-08-19
|
||||||
event_time_microseconds: 2023-08-19 11:05:21.998566
|
event_time_microseconds: 2023-08-19 11:05:21.998566
|
||||||
id: e5b74ecb-f6f1-426a-80be-872f90043885
|
id: e5b74ecb-f6f1-426a-80be-872f90043885
|
||||||
@ -63,6 +65,7 @@ bytes_read: 0
|
|||||||
|
|
||||||
Row 2:
|
Row 2:
|
||||||
──────
|
──────
|
||||||
|
hostname: clickhouse.eu-central1.internal
|
||||||
event_date: 2023-08-19
|
event_date: 2023-08-19
|
||||||
event_time_microseconds: 2023-08-19 11:08:56.916192
|
event_time_microseconds: 2023-08-19 11:08:56.916192
|
||||||
id: e5b74ecb-f6f1-426a-80be-872f90043885
|
id: e5b74ecb-f6f1-426a-80be-872f90043885
|
||||||
@ -93,6 +96,7 @@ SELECT * FROM system.backup_log WHERE id = 'cdf1f731-52ef-42da-bc65-2e1bfcd4ce90
|
|||||||
```response
|
```response
|
||||||
Row 1:
|
Row 1:
|
||||||
──────
|
──────
|
||||||
|
hostname: clickhouse.eu-central1.internal
|
||||||
event_date: 2023-08-19
|
event_date: 2023-08-19
|
||||||
event_time_microseconds: 2023-08-19 11:09:19.718077
|
event_time_microseconds: 2023-08-19 11:09:19.718077
|
||||||
id: cdf1f731-52ef-42da-bc65-2e1bfcd4ce90
|
id: cdf1f731-52ef-42da-bc65-2e1bfcd4ce90
|
||||||
@ -111,6 +115,7 @@ bytes_read: 0
|
|||||||
|
|
||||||
Row 2:
|
Row 2:
|
||||||
──────
|
──────
|
||||||
|
hostname: clickhouse.eu-central1.internal
|
||||||
event_date: 2023-08-19
|
event_date: 2023-08-19
|
||||||
event_time_microseconds: 2023-08-19 11:09:29.334234
|
event_time_microseconds: 2023-08-19 11:09:29.334234
|
||||||
id: cdf1f731-52ef-42da-bc65-2e1bfcd4ce90
|
id: cdf1f731-52ef-42da-bc65-2e1bfcd4ce90
|
||||||
|
@ -7,6 +7,7 @@ Contains information about stack traces for fatal errors. The table does not exi
|
|||||||
|
|
||||||
Columns:
|
Columns:
|
||||||
|
|
||||||
|
- `hostname` ([LowCardinality(String)](../../sql-reference/data-types/string.md)) — Hostname of the server executing the query.
|
||||||
- `event_date` ([DateTime](../../sql-reference/data-types/datetime.md)) — Date of the event.
|
- `event_date` ([DateTime](../../sql-reference/data-types/datetime.md)) — Date of the event.
|
||||||
- `event_time` ([DateTime](../../sql-reference/data-types/datetime.md)) — Time of the event.
|
- `event_time` ([DateTime](../../sql-reference/data-types/datetime.md)) — Time of the event.
|
||||||
- `timestamp_ns` ([UInt64](../../sql-reference/data-types/int-uint.md)) — Timestamp of the event with nanoseconds.
|
- `timestamp_ns` ([UInt64](../../sql-reference/data-types/int-uint.md)) — Timestamp of the event with nanoseconds.
|
||||||
@ -32,6 +33,7 @@ Result (not full):
|
|||||||
``` text
|
``` text
|
||||||
Row 1:
|
Row 1:
|
||||||
──────
|
──────
|
||||||
|
hostname: clickhouse.eu-central1.internal
|
||||||
event_date: 2020-10-14
|
event_date: 2020-10-14
|
||||||
event_time: 2020-10-14 15:47:40
|
event_time: 2020-10-14 15:47:40
|
||||||
timestamp_ns: 1602679660271312710
|
timestamp_ns: 1602679660271312710
|
||||||
|
@ -6,6 +6,7 @@ slug: /en/operations/system-tables/metric_log
|
|||||||
Contains history of metrics values from tables `system.metrics` and `system.events`, periodically flushed to disk.
|
Contains history of metrics values from tables `system.metrics` and `system.events`, periodically flushed to disk.
|
||||||
|
|
||||||
Columns:
|
Columns:
|
||||||
|
- `hostname` ([LowCardinality(String)](../../sql-reference/data-types/string.md)) — Hostname of the server executing the query.
|
||||||
- `event_date` ([Date](../../sql-reference/data-types/date.md)) — Event date.
|
- `event_date` ([Date](../../sql-reference/data-types/date.md)) — Event date.
|
||||||
- `event_time` ([DateTime](../../sql-reference/data-types/datetime.md)) — Event time.
|
- `event_time` ([DateTime](../../sql-reference/data-types/datetime.md)) — Event time.
|
||||||
- `event_time_microseconds` ([DateTime64](../../sql-reference/data-types/datetime64.md)) — Event time with microseconds resolution.
|
- `event_time_microseconds` ([DateTime64](../../sql-reference/data-types/datetime64.md)) — Event time with microseconds resolution.
|
||||||
@ -19,6 +20,7 @@ SELECT * FROM system.metric_log LIMIT 1 FORMAT Vertical;
|
|||||||
``` text
|
``` text
|
||||||
Row 1:
|
Row 1:
|
||||||
──────
|
──────
|
||||||
|
hostname: clickhouse.eu-central1.internal
|
||||||
event_date: 2020-09-05
|
event_date: 2020-09-05
|
||||||
event_time: 2020-09-05 16:22:33
|
event_time: 2020-09-05 16:22:33
|
||||||
event_time_microseconds: 2020-09-05 16:22:33.196807
|
event_time_microseconds: 2020-09-05 16:22:33.196807
|
||||||
|
@ -45,6 +45,22 @@ Number of threads in the Aggregator thread pool.
|
|||||||
|
|
||||||
Number of threads in the Aggregator thread pool running a task.
|
Number of threads in the Aggregator thread pool running a task.
|
||||||
|
|
||||||
|
### TablesLoaderForegroundThreads
|
||||||
|
|
||||||
|
Number of threads in the async loader foreground thread pool.
|
||||||
|
|
||||||
|
### TablesLoaderForegroundThreadsActive
|
||||||
|
|
||||||
|
Number of threads in the async loader foreground thread pool running a task.
|
||||||
|
|
||||||
|
### TablesLoaderBackgroundThreads
|
||||||
|
|
||||||
|
Number of threads in the async loader background thread pool.
|
||||||
|
|
||||||
|
### TablesLoaderBackgroundThreadsActive
|
||||||
|
|
||||||
|
Number of threads in the async loader background thread pool running a task.
|
||||||
|
|
||||||
### AsyncInsertCacheSize
|
### AsyncInsertCacheSize
|
||||||
|
|
||||||
Number of async insert hash id in cache
|
Number of async insert hash id in cache
|
||||||
@ -197,14 +213,6 @@ Number of threads in the DatabaseOnDisk thread pool.
|
|||||||
|
|
||||||
Number of threads in the DatabaseOnDisk thread pool running a task.
|
Number of threads in the DatabaseOnDisk thread pool running a task.
|
||||||
|
|
||||||
### DatabaseOrdinaryThreads
|
|
||||||
|
|
||||||
Number of threads in the Ordinary database thread pool.
|
|
||||||
|
|
||||||
### DatabaseOrdinaryThreadsActive
|
|
||||||
|
|
||||||
Number of threads in the Ordinary database thread pool running a task.
|
|
||||||
|
|
||||||
### DelayedInserts
|
### DelayedInserts
|
||||||
|
|
||||||
Number of INSERT queries that are throttled due to high number of active data parts for partition in a MergeTree table.
|
Number of INSERT queries that are throttled due to high number of active data parts for partition in a MergeTree table.
|
||||||
@ -625,14 +633,6 @@ Number of connections that are sending data for external tables to remote server
|
|||||||
|
|
||||||
Number of connections that are sending data for scalars to remote servers.
|
Number of connections that are sending data for scalars to remote servers.
|
||||||
|
|
||||||
### StartupSystemTablesThreads
|
|
||||||
|
|
||||||
Number of threads in the StartupSystemTables thread pool.
|
|
||||||
|
|
||||||
### StartupSystemTablesThreadsActive
|
|
||||||
|
|
||||||
Number of threads in the StartupSystemTables thread pool running a task.
|
|
||||||
|
|
||||||
### StorageBufferBytes
|
### StorageBufferBytes
|
||||||
|
|
||||||
Number of bytes in buffers of Buffer tables
|
Number of bytes in buffers of Buffer tables
|
||||||
@ -677,14 +677,6 @@ Number of threads in the system.replicas thread pool running a task.
|
|||||||
|
|
||||||
Number of connections to TCP server (clients with native interface), also included server-server distributed query connections
|
Number of connections to TCP server (clients with native interface), also included server-server distributed query connections
|
||||||
|
|
||||||
### TablesLoaderThreads
|
|
||||||
|
|
||||||
Number of threads in the tables loader thread pool.
|
|
||||||
|
|
||||||
### TablesLoaderThreadsActive
|
|
||||||
|
|
||||||
Number of threads in the tables loader thread pool running a task.
|
|
||||||
|
|
||||||
### TablesToDropQueueSize
|
### TablesToDropQueueSize
|
||||||
|
|
||||||
Number of dropped tables, that are waiting for background data removal.
|
Number of dropped tables, that are waiting for background data removal.
|
||||||
|
@ -8,28 +8,19 @@ Contains information about [trace spans](https://opentracing.io/docs/overview/sp
|
|||||||
Columns:
|
Columns:
|
||||||
|
|
||||||
- `trace_id` ([UUID](../../sql-reference/data-types/uuid.md)) — ID of the trace for executed query.
|
- `trace_id` ([UUID](../../sql-reference/data-types/uuid.md)) — ID of the trace for executed query.
|
||||||
|
|
||||||
- `span_id` ([UInt64](../../sql-reference/data-types/int-uint.md)) — ID of the `trace span`.
|
- `span_id` ([UInt64](../../sql-reference/data-types/int-uint.md)) — ID of the `trace span`.
|
||||||
|
|
||||||
- `parent_span_id` ([UInt64](../../sql-reference/data-types/int-uint.md)) — ID of the parent `trace span`.
|
- `parent_span_id` ([UInt64](../../sql-reference/data-types/int-uint.md)) — ID of the parent `trace span`.
|
||||||
|
|
||||||
- `operation_name` ([String](../../sql-reference/data-types/string.md)) — The name of the operation.
|
- `operation_name` ([String](../../sql-reference/data-types/string.md)) — The name of the operation.
|
||||||
|
|
||||||
- `kind` ([Enum8](../../sql-reference/data-types/enum.md)) — The [SpanKind](https://opentelemetry.io/docs/reference/specification/trace/api/#spankind) of the span.
|
- `kind` ([Enum8](../../sql-reference/data-types/enum.md)) — The [SpanKind](https://opentelemetry.io/docs/reference/specification/trace/api/#spankind) of the span.
|
||||||
- `INTERNAL` — Indicates that the span represents an internal operation within an application.
|
- `INTERNAL` — Indicates that the span represents an internal operation within an application.
|
||||||
- `SERVER` — Indicates that the span covers server-side handling of a synchronous RPC or other remote request.
|
- `SERVER` — Indicates that the span covers server-side handling of a synchronous RPC or other remote request.
|
||||||
- `CLIENT` — Indicates that the span describes a request to some remote service.
|
- `CLIENT` — Indicates that the span describes a request to some remote service.
|
||||||
- `PRODUCER` — Indicates that the span describes the initiators of an asynchronous request. This parent span will often end before the corresponding child CONSUMER span, possibly even before the child span starts.
|
- `PRODUCER` — Indicates that the span describes the initiators of an asynchronous request. This parent span will often end before the corresponding child CONSUMER span, possibly even before the child span starts.
|
||||||
- `CONSUMER` - Indicates that the span describes a child of an asynchronous PRODUCER request.
|
- `CONSUMER` - Indicates that the span describes a child of an asynchronous PRODUCER request.
|
||||||
|
|
||||||
- `start_time_us` ([UInt64](../../sql-reference/data-types/int-uint.md)) — The start time of the `trace span` (in microseconds).
|
- `start_time_us` ([UInt64](../../sql-reference/data-types/int-uint.md)) — The start time of the `trace span` (in microseconds).
|
||||||
|
|
||||||
- `finish_time_us` ([UInt64](../../sql-reference/data-types/int-uint.md)) — The finish time of the `trace span` (in microseconds).
|
- `finish_time_us` ([UInt64](../../sql-reference/data-types/int-uint.md)) — The finish time of the `trace span` (in microseconds).
|
||||||
|
|
||||||
- `finish_date` ([Date](../../sql-reference/data-types/date.md)) — The finish date of the `trace span`.
|
- `finish_date` ([Date](../../sql-reference/data-types/date.md)) — The finish date of the `trace span`.
|
||||||
|
|
||||||
- `attribute.names` ([Array](../../sql-reference/data-types/array.md)([String](../../sql-reference/data-types/string.md))) — [Attribute](https://opentelemetry.io/docs/go/instrumentation/#attributes) names depending on the `trace span`. They are filled in according to the recommendations in the [OpenTelemetry](https://opentelemetry.io/) standard.
|
- `attribute.names` ([Array](../../sql-reference/data-types/array.md)([String](../../sql-reference/data-types/string.md))) — [Attribute](https://opentelemetry.io/docs/go/instrumentation/#attributes) names depending on the `trace span`. They are filled in according to the recommendations in the [OpenTelemetry](https://opentelemetry.io/) standard.
|
||||||
|
|
||||||
- `attribute.values` ([Array](../../sql-reference/data-types/array.md)([String](../../sql-reference/data-types/string.md))) — Attribute values depending on the `trace span`. They are filled in according to the recommendations in the `OpenTelemetry` standard.
|
- `attribute.values` ([Array](../../sql-reference/data-types/array.md)([String](../../sql-reference/data-types/string.md))) — Attribute values depending on the `trace span`. They are filled in according to the recommendations in the `OpenTelemetry` standard.
|
||||||
|
|
||||||
**Example**
|
**Example**
|
||||||
|
@ -9,6 +9,7 @@ This table contains information about events that occurred with [data parts](../
|
|||||||
|
|
||||||
The `system.part_log` table contains the following columns:
|
The `system.part_log` table contains the following columns:
|
||||||
|
|
||||||
|
- `hostname` ([LowCardinality(String)](../../sql-reference/data-types/string.md)) — Hostname of the server executing the query.
|
||||||
- `query_id` ([String](../../sql-reference/data-types/string.md)) — Identifier of the `INSERT` query that created this data part.
|
- `query_id` ([String](../../sql-reference/data-types/string.md)) — Identifier of the `INSERT` query that created this data part.
|
||||||
- `event_type` ([Enum8](../../sql-reference/data-types/enum.md)) — Type of the event that occurred with the data part. Can have one of the following values:
|
- `event_type` ([Enum8](../../sql-reference/data-types/enum.md)) — Type of the event that occurred with the data part. Can have one of the following values:
|
||||||
- `NewPart` — Inserting of a new data part.
|
- `NewPart` — Inserting of a new data part.
|
||||||
@ -56,13 +57,14 @@ SELECT * FROM system.part_log LIMIT 1 FORMAT Vertical;
|
|||||||
``` text
|
``` text
|
||||||
Row 1:
|
Row 1:
|
||||||
──────
|
──────
|
||||||
|
hostname: clickhouse.eu-central1.internal
|
||||||
query_id: 983ad9c7-28d5-4ae1-844e-603116b7de31
|
query_id: 983ad9c7-28d5-4ae1-844e-603116b7de31
|
||||||
event_type: NewPart
|
event_type: NewPart
|
||||||
merge_reason: NotAMerge
|
merge_reason: NotAMerge
|
||||||
merge_algorithm: Undecided
|
merge_algorithm: Undecided
|
||||||
event_date: 2021-02-02
|
event_date: 2021-02-02
|
||||||
event_time: 2021-02-02 11:14:28
|
event_time: 2021-02-02 11:14:28
|
||||||
event_time_microseconds: 2021-02-02 11:14:28.861919
|
event_time_microseconds: 2021-02-02 11:14:28.861919
|
||||||
duration_ms: 35
|
duration_ms: 35
|
||||||
database: default
|
database: default
|
||||||
table: log_mt_2
|
table: log_mt_2
|
||||||
|
@ -4,6 +4,7 @@ This table contains profiling on processors level (that you can find in [`EXPLAI
|
|||||||
|
|
||||||
Columns:
|
Columns:
|
||||||
|
|
||||||
|
- `hostname` ([LowCardinality(String)](../../sql-reference/data-types/string.md)) — Hostname of the server executing the query.
|
||||||
- `event_date` ([Date](../../sql-reference/data-types/date.md)) — The date when the event happened.
|
- `event_date` ([Date](../../sql-reference/data-types/date.md)) — The date when the event happened.
|
||||||
- `event_time` ([DateTime](../../sql-reference/data-types/datetime.md)) — The date and time when the event happened.
|
- `event_time` ([DateTime](../../sql-reference/data-types/datetime.md)) — The date and time when the event happened.
|
||||||
- `event_time_microseconds` ([DateTime64](../../sql-reference/data-types/datetime64.md)) — The date and time with microseconds precision when the event happened.
|
- `event_time_microseconds` ([DateTime64](../../sql-reference/data-types/datetime64.md)) — The date and time with microseconds precision when the event happened.
|
||||||
|
@ -34,6 +34,7 @@ You can use the [log_formatted_queries](../../operations/settings/settings.md#se
|
|||||||
|
|
||||||
Columns:
|
Columns:
|
||||||
|
|
||||||
|
- `hostname` ([LowCardinality(String)](../../sql-reference/data-types/string.md)) — Hostname of the server executing the query.
|
||||||
- `type` ([Enum8](../../sql-reference/data-types/enum.md)) — Type of an event that occurred when executing the query. Values:
|
- `type` ([Enum8](../../sql-reference/data-types/enum.md)) — Type of an event that occurred when executing the query. Values:
|
||||||
- `'QueryStart' = 1` — Successful start of query execution.
|
- `'QueryStart' = 1` — Successful start of query execution.
|
||||||
- `'QueryFinish' = 2` — Successful end of query execution.
|
- `'QueryFinish' = 2` — Successful end of query execution.
|
||||||
@ -127,6 +128,7 @@ SELECT * FROM system.query_log WHERE type = 'QueryFinish' ORDER BY query_start_t
|
|||||||
``` text
|
``` text
|
||||||
Row 1:
|
Row 1:
|
||||||
──────
|
──────
|
||||||
|
hostname: clickhouse.eu-central1.internal
|
||||||
type: QueryFinish
|
type: QueryFinish
|
||||||
event_date: 2021-11-03
|
event_date: 2021-11-03
|
||||||
event_time: 2021-11-03 16:13:54
|
event_time: 2021-11-03 16:13:54
|
||||||
@ -167,7 +169,7 @@ initial_query_start_time: 2021-11-03 16:13:54
|
|||||||
initial_query_start_time_microseconds: 2021-11-03 16:13:54.952325
|
initial_query_start_time_microseconds: 2021-11-03 16:13:54.952325
|
||||||
interface: 1
|
interface: 1
|
||||||
os_user: sevirov
|
os_user: sevirov
|
||||||
client_hostname: clickhouse.ru-central1.internal
|
client_hostname: clickhouse.eu-central1.internal
|
||||||
client_name: ClickHouse
|
client_name: ClickHouse
|
||||||
client_revision: 54449
|
client_revision: 54449
|
||||||
client_version_major: 21
|
client_version_major: 21
|
||||||
|
@ -18,6 +18,7 @@ You can use the [log_queries_probability](../../operations/settings/settings.md#
|
|||||||
|
|
||||||
Columns:
|
Columns:
|
||||||
|
|
||||||
|
- `hostname` ([LowCardinality(String)](../../sql-reference/data-types/string.md)) — Hostname of the server executing the query.
|
||||||
- `event_date` ([Date](../../sql-reference/data-types/date.md)) — The date when the thread has finished execution of the query.
|
- `event_date` ([Date](../../sql-reference/data-types/date.md)) — The date when the thread has finished execution of the query.
|
||||||
- `event_time` ([DateTime](../../sql-reference/data-types/datetime.md)) — The date and time when the thread has finished execution of the query.
|
- `event_time` ([DateTime](../../sql-reference/data-types/datetime.md)) — The date and time when the thread has finished execution of the query.
|
||||||
- `event_time_microsecinds` ([DateTime](../../sql-reference/data-types/datetime.md)) — The date and time when the thread has finished execution of the query with microseconds precision.
|
- `event_time_microsecinds` ([DateTime](../../sql-reference/data-types/datetime.md)) — The date and time when the thread has finished execution of the query with microseconds precision.
|
||||||
@ -74,6 +75,7 @@ Columns:
|
|||||||
``` text
|
``` text
|
||||||
Row 1:
|
Row 1:
|
||||||
──────
|
──────
|
||||||
|
hostname: clickhouse.eu-central1.internal
|
||||||
event_date: 2020-09-11
|
event_date: 2020-09-11
|
||||||
event_time: 2020-09-11 10:08:17
|
event_time: 2020-09-11 10:08:17
|
||||||
event_time_microseconds: 2020-09-11 10:08:17.134042
|
event_time_microseconds: 2020-09-11 10:08:17.134042
|
||||||
|
@ -18,6 +18,7 @@ You can use the [log_queries_probability](../../operations/settings/settings.md#
|
|||||||
|
|
||||||
Columns:
|
Columns:
|
||||||
|
|
||||||
|
- `hostname` ([LowCardinality(String)](../../sql-reference/data-types/string.md)) — Hostname of the server executing the query.
|
||||||
- `event_date` ([Date](../../sql-reference/data-types/date.md)) — The date when the last event of the view happened.
|
- `event_date` ([Date](../../sql-reference/data-types/date.md)) — The date when the last event of the view happened.
|
||||||
- `event_time` ([DateTime](../../sql-reference/data-types/datetime.md)) — The date and time when the view finished execution.
|
- `event_time` ([DateTime](../../sql-reference/data-types/datetime.md)) — The date and time when the view finished execution.
|
||||||
- `event_time_microseconds` ([DateTime](../../sql-reference/data-types/datetime.md)) — The date and time when the view finished execution with microseconds precision.
|
- `event_time_microseconds` ([DateTime](../../sql-reference/data-types/datetime.md)) — The date and time when the view finished execution with microseconds precision.
|
||||||
@ -59,6 +60,7 @@ Result:
|
|||||||
``` text
|
``` text
|
||||||
Row 1:
|
Row 1:
|
||||||
──────
|
──────
|
||||||
|
hostname: clickhouse.eu-central1.internal
|
||||||
event_date: 2021-06-22
|
event_date: 2021-06-22
|
||||||
event_time: 2021-06-22 13:23:07
|
event_time: 2021-06-22 13:23:07
|
||||||
event_time_microseconds: 2021-06-22 13:23:07.738221
|
event_time_microseconds: 2021-06-22 13:23:07.738221
|
||||||
|
@ -7,6 +7,7 @@ Contains information about all successful and failed login and logout events.
|
|||||||
|
|
||||||
Columns:
|
Columns:
|
||||||
|
|
||||||
|
- `hostname` ([LowCardinality(String)](../../sql-reference/data-types/string.md)) — Hostname of the server executing the query.
|
||||||
- `type` ([Enum8](../../sql-reference/data-types/enum.md)) — Login/logout result. Possible values:
|
- `type` ([Enum8](../../sql-reference/data-types/enum.md)) — Login/logout result. Possible values:
|
||||||
- `LoginFailure` — Login error.
|
- `LoginFailure` — Login error.
|
||||||
- `LoginSuccess` — Successful login.
|
- `LoginSuccess` — Successful login.
|
||||||
@ -57,6 +58,7 @@ Result:
|
|||||||
``` text
|
``` text
|
||||||
Row 1:
|
Row 1:
|
||||||
──────
|
──────
|
||||||
|
hostname: clickhouse.eu-central1.internal
|
||||||
type: LoginSuccess
|
type: LoginSuccess
|
||||||
auth_id: 45e6bd83-b4aa-4a23-85e6-bd83b4aa1a23
|
auth_id: 45e6bd83-b4aa-4a23-85e6-bd83b4aa1a23
|
||||||
session_id:
|
session_id:
|
||||||
|
@ -17,7 +17,7 @@ Columns:
|
|||||||
- `UNKNOWN`
|
- `UNKNOWN`
|
||||||
- `max_data_part_size` ([UInt64](../../sql-reference/data-types/int-uint.md)) — Maximum size of a data part that can be stored on volume disks (0 — no limit).
|
- `max_data_part_size` ([UInt64](../../sql-reference/data-types/int-uint.md)) — Maximum size of a data part that can be stored on volume disks (0 — no limit).
|
||||||
- `move_factor` ([Float64](../../sql-reference/data-types/float.md)) — Ratio of free disk space. When the ratio exceeds the value of configuration parameter, ClickHouse start to move data to the next volume in order.
|
- `move_factor` ([Float64](../../sql-reference/data-types/float.md)) — Ratio of free disk space. When the ratio exceeds the value of configuration parameter, ClickHouse start to move data to the next volume in order.
|
||||||
- `prefer_not_to_merge` ([UInt8](../../sql-reference/data-types/int-uint.md)) — Value of the `prefer_not_to_merge` setting. When this setting is enabled, merging data on this volume is not allowed. This allows controlling how ClickHouse works with slow disks.
|
- `prefer_not_to_merge` ([UInt8](../../sql-reference/data-types/int-uint.md)) — Value of the `prefer_not_to_merge` setting. Should be always false. When this setting is enabled, you did a mistake.
|
||||||
- `perform_ttl_move_on_insert` ([UInt8](../../sql-reference/data-types/int-uint.md)) — Value of the `perform_ttl_move_on_insert` setting. — Disables TTL move on data part INSERT. By default if we insert a data part that already expired by the TTL move rule it immediately goes to a volume/disk declared in move rule. This can significantly slowdown insert in case if destination volume/disk is slow (e.g. S3).
|
- `perform_ttl_move_on_insert` ([UInt8](../../sql-reference/data-types/int-uint.md)) — Value of the `perform_ttl_move_on_insert` setting. — Disables TTL move on data part INSERT. By default if we insert a data part that already expired by the TTL move rule it immediately goes to a volume/disk declared in move rule. This can significantly slowdown insert in case if destination volume/disk is slow (e.g. S3).
|
||||||
- `load_balancing` ([Enum8](../../sql-reference/data-types/enum.md)) — Policy for disk balancing. Can have one of the following values:
|
- `load_balancing` ([Enum8](../../sql-reference/data-types/enum.md)) — Policy for disk balancing. Can have one of the following values:
|
||||||
- `ROUND_ROBIN`
|
- `ROUND_ROBIN`
|
||||||
|
@ -7,6 +7,7 @@ Contains logging entries. The logging level which goes to this table can be limi
|
|||||||
|
|
||||||
Columns:
|
Columns:
|
||||||
|
|
||||||
|
- `hostname` ([LowCardinality(String)](../../sql-reference/data-types/string.md)) — Hostname of the server executing the query.
|
||||||
- `event_date` (Date) — Date of the entry.
|
- `event_date` (Date) — Date of the entry.
|
||||||
- `event_time` (DateTime) — Time of the entry.
|
- `event_time` (DateTime) — Time of the entry.
|
||||||
- `event_time_microseconds` (DateTime) — Time of the entry with microseconds precision.
|
- `event_time_microseconds` (DateTime) — Time of the entry with microseconds precision.
|
||||||
@ -39,6 +40,7 @@ SELECT * FROM system.text_log LIMIT 1 \G
|
|||||||
``` text
|
``` text
|
||||||
Row 1:
|
Row 1:
|
||||||
──────
|
──────
|
||||||
|
hostname: clickhouse.eu-central1.internal
|
||||||
event_date: 2020-09-10
|
event_date: 2020-09-10
|
||||||
event_time: 2020-09-10 11:23:07
|
event_time: 2020-09-10 11:23:07
|
||||||
event_time_microseconds: 2020-09-10 11:23:07.871397
|
event_time_microseconds: 2020-09-10 11:23:07.871397
|
||||||
|
@ -12,37 +12,27 @@ To analyze logs, use the `addressToLine`, `addressToLineWithInlines`, `addressTo
|
|||||||
|
|
||||||
Columns:
|
Columns:
|
||||||
|
|
||||||
|
- `hostname` ([LowCardinality(String)](../../sql-reference/data-types/string.md)) — Hostname of the server executing the query.
|
||||||
- `event_date` ([Date](../../sql-reference/data-types/date.md)) — Date of sampling moment.
|
- `event_date` ([Date](../../sql-reference/data-types/date.md)) — Date of sampling moment.
|
||||||
|
|
||||||
- `event_time` ([DateTime](../../sql-reference/data-types/datetime.md)) — Timestamp of the sampling moment.
|
- `event_time` ([DateTime](../../sql-reference/data-types/datetime.md)) — Timestamp of the sampling moment.
|
||||||
|
|
||||||
- `event_time_microseconds` ([DateTime64](../../sql-reference/data-types/datetime64.md)) — Timestamp of the sampling moment with microseconds precision.
|
- `event_time_microseconds` ([DateTime64](../../sql-reference/data-types/datetime64.md)) — Timestamp of the sampling moment with microseconds precision.
|
||||||
|
|
||||||
- `timestamp_ns` ([UInt64](../../sql-reference/data-types/int-uint.md)) — Timestamp of the sampling moment in nanoseconds.
|
- `timestamp_ns` ([UInt64](../../sql-reference/data-types/int-uint.md)) — Timestamp of the sampling moment in nanoseconds.
|
||||||
|
|
||||||
- `revision` ([UInt32](../../sql-reference/data-types/int-uint.md)) — ClickHouse server build revision.
|
- `revision` ([UInt32](../../sql-reference/data-types/int-uint.md)) — ClickHouse server build revision.
|
||||||
|
|
||||||
When connecting to the server by `clickhouse-client`, you see the string similar to `Connected to ClickHouse server version 19.18.1.`. This field contains the `revision`, but not the `version` of a server.
|
When connecting to the server by `clickhouse-client`, you see the string similar to `Connected to ClickHouse server version 19.18.1.`. This field contains the `revision`, but not the `version` of a server.
|
||||||
|
|
||||||
- `trace_type` ([Enum8](../../sql-reference/data-types/enum.md)) — Trace type:
|
- `trace_type` ([Enum8](../../sql-reference/data-types/enum.md)) — Trace type:
|
||||||
|
|
||||||
- `Real` represents collecting stack traces by wall-clock time.
|
- `Real` represents collecting stack traces by wall-clock time.
|
||||||
- `CPU` represents collecting stack traces by CPU time.
|
- `CPU` represents collecting stack traces by CPU time.
|
||||||
- `Memory` represents collecting allocations and deallocations when memory allocation exceeds the subsequent watermark.
|
- `Memory` represents collecting allocations and deallocations when memory allocation exceeds the subsequent watermark.
|
||||||
- `MemorySample` represents collecting random allocations and deallocations.
|
- `MemorySample` represents collecting random allocations and deallocations.
|
||||||
- `MemoryPeak` represents collecting updates of peak memory usage.
|
- `MemoryPeak` represents collecting updates of peak memory usage.
|
||||||
- `ProfileEvent` represents collecting of increments of profile events.
|
- `ProfileEvent` represents collecting of increments of profile events.
|
||||||
|
|
||||||
- `thread_id` ([UInt64](../../sql-reference/data-types/int-uint.md)) — Thread identifier.
|
- `thread_id` ([UInt64](../../sql-reference/data-types/int-uint.md)) — Thread identifier.
|
||||||
|
|
||||||
- `query_id` ([String](../../sql-reference/data-types/string.md)) — Query identifier that can be used to get details about a query that was running from the [query_log](#system_tables-query_log) system table.
|
- `query_id` ([String](../../sql-reference/data-types/string.md)) — Query identifier that can be used to get details about a query that was running from the [query_log](#system_tables-query_log) system table.
|
||||||
|
|
||||||
- `trace` ([Array(UInt64)](../../sql-reference/data-types/array.md)) — Stack trace at the moment of sampling. Each element is a virtual memory address inside ClickHouse server process.
|
- `trace` ([Array(UInt64)](../../sql-reference/data-types/array.md)) — Stack trace at the moment of sampling. Each element is a virtual memory address inside ClickHouse server process.
|
||||||
|
|
||||||
- `size` ([Int64](../../sql-reference/data-types/int-uint.md)) - For trace types `Memory`, `MemorySample` or `MemoryPeak` is the amount of memory allocated, for other trace types is 0.
|
- `size` ([Int64](../../sql-reference/data-types/int-uint.md)) - For trace types `Memory`, `MemorySample` or `MemoryPeak` is the amount of memory allocated, for other trace types is 0.
|
||||||
|
|
||||||
- `event` ([LowCardinality(String)](../../sql-reference/data-types/lowcardinality.md)) - For trace type `ProfileEvent` is the name of updated profile event, for other trace types is an empty string.
|
- `event` ([LowCardinality(String)](../../sql-reference/data-types/lowcardinality.md)) - For trace type `ProfileEvent` is the name of updated profile event, for other trace types is an empty string.
|
||||||
|
|
||||||
- `increment` ([UInt64](../../sql-reference/data-types/int-uint.md)) - For trace type `ProfileEvent` is the amount of increment of profile event, for other trace types is 0.
|
- `increment` ([UInt64](../../sql-reference/data-types/int-uint.md)) - For trace type `ProfileEvent` is the amount of increment of profile event, for other trace types is 0.
|
||||||
|
|
||||||
**Example**
|
**Example**
|
||||||
@ -54,6 +44,7 @@ SELECT * FROM system.trace_log LIMIT 1 \G
|
|||||||
``` text
|
``` text
|
||||||
Row 1:
|
Row 1:
|
||||||
──────
|
──────
|
||||||
|
hostname: clickhouse.eu-central1.internal
|
||||||
event_date: 2020-09-10
|
event_date: 2020-09-10
|
||||||
event_time: 2020-09-10 11:23:09
|
event_time: 2020-09-10 11:23:09
|
||||||
event_time_microseconds: 2020-09-10 11:23:09.872924
|
event_time_microseconds: 2020-09-10 11:23:09.872924
|
||||||
|
@ -9,6 +9,7 @@ For requests, only columns with request parameters are filled in, and the remain
|
|||||||
|
|
||||||
Columns with request parameters:
|
Columns with request parameters:
|
||||||
|
|
||||||
|
- `hostname` ([LowCardinality(String)](../../sql-reference/data-types/string.md)) — Hostname of the server executing the query.
|
||||||
- `type` ([Enum](../../sql-reference/data-types/enum.md)) — Event type in the ZooKeeper client. Can have one of the following values:
|
- `type` ([Enum](../../sql-reference/data-types/enum.md)) — Event type in the ZooKeeper client. Can have one of the following values:
|
||||||
- `Request` — The request has been sent.
|
- `Request` — The request has been sent.
|
||||||
- `Response` — The response was received.
|
- `Response` — The response was received.
|
||||||
@ -63,6 +64,7 @@ Result:
|
|||||||
``` text
|
``` text
|
||||||
Row 1:
|
Row 1:
|
||||||
──────
|
──────
|
||||||
|
hostname: clickhouse.eu-central1.internal
|
||||||
type: Request
|
type: Request
|
||||||
event_date: 2021-08-09
|
event_date: 2021-08-09
|
||||||
event_time: 2021-08-09 21:38:30.291792
|
event_time: 2021-08-09 21:38:30.291792
|
||||||
|
@ -93,7 +93,7 @@ While ClickHouse can work over NFS, it is not the best idea.
|
|||||||
|
|
||||||
## Linux Kernel {#linux-kernel}
|
## Linux Kernel {#linux-kernel}
|
||||||
|
|
||||||
Don’t use an outdated Linux kernel.
|
Don't use an outdated Linux kernel.
|
||||||
|
|
||||||
## Network {#network}
|
## Network {#network}
|
||||||
|
|
||||||
|
@ -487,24 +487,23 @@ Where:
|
|||||||
|
|
||||||
## uniqUpTo(N)(x)
|
## uniqUpTo(N)(x)
|
||||||
|
|
||||||
Calculates the number of different argument values if it is less than or equal to N. If the number of different argument values is greater than N, it returns N + 1.
|
Calculates the number of different values of the argument up to a specified limit, `N`. If the number of different argument values is greater than `N`, this function returns `N` + 1, otherwise it calculates the exact value.
|
||||||
|
|
||||||
Recommended for use with small Ns, up to 10. The maximum value of N is 100.
|
Recommended for use with small `N`s, up to 10. The maximum value of `N` is 100.
|
||||||
|
|
||||||
For the state of an aggregate function, it uses the amount of memory equal to 1 + N \* the size of one value of bytes.
|
For the state of an aggregate function, this function uses the amount of memory equal to 1 + `N` \* the size of one value of bytes.
|
||||||
For strings, it stores a non-cryptographic hash of 8 bytes. That is, the calculation is approximated for strings.
|
When dealing with strings, this function stores a non-cryptographic hash of 8 bytes; the calculation is approximated for strings.
|
||||||
|
|
||||||
The function also works for several arguments.
|
For example, if you had a table that logs every search query made by users on your website. Each row in the table represents a single search query, with columns for the user ID, the search query, and the timestamp of the query. You can use `uniqUpTo` to generate a report that shows only the keywords that produced at least 5 unique users.
|
||||||
|
|
||||||
It works as fast as possible, except for cases when a large N value is used and the number of unique values is slightly less than N.
|
```sql
|
||||||
|
SELECT SearchPhrase
|
||||||
Usage example:
|
FROM SearchLog
|
||||||
|
GROUP BY SearchPhrase
|
||||||
``` text
|
HAVING uniqUpTo(4)(UserID) >= 5
|
||||||
Problem: Generate a report that shows only keywords that produced at least 5 unique users.
|
|
||||||
Solution: Write in the GROUP BY query SearchPhrase HAVING uniqUpTo(4)(UserID) >= 5
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
`uniqUpTo(4)(UserID)` calculates the number of unique `UserID` values for each `SearchPhrase`, but it only counts up to 4 unique values. If there are more than 4 unique `UserID` values for a `SearchPhrase`, the function returns 5 (4 + 1). The `HAVING` clause then filters out the `SearchPhrase` values for which the number of unique `UserID` values is less than 5. This will give you a list of search keywords that were used by at least 5 unique users.
|
||||||
|
|
||||||
## sumMapFiltered(keys_to_keep)(keys, values)
|
## sumMapFiltered(keys_to_keep)(keys, values)
|
||||||
|
|
||||||
|
@ -1,48 +0,0 @@
|
|||||||
---
|
|
||||||
toc_priority: 112
|
|
||||||
---
|
|
||||||
|
|
||||||
# groupArraySorted {#groupArraySorted}
|
|
||||||
|
|
||||||
Returns an array with the first N items in ascending order.
|
|
||||||
|
|
||||||
``` sql
|
|
||||||
groupArraySorted(N)(column)
|
|
||||||
```
|
|
||||||
|
|
||||||
**Arguments**
|
|
||||||
|
|
||||||
- `N` – The number of elements to return.
|
|
||||||
|
|
||||||
If the parameter is omitted, default value is the size of input.
|
|
||||||
|
|
||||||
- `column` – The value (Integer, String, Float and other Generic types).
|
|
||||||
|
|
||||||
**Example**
|
|
||||||
|
|
||||||
Gets the first 10 numbers:
|
|
||||||
|
|
||||||
``` sql
|
|
||||||
SELECT groupArraySorted(10)(number) FROM numbers(100)
|
|
||||||
```
|
|
||||||
|
|
||||||
``` text
|
|
||||||
┌─groupArraySorted(10)(number)─┐
|
|
||||||
│ [0,1,2,3,4,5,6,7,8,9] │
|
|
||||||
└──────────────────────────────┘
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
Gets all the String implementations of all numbers in column:
|
|
||||||
|
|
||||||
``` sql
|
|
||||||
SELECT groupArraySorted(str) FROM (SELECT toString(number) as str FROM numbers(5));
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
``` text
|
|
||||||
┌─groupArraySorted(str)────────┐
|
|
||||||
│ ['0','1','2','3','4'] │
|
|
||||||
└──────────────────────────────┘
|
|
||||||
```
|
|
||||||
|
|
@ -54,7 +54,6 @@ ClickHouse-specific aggregate functions:
|
|||||||
- [groupArrayMovingAvg](/docs/en/sql-reference/aggregate-functions/reference/grouparraymovingavg.md)
|
- [groupArrayMovingAvg](/docs/en/sql-reference/aggregate-functions/reference/grouparraymovingavg.md)
|
||||||
- [groupArrayMovingSum](/docs/en/sql-reference/aggregate-functions/reference/grouparraymovingsum.md)
|
- [groupArrayMovingSum](/docs/en/sql-reference/aggregate-functions/reference/grouparraymovingsum.md)
|
||||||
- [groupArraySample](./grouparraysample.md)
|
- [groupArraySample](./grouparraysample.md)
|
||||||
- [groupArraySorted](/docs/en/sql-reference/aggregate-functions/reference/grouparraysorted.md)
|
|
||||||
- [groupBitAnd](/docs/en/sql-reference/aggregate-functions/reference/groupbitand.md)
|
- [groupBitAnd](/docs/en/sql-reference/aggregate-functions/reference/groupbitand.md)
|
||||||
- [groupBitOr](/docs/en/sql-reference/aggregate-functions/reference/groupbitor.md)
|
- [groupBitOr](/docs/en/sql-reference/aggregate-functions/reference/groupbitor.md)
|
||||||
- [groupBitXor](/docs/en/sql-reference/aggregate-functions/reference/groupbitxor.md)
|
- [groupBitXor](/docs/en/sql-reference/aggregate-functions/reference/groupbitxor.md)
|
||||||
|
@ -1780,12 +1780,11 @@ Result:
|
|||||||
## sqid
|
## sqid
|
||||||
|
|
||||||
Transforms numbers into YouTube-like short URL hash called [Sqid](https://sqids.org/).
|
Transforms numbers into YouTube-like short URL hash called [Sqid](https://sqids.org/).
|
||||||
To use this function, set setting `allow_experimental_hash_functions = 1`.
|
|
||||||
|
|
||||||
**Syntax**
|
**Syntax**
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
sqid(number1,...)
|
sqid(number1, ...)
|
||||||
```
|
```
|
||||||
|
|
||||||
**Arguments**
|
**Arguments**
|
||||||
|
@ -68,44 +68,6 @@ WHERE macro = 'test';
|
|||||||
└───────┴──────────────┘
|
└───────┴──────────────┘
|
||||||
```
|
```
|
||||||
|
|
||||||
## getClientHTTPHeader
|
|
||||||
Returns the value of specified http header.If there is no such header or the request method is not http, it will throw an exception.
|
|
||||||
|
|
||||||
**Syntax**
|
|
||||||
|
|
||||||
```sql
|
|
||||||
getClientHTTPHeader(name);
|
|
||||||
```
|
|
||||||
|
|
||||||
**Arguments**
|
|
||||||
|
|
||||||
- `name` — HTTP header name .[String](../../sql-reference/data-types/string.md#string)
|
|
||||||
|
|
||||||
**Returned value**
|
|
||||||
|
|
||||||
Value of the specified header.
|
|
||||||
Type:[String](../../sql-reference/data-types/string.md#string).
|
|
||||||
|
|
||||||
|
|
||||||
When we use `clickhouse-client` to execute this function, we'll always get empty string, because client doesn't use http protocol.
|
|
||||||
```sql
|
|
||||||
SELECT getCientHTTPHeader('test')
|
|
||||||
```
|
|
||||||
result:
|
|
||||||
|
|
||||||
```text
|
|
||||||
┌─getClientHTTPHeader('test')─┐
|
|
||||||
│ │
|
|
||||||
└────────────------───────────┘
|
|
||||||
```
|
|
||||||
Try to use http request:
|
|
||||||
```shell
|
|
||||||
echo "select getClientHTTPHeader('X-Clickhouse-User')" | curl -H 'X-ClickHouse-User: default' -H 'X-ClickHouse-Key: ' 'http://localhost:8123/' -d @-
|
|
||||||
|
|
||||||
#result
|
|
||||||
default
|
|
||||||
```
|
|
||||||
|
|
||||||
## FQDN
|
## FQDN
|
||||||
|
|
||||||
Returns the fully qualified domain name of the ClickHouse server.
|
Returns the fully qualified domain name of the ClickHouse server.
|
||||||
|
@ -1,47 +0,0 @@
|
|||||||
---
|
|
||||||
slug: /en/sql-reference/functions/time-series-functions
|
|
||||||
sidebar_position: 172
|
|
||||||
sidebar_label: Time Series
|
|
||||||
---
|
|
||||||
|
|
||||||
# Time Series Functions
|
|
||||||
|
|
||||||
Below functions are used for time series analysis.
|
|
||||||
|
|
||||||
## seriesPeriodDetectFFT
|
|
||||||
|
|
||||||
Finds the period of the given time series data using FFT
|
|
||||||
Detect Period in time series data using FFT.
|
|
||||||
FFT - Fast Fourier transform (https://en.wikipedia.org/wiki/Fast_Fourier_transform)
|
|
||||||
|
|
||||||
**Syntax**
|
|
||||||
|
|
||||||
``` sql
|
|
||||||
seriesPeriodDetectFFT(series);
|
|
||||||
```
|
|
||||||
|
|
||||||
**Arguments**
|
|
||||||
|
|
||||||
- `series` - An array of numeric values
|
|
||||||
|
|
||||||
**Returned value**
|
|
||||||
|
|
||||||
- A real value equal to the period of time series
|
|
||||||
|
|
||||||
Type: [Float64](../../sql-reference/data-types/float.md).
|
|
||||||
|
|
||||||
**Examples**
|
|
||||||
|
|
||||||
Query:
|
|
||||||
|
|
||||||
``` sql
|
|
||||||
SELECT seriesPeriodDetectFFT([1, 4, 6, 1, 4, 6, 1, 4, 6, 1, 4, 6, 1, 4, 6, 1, 4, 6, 1, 4, 6]) AS print_0;
|
|
||||||
```
|
|
||||||
|
|
||||||
Result:
|
|
||||||
|
|
||||||
``` text
|
|
||||||
┌───────────print_0──────┐
|
|
||||||
│ 3 │
|
|
||||||
└────────────────────────┘
|
|
||||||
```
|
|
@ -456,7 +456,7 @@ Closes the socket and gracefully terminates the existing connections to the serv
|
|||||||
However, if the corresponding protocol settings were not specified in the clickhouse-server configuration, this command will have no effect.
|
However, if the corresponding protocol settings were not specified in the clickhouse-server configuration, this command will have no effect.
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
SYSTEM STOP LISTEN [ON CLUSTER cluster_name] [QUERIES ALL | QUERIES DEFAULT | QUERIES CUSTOM | TCP | TCP_WITH_PROXY | TCP_SECURE | HTTP | HTTPS | MYSQL | GRPC | POSTGRESQL | PROMETHEUS | CUSTOM 'protocol']
|
SYSTEM STOP LISTEN [ON CLUSTER cluster_name] [QUERIES ALL | QUERIES DEFAULT | QUERIES CUSTOM | TCP | TCP WITH PROXY | TCP SECURE | HTTP | HTTPS | MYSQL | GRPC | POSTGRESQL | PROMETHEUS | CUSTOM 'protocol']
|
||||||
```
|
```
|
||||||
|
|
||||||
- If `CUSTOM 'protocol'` modifier is specified, the custom protocol with the specified name defined in the protocols section of the server configuration will be stopped.
|
- If `CUSTOM 'protocol'` modifier is specified, the custom protocol with the specified name defined in the protocols section of the server configuration will be stopped.
|
||||||
@ -471,5 +471,5 @@ Allows new connections to be established on the specified protocols.
|
|||||||
However, if the server on the specified port and protocol was not stopped using the SYSTEM STOP LISTEN command, this command will have no effect.
|
However, if the server on the specified port and protocol was not stopped using the SYSTEM STOP LISTEN command, this command will have no effect.
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
SYSTEM START LISTEN [ON CLUSTER cluster_name] [QUERIES ALL | QUERIES DEFAULT | QUERIES CUSTOM | TCP | TCP_WITH_PROXY | TCP_SECURE | HTTP | HTTPS | MYSQL | GRPC | POSTGRESQL | PROMETHEUS | CUSTOM 'protocol']
|
SYSTEM START LISTEN [ON CLUSTER cluster_name] [QUERIES ALL | QUERIES DEFAULT | QUERIES CUSTOM | TCP | TCP WITH PROXY | TCP SECURE | HTTP | HTTPS | MYSQL | GRPC | POSTGRESQL | PROMETHEUS | CUSTOM 'protocol']
|
||||||
```
|
```
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
--
|
---
|
||||||
slug: /en/sql-reference/table-functions/file
|
slug: /en/sql-reference/table-functions/file
|
||||||
sidebar_position: 60
|
sidebar_position: 60
|
||||||
sidebar_label: file
|
sidebar_label: file
|
||||||
|
@ -681,7 +681,6 @@ TTL d + INTERVAL 1 MONTH GROUP BY k1, k2 SET x = max(x), y = min(y);
|
|||||||
- `disk` — диск, находящийся внутри тома.
|
- `disk` — диск, находящийся внутри тома.
|
||||||
- `max_data_part_size_bytes` — максимальный размер куска данных, который может находиться на любом из дисков этого тома. Если в результате слияния размер куска ожидается больше, чем max_data_part_size_bytes, то этот кусок будет записан в следующий том. В основном эта функция позволяет хранить новые / мелкие куски на горячем (SSD) томе и перемещать их на холодный (HDD) том, когда они достигают большого размера. Не используйте этот параметр, если политика имеет только один том.
|
- `max_data_part_size_bytes` — максимальный размер куска данных, который может находиться на любом из дисков этого тома. Если в результате слияния размер куска ожидается больше, чем max_data_part_size_bytes, то этот кусок будет записан в следующий том. В основном эта функция позволяет хранить новые / мелкие куски на горячем (SSD) томе и перемещать их на холодный (HDD) том, когда они достигают большого размера. Не используйте этот параметр, если политика имеет только один том.
|
||||||
- `move_factor` — доля доступного свободного места на томе, если места становится меньше, то данные начнут перемещение на следующий том, если он есть (по умолчанию 0.1). Для перемещения куски сортируются по размеру от большего к меньшему (по убыванию) и выбираются куски, совокупный размер которых достаточен для соблюдения условия `move_factor`, если совокупный размер всех партов недостаточен, будут перемещены все парты.
|
- `move_factor` — доля доступного свободного места на томе, если места становится меньше, то данные начнут перемещение на следующий том, если он есть (по умолчанию 0.1). Для перемещения куски сортируются по размеру от большего к меньшему (по убыванию) и выбираются куски, совокупный размер которых достаточен для соблюдения условия `move_factor`, если совокупный размер всех партов недостаточен, будут перемещены все парты.
|
||||||
- `prefer_not_to_merge` — Отключает слияние кусков данных, хранящихся на данном томе. Если данная настройка включена, то слияние данных, хранящихся на данном томе, не допускается. Это позволяет контролировать работу ClickHouse с медленными дисками.
|
|
||||||
|
|
||||||
Примеры конфигураций:
|
Примеры конфигураций:
|
||||||
|
|
||||||
@ -718,7 +717,6 @@ TTL d + INTERVAL 1 MONTH GROUP BY k1, k2 SET x = max(x), y = min(y);
|
|||||||
</main>
|
</main>
|
||||||
<external>
|
<external>
|
||||||
<disk>external</disk>
|
<disk>external</disk>
|
||||||
<prefer_not_to_merge>true</prefer_not_to_merge>
|
|
||||||
</external>
|
</external>
|
||||||
</volumes>
|
</volumes>
|
||||||
</small_jbod_with_external_no_merges>
|
</small_jbod_with_external_no_merges>
|
||||||
|
@ -13,6 +13,5 @@ slug: /ru/operations/system-tables/storage_policies
|
|||||||
- `disks` ([Array(String)](../../sql-reference/data-types/array.md)) — имена дисков, содержащихся в политике хранения.
|
- `disks` ([Array(String)](../../sql-reference/data-types/array.md)) — имена дисков, содержащихся в политике хранения.
|
||||||
- `max_data_part_size` ([UInt64](../../sql-reference/data-types/int-uint.md)) — максимальный размер куска данных, который может храниться на дисках тома (0 — без ограничений).
|
- `max_data_part_size` ([UInt64](../../sql-reference/data-types/int-uint.md)) — максимальный размер куска данных, который может храниться на дисках тома (0 — без ограничений).
|
||||||
- `move_factor` — доля доступного свободного места на томе, если места становится меньше, то данные начнут перемещение на следующий том, если он есть (по умолчанию 0.1).
|
- `move_factor` — доля доступного свободного места на томе, если места становится меньше, то данные начнут перемещение на следующий том, если он есть (по умолчанию 0.1).
|
||||||
- `prefer_not_to_merge` ([UInt8](../../sql-reference/data-types/int-uint.md)) — Значение настройки `prefer_not_to_merge`. Если данная настройка включена, то слияние данных, хранящихся на данном томе, не допускается. Это позволяет контролировать работу ClickHouse с медленными дисками.
|
|
||||||
|
|
||||||
Если политика хранения содержит несколько томов, то каждому тому соответствует отдельная запись в таблице.
|
Если политика хранения содержит несколько томов, то каждому тому соответствует отдельная запись в таблице.
|
||||||
|
@ -623,7 +623,6 @@ MergeTree 系列表引擎可以将数据存储在多个块设备上。这对某
|
|||||||
- `disk` — 卷中的磁盘。
|
- `disk` — 卷中的磁盘。
|
||||||
- `max_data_part_size_bytes` — 卷中的磁盘可以存储的数据片段的最大大小。
|
- `max_data_part_size_bytes` — 卷中的磁盘可以存储的数据片段的最大大小。
|
||||||
- `move_factor` — 当可用空间少于这个因子时,数据将自动的向下一个卷(如果有的话)移动 (默认值为 0.1)。
|
- `move_factor` — 当可用空间少于这个因子时,数据将自动的向下一个卷(如果有的话)移动 (默认值为 0.1)。
|
||||||
- `prefer_not_to_merge` - 禁止在这个卷中进行数据合并。该选项启用时,对该卷的数据不能进行合并。这个选项主要用于慢速磁盘。
|
|
||||||
|
|
||||||
配置示例:
|
配置示例:
|
||||||
|
|
||||||
@ -660,7 +659,6 @@ MergeTree 系列表引擎可以将数据存储在多个块设备上。这对某
|
|||||||
</main>
|
</main>
|
||||||
<external>
|
<external>
|
||||||
<disk>external</disk>
|
<disk>external</disk>
|
||||||
<prefer_not_to_merge>true</prefer_not_to_merge>
|
|
||||||
</external>
|
</external>
|
||||||
</volumes>
|
</volumes>
|
||||||
</small_jbod_with_external_no_merges>
|
</small_jbod_with_external_no_merges>
|
||||||
|
@ -13,6 +13,5 @@ slug: /zh/operations/system-tables/storage_policies
|
|||||||
- `disks` ([Array(String)](../../sql-reference/data-types/array.md)) — 存储策略中定义的磁盘名。
|
- `disks` ([Array(String)](../../sql-reference/data-types/array.md)) — 存储策略中定义的磁盘名。
|
||||||
- `max_data_part_size` ([UInt64](../../sql-reference/data-types/int-uint.md)) — 可以存储在卷磁盘上数据部分的最大大小 (0 - 不限制)。
|
- `max_data_part_size` ([UInt64](../../sql-reference/data-types/int-uint.md)) — 可以存储在卷磁盘上数据部分的最大大小 (0 - 不限制)。
|
||||||
- `move_factor` ([Float64](../../sql-reference/data-types/float.md)) — 磁盘空闲的比率。当比率超过配置的值,ClickHouse 将把数据向下一个卷移动。
|
- `move_factor` ([Float64](../../sql-reference/data-types/float.md)) — 磁盘空闲的比率。当比率超过配置的值,ClickHouse 将把数据向下一个卷移动。
|
||||||
- `prefer_not_to_merge` ([UInt8](../../sql-reference/data-types/int-uint.md)) — 设置中 `prefer_not_to_merge` 的值. 当这个设置启用时,不允许在此卷上合并数据。这将允许控制 ClickHouse 如何与运行速度较慢的磁盘一起工作。
|
|
||||||
|
|
||||||
如果存储策略包含多个卷,则每个卷的信息将在表中作为单独一行存储。
|
如果存储策略包含多个卷,则每个卷的信息将在表中作为单独一行存储。
|
||||||
|
@ -36,7 +36,7 @@ public:
|
|||||||
|
|
||||||
void execute(
|
void execute(
|
||||||
const std::vector<String> & command_arguments,
|
const std::vector<String> & command_arguments,
|
||||||
DB::ContextMutablePtr & global_context,
|
std::shared_ptr<DiskSelector> & disk_selector,
|
||||||
Poco::Util::LayeredConfiguration & config) override
|
Poco::Util::LayeredConfiguration & config) override
|
||||||
{
|
{
|
||||||
if (command_arguments.size() != 2)
|
if (command_arguments.size() != 2)
|
||||||
@ -51,8 +51,8 @@ public:
|
|||||||
const String & path_from = command_arguments[0];
|
const String & path_from = command_arguments[0];
|
||||||
const String & path_to = command_arguments[1];
|
const String & path_to = command_arguments[1];
|
||||||
|
|
||||||
DiskPtr disk_from = global_context->getDisk(disk_name_from);
|
DiskPtr disk_from = disk_selector->get(disk_name_from);
|
||||||
DiskPtr disk_to = global_context->getDisk(disk_name_to);
|
DiskPtr disk_to = disk_selector->get(disk_name_to);
|
||||||
|
|
||||||
String relative_path_from = validatePathAndGetAsRelative(path_from);
|
String relative_path_from = validatePathAndGetAsRelative(path_from);
|
||||||
String relative_path_to = validatePathAndGetAsRelative(path_to);
|
String relative_path_to = validatePathAndGetAsRelative(path_to);
|
||||||
|
@ -27,7 +27,7 @@ public:
|
|||||||
|
|
||||||
void execute(
|
void execute(
|
||||||
const std::vector<String> & command_arguments,
|
const std::vector<String> & command_arguments,
|
||||||
DB::ContextMutablePtr & global_context,
|
std::shared_ptr<DiskSelector> & disk_selector,
|
||||||
Poco::Util::LayeredConfiguration & config) override
|
Poco::Util::LayeredConfiguration & config) override
|
||||||
{
|
{
|
||||||
if (command_arguments.size() != 2)
|
if (command_arguments.size() != 2)
|
||||||
@ -41,7 +41,7 @@ public:
|
|||||||
const String & path_from = command_arguments[0];
|
const String & path_from = command_arguments[0];
|
||||||
const String & path_to = command_arguments[1];
|
const String & path_to = command_arguments[1];
|
||||||
|
|
||||||
DiskPtr disk = global_context->getDisk(disk_name);
|
DiskPtr disk = disk_selector->get(disk_name);
|
||||||
|
|
||||||
String relative_path_from = validatePathAndGetAsRelative(path_from);
|
String relative_path_from = validatePathAndGetAsRelative(path_from);
|
||||||
String relative_path_to = validatePathAndGetAsRelative(path_to);
|
String relative_path_to = validatePathAndGetAsRelative(path_to);
|
||||||
|
@ -33,7 +33,7 @@ public:
|
|||||||
|
|
||||||
void execute(
|
void execute(
|
||||||
const std::vector<String> & command_arguments,
|
const std::vector<String> & command_arguments,
|
||||||
DB::ContextMutablePtr & global_context,
|
std::shared_ptr<DiskSelector> & disk_selector,
|
||||||
Poco::Util::LayeredConfiguration & config) override
|
Poco::Util::LayeredConfiguration & config) override
|
||||||
{
|
{
|
||||||
if (command_arguments.size() != 1)
|
if (command_arguments.size() != 1)
|
||||||
@ -46,7 +46,7 @@ public:
|
|||||||
|
|
||||||
const String & path = command_arguments[0];
|
const String & path = command_arguments[0];
|
||||||
|
|
||||||
DiskPtr disk = global_context->getDisk(disk_name);
|
DiskPtr disk = disk_selector->get(disk_name);
|
||||||
|
|
||||||
String relative_path = validatePathAndGetAsRelative(path);
|
String relative_path = validatePathAndGetAsRelative(path);
|
||||||
|
|
||||||
|
@ -26,8 +26,8 @@ public:
|
|||||||
|
|
||||||
void execute(
|
void execute(
|
||||||
const std::vector<String> & command_arguments,
|
const std::vector<String> & command_arguments,
|
||||||
DB::ContextMutablePtr & global_context,
|
std::shared_ptr<DiskSelector> &,
|
||||||
Poco::Util::LayeredConfiguration &) override
|
Poco::Util::LayeredConfiguration & config) override
|
||||||
{
|
{
|
||||||
if (!command_arguments.empty())
|
if (!command_arguments.empty())
|
||||||
{
|
{
|
||||||
@ -35,8 +35,29 @@ public:
|
|||||||
throw DB::Exception(DB::ErrorCodes::BAD_ARGUMENTS, "Bad Arguments");
|
throw DB::Exception(DB::ErrorCodes::BAD_ARGUMENTS, "Bad Arguments");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const auto & [disk_name, _] : global_context->getDisksMap())
|
constexpr auto config_prefix = "storage_configuration.disks";
|
||||||
std::cout << disk_name << '\n';
|
constexpr auto default_disk_name = "default";
|
||||||
|
|
||||||
|
Poco::Util::AbstractConfiguration::Keys keys;
|
||||||
|
config.keys(config_prefix, keys);
|
||||||
|
|
||||||
|
bool has_default_disk = false;
|
||||||
|
|
||||||
|
/// For the output to be ordered
|
||||||
|
std::set<String> disks;
|
||||||
|
|
||||||
|
for (const auto & disk_name : keys)
|
||||||
|
{
|
||||||
|
if (disk_name == default_disk_name)
|
||||||
|
has_default_disk = true;
|
||||||
|
disks.insert(disk_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!has_default_disk)
|
||||||
|
disks.insert(default_disk_name);
|
||||||
|
|
||||||
|
for (const auto & disk : disks)
|
||||||
|
std::cout << disk << '\n';
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ public:
|
|||||||
|
|
||||||
void execute(
|
void execute(
|
||||||
const std::vector<String> & command_arguments,
|
const std::vector<String> & command_arguments,
|
||||||
DB::ContextMutablePtr & global_context,
|
std::shared_ptr<DiskSelector> & disk_selector,
|
||||||
Poco::Util::LayeredConfiguration & config) override
|
Poco::Util::LayeredConfiguration & config) override
|
||||||
{
|
{
|
||||||
if (command_arguments.size() != 1)
|
if (command_arguments.size() != 1)
|
||||||
@ -47,7 +47,7 @@ public:
|
|||||||
|
|
||||||
const String & path = command_arguments[0];
|
const String & path = command_arguments[0];
|
||||||
|
|
||||||
DiskPtr disk = global_context->getDisk(disk_name);
|
DiskPtr disk = disk_selector->get(disk_name);
|
||||||
|
|
||||||
String relative_path = validatePathAndGetAsRelative(path);
|
String relative_path = validatePathAndGetAsRelative(path);
|
||||||
bool recursive = config.getBool("recursive", false);
|
bool recursive = config.getBool("recursive", false);
|
||||||
|
@ -26,7 +26,7 @@ public:
|
|||||||
|
|
||||||
void execute(
|
void execute(
|
||||||
const std::vector<String> & command_arguments,
|
const std::vector<String> & command_arguments,
|
||||||
DB::ContextMutablePtr & global_context,
|
std::shared_ptr<DiskSelector> & disk_selector,
|
||||||
Poco::Util::LayeredConfiguration & config) override
|
Poco::Util::LayeredConfiguration & config) override
|
||||||
{
|
{
|
||||||
if (command_arguments.size() != 2)
|
if (command_arguments.size() != 2)
|
||||||
@ -40,7 +40,7 @@ public:
|
|||||||
const String & path_from = command_arguments[0];
|
const String & path_from = command_arguments[0];
|
||||||
const String & path_to = command_arguments[1];
|
const String & path_to = command_arguments[1];
|
||||||
|
|
||||||
DiskPtr disk = global_context->getDisk(disk_name);
|
DiskPtr disk = disk_selector->get(disk_name);
|
||||||
|
|
||||||
String relative_path_from = validatePathAndGetAsRelative(path_from);
|
String relative_path_from = validatePathAndGetAsRelative(path_from);
|
||||||
String relative_path_to = validatePathAndGetAsRelative(path_to);
|
String relative_path_to = validatePathAndGetAsRelative(path_to);
|
||||||
|
@ -36,7 +36,7 @@ public:
|
|||||||
|
|
||||||
void execute(
|
void execute(
|
||||||
const std::vector<String> & command_arguments,
|
const std::vector<String> & command_arguments,
|
||||||
DB::ContextMutablePtr & global_context,
|
std::shared_ptr<DiskSelector> & disk_selector,
|
||||||
Poco::Util::LayeredConfiguration & config) override
|
Poco::Util::LayeredConfiguration & config) override
|
||||||
{
|
{
|
||||||
if (command_arguments.size() != 1)
|
if (command_arguments.size() != 1)
|
||||||
@ -47,7 +47,7 @@ public:
|
|||||||
|
|
||||||
String disk_name = config.getString("disk", "default");
|
String disk_name = config.getString("disk", "default");
|
||||||
|
|
||||||
DiskPtr disk = global_context->getDisk(disk_name);
|
DiskPtr disk = disk_selector->get(disk_name);
|
||||||
|
|
||||||
String relative_path = validatePathAndGetAsRelative(command_arguments[0]);
|
String relative_path = validatePathAndGetAsRelative(command_arguments[0]);
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ public:
|
|||||||
|
|
||||||
void execute(
|
void execute(
|
||||||
const std::vector<String> & command_arguments,
|
const std::vector<String> & command_arguments,
|
||||||
DB::ContextMutablePtr & global_context,
|
std::shared_ptr<DiskSelector> & disk_selector,
|
||||||
Poco::Util::LayeredConfiguration & config) override
|
Poco::Util::LayeredConfiguration & config) override
|
||||||
{
|
{
|
||||||
if (command_arguments.size() != 1)
|
if (command_arguments.size() != 1)
|
||||||
@ -39,7 +39,7 @@ public:
|
|||||||
|
|
||||||
const String & path = command_arguments[0];
|
const String & path = command_arguments[0];
|
||||||
|
|
||||||
DiskPtr disk = global_context->getDisk(disk_name);
|
DiskPtr disk = disk_selector->get(disk_name);
|
||||||
|
|
||||||
String relative_path = validatePathAndGetAsRelative(path);
|
String relative_path = validatePathAndGetAsRelative(path);
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ public:
|
|||||||
|
|
||||||
void execute(
|
void execute(
|
||||||
const std::vector<String> & command_arguments,
|
const std::vector<String> & command_arguments,
|
||||||
DB::ContextMutablePtr & global_context,
|
std::shared_ptr<DiskSelector> & disk_selector,
|
||||||
Poco::Util::LayeredConfiguration & config) override
|
Poco::Util::LayeredConfiguration & config) override
|
||||||
{
|
{
|
||||||
if (command_arguments.size() != 1)
|
if (command_arguments.size() != 1)
|
||||||
@ -50,7 +50,7 @@ public:
|
|||||||
|
|
||||||
const String & path = command_arguments[0];
|
const String & path = command_arguments[0];
|
||||||
|
|
||||||
DiskPtr disk = global_context->getDisk(disk_name);
|
DiskPtr disk = disk_selector->get(disk_name);
|
||||||
|
|
||||||
String relative_path = validatePathAndGetAsRelative(path);
|
String relative_path = validatePathAndGetAsRelative(path);
|
||||||
|
|
||||||
|
@ -209,7 +209,35 @@ int DisksApp::main(const std::vector<String> & /*args*/)
|
|||||||
po::parsed_options parsed = parser.run();
|
po::parsed_options parsed = parser.run();
|
||||||
args = po::collect_unrecognized(parsed.options, po::collect_unrecognized_mode::include_positional);
|
args = po::collect_unrecognized(parsed.options, po::collect_unrecognized_mode::include_positional);
|
||||||
}
|
}
|
||||||
command->execute(args, global_context, config());
|
|
||||||
|
std::unordered_set<std::string> disks
|
||||||
|
{
|
||||||
|
config().getString("disk", "default"),
|
||||||
|
config().getString("disk-from", config().getString("disk", "default")),
|
||||||
|
config().getString("disk-to", config().getString("disk", "default")),
|
||||||
|
};
|
||||||
|
|
||||||
|
auto validator = [&disks](
|
||||||
|
const Poco::Util::AbstractConfiguration & config,
|
||||||
|
const std::string & disk_config_prefix,
|
||||||
|
const std::string & disk_name)
|
||||||
|
{
|
||||||
|
if (!disks.contains(disk_name))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
const auto disk_type = config.getString(disk_config_prefix + ".type", "local");
|
||||||
|
|
||||||
|
if (disk_type == "cache")
|
||||||
|
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Disk type 'cache' of disk {} is not supported by clickhouse-disks", disk_name);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
constexpr auto config_prefix = "storage_configuration.disks";
|
||||||
|
auto disk_selector = std::make_shared<DiskSelector>();
|
||||||
|
disk_selector->initialize(config(), config_prefix, global_context, validator);
|
||||||
|
|
||||||
|
command->execute(args, disk_selector, config());
|
||||||
|
|
||||||
return Application::EXIT_OK;
|
return Application::EXIT_OK;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <Disks/IDisk.h>
|
#include <Disks/IDisk.h>
|
||||||
|
#include <Disks/DiskSelector.h>
|
||||||
|
|
||||||
#include <boost/program_options.hpp>
|
#include <boost/program_options.hpp>
|
||||||
|
|
||||||
@ -25,7 +26,7 @@ public:
|
|||||||
|
|
||||||
virtual void execute(
|
virtual void execute(
|
||||||
const std::vector<String> & command_arguments,
|
const std::vector<String> & command_arguments,
|
||||||
DB::ContextMutablePtr & global_context,
|
std::shared_ptr<DiskSelector> & disk_selector,
|
||||||
Poco::Util::LayeredConfiguration & config) = 0;
|
Poco::Util::LayeredConfiguration & config) = 0;
|
||||||
|
|
||||||
const std::optional<ProgramOptionsDescription> & getCommandOptions() const { return command_option_description; }
|
const std::optional<ProgramOptionsDescription> & getCommandOptions() const { return command_option_description; }
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include <Common/scope_guard_safe.h>
|
#include <Common/scope_guard_safe.h>
|
||||||
#include <Interpreters/Session.h>
|
#include <Interpreters/Session.h>
|
||||||
#include <Access/AccessControl.h>
|
#include <Access/AccessControl.h>
|
||||||
|
#include <Common/PoolId.h>
|
||||||
#include <Common/Exception.h>
|
#include <Common/Exception.h>
|
||||||
#include <Common/Macros.h>
|
#include <Common/Macros.h>
|
||||||
#include <Common/Config/ConfigProcessor.h>
|
#include <Common/Config/ConfigProcessor.h>
|
||||||
@ -742,16 +743,16 @@ void LocalServer::processConfig()
|
|||||||
status.emplace(fs::path(path) / "status", StatusFile::write_full_info);
|
status.emplace(fs::path(path) / "status", StatusFile::write_full_info);
|
||||||
|
|
||||||
LOG_DEBUG(log, "Loading metadata from {}", path);
|
LOG_DEBUG(log, "Loading metadata from {}", path);
|
||||||
loadMetadataSystem(global_context);
|
auto startup_system_tasks = loadMetadataSystem(global_context);
|
||||||
attachSystemTablesLocal(global_context, *createMemoryDatabaseIfNotExists(global_context, DatabaseCatalog::SYSTEM_DATABASE));
|
attachSystemTablesLocal(global_context, *createMemoryDatabaseIfNotExists(global_context, DatabaseCatalog::SYSTEM_DATABASE));
|
||||||
attachInformationSchema(global_context, *createMemoryDatabaseIfNotExists(global_context, DatabaseCatalog::INFORMATION_SCHEMA));
|
attachInformationSchema(global_context, *createMemoryDatabaseIfNotExists(global_context, DatabaseCatalog::INFORMATION_SCHEMA));
|
||||||
attachInformationSchema(global_context, *createMemoryDatabaseIfNotExists(global_context, DatabaseCatalog::INFORMATION_SCHEMA_UPPERCASE));
|
attachInformationSchema(global_context, *createMemoryDatabaseIfNotExists(global_context, DatabaseCatalog::INFORMATION_SCHEMA_UPPERCASE));
|
||||||
startupSystemTables();
|
waitLoad(TablesLoaderForegroundPoolId, startup_system_tasks);
|
||||||
|
|
||||||
if (!config().has("only-system-tables"))
|
if (!config().has("only-system-tables"))
|
||||||
{
|
{
|
||||||
DatabaseCatalog::instance().createBackgroundTasks();
|
DatabaseCatalog::instance().createBackgroundTasks();
|
||||||
loadMetadata(global_context);
|
waitLoad(loadMetadata(global_context));
|
||||||
DatabaseCatalog::instance().startupBackgroundTasks();
|
DatabaseCatalog::instance().startupBackgroundTasks();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include <base/coverage.h>
|
#include <base/coverage.h>
|
||||||
#include <base/getFQDNOrHostName.h>
|
#include <base/getFQDNOrHostName.h>
|
||||||
#include <base/safeExit.h>
|
#include <base/safeExit.h>
|
||||||
|
#include <Common/PoolId.h>
|
||||||
#include <Common/MemoryTracker.h>
|
#include <Common/MemoryTracker.h>
|
||||||
#include <Common/ClickHouseRevision.h>
|
#include <Common/ClickHouseRevision.h>
|
||||||
#include <Common/DNSResolver.h>
|
#include <Common/DNSResolver.h>
|
||||||
@ -1279,8 +1280,6 @@ try
|
|||||||
global_context->setHTTPHeaderFilter(*config);
|
global_context->setHTTPHeaderFilter(*config);
|
||||||
|
|
||||||
global_context->setMaxTableSizeToDrop(server_settings_.max_table_size_to_drop);
|
global_context->setMaxTableSizeToDrop(server_settings_.max_table_size_to_drop);
|
||||||
global_context->setClientHTTPHeaderForbiddenHeaders(server_settings_.get_client_http_header_forbidden_headers);
|
|
||||||
global_context->setAllowGetHTTPHeaderFunction(server_settings_.allow_get_client_http_header);
|
|
||||||
global_context->setMaxPartitionSizeToDrop(server_settings_.max_partition_size_to_drop);
|
global_context->setMaxPartitionSizeToDrop(server_settings_.max_partition_size_to_drop);
|
||||||
|
|
||||||
ConcurrencyControl::SlotCount concurrent_threads_soft_limit = ConcurrencyControl::Unlimited;
|
ConcurrencyControl::SlotCount concurrent_threads_soft_limit = ConcurrencyControl::Unlimited;
|
||||||
@ -1336,6 +1335,10 @@ try
|
|||||||
global_context->getMessageBrokerSchedulePool().increaseThreadsCount(server_settings_.background_message_broker_schedule_pool_size);
|
global_context->getMessageBrokerSchedulePool().increaseThreadsCount(server_settings_.background_message_broker_schedule_pool_size);
|
||||||
global_context->getDistributedSchedulePool().increaseThreadsCount(server_settings_.background_distributed_schedule_pool_size);
|
global_context->getDistributedSchedulePool().increaseThreadsCount(server_settings_.background_distributed_schedule_pool_size);
|
||||||
|
|
||||||
|
global_context->getAsyncLoader().setMaxThreads(TablesLoaderForegroundPoolId, server_settings_.tables_loader_foreground_pool_size);
|
||||||
|
global_context->getAsyncLoader().setMaxThreads(TablesLoaderBackgroundLoadPoolId, server_settings_.tables_loader_background_pool_size);
|
||||||
|
global_context->getAsyncLoader().setMaxThreads(TablesLoaderBackgroundStartupPoolId, server_settings_.tables_loader_background_pool_size);
|
||||||
|
|
||||||
getIOThreadPool().reloadConfiguration(
|
getIOThreadPool().reloadConfiguration(
|
||||||
server_settings.max_io_thread_pool_size,
|
server_settings.max_io_thread_pool_size,
|
||||||
server_settings.max_io_thread_pool_free_size,
|
server_settings.max_io_thread_pool_free_size,
|
||||||
@ -1676,17 +1679,18 @@ try
|
|||||||
|
|
||||||
LOG_INFO(log, "Loading metadata from {}", path_str);
|
LOG_INFO(log, "Loading metadata from {}", path_str);
|
||||||
|
|
||||||
|
LoadTaskPtrs load_metadata_tasks;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
auto & database_catalog = DatabaseCatalog::instance();
|
auto & database_catalog = DatabaseCatalog::instance();
|
||||||
/// We load temporary database first, because projections need it.
|
/// We load temporary database first, because projections need it.
|
||||||
database_catalog.initializeAndLoadTemporaryDatabase();
|
database_catalog.initializeAndLoadTemporaryDatabase();
|
||||||
loadMetadataSystem(global_context);
|
auto system_startup_tasks = loadMetadataSystem(global_context);
|
||||||
maybeConvertSystemDatabase(global_context);
|
maybeConvertSystemDatabase(global_context, system_startup_tasks);
|
||||||
/// This has to be done before the initialization of system logs,
|
/// This has to be done before the initialization of system logs,
|
||||||
/// otherwise there is a race condition between the system database initialization
|
/// otherwise there is a race condition between the system database initialization
|
||||||
/// and creation of new tables in the database.
|
/// and creation of new tables in the database.
|
||||||
startupSystemTables();
|
waitLoad(TablesLoaderForegroundPoolId, system_startup_tasks);
|
||||||
/// After attaching system databases we can initialize system log.
|
/// After attaching system databases we can initialize system log.
|
||||||
global_context->initializeSystemLogs();
|
global_context->initializeSystemLogs();
|
||||||
global_context->setSystemZooKeeperLogAfterInitializationIfNeeded();
|
global_context->setSystemZooKeeperLogAfterInitializationIfNeeded();
|
||||||
@ -1702,9 +1706,10 @@ try
|
|||||||
/// and so loadMarkedAsDroppedTables() will find it and try to add, and UUID will overlap.
|
/// and so loadMarkedAsDroppedTables() will find it and try to add, and UUID will overlap.
|
||||||
database_catalog.loadMarkedAsDroppedTables();
|
database_catalog.loadMarkedAsDroppedTables();
|
||||||
database_catalog.createBackgroundTasks();
|
database_catalog.createBackgroundTasks();
|
||||||
/// Then, load remaining databases
|
/// Then, load remaining databases (some of them maybe be loaded asynchronously)
|
||||||
loadMetadata(global_context, default_database);
|
load_metadata_tasks = loadMetadata(global_context, default_database, server_settings.async_load_databases);
|
||||||
convertDatabasesEnginesIfNeed(global_context);
|
/// If we need to convert database engines, disable async tables loading
|
||||||
|
convertDatabasesEnginesIfNeed(load_metadata_tasks, global_context);
|
||||||
database_catalog.startupBackgroundTasks();
|
database_catalog.startupBackgroundTasks();
|
||||||
/// After loading validate that default database exists
|
/// After loading validate that default database exists
|
||||||
database_catalog.assertDatabaseExists(default_database);
|
database_catalog.assertDatabaseExists(default_database);
|
||||||
@ -1716,6 +1721,7 @@ try
|
|||||||
tryLogCurrentException(log, "Caught exception while loading metadata");
|
tryLogCurrentException(log, "Caught exception while loading metadata");
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_DEBUG(log, "Loaded metadata.");
|
LOG_DEBUG(log, "Loaded metadata.");
|
||||||
|
|
||||||
/// Init trace collector only after trace_log system table was created
|
/// Init trace collector only after trace_log system table was created
|
||||||
@ -1871,9 +1877,14 @@ try
|
|||||||
throw Exception(ErrorCodes::ARGUMENT_OUT_OF_BOUND, "distributed_ddl.pool_size should be greater then 0");
|
throw Exception(ErrorCodes::ARGUMENT_OUT_OF_BOUND, "distributed_ddl.pool_size should be greater then 0");
|
||||||
global_context->setDDLWorker(std::make_unique<DDLWorker>(pool_size, ddl_zookeeper_path, global_context, &config(),
|
global_context->setDDLWorker(std::make_unique<DDLWorker>(pool_size, ddl_zookeeper_path, global_context, &config(),
|
||||||
"distributed_ddl", "DDLWorker",
|
"distributed_ddl", "DDLWorker",
|
||||||
&CurrentMetrics::MaxDDLEntryID, &CurrentMetrics::MaxPushedDDLEntryID));
|
&CurrentMetrics::MaxDDLEntryID, &CurrentMetrics::MaxPushedDDLEntryID),
|
||||||
|
load_metadata_tasks);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Do not keep tasks in server, they should be kept inside databases. Used here to make dependent tasks only.
|
||||||
|
load_metadata_tasks.clear();
|
||||||
|
load_metadata_tasks.shrink_to_fit();
|
||||||
|
|
||||||
{
|
{
|
||||||
std::lock_guard lock(servers_lock);
|
std::lock_guard lock(servers_lock);
|
||||||
for (auto & server : servers)
|
for (auto & server : servers)
|
||||||
|
@ -364,8 +364,15 @@
|
|||||||
<background_schedule_pool_size>128</background_schedule_pool_size>
|
<background_schedule_pool_size>128</background_schedule_pool_size>
|
||||||
<background_message_broker_schedule_pool_size>16</background_message_broker_schedule_pool_size>
|
<background_message_broker_schedule_pool_size>16</background_message_broker_schedule_pool_size>
|
||||||
<background_distributed_schedule_pool_size>16</background_distributed_schedule_pool_size>
|
<background_distributed_schedule_pool_size>16</background_distributed_schedule_pool_size>
|
||||||
|
<tables_loader_foreground_pool_size>0</tables_loader_foreground_pool_size>
|
||||||
|
<tables_loader_background_pool_size>0</tables_loader_background_pool_size>
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
<!-- Enables asynchronous loading of databases and tables to speedup server startup.
|
||||||
|
Queries to not yet loaded entity will be blocked until load is finished.
|
||||||
|
-->
|
||||||
|
<!-- <async_load_databases>true</async_load_databases> -->
|
||||||
|
|
||||||
<!-- On memory constrained environments you may have to set this to value larger than 1.
|
<!-- On memory constrained environments you may have to set this to value larger than 1.
|
||||||
-->
|
-->
|
||||||
<max_server_memory_usage_to_ram_ratio>0.9</max_server_memory_usage_to_ram_ratio>
|
<max_server_memory_usage_to_ram_ratio>0.9</max_server_memory_usage_to_ram_ratio>
|
||||||
@ -478,7 +485,6 @@
|
|||||||
<max_data_part_size_bytes></max_data_part_size_bytes>
|
<max_data_part_size_bytes></max_data_part_size_bytes>
|
||||||
<max_data_part_size_ratio></max_data_part_size_ratio>
|
<max_data_part_size_ratio></max_data_part_size_ratio>
|
||||||
<perform_ttl_move_on_insert>true</perform_ttl_move_on_insert>
|
<perform_ttl_move_on_insert>true</perform_ttl_move_on_insert>
|
||||||
<prefer_not_to_merge>false</prefer_not_to_merge>
|
|
||||||
<load_balancing>round_robin</load_balancing>
|
<load_balancing>round_robin</load_balancing>
|
||||||
</main>
|
</main>
|
||||||
</volumes>
|
</volumes>
|
||||||
|
@ -108,7 +108,7 @@
|
|||||||
filter: blur(1px);
|
filter: blur(1px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.chart div { position: absolute; }
|
.chart > div { position: absolute; }
|
||||||
|
|
||||||
.inputs {
|
.inputs {
|
||||||
height: auto;
|
height: auto;
|
||||||
@ -215,8 +215,6 @@
|
|||||||
color: var(--text-color);
|
color: var(--text-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
.u-legend th { display: none; }
|
|
||||||
|
|
||||||
.themes {
|
.themes {
|
||||||
float: right;
|
float: right;
|
||||||
font-size: 20pt;
|
font-size: 20pt;
|
||||||
@ -433,6 +431,16 @@
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.u-series {
|
||||||
|
line-height: 0.8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.u-series.footer {
|
||||||
|
font-size: 8px;
|
||||||
|
padding-top: 0;
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* Source: https://cdn.jsdelivr.net/npm/uplot@1.6.21/dist/uPlot.min.css
|
/* Source: https://cdn.jsdelivr.net/npm/uplot@1.6.21/dist/uPlot.min.css
|
||||||
* It is copy-pasted to lower the number of requests.
|
* It is copy-pasted to lower the number of requests.
|
||||||
*/
|
*/
|
||||||
@ -478,7 +486,6 @@
|
|||||||
* - compress the state for URL's #hash;
|
* - compress the state for URL's #hash;
|
||||||
* - footer with "about" or a link to source code;
|
* - footer with "about" or a link to source code;
|
||||||
* - allow to configure a table on a server to save the dashboards;
|
* - allow to configure a table on a server to save the dashboards;
|
||||||
* - multiple lines on chart;
|
|
||||||
* - if a query returned one value, display this value instead of a diagram;
|
* - if a query returned one value, display this value instead of a diagram;
|
||||||
* - if a query returned something unusual, display the table;
|
* - if a query returned something unusual, display the table;
|
||||||
*/
|
*/
|
||||||
@ -520,10 +527,54 @@ let queries = [];
|
|||||||
/// Query parameters with predefined default values.
|
/// Query parameters with predefined default values.
|
||||||
/// All other parameters will be automatically found in the queries.
|
/// All other parameters will be automatically found in the queries.
|
||||||
let params = {
|
let params = {
|
||||||
"rounding": "60",
|
'rounding': '60',
|
||||||
"seconds": "86400"
|
'seconds': '86400'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// Palette generation for charts
|
||||||
|
function generatePalette(baseColor, numColors) {
|
||||||
|
const baseHSL = hexToHsl(baseColor);
|
||||||
|
const hueStep = 360 / numColors;
|
||||||
|
const palette = [];
|
||||||
|
for (let i = 0; i < numColors; i++) {
|
||||||
|
const hue = Math.round((baseHSL.h + i * hueStep) % 360);
|
||||||
|
const color = `hsl(${hue}, ${baseHSL.s}%, ${baseHSL.l}%)`;
|
||||||
|
palette.push(color);
|
||||||
|
}
|
||||||
|
return palette;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Helper function to convert hex color to HSL
|
||||||
|
function hexToHsl(hex) {
|
||||||
|
hex = hex.replace(/^#/, '');
|
||||||
|
const bigint = parseInt(hex, 16);
|
||||||
|
const r = (bigint >> 16) & 255;
|
||||||
|
const g = (bigint >> 8) & 255;
|
||||||
|
const b = bigint & 255;
|
||||||
|
const r_norm = r / 255;
|
||||||
|
const g_norm = g / 255;
|
||||||
|
const b_norm = b / 255;
|
||||||
|
const max = Math.max(r_norm, g_norm, b_norm);
|
||||||
|
const min = Math.min(r_norm, g_norm, b_norm);
|
||||||
|
const l = (max + min) / 2;
|
||||||
|
let s = 0;
|
||||||
|
if (max !== min) {
|
||||||
|
s = l > 0.5 ? (max - min) / (2 - max - min) : (max - min) / (max + min);
|
||||||
|
}
|
||||||
|
let h = 0;
|
||||||
|
if (max !== min) {
|
||||||
|
if (max === r_norm) {
|
||||||
|
h = (g_norm - b_norm) / (max - min) + (g_norm < b_norm ? 6 : 0);
|
||||||
|
} else if (max === g_norm) {
|
||||||
|
h = (b_norm - r_norm) / (max - min) + 2;
|
||||||
|
} else {
|
||||||
|
h = (r_norm - g_norm) / (max - min) + 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
h = Math.round(h * 60);
|
||||||
|
return { h, s: Math.round(s * 100), l: Math.round(l * 100) };
|
||||||
|
}
|
||||||
|
|
||||||
let theme = 'light';
|
let theme = 'light';
|
||||||
|
|
||||||
function setTheme(new_theme) {
|
function setTheme(new_theme) {
|
||||||
@ -913,6 +964,8 @@ document.getElementById('mass-editor-textarea').addEventListener('input', e => {
|
|||||||
|
|
||||||
function legendAsTooltipPlugin({ className, style = { background: "var(--legend-background)" } } = {}) {
|
function legendAsTooltipPlugin({ className, style = { background: "var(--legend-background)" } } = {}) {
|
||||||
let legendEl;
|
let legendEl;
|
||||||
|
let showTop = false;
|
||||||
|
const showLimit = 5;
|
||||||
|
|
||||||
function init(u, opts) {
|
function init(u, opts) {
|
||||||
legendEl = u.root.querySelector(".u-legend");
|
legendEl = u.root.querySelector(".u-legend");
|
||||||
@ -932,13 +985,28 @@ function legendAsTooltipPlugin({ className, style = { background: "var(--legend-
|
|||||||
...style
|
...style
|
||||||
});
|
});
|
||||||
|
|
||||||
// hide series color markers
|
if (opts.series.length == 2) {
|
||||||
const idents = legendEl.querySelectorAll(".u-marker");
|
const nodes = legendEl.querySelectorAll("th");
|
||||||
|
for (let i = 0; i < nodes.length; i++)
|
||||||
|
nodes[i].style.display = "none";
|
||||||
|
} else {
|
||||||
|
legendEl.querySelector("th").remove();
|
||||||
|
legendEl.querySelector("td").setAttribute('colspan', '2');
|
||||||
|
legendEl.querySelector("td").style.textAlign = 'center';
|
||||||
|
}
|
||||||
|
|
||||||
for (let i = 0; i < idents.length; i++)
|
if (opts.series.length - 1 > showLimit) {
|
||||||
idents[i].style.display = "none";
|
showTop = true;
|
||||||
|
let footer = legendEl.insertRow().insertCell();
|
||||||
|
footer.setAttribute('colspan', '2');
|
||||||
|
footer.style.textAlign = 'center';
|
||||||
|
footer.classList.add('u-value');
|
||||||
|
footer.parentNode.classList.add('u-series','footer');
|
||||||
|
footer.textContent = ". . .";
|
||||||
|
}
|
||||||
|
|
||||||
const overEl = u.over;
|
const overEl = u.over;
|
||||||
|
overEl.style.overflow = "visible";
|
||||||
|
|
||||||
overEl.appendChild(legendEl);
|
overEl.appendChild(legendEl);
|
||||||
|
|
||||||
@ -946,11 +1014,28 @@ function legendAsTooltipPlugin({ className, style = { background: "var(--legend-
|
|||||||
overEl.addEventListener("mouseleave", () => {legendEl.style.display = "none";});
|
overEl.addEventListener("mouseleave", () => {legendEl.style.display = "none";});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function nodeListToArray(nodeList) {
|
||||||
|
return Array.prototype.slice.call(nodeList);
|
||||||
|
}
|
||||||
|
|
||||||
function update(u) {
|
function update(u) {
|
||||||
let { left, top } = u.cursor;
|
let { left, top } = u.cursor;
|
||||||
left -= legendEl.clientWidth / 2;
|
left -= legendEl.clientWidth / 2;
|
||||||
top -= legendEl.clientHeight / 2;
|
top -= legendEl.clientHeight / 2;
|
||||||
legendEl.style.transform = "translate(" + left + "px, " + top + "px)";
|
legendEl.style.transform = "translate(" + left + "px, " + top + "px)";
|
||||||
|
if (showTop) {
|
||||||
|
let nodes = nodeListToArray(legendEl.querySelectorAll("tr"));
|
||||||
|
let header = nodes.shift();
|
||||||
|
let footer = nodes.pop();
|
||||||
|
nodes.forEach(function (node) { node._sort_key = +node.querySelector("td").textContent; });
|
||||||
|
nodes.sort((a, b) => +b._sort_key - +a._sort_key);
|
||||||
|
nodes.forEach(function (node) { node.parentNode.appendChild(node); });
|
||||||
|
for (let i = 0; i < nodes.length; i++) {
|
||||||
|
nodes[i].style.display = i < showLimit ? null : "none";
|
||||||
|
delete nodes[i]._sort_key;
|
||||||
|
}
|
||||||
|
footer.parentNode.appendChild(footer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@ -961,12 +1046,13 @@ function legendAsTooltipPlugin({ className, style = { background: "var(--legend-
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async function doFetch(query, url_params = '') {
|
async function doFetch(query, url_params = '') {
|
||||||
host = document.getElementById('url').value || host;
|
host = document.getElementById('url').value || host;
|
||||||
user = document.getElementById('user').value;
|
user = document.getElementById('user').value;
|
||||||
password = document.getElementById('password').value;
|
password = document.getElementById('password').value;
|
||||||
|
|
||||||
let url = `${host}?default_format=JSONCompactColumns&enable_http_compression=1`
|
let url = `${host}?default_format=JSONColumnsWithMetadata&enable_http_compression=1`
|
||||||
|
|
||||||
if (add_http_cors_header) {
|
if (add_http_cors_header) {
|
||||||
// For debug purposes, you may set add_http_cors_header from a browser console
|
// For debug purposes, you may set add_http_cors_header from a browser console
|
||||||
@ -980,14 +1066,17 @@ async function doFetch(query, url_params = '') {
|
|||||||
url += `&password=${encodeURIComponent(password)}`;
|
url += `&password=${encodeURIComponent(password)}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
let response, data, error;
|
let response, reply, error;
|
||||||
try {
|
try {
|
||||||
response = await fetch(url + url_params, { method: "POST", body: query });
|
response = await fetch(url + url_params, { method: "POST", body: query });
|
||||||
data = await response.text();
|
reply = await response.text();
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
data = JSON.parse(data);
|
reply = JSON.parse(reply);
|
||||||
|
if (reply.exception) {
|
||||||
|
error = reply.exception;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
error = data;
|
error = reply;
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
@ -1006,7 +1095,7 @@ async function doFetch(query, url_params = '') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {data, error};
|
return {reply, error};
|
||||||
}
|
}
|
||||||
|
|
||||||
async function draw(idx, chart, url_params, query) {
|
async function draw(idx, chart, url_params, query) {
|
||||||
@ -1015,17 +1104,76 @@ async function draw(idx, chart, url_params, query) {
|
|||||||
plots[idx] = null;
|
plots[idx] = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
let {data, error} = await doFetch(query, url_params);
|
let {reply, error} = await doFetch(query, url_params);
|
||||||
|
if (!error) {
|
||||||
|
if (reply.rows.length == 0) {
|
||||||
|
error = "Query returned empty result.";
|
||||||
|
} else if (reply.meta.length < 2) {
|
||||||
|
error = "Query should return at least two columns: unix timestamp and value.";
|
||||||
|
} else {
|
||||||
|
for (let i = 0; i < reply.meta.length; i++) {
|
||||||
|
let label = reply.meta[i].name;
|
||||||
|
let column = reply.data[label];
|
||||||
|
if (!Array.isArray(column) || column.length != reply.data[reply.meta[0].name].length) {
|
||||||
|
error = "Wrong data format of the query.";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Transform string-labeled data to multi-column data
|
||||||
|
function transformToColumns() {
|
||||||
|
const x = reply.meta[0].name; // time; must be ordered
|
||||||
|
const l = reply.meta[1].name; // string label column to distinguish series; must be ordered
|
||||||
|
const y = reply.meta[2].name; // values; must have single value for (x, l) pair
|
||||||
|
const labels = [...new Set(reply.data[l])].sort((a, b) => a - b);
|
||||||
|
if (labels.includes('__time__')) {
|
||||||
|
error = "The second column is not allowed to contain '__time__' values.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const times = [...new Set(reply.data[x])].sort((a, b) => a - b);
|
||||||
|
let new_meta = [{ name: '__time__', type: reply.meta[0].type }];
|
||||||
|
let new_data = { __time__: [] };
|
||||||
|
for (let label of labels) {
|
||||||
|
new_meta.push({ name: label, type: reply.meta[2].type });
|
||||||
|
new_data[label] = [];
|
||||||
|
}
|
||||||
|
let new_rows = 0;
|
||||||
|
function row_done(row_time) {
|
||||||
|
new_rows++;
|
||||||
|
new_data.__time__.push(row_time);
|
||||||
|
for (let label of labels) {
|
||||||
|
if (new_data[label].length < new_rows) {
|
||||||
|
new_data[label].push(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let prev_time = reply.data[x][0];
|
||||||
|
const old_rows = reply.data[x].length;
|
||||||
|
for (let i = 0; i < old_rows; i++) {
|
||||||
|
const time = reply.data[x][i];
|
||||||
|
const label = reply.data[l][i];
|
||||||
|
const value = reply.data[y][i];
|
||||||
|
if (prev_time != time) {
|
||||||
|
row_done(prev_time);
|
||||||
|
prev_time = time;
|
||||||
|
}
|
||||||
|
new_data[label].push(value);
|
||||||
|
}
|
||||||
|
row_done(prev_time);
|
||||||
|
reply.meta = new_meta;
|
||||||
|
reply.data = new_data;
|
||||||
|
reply.rows = new_rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
function isStringColumn(type) {
|
||||||
|
return type === 'String' || type === 'LowCardinality(String)';
|
||||||
|
}
|
||||||
|
|
||||||
if (!error) {
|
if (!error) {
|
||||||
if (!Array.isArray(data)) {
|
if (reply.meta.length == 3 && isStringColumn(reply.meta[1].type)) {
|
||||||
error = "Query should return an array.";
|
transformToColumns();
|
||||||
} else if (data.length == 0) {
|
|
||||||
error = "Query returned empty result.";
|
|
||||||
} else if (data.length != 2) {
|
|
||||||
error = "Query should return exactly two columns: unix timestamp and value.";
|
|
||||||
} else if (!Array.isArray(data[0]) || !Array.isArray(data[1]) || data[0].length != data[1].length) {
|
|
||||||
error = "Wrong data format of the query.";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1043,24 +1191,38 @@ async function draw(idx, chart, url_params, query) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const [line_color, fill_color, grid_color, axes_color] = theme != 'dark'
|
const [line_color, fill_color, grid_color, axes_color] = theme != 'dark'
|
||||||
? ["#F88", "#FEE", "#EED", "#2c3235"]
|
? ["#ff8888", "#ffeeee", "#eeeedd", "#2c3235"]
|
||||||
: ["#864", "#045", "#2c3235", "#c7d0d9"];
|
: ["#886644", "#004455", "#2c3235", "#c7d0d9"];
|
||||||
|
|
||||||
let sync = uPlot.sync("sync");
|
let sync = uPlot.sync("sync");
|
||||||
|
|
||||||
const max_value = Math.max(...data[1]);
|
let axis = {
|
||||||
|
stroke: axes_color,
|
||||||
|
grid: { width: 1 / devicePixelRatio, stroke: grid_color },
|
||||||
|
ticks: { width: 1 / devicePixelRatio, stroke: grid_color }
|
||||||
|
};
|
||||||
|
|
||||||
|
let axes = [axis, axis];
|
||||||
|
let series = [{ label: "x" }];
|
||||||
|
let data = [reply.data[reply.meta[0].name]];
|
||||||
|
|
||||||
|
// Treat every column as series
|
||||||
|
const series_count = reply.meta.length;
|
||||||
|
const fill = series_count == 2 ? fill_color : undefined;
|
||||||
|
const palette = generatePalette(line_color, series_count);
|
||||||
|
let max_value = Number.NEGATIVE_INFINITY;
|
||||||
|
for (let i = 1; i < series_count; i++) {
|
||||||
|
let label = reply.meta[i].name;
|
||||||
|
series.push({ label, stroke: palette[i - 1], fill });
|
||||||
|
data.push(reply.data[label]);
|
||||||
|
max_value = Math.max(max_value, ...reply.data[label]);
|
||||||
|
}
|
||||||
|
|
||||||
const opts = {
|
const opts = {
|
||||||
width: chart.clientWidth,
|
width: chart.clientWidth,
|
||||||
height: chart.clientHeight,
|
height: chart.clientHeight,
|
||||||
axes: [ { stroke: axes_color,
|
axes,
|
||||||
grid: { width: 1 / devicePixelRatio, stroke: grid_color },
|
series,
|
||||||
ticks: { width: 1 / devicePixelRatio, stroke: grid_color } },
|
|
||||||
{ stroke: axes_color,
|
|
||||||
grid: { width: 1 / devicePixelRatio, stroke: grid_color },
|
|
||||||
ticks: { width: 1 / devicePixelRatio, stroke: grid_color } } ],
|
|
||||||
series: [ { label: "x" },
|
|
||||||
{ label: "y", stroke: line_color, fill: fill_color } ],
|
|
||||||
padding: [ null, null, null, (Math.round(max_value * 100) / 100).toString().length * 6 - 10 ],
|
padding: [ null, null, null, (Math.round(max_value * 100) / 100).toString().length * 6 - 10 ],
|
||||||
plugins: [ legendAsTooltipPlugin() ],
|
plugins: [ legendAsTooltipPlugin() ],
|
||||||
cursor: {
|
cursor: {
|
||||||
@ -1216,22 +1378,21 @@ function saveState() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function searchQueries() {
|
async function searchQueries() {
|
||||||
let {data, error} = await doFetch(search_query);
|
let {reply, error} = await doFetch(search_query);
|
||||||
if (error) {
|
if (error) {
|
||||||
throw new Error(error);
|
throw new Error(error);
|
||||||
}
|
}
|
||||||
if (!Array.isArray(data)) {
|
let data = reply.data;
|
||||||
throw new Error("Search query should return an array.");
|
if (reply.rows == 0) {
|
||||||
} else if (data.length == 0) {
|
|
||||||
throw new Error("Search query returned empty result.");
|
throw new Error("Search query returned empty result.");
|
||||||
} else if (data.length != 2) {
|
} else if (reply.meta.length != 2 || reply.meta[0].name != "title" || reply.meta[1].name != "query") {
|
||||||
throw new Error("Search query should return exactly two columns: title and query.");
|
throw new Error("Search query should return exactly two columns: title and query.");
|
||||||
} else if (!Array.isArray(data[0]) || !Array.isArray(data[1]) || data[0].length != data[1].length) {
|
} else if (!Array.isArray(data.title) || !Array.isArray(data.query) || data.title.length != data.query.length) {
|
||||||
throw new Error("Wrong data format of the search query.");
|
throw new Error("Wrong data format of the search query.");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let i = 0; i < data[0].length; i++) {
|
for (let i = 0; i < data.title.length; i++) {
|
||||||
queries.push({title: data[0][i], query: data[1][i]});
|
queries.push({title: data.title[i], query: data.query[i]});
|
||||||
}
|
}
|
||||||
|
|
||||||
regenerate();
|
regenerate();
|
||||||
|
@ -1,82 +0,0 @@
|
|||||||
#include <AggregateFunctions/AggregateFunctionFactory.h>
|
|
||||||
#include <AggregateFunctions/AggregateFunctionGroupArraySorted.h>
|
|
||||||
#include <AggregateFunctions/Helpers.h>
|
|
||||||
#include <AggregateFunctions/FactoryHelpers.h>
|
|
||||||
#include <DataTypes/DataTypeDate.h>
|
|
||||||
#include <DataTypes/DataTypeDateTime.h>
|
|
||||||
#include <Common/Exception.h>
|
|
||||||
|
|
||||||
namespace DB
|
|
||||||
{
|
|
||||||
struct Settings;
|
|
||||||
|
|
||||||
namespace ErrorCodes
|
|
||||||
{
|
|
||||||
extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH;
|
|
||||||
extern const int BAD_ARGUMENTS;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace
|
|
||||||
{
|
|
||||||
|
|
||||||
template <template <typename> class AggregateFunctionTemplate, typename ... TArgs>
|
|
||||||
AggregateFunctionPtr createWithNumericOrTimeType(const IDataType & argument_type, TArgs && ... args)
|
|
||||||
{
|
|
||||||
WhichDataType which(argument_type);
|
|
||||||
if (which.idx == TypeIndex::Date) return std::make_shared<AggregateFunctionTemplate<UInt16>>(std::forward<TArgs>(args)...);
|
|
||||||
if (which.idx == TypeIndex::DateTime) return std::make_shared<AggregateFunctionTemplate<UInt32>>(std::forward<TArgs>(args)...);
|
|
||||||
if (which.idx == TypeIndex::IPv4) return std::make_shared<AggregateFunctionTemplate<IPv4>>(std::forward<TArgs>(args)...);
|
|
||||||
return AggregateFunctionPtr(createWithNumericType<AggregateFunctionTemplate, TArgs...>(argument_type, std::forward<TArgs>(args)...));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename ... TArgs>
|
|
||||||
inline AggregateFunctionPtr createAggregateFunctionGroupArraySortedImpl(const DataTypePtr & argument_type, const Array & parameters, TArgs ... args)
|
|
||||||
{
|
|
||||||
if (auto res = createWithNumericOrTimeType<GroupArraySortedNumericImpl>(*argument_type, argument_type, parameters, std::forward<TArgs>(args)...))
|
|
||||||
return AggregateFunctionPtr(res);
|
|
||||||
|
|
||||||
WhichDataType which(argument_type);
|
|
||||||
return std::make_shared<GroupArraySortedGeneralImpl<GroupArraySortedNodeGeneral>>(argument_type, parameters, std::forward<TArgs>(args)...);
|
|
||||||
}
|
|
||||||
|
|
||||||
AggregateFunctionPtr createAggregateFunctionGroupArraySorted(
|
|
||||||
const std::string & name, const DataTypes & argument_types, const Array & parameters, const Settings *)
|
|
||||||
{
|
|
||||||
assertUnary(name, argument_types);
|
|
||||||
|
|
||||||
UInt64 max_elems = std::numeric_limits<UInt64>::max();
|
|
||||||
|
|
||||||
if (parameters.empty())
|
|
||||||
{
|
|
||||||
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Parameter for aggregate function {} should have limit argument", name);
|
|
||||||
}
|
|
||||||
else if (parameters.size() == 1)
|
|
||||||
{
|
|
||||||
auto type = parameters[0].getType();
|
|
||||||
if (type != Field::Types::Int64 && type != Field::Types::UInt64)
|
|
||||||
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Parameter for aggregate function {} should be positive number", name);
|
|
||||||
|
|
||||||
if ((type == Field::Types::Int64 && parameters[0].get<Int64>() < 0) ||
|
|
||||||
(type == Field::Types::UInt64 && parameters[0].get<UInt64>() == 0))
|
|
||||||
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Parameter for aggregate function {} should be positive number", name);
|
|
||||||
|
|
||||||
max_elems = parameters[0].get<UInt64>();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
throw Exception(ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH,
|
|
||||||
"Function {} does not support this number of arguments", name);
|
|
||||||
|
|
||||||
return createAggregateFunctionGroupArraySortedImpl(argument_types[0], parameters, max_elems);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void registerAggregateFunctionGroupArraySorted(AggregateFunctionFactory & factory)
|
|
||||||
{
|
|
||||||
AggregateFunctionProperties properties = { .returns_default_when_only_null = false, .is_order_dependent = false };
|
|
||||||
|
|
||||||
factory.registerFunction("groupArraySorted", { createAggregateFunctionGroupArraySorted, properties });
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,355 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <IO/ReadHelpers.h>
|
|
||||||
#include <IO/WriteHelpers.h>
|
|
||||||
#include <IO/ReadBufferFromString.h>
|
|
||||||
#include <IO/WriteBufferFromString.h>
|
|
||||||
#include <IO/Operators.h>
|
|
||||||
|
|
||||||
#include <DataTypes/DataTypeArray.h>
|
|
||||||
#include <DataTypes/DataTypeString.h>
|
|
||||||
#include <DataTypes/DataTypesNumber.h>
|
|
||||||
|
|
||||||
#include <Columns/ColumnArray.h>
|
|
||||||
#include <Columns/ColumnString.h>
|
|
||||||
#include <Columns/ColumnVector.h>
|
|
||||||
#include <Functions/array/arraySort.h>
|
|
||||||
|
|
||||||
#include <Common/Exception.h>
|
|
||||||
#include <Common/ArenaAllocator.h>
|
|
||||||
#include <Common/assert_cast.h>
|
|
||||||
#include <Columns/ColumnConst.h>
|
|
||||||
#include <DataTypes/IDataType.h>
|
|
||||||
#include <base/sort.h>
|
|
||||||
#include <Columns/IColumn.h>
|
|
||||||
|
|
||||||
#include <AggregateFunctions/IAggregateFunction.h>
|
|
||||||
|
|
||||||
#include <Common/RadixSort.h>
|
|
||||||
#include <algorithm>
|
|
||||||
#include <type_traits>
|
|
||||||
#include <utility>
|
|
||||||
|
|
||||||
#define AGGREGATE_FUNCTION_GROUP_ARRAY_MAX_ELEMENT_SIZE 0xFFFFFF
|
|
||||||
|
|
||||||
namespace DB
|
|
||||||
{
|
|
||||||
struct Settings;
|
|
||||||
|
|
||||||
namespace ErrorCodes
|
|
||||||
{
|
|
||||||
extern const int TOO_LARGE_ARRAY_SIZE;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
struct GroupArraySortedData;
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
struct GroupArraySortedData
|
|
||||||
{
|
|
||||||
/// For easy serialization.
|
|
||||||
static_assert(std::has_unique_object_representations_v<T> || std::is_floating_point_v<T>);
|
|
||||||
|
|
||||||
// Switch to ordinary Allocator after 4096 bytes to avoid fragmentation and trash in Arena
|
|
||||||
using Allocator = MixedAlignedArenaAllocator<alignof(T), 4096>;
|
|
||||||
using Array = PODArray<T, 32, Allocator>;
|
|
||||||
|
|
||||||
Array value;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
class GroupArraySortedNumericImpl final
|
|
||||||
: public IAggregateFunctionDataHelper<GroupArraySortedData<T>, GroupArraySortedNumericImpl<T>>
|
|
||||||
{
|
|
||||||
using Data = GroupArraySortedData<T>;
|
|
||||||
UInt64 max_elems;
|
|
||||||
SerializationPtr serialization;
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit GroupArraySortedNumericImpl(
|
|
||||||
const DataTypePtr & data_type_, const Array & parameters_, UInt64 max_elems_ = std::numeric_limits<UInt64>::max())
|
|
||||||
: IAggregateFunctionDataHelper<GroupArraySortedData<T>, GroupArraySortedNumericImpl<T>>(
|
|
||||||
{data_type_}, parameters_, std::make_shared<DataTypeArray>(data_type_))
|
|
||||||
, max_elems(max_elems_)
|
|
||||||
, serialization(data_type_->getDefaultSerialization())
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
String getName() const override { return "groupArraySorted"; }
|
|
||||||
|
|
||||||
void add(AggregateDataPtr __restrict place, const IColumn ** columns, size_t row_num, Arena * arena) const override
|
|
||||||
{
|
|
||||||
const auto & row_value = assert_cast<const ColumnVector<T> &>(*columns[0]).getData()[row_num];
|
|
||||||
auto & cur_elems = this->data(place);
|
|
||||||
|
|
||||||
cur_elems.value.push_back(row_value, arena);
|
|
||||||
|
|
||||||
/// To optimize, we sort (2 * max_size) elements of input array over and over again
|
|
||||||
/// and after each loop we delete the last half of sorted array
|
|
||||||
if (cur_elems.value.size() >= max_elems * 2)
|
|
||||||
{
|
|
||||||
RadixSort<RadixSortNumTraits<T>>::executeLSD(cur_elems.value.data(), cur_elems.value.size());
|
|
||||||
cur_elems.value.resize(max_elems, arena);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void merge(AggregateDataPtr __restrict place, ConstAggregateDataPtr rhs, Arena * arena) const override
|
|
||||||
{
|
|
||||||
auto & cur_elems = this->data(place);
|
|
||||||
auto & rhs_elems = this->data(rhs);
|
|
||||||
|
|
||||||
if (rhs_elems.value.empty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (rhs_elems.value.size())
|
|
||||||
cur_elems.value.insertByOffsets(rhs_elems.value, 0, rhs_elems.value.size(), arena);
|
|
||||||
|
|
||||||
RadixSort<RadixSortNumTraits<T>>::executeLSD(cur_elems.value.data(), cur_elems.value.size());
|
|
||||||
|
|
||||||
size_t elems_size = cur_elems.value.size() < max_elems ? cur_elems.value.size() : max_elems;
|
|
||||||
cur_elems.value.resize(elems_size, arena);
|
|
||||||
}
|
|
||||||
|
|
||||||
void serialize(ConstAggregateDataPtr __restrict place, WriteBuffer & buf, std::optional<size_t> /* version */) const override
|
|
||||||
{
|
|
||||||
auto & value = this->data(place).value;
|
|
||||||
size_t size = value.size();
|
|
||||||
writeVarUInt(size, buf);
|
|
||||||
|
|
||||||
for (const auto & elem : value)
|
|
||||||
writeBinaryLittleEndian(elem, buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
void deserialize(AggregateDataPtr __restrict place, ReadBuffer & buf, std::optional<size_t> /* version */, Arena * arena) const override
|
|
||||||
{
|
|
||||||
size_t size = 0;
|
|
||||||
readVarUInt(size, buf);
|
|
||||||
|
|
||||||
if (unlikely(size > max_elems))
|
|
||||||
throw Exception(ErrorCodes::TOO_LARGE_ARRAY_SIZE, "Too large array size, it should not exceed {}", max_elems);
|
|
||||||
|
|
||||||
auto & value = this->data(place).value;
|
|
||||||
|
|
||||||
value.resize(size, arena);
|
|
||||||
for (auto & element : value)
|
|
||||||
readBinaryLittleEndian(element, buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void checkArraySize(size_t elems, size_t max_elems)
|
|
||||||
{
|
|
||||||
if (unlikely(elems > max_elems))
|
|
||||||
throw Exception(ErrorCodes::TOO_LARGE_ARRAY_SIZE,
|
|
||||||
"Too large array size {} (maximum: {})", elems, max_elems);
|
|
||||||
}
|
|
||||||
|
|
||||||
void insertResultInto(AggregateDataPtr __restrict place, IColumn & to, Arena * arena) const override
|
|
||||||
{
|
|
||||||
auto& value = this->data(place).value;
|
|
||||||
|
|
||||||
RadixSort<RadixSortNumTraits<T>>::executeLSD(value.data(), value.size());
|
|
||||||
size_t elems_size = value.size() < max_elems ? value.size() : max_elems;
|
|
||||||
value.resize(elems_size, arena);
|
|
||||||
size_t size = value.size();
|
|
||||||
|
|
||||||
ColumnArray & arr_to = assert_cast<ColumnArray &>(to);
|
|
||||||
ColumnArray::Offsets & offsets_to = arr_to.getOffsets();
|
|
||||||
|
|
||||||
offsets_to.push_back(offsets_to.back() + size);
|
|
||||||
|
|
||||||
if (size)
|
|
||||||
{
|
|
||||||
typename ColumnVector<T>::Container & data_to = assert_cast<ColumnVector<T> &>(arr_to.getData()).getData();
|
|
||||||
data_to.insert(this->data(place).value.begin(), this->data(place).value.end());
|
|
||||||
RadixSort<RadixSortNumTraits<T>>::executeLSD(value.data(), value.size());
|
|
||||||
value.resize(elems_size, arena);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool allocatesMemoryInArena() const override { return true; }
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
template <typename Node, bool has_sampler>
|
|
||||||
struct GroupArraySortedGeneralData;
|
|
||||||
|
|
||||||
template <typename Node>
|
|
||||||
struct GroupArraySortedGeneralData<Node, false>
|
|
||||||
{
|
|
||||||
// Switch to ordinary Allocator after 4096 bytes to avoid fragmentation and trash in Arena
|
|
||||||
using Allocator = MixedAlignedArenaAllocator<alignof(Node *), 4096>;
|
|
||||||
using Array = PODArray<Field, 32, Allocator>;
|
|
||||||
|
|
||||||
Array value;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename Node>
|
|
||||||
struct GroupArraySortedNodeBase
|
|
||||||
{
|
|
||||||
UInt64 size; // size of payload
|
|
||||||
|
|
||||||
/// Returns pointer to actual payload
|
|
||||||
char * data() { return reinterpret_cast<char *>(this) + sizeof(Node); }
|
|
||||||
|
|
||||||
const char * data() const { return reinterpret_cast<const char *>(this) + sizeof(Node); }
|
|
||||||
};
|
|
||||||
|
|
||||||
struct GroupArraySortedNodeString : public GroupArraySortedNodeBase<GroupArraySortedNodeString>
|
|
||||||
{
|
|
||||||
using Node = GroupArraySortedNodeString;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
struct GroupArraySortedNodeGeneral : public GroupArraySortedNodeBase<GroupArraySortedNodeGeneral>
|
|
||||||
{
|
|
||||||
using Node = GroupArraySortedNodeGeneral;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
/// Implementation of groupArraySorted for Generic data via Array
|
|
||||||
template <typename Node>
|
|
||||||
class GroupArraySortedGeneralImpl final
|
|
||||||
: public IAggregateFunctionDataHelper<GroupArraySortedGeneralData<Node, false>, GroupArraySortedGeneralImpl<Node>>
|
|
||||||
{
|
|
||||||
using Data = GroupArraySortedGeneralData<Node, false>;
|
|
||||||
static Data & data(AggregateDataPtr __restrict place) { return *reinterpret_cast<Data *>(place); }
|
|
||||||
static const Data & data(ConstAggregateDataPtr __restrict place) { return *reinterpret_cast<const Data *>(place); }
|
|
||||||
|
|
||||||
DataTypePtr & data_type;
|
|
||||||
UInt64 max_elems;
|
|
||||||
SerializationPtr serialization;
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
GroupArraySortedGeneralImpl(const DataTypePtr & data_type_, const Array & parameters_, UInt64 max_elems_ = std::numeric_limits<UInt64>::max())
|
|
||||||
: IAggregateFunctionDataHelper<GroupArraySortedGeneralData<Node, false>, GroupArraySortedGeneralImpl<Node>>(
|
|
||||||
{data_type_}, parameters_, std::make_shared<DataTypeArray>(data_type_))
|
|
||||||
, data_type(this->argument_types[0])
|
|
||||||
, max_elems(max_elems_)
|
|
||||||
, serialization(data_type->getDefaultSerialization())
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
String getName() const override { return "groupArraySorted"; }
|
|
||||||
|
|
||||||
void add(AggregateDataPtr __restrict place, const IColumn ** columns, size_t row_num, Arena * arena) const override
|
|
||||||
{
|
|
||||||
auto & cur_elems = data(place);
|
|
||||||
|
|
||||||
cur_elems.value.push_back(columns[0][0][row_num], arena);
|
|
||||||
|
|
||||||
/// To optimize, we sort (2 * max_size) elements of input array over and over again and
|
|
||||||
/// after each loop we delete the last half of sorted array
|
|
||||||
|
|
||||||
if (cur_elems.value.size() >= max_elems * 2)
|
|
||||||
{
|
|
||||||
std::sort(cur_elems.value.begin(), cur_elems.value.begin() + (max_elems * 2));
|
|
||||||
cur_elems.value.erase(cur_elems.value.begin() + max_elems, cur_elems.value.begin() + (max_elems * 2));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void merge(AggregateDataPtr __restrict place, ConstAggregateDataPtr rhs, Arena * arena) const override
|
|
||||||
{
|
|
||||||
auto & cur_elems = data(place);
|
|
||||||
auto & rhs_elems = data(rhs);
|
|
||||||
|
|
||||||
if (rhs_elems.value.empty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
UInt64 new_elems = rhs_elems.value.size();
|
|
||||||
|
|
||||||
for (UInt64 i = 0; i < new_elems; ++i)
|
|
||||||
cur_elems.value.push_back(rhs_elems.value[i], arena);
|
|
||||||
|
|
||||||
checkArraySize(cur_elems.value.size(), AGGREGATE_FUNCTION_GROUP_ARRAY_MAX_ELEMENT_SIZE);
|
|
||||||
|
|
||||||
if (!cur_elems.value.empty())
|
|
||||||
{
|
|
||||||
std::sort(cur_elems.value.begin(), cur_elems.value.end());
|
|
||||||
|
|
||||||
if (cur_elems.value.size() > max_elems)
|
|
||||||
cur_elems.value.resize(max_elems, arena);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void checkArraySize(size_t elems, size_t max_elems)
|
|
||||||
{
|
|
||||||
if (unlikely(elems > max_elems))
|
|
||||||
throw Exception(ErrorCodes::TOO_LARGE_ARRAY_SIZE,
|
|
||||||
"Too large array size {} (maximum: {})", elems, max_elems);
|
|
||||||
}
|
|
||||||
|
|
||||||
void serialize(ConstAggregateDataPtr __restrict place, WriteBuffer & buf, std::optional<size_t> /* version */) const override
|
|
||||||
{
|
|
||||||
auto & value = data(place).value;
|
|
||||||
size_t size = value.size();
|
|
||||||
checkArraySize(size, AGGREGATE_FUNCTION_GROUP_ARRAY_MAX_ELEMENT_SIZE);
|
|
||||||
writeVarUInt(size, buf);
|
|
||||||
|
|
||||||
for (const Field & elem : value)
|
|
||||||
{
|
|
||||||
if (elem.isNull())
|
|
||||||
{
|
|
||||||
writeBinary(false, buf);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
writeBinary(true, buf);
|
|
||||||
serialization->serializeBinary(elem, buf, {});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void deserialize(AggregateDataPtr __restrict place, ReadBuffer & buf, std::optional<size_t> /* version */, Arena * arena) const override
|
|
||||||
{
|
|
||||||
size_t size = 0;
|
|
||||||
readVarUInt(size, buf);
|
|
||||||
|
|
||||||
if (unlikely(size > max_elems))
|
|
||||||
throw Exception(ErrorCodes::TOO_LARGE_ARRAY_SIZE, "Too large array size, it should not exceed {}", max_elems);
|
|
||||||
|
|
||||||
checkArraySize(size, AGGREGATE_FUNCTION_GROUP_ARRAY_MAX_ELEMENT_SIZE);
|
|
||||||
auto & value = data(place).value;
|
|
||||||
|
|
||||||
value.resize(size, arena);
|
|
||||||
for (Field & elem : value)
|
|
||||||
{
|
|
||||||
UInt8 is_null = 0;
|
|
||||||
readBinary(is_null, buf);
|
|
||||||
if (!is_null)
|
|
||||||
serialization->deserializeBinary(elem, buf, {});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void insertResultInto(AggregateDataPtr __restrict place, IColumn & to, Arena * arena) const override
|
|
||||||
{
|
|
||||||
auto & column_array = assert_cast<ColumnArray &>(to);
|
|
||||||
auto & value = data(place).value;
|
|
||||||
|
|
||||||
if (!value.empty())
|
|
||||||
{
|
|
||||||
std::sort(value.begin(), value.end());
|
|
||||||
|
|
||||||
if (value.size() > max_elems)
|
|
||||||
value.resize_exact(max_elems, arena);
|
|
||||||
}
|
|
||||||
auto & offsets = column_array.getOffsets();
|
|
||||||
offsets.push_back(offsets.back() + value.size());
|
|
||||||
|
|
||||||
auto & column_data = column_array.getData();
|
|
||||||
|
|
||||||
if (std::is_same_v<Node, GroupArraySortedNodeString>)
|
|
||||||
{
|
|
||||||
auto & string_offsets = assert_cast<ColumnString &>(column_data).getOffsets();
|
|
||||||
string_offsets.reserve(string_offsets.size() + value.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const Field& field : value)
|
|
||||||
column_data.insert(field);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool allocatesMemoryInArena() const override { return true; }
|
|
||||||
};
|
|
||||||
|
|
||||||
#undef AGGREGATE_FUNCTION_GROUP_ARRAY_MAX_ARRAY_SIZE
|
|
||||||
|
|
||||||
}
|
|
@ -15,7 +15,6 @@ void registerAggregateFunctionCount(AggregateFunctionFactory &);
|
|||||||
void registerAggregateFunctionDeltaSum(AggregateFunctionFactory &);
|
void registerAggregateFunctionDeltaSum(AggregateFunctionFactory &);
|
||||||
void registerAggregateFunctionDeltaSumTimestamp(AggregateFunctionFactory &);
|
void registerAggregateFunctionDeltaSumTimestamp(AggregateFunctionFactory &);
|
||||||
void registerAggregateFunctionGroupArray(AggregateFunctionFactory &);
|
void registerAggregateFunctionGroupArray(AggregateFunctionFactory &);
|
||||||
void registerAggregateFunctionGroupArraySorted(AggregateFunctionFactory & factory);
|
|
||||||
void registerAggregateFunctionGroupUniqArray(AggregateFunctionFactory &);
|
void registerAggregateFunctionGroupUniqArray(AggregateFunctionFactory &);
|
||||||
void registerAggregateFunctionGroupArrayInsertAt(AggregateFunctionFactory &);
|
void registerAggregateFunctionGroupArrayInsertAt(AggregateFunctionFactory &);
|
||||||
void registerAggregateFunctionsQuantile(AggregateFunctionFactory &);
|
void registerAggregateFunctionsQuantile(AggregateFunctionFactory &);
|
||||||
@ -112,7 +111,6 @@ void registerAggregateFunctions()
|
|||||||
registerAggregateFunctionDeltaSum(factory);
|
registerAggregateFunctionDeltaSum(factory);
|
||||||
registerAggregateFunctionDeltaSumTimestamp(factory);
|
registerAggregateFunctionDeltaSumTimestamp(factory);
|
||||||
registerAggregateFunctionGroupArray(factory);
|
registerAggregateFunctionGroupArray(factory);
|
||||||
registerAggregateFunctionGroupArraySorted(factory);
|
|
||||||
registerAggregateFunctionGroupUniqArray(factory);
|
registerAggregateFunctionGroupUniqArray(factory);
|
||||||
registerAggregateFunctionGroupArrayInsertAt(factory);
|
registerAggregateFunctionGroupArrayInsertAt(factory);
|
||||||
registerAggregateFunctionsQuantile(factory);
|
registerAggregateFunctionsQuantile(factory);
|
||||||
|
@ -48,20 +48,22 @@ namespace
|
|||||||
}
|
}
|
||||||
|
|
||||||
const auto & request_settings = settings.request_settings;
|
const auto & request_settings = settings.request_settings;
|
||||||
|
const Settings & global_settings = context->getGlobalContext()->getSettingsRef();
|
||||||
|
const Settings & local_settings = context->getSettingsRef();
|
||||||
|
|
||||||
S3::PocoHTTPClientConfiguration client_configuration = S3::ClientFactory::instance().createClientConfiguration(
|
S3::PocoHTTPClientConfiguration client_configuration = S3::ClientFactory::instance().createClientConfiguration(
|
||||||
settings.auth_settings.region,
|
settings.auth_settings.region,
|
||||||
context->getRemoteHostFilter(),
|
context->getRemoteHostFilter(),
|
||||||
static_cast<unsigned>(context->getGlobalContext()->getSettingsRef().s3_max_redirects),
|
static_cast<unsigned>(global_settings.s3_max_redirects),
|
||||||
static_cast<unsigned>(context->getGlobalContext()->getSettingsRef().s3_retry_attempts),
|
static_cast<unsigned>(global_settings.s3_retry_attempts),
|
||||||
context->getGlobalContext()->getSettingsRef().enable_s3_requests_logging,
|
global_settings.enable_s3_requests_logging,
|
||||||
/* for_disk_s3 = */ false,
|
/* for_disk_s3 = */ false,
|
||||||
request_settings.get_request_throttler,
|
request_settings.get_request_throttler,
|
||||||
request_settings.put_request_throttler,
|
request_settings.put_request_throttler,
|
||||||
s3_uri.uri.getScheme());
|
s3_uri.uri.getScheme());
|
||||||
|
|
||||||
client_configuration.endpointOverride = s3_uri.endpoint;
|
client_configuration.endpointOverride = s3_uri.endpoint;
|
||||||
client_configuration.maxConnections = static_cast<unsigned>(context->getSettingsRef().s3_max_connections);
|
client_configuration.maxConnections = static_cast<unsigned>(global_settings.s3_max_connections);
|
||||||
/// Increase connect timeout
|
/// Increase connect timeout
|
||||||
client_configuration.connectTimeoutMs = 10 * 1000;
|
client_configuration.connectTimeoutMs = 10 * 1000;
|
||||||
/// Requests in backups can be extremely long, set to one hour
|
/// Requests in backups can be extremely long, set to one hour
|
||||||
@ -71,6 +73,7 @@ namespace
|
|||||||
return S3::ClientFactory::instance().create(
|
return S3::ClientFactory::instance().create(
|
||||||
client_configuration,
|
client_configuration,
|
||||||
s3_uri.is_virtual_hosted_style,
|
s3_uri.is_virtual_hosted_style,
|
||||||
|
local_settings.s3_disable_checksum,
|
||||||
credentials.GetAWSAccessKeyId(),
|
credentials.GetAWSAccessKeyId(),
|
||||||
credentials.GetAWSSecretKey(),
|
credentials.GetAWSSecretKey(),
|
||||||
settings.auth_settings.server_side_encryption_customer_key_base64,
|
settings.auth_settings.server_side_encryption_customer_key_base64,
|
||||||
|
@ -436,10 +436,6 @@ dbms_target_link_libraries(PRIVATE ch_contrib::zstd)
|
|||||||
target_link_libraries (clickhouse_common_io PUBLIC ch_contrib::zstd)
|
target_link_libraries (clickhouse_common_io PUBLIC ch_contrib::zstd)
|
||||||
target_link_libraries (clickhouse_common_io PUBLIC ch_contrib::xz)
|
target_link_libraries (clickhouse_common_io PUBLIC ch_contrib::xz)
|
||||||
|
|
||||||
if (TARGET ch_contrib::pocketfft)
|
|
||||||
target_link_libraries(clickhouse_common_io PUBLIC ch_contrib::pocketfft)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
if (TARGET ch_contrib::icu)
|
if (TARGET ch_contrib::icu)
|
||||||
dbms_target_link_libraries (PRIVATE ch_contrib::icu)
|
dbms_target_link_libraries (PRIVATE ch_contrib::icu)
|
||||||
endif ()
|
endif ()
|
||||||
|
@ -2566,7 +2566,7 @@ bool ClientBase::processMultiQueryFromFile(const String & file_name)
|
|||||||
ReadBufferFromFile in(file_name);
|
ReadBufferFromFile in(file_name);
|
||||||
readStringUntilEOF(queries_from_file, in);
|
readStringUntilEOF(queries_from_file, in);
|
||||||
|
|
||||||
if (!global_context->getSettings().log_comment.changed)
|
if (!has_log_comment)
|
||||||
{
|
{
|
||||||
Settings settings = global_context->getSettings();
|
Settings settings = global_context->getSettings();
|
||||||
/// NOTE: cannot use even weakly_canonical() since it fails for /dev/stdin due to resolving of "pipe:[X]"
|
/// NOTE: cannot use even weakly_canonical() since it fails for /dev/stdin due to resolving of "pipe:[X]"
|
||||||
@ -3005,6 +3005,8 @@ void ClientBase::init(int argc, char ** argv)
|
|||||||
total_memory_tracker.setDescription("(total)");
|
total_memory_tracker.setDescription("(total)");
|
||||||
total_memory_tracker.setMetric(CurrentMetrics::MemoryTracking);
|
total_memory_tracker.setMetric(CurrentMetrics::MemoryTracking);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
has_log_comment = config().has("log_comment");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -321,6 +321,9 @@ protected:
|
|||||||
bool allow_merge_tree_settings = false;
|
bool allow_merge_tree_settings = false;
|
||||||
|
|
||||||
bool cancelled = false;
|
bool cancelled = false;
|
||||||
|
|
||||||
|
/// Does log_comment has specified by user?
|
||||||
|
bool has_log_comment = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,24 @@
|
|||||||
#include <Common/AsyncLoader.h>
|
#include <Common/AsyncLoader.h>
|
||||||
|
|
||||||
|
#include <limits>
|
||||||
|
#include <optional>
|
||||||
#include <base/defines.h>
|
#include <base/defines.h>
|
||||||
|
#include <base/scope_guard.h>
|
||||||
#include <Common/ErrorCodes.h>
|
#include <Common/ErrorCodes.h>
|
||||||
#include <Common/Exception.h>
|
#include <Common/Exception.h>
|
||||||
#include <Common/noexcept_scope.h>
|
#include <Common/noexcept_scope.h>
|
||||||
#include <Common/setThreadName.h>
|
#include <Common/setThreadName.h>
|
||||||
#include <Common/logger_useful.h>
|
#include <Common/logger_useful.h>
|
||||||
#include <Common/ThreadPool.h>
|
#include <Common/ThreadPool.h>
|
||||||
|
#include <Common/getNumberOfPhysicalCPUCores.h>
|
||||||
|
#include <Common/ProfileEvents.h>
|
||||||
|
#include <Common/Stopwatch.h>
|
||||||
|
|
||||||
|
|
||||||
|
namespace ProfileEvents
|
||||||
|
{
|
||||||
|
extern const Event AsyncLoaderWaitMicroseconds;
|
||||||
|
}
|
||||||
|
|
||||||
namespace DB
|
namespace DB
|
||||||
{
|
{
|
||||||
@ -16,6 +28,7 @@ namespace ErrorCodes
|
|||||||
extern const int ASYNC_LOAD_CYCLE;
|
extern const int ASYNC_LOAD_CYCLE;
|
||||||
extern const int ASYNC_LOAD_FAILED;
|
extern const int ASYNC_LOAD_FAILED;
|
||||||
extern const int ASYNC_LOAD_CANCELED;
|
extern const int ASYNC_LOAD_CANCELED;
|
||||||
|
extern const int LOGICAL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
static constexpr size_t PRINT_MESSAGE_EACH_N_OBJECTS = 256;
|
static constexpr size_t PRINT_MESSAGE_EACH_N_OBJECTS = 256;
|
||||||
@ -52,63 +65,48 @@ size_t LoadJob::pool() const
|
|||||||
return pool_id;
|
return pool_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadJob::wait() const
|
|
||||||
{
|
|
||||||
std::unique_lock lock{mutex};
|
|
||||||
waiters++;
|
|
||||||
finished.wait(lock, [this] { return load_status != LoadStatus::PENDING; });
|
|
||||||
waiters--;
|
|
||||||
if (load_exception)
|
|
||||||
std::rethrow_exception(load_exception);
|
|
||||||
}
|
|
||||||
|
|
||||||
void LoadJob::waitNoThrow() const noexcept
|
|
||||||
{
|
|
||||||
std::unique_lock lock{mutex};
|
|
||||||
waiters++;
|
|
||||||
finished.wait(lock, [this] { return load_status != LoadStatus::PENDING; });
|
|
||||||
waiters--;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t LoadJob::waitersCount() const
|
size_t LoadJob::waitersCount() const
|
||||||
{
|
{
|
||||||
std::unique_lock lock{mutex};
|
std::unique_lock lock{mutex};
|
||||||
return waiters;
|
return waiters;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadJob::ok()
|
size_t LoadJob::ok()
|
||||||
{
|
{
|
||||||
std::unique_lock lock{mutex};
|
std::unique_lock lock{mutex};
|
||||||
load_status = LoadStatus::OK;
|
load_status = LoadStatus::OK;
|
||||||
finish();
|
return finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadJob::failed(const std::exception_ptr & ptr)
|
size_t LoadJob::failed(const std::exception_ptr & ptr)
|
||||||
{
|
{
|
||||||
std::unique_lock lock{mutex};
|
std::unique_lock lock{mutex};
|
||||||
load_status = LoadStatus::FAILED;
|
load_status = LoadStatus::FAILED;
|
||||||
load_exception = ptr;
|
load_exception = ptr;
|
||||||
finish();
|
return finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadJob::canceled(const std::exception_ptr & ptr)
|
size_t LoadJob::canceled(const std::exception_ptr & ptr)
|
||||||
{
|
{
|
||||||
std::unique_lock lock{mutex};
|
std::unique_lock lock{mutex};
|
||||||
load_status = LoadStatus::CANCELED;
|
load_status = LoadStatus::CANCELED;
|
||||||
load_exception = ptr;
|
load_exception = ptr;
|
||||||
finish();
|
return finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadJob::finish()
|
size_t LoadJob::finish()
|
||||||
{
|
{
|
||||||
func = {}; // To ensure job function is destructed before `AsyncLoader::wait()` and `LoadJob::wait()` return
|
func = {}; // To ensure job function is destructed before `AsyncLoader::wait()` return
|
||||||
finish_time = std::chrono::system_clock::now();
|
finish_time = std::chrono::system_clock::now();
|
||||||
if (waiters > 0)
|
if (waiters > 0)
|
||||||
finished.notify_all();
|
finished.notify_all();
|
||||||
|
return std::exchange(suspended_waiters, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadJob::scheduled()
|
void LoadJob::scheduled(UInt64 job_id_)
|
||||||
{
|
{
|
||||||
|
chassert(job_id == 0); // Job cannot be scheduled twice
|
||||||
|
job_id = job_id_;
|
||||||
schedule_time = std::chrono::system_clock::now();
|
schedule_time = std::chrono::system_clock::now();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,11 +116,11 @@ void LoadJob::enqueued()
|
|||||||
enqueue_time = std::chrono::system_clock::now();
|
enqueue_time = std::chrono::system_clock::now();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadJob::execute(size_t pool, const LoadJobPtr & self)
|
void LoadJob::execute(AsyncLoader & loader, size_t pool, const LoadJobPtr & self)
|
||||||
{
|
{
|
||||||
execution_pool_id = pool;
|
execution_pool_id = pool;
|
||||||
start_time = std::chrono::system_clock::now();
|
start_time = std::chrono::system_clock::now();
|
||||||
func(self);
|
func(loader, self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -180,11 +178,11 @@ AsyncLoader::AsyncLoader(std::vector<PoolInitializer> pool_initializers, bool lo
|
|||||||
init.metric_threads,
|
init.metric_threads,
|
||||||
init.metric_active_threads,
|
init.metric_active_threads,
|
||||||
init.metric_scheduled_threads,
|
init.metric_scheduled_threads,
|
||||||
init.max_threads,
|
/* max_threads = */ std::numeric_limits<size_t>::max(), // Unlimited number of threads, we do worker management ourselves
|
||||||
/* max_free_threads = */ 0,
|
/* max_free_threads = */ 0, // We do not require free threads
|
||||||
init.max_threads),
|
/* queue_size = */0), // Unlimited queue to avoid blocking during worker spawning
|
||||||
.ready_queue = {},
|
.ready_queue = {},
|
||||||
.max_threads = init.max_threads
|
.max_threads = init.max_threads > 0 ? init.max_threads : getNumberOfPhysicalCPUCores()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -228,16 +226,16 @@ void AsyncLoader::stop()
|
|||||||
void AsyncLoader::schedule(LoadTask & task)
|
void AsyncLoader::schedule(LoadTask & task)
|
||||||
{
|
{
|
||||||
chassert(this == &task.loader);
|
chassert(this == &task.loader);
|
||||||
scheduleImpl(task.jobs);
|
schedule(task.jobs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AsyncLoader::schedule(const LoadTaskPtr & task)
|
void AsyncLoader::schedule(const LoadTaskPtr & task)
|
||||||
{
|
{
|
||||||
chassert(this == &task->loader);
|
chassert(this == &task->loader);
|
||||||
scheduleImpl(task->jobs);
|
schedule(task->jobs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AsyncLoader::schedule(const std::vector<LoadTaskPtr> & tasks)
|
void AsyncLoader::schedule(const LoadTaskPtrs & tasks)
|
||||||
{
|
{
|
||||||
LoadJobSet all_jobs;
|
LoadJobSet all_jobs;
|
||||||
for (const auto & task : tasks)
|
for (const auto & task : tasks)
|
||||||
@ -245,10 +243,10 @@ void AsyncLoader::schedule(const std::vector<LoadTaskPtr> & tasks)
|
|||||||
chassert(this == &task->loader);
|
chassert(this == &task->loader);
|
||||||
all_jobs.insert(task->jobs.begin(), task->jobs.end());
|
all_jobs.insert(task->jobs.begin(), task->jobs.end());
|
||||||
}
|
}
|
||||||
scheduleImpl(all_jobs);
|
schedule(all_jobs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AsyncLoader::scheduleImpl(const LoadJobSet & input_jobs)
|
void AsyncLoader::schedule(const LoadJobSet & jobs_to_schedule)
|
||||||
{
|
{
|
||||||
std::unique_lock lock{mutex};
|
std::unique_lock lock{mutex};
|
||||||
|
|
||||||
@ -264,7 +262,7 @@ void AsyncLoader::scheduleImpl(const LoadJobSet & input_jobs)
|
|||||||
// 1) exclude already scheduled or finished jobs
|
// 1) exclude already scheduled or finished jobs
|
||||||
// 2) include assigned job dependencies (that are not yet scheduled)
|
// 2) include assigned job dependencies (that are not yet scheduled)
|
||||||
LoadJobSet jobs;
|
LoadJobSet jobs;
|
||||||
for (const auto & job : input_jobs)
|
for (const auto & job : jobs_to_schedule)
|
||||||
gatherNotScheduled(job, jobs, lock);
|
gatherNotScheduled(job, jobs, lock);
|
||||||
|
|
||||||
// Ensure scheduled_jobs graph will have no cycles. The only way to get a cycle is to add a cycle, assuming old jobs cannot reference new ones.
|
// Ensure scheduled_jobs graph will have no cycles. The only way to get a cycle is to add a cycle, assuming old jobs cannot reference new ones.
|
||||||
@ -280,7 +278,7 @@ void AsyncLoader::scheduleImpl(const LoadJobSet & input_jobs)
|
|||||||
NOEXCEPT_SCOPE({
|
NOEXCEPT_SCOPE({
|
||||||
ALLOW_ALLOCATIONS_IN_SCOPE;
|
ALLOW_ALLOCATIONS_IN_SCOPE;
|
||||||
scheduled_jobs.try_emplace(job);
|
scheduled_jobs.try_emplace(job);
|
||||||
job->scheduled();
|
job->scheduled(++last_job_id);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -365,11 +363,20 @@ void AsyncLoader::prioritize(const LoadJobPtr & job, size_t new_pool)
|
|||||||
if (!job)
|
if (!job)
|
||||||
return;
|
return;
|
||||||
chassert(new_pool < pools.size());
|
chassert(new_pool < pools.size());
|
||||||
|
|
||||||
DENY_ALLOCATIONS_IN_SCOPE;
|
DENY_ALLOCATIONS_IN_SCOPE;
|
||||||
std::unique_lock lock{mutex};
|
std::unique_lock lock{mutex};
|
||||||
prioritize(job, new_pool, lock);
|
prioritize(job, new_pool, lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AsyncLoader::wait(const LoadJobPtr & job, bool no_throw)
|
||||||
|
{
|
||||||
|
std::unique_lock job_lock{job->mutex};
|
||||||
|
wait(job_lock, job);
|
||||||
|
if (!no_throw && job->load_exception)
|
||||||
|
std::rethrow_exception(job->load_exception);
|
||||||
|
}
|
||||||
|
|
||||||
void AsyncLoader::remove(const LoadJobSet & jobs)
|
void AsyncLoader::remove(const LoadJobSet & jobs)
|
||||||
{
|
{
|
||||||
DENY_ALLOCATIONS_IN_SCOPE;
|
DENY_ALLOCATIONS_IN_SCOPE;
|
||||||
@ -397,9 +404,10 @@ void AsyncLoader::remove(const LoadJobSet & jobs)
|
|||||||
if (auto info = scheduled_jobs.find(job); info != scheduled_jobs.end())
|
if (auto info = scheduled_jobs.find(job); info != scheduled_jobs.end())
|
||||||
{
|
{
|
||||||
// Job is currently executing
|
// Job is currently executing
|
||||||
|
ALLOW_ALLOCATIONS_IN_SCOPE;
|
||||||
chassert(info->second.isExecuting());
|
chassert(info->second.isExecuting());
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
job->waitNoThrow(); // Wait for job to finish
|
wait(job, /* no_throw = */ true); // Wait for job to finish
|
||||||
lock.lock();
|
lock.lock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -415,10 +423,12 @@ void AsyncLoader::remove(const LoadJobSet & jobs)
|
|||||||
|
|
||||||
void AsyncLoader::setMaxThreads(size_t pool, size_t value)
|
void AsyncLoader::setMaxThreads(size_t pool, size_t value)
|
||||||
{
|
{
|
||||||
|
if (value == 0)
|
||||||
|
value = getNumberOfPhysicalCPUCores();
|
||||||
std::unique_lock lock{mutex};
|
std::unique_lock lock{mutex};
|
||||||
auto & p = pools[pool];
|
auto & p = pools[pool];
|
||||||
p.thread_pool->setMaxThreads(value);
|
// Note that underlying `ThreadPool` always has unlimited `queue_size` and `max_threads`.
|
||||||
p.thread_pool->setQueueSize(value); // Keep queue size equal max threads count to avoid blocking during spawning
|
// Worker management is done by `AsyncLoader` based on `Pool::max_threads + Pool::suspended_workers` instead.
|
||||||
p.max_threads = value;
|
p.max_threads = value;
|
||||||
if (!is_running)
|
if (!is_running)
|
||||||
return;
|
return;
|
||||||
@ -442,7 +452,6 @@ Priority AsyncLoader::getPoolPriority(size_t pool) const
|
|||||||
return pools[pool].priority; // NOTE: lock is not needed because `priority` is const and `pools` are immutable
|
return pools[pool].priority; // NOTE: lock is not needed because `priority` is const and `pools` are immutable
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
size_t AsyncLoader::getScheduledJobCount() const
|
size_t AsyncLoader::getScheduledJobCount() const
|
||||||
{
|
{
|
||||||
std::unique_lock lock{mutex};
|
std::unique_lock lock{mutex};
|
||||||
@ -479,11 +488,11 @@ void AsyncLoader::checkCycle(const LoadJobSet & jobs, std::unique_lock<std::mute
|
|||||||
while (!left.empty())
|
while (!left.empty())
|
||||||
{
|
{
|
||||||
LoadJobPtr job = *left.begin();
|
LoadJobPtr job = *left.begin();
|
||||||
checkCycleImpl(job, left, visited, lock);
|
checkCycle(job, left, visited, lock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String AsyncLoader::checkCycleImpl(const LoadJobPtr & job, LoadJobSet & left, LoadJobSet & visited, std::unique_lock<std::mutex> & lock)
|
String AsyncLoader::checkCycle(const LoadJobPtr & job, LoadJobSet & left, LoadJobSet & visited, std::unique_lock<std::mutex> & lock)
|
||||||
{
|
{
|
||||||
if (!left.contains(job))
|
if (!left.contains(job))
|
||||||
return {}; // Do not consider external dependencies and already processed jobs
|
return {}; // Do not consider external dependencies and already processed jobs
|
||||||
@ -494,7 +503,7 @@ String AsyncLoader::checkCycleImpl(const LoadJobPtr & job, LoadJobSet & left, Lo
|
|||||||
}
|
}
|
||||||
for (const auto & dep : job->dependencies)
|
for (const auto & dep : job->dependencies)
|
||||||
{
|
{
|
||||||
if (auto chain = checkCycleImpl(dep, left, visited, lock); !chain.empty())
|
if (auto chain = checkCycle(dep, left, visited, lock); !chain.empty())
|
||||||
{
|
{
|
||||||
if (!visited.contains(job)) // Check for cycle end
|
if (!visited.contains(job)) // Check for cycle end
|
||||||
throw Exception(ErrorCodes::ASYNC_LOAD_CYCLE, "Load job dependency cycle detected: {} -> {}", job->name, chain);
|
throw Exception(ErrorCodes::ASYNC_LOAD_CYCLE, "Load job dependency cycle detected: {} -> {}", job->name, chain);
|
||||||
@ -509,10 +518,11 @@ String AsyncLoader::checkCycleImpl(const LoadJobPtr & job, LoadJobSet & left, Lo
|
|||||||
void AsyncLoader::finish(const LoadJobPtr & job, LoadStatus status, std::exception_ptr exception_from_job, std::unique_lock<std::mutex> & lock)
|
void AsyncLoader::finish(const LoadJobPtr & job, LoadStatus status, std::exception_ptr exception_from_job, std::unique_lock<std::mutex> & lock)
|
||||||
{
|
{
|
||||||
chassert(scheduled_jobs.contains(job)); // Job was pending
|
chassert(scheduled_jobs.contains(job)); // Job was pending
|
||||||
|
size_t resumed_workers = 0; // Number of workers resumed in the execution pool of the job
|
||||||
if (status == LoadStatus::OK)
|
if (status == LoadStatus::OK)
|
||||||
{
|
{
|
||||||
// Notify waiters
|
// Notify waiters
|
||||||
job->ok();
|
resumed_workers += job->ok();
|
||||||
|
|
||||||
// Update dependent jobs and enqueue if ready
|
// Update dependent jobs and enqueue if ready
|
||||||
for (const auto & dep : scheduled_jobs[job].dependent_jobs)
|
for (const auto & dep : scheduled_jobs[job].dependent_jobs)
|
||||||
@ -528,9 +538,9 @@ void AsyncLoader::finish(const LoadJobPtr & job, LoadStatus status, std::excepti
|
|||||||
{
|
{
|
||||||
// Notify waiters
|
// Notify waiters
|
||||||
if (status == LoadStatus::FAILED)
|
if (status == LoadStatus::FAILED)
|
||||||
job->failed(exception_from_job);
|
resumed_workers += job->failed(exception_from_job);
|
||||||
else if (status == LoadStatus::CANCELED)
|
else if (status == LoadStatus::CANCELED)
|
||||||
job->canceled(exception_from_job);
|
resumed_workers += job->canceled(exception_from_job);
|
||||||
|
|
||||||
Info & info = scheduled_jobs[job];
|
Info & info = scheduled_jobs[job];
|
||||||
if (info.isReady())
|
if (info.isReady())
|
||||||
@ -572,35 +582,40 @@ void AsyncLoader::finish(const LoadJobPtr & job, LoadStatus status, std::excepti
|
|||||||
if (log_progress)
|
if (log_progress)
|
||||||
logAboutProgress(log, finished_jobs.size() - old_jobs, finished_jobs.size() + scheduled_jobs.size() - old_jobs, stopwatch);
|
logAboutProgress(log, finished_jobs.size() - old_jobs, finished_jobs.size() + scheduled_jobs.size() - old_jobs, stopwatch);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (resumed_workers)
|
||||||
|
{
|
||||||
|
Pool & pool = pools[job->executionPool()];
|
||||||
|
pool.suspended_workers -= resumed_workers;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AsyncLoader::prioritize(const LoadJobPtr & job, size_t new_pool_id, std::unique_lock<std::mutex> & lock)
|
void AsyncLoader::prioritize(const LoadJobPtr & job, size_t new_pool_id, std::unique_lock<std::mutex> & lock)
|
||||||
{
|
{
|
||||||
|
Pool & old_pool = pools[job->pool_id];
|
||||||
|
Pool & new_pool = pools[new_pool_id];
|
||||||
|
if (old_pool.priority <= new_pool.priority)
|
||||||
|
return; // Never lower priority or change pool leaving the same priority
|
||||||
|
|
||||||
|
// Note that there is no point in prioritizing finished jobs, but because we do not lock `job.mutex` here (due to recursion),
|
||||||
|
// Races are inevitable, so we prioritize all job unconditionally: both finished and pending.
|
||||||
|
|
||||||
if (auto info = scheduled_jobs.find(job); info != scheduled_jobs.end())
|
if (auto info = scheduled_jobs.find(job); info != scheduled_jobs.end())
|
||||||
{
|
{
|
||||||
Pool & old_pool = pools[job->pool_id];
|
|
||||||
Pool & new_pool = pools[new_pool_id];
|
|
||||||
if (old_pool.priority <= new_pool.priority)
|
|
||||||
return; // Never lower priority or change pool leaving the same priority
|
|
||||||
|
|
||||||
// Update priority and push job forward through ready queue if needed
|
|
||||||
UInt64 ready_seqno = info->second.ready_seqno;
|
|
||||||
|
|
||||||
// Requeue job into the new pool queue without allocations
|
// Requeue job into the new pool queue without allocations
|
||||||
if (ready_seqno)
|
if (UInt64 ready_seqno = info->second.ready_seqno)
|
||||||
{
|
{
|
||||||
new_pool.ready_queue.insert(old_pool.ready_queue.extract(ready_seqno));
|
new_pool.ready_queue.insert(old_pool.ready_queue.extract(ready_seqno));
|
||||||
if (canSpawnWorker(new_pool, lock))
|
if (canSpawnWorker(new_pool, lock))
|
||||||
spawn(new_pool, lock);
|
spawn(new_pool, lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set user-facing pool (may affect executing jobs)
|
|
||||||
job->pool_id.store(new_pool_id);
|
|
||||||
|
|
||||||
// Recurse into dependencies
|
|
||||||
for (const auto & dep : job->dependencies)
|
|
||||||
prioritize(dep, new_pool_id, lock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
job->pool_id.store(new_pool_id);
|
||||||
|
|
||||||
|
// Recurse into dependencies
|
||||||
|
for (const auto & dep : job->dependencies)
|
||||||
|
prioritize(dep, new_pool_id, lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AsyncLoader::enqueue(Info & info, const LoadJobPtr & job, std::unique_lock<std::mutex> & lock)
|
void AsyncLoader::enqueue(Info & info, const LoadJobPtr & job, std::unique_lock<std::mutex> & lock)
|
||||||
@ -620,11 +635,102 @@ void AsyncLoader::enqueue(Info & info, const LoadJobPtr & job, std::unique_lock<
|
|||||||
spawn(pool, lock);
|
spawn(pool, lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Keep track of currently executing load jobs to be able to:
|
||||||
|
// 1) Detect "wait dependent" deadlocks -- throw LOGICAL_ERROR
|
||||||
|
// (when job A function waits for job B that depends on job A)
|
||||||
|
// 2) Detect "wait not scheduled" deadlocks -- throw LOGICAL_ERROR
|
||||||
|
// (thread T is waiting on an assigned job A, but job A is not yet scheduled)
|
||||||
|
// 3) Resolve "priority inversion" deadlocks -- apply priority inheritance
|
||||||
|
// (when high-priority job A function waits for a lower-priority job B, and B never starts due to its priority)
|
||||||
|
// 4) Resolve "blocked pool" deadlocks -- spawn more workers
|
||||||
|
// (when job A in pool P waits for another ready job B in P, but B never starts because there are no free workers in P)
|
||||||
|
thread_local LoadJob * current_load_job = nullptr;
|
||||||
|
|
||||||
|
size_t currentPoolOr(size_t pool)
|
||||||
|
{
|
||||||
|
return current_load_job ? current_load_job->executionPool() : pool;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool detectWaitDependentDeadlock(const LoadJobPtr & waited)
|
||||||
|
{
|
||||||
|
if (waited.get() == current_load_job)
|
||||||
|
return true;
|
||||||
|
for (const auto & dep : waited->dependencies)
|
||||||
|
{
|
||||||
|
if (detectWaitDependentDeadlock(dep))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AsyncLoader::wait(std::unique_lock<std::mutex> & job_lock, const LoadJobPtr & job)
|
||||||
|
{
|
||||||
|
// Ensure job we are going to wait was scheduled to avoid "wait not scheduled" deadlocks
|
||||||
|
if (job->job_id == 0)
|
||||||
|
throw Exception(ErrorCodes::LOGICAL_ERROR, "Load job '{}' waits for not scheduled load job '{}'", current_load_job->name, job->name);
|
||||||
|
|
||||||
|
// Deadlock detection and resolution
|
||||||
|
if (current_load_job && job->load_status == LoadStatus::PENDING)
|
||||||
|
{
|
||||||
|
if (detectWaitDependentDeadlock(job))
|
||||||
|
throw Exception(ErrorCodes::LOGICAL_ERROR, "Load job '{}' waits for dependent load job '{}'", current_load_job->name, job->name);
|
||||||
|
|
||||||
|
auto worker_pool = current_load_job->executionPool();
|
||||||
|
auto worker_priority = getPoolPriority(worker_pool);
|
||||||
|
auto job_priority = getPoolPriority(job->pool_id);
|
||||||
|
|
||||||
|
// Waiting for a lower-priority job ("priority inversion" deadlock) is resolved using priority inheritance.
|
||||||
|
if (worker_priority < job_priority)
|
||||||
|
{
|
||||||
|
job_lock.unlock(); // Avoid reverse locking order
|
||||||
|
prioritize(job, worker_pool);
|
||||||
|
job_lock.lock();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Spawn more workers to avoid exhaustion of worker pool ("blocked pool" deadlock)
|
||||||
|
if (worker_pool == job->pool_id)
|
||||||
|
{
|
||||||
|
job_lock.unlock(); // Avoid reverse locking order
|
||||||
|
workerIsSuspendedByWait(worker_pool, job);
|
||||||
|
job_lock.lock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Stopwatch watch;
|
||||||
|
job->waiters++;
|
||||||
|
job->finished.wait(job_lock, [&] { return job->load_status != LoadStatus::PENDING; });
|
||||||
|
job->waiters--;
|
||||||
|
ProfileEvents::increment(ProfileEvents::AsyncLoaderWaitMicroseconds, watch.elapsedMicroseconds());
|
||||||
|
}
|
||||||
|
|
||||||
|
void AsyncLoader::workerIsSuspendedByWait(size_t pool_id, const LoadJobPtr & job)
|
||||||
|
{
|
||||||
|
std::unique_lock lock{mutex};
|
||||||
|
std::unique_lock job_lock{job->mutex};
|
||||||
|
|
||||||
|
if (job->load_status != LoadStatus::PENDING)
|
||||||
|
return; // Job is already done, worker can continue execution
|
||||||
|
|
||||||
|
// To resolve "blocked pool" deadlocks we spawn a new worker for every suspended worker, if required
|
||||||
|
// This can lead to a visible excess of `max_threads` specified for a pool,
|
||||||
|
// but actual number of NOT suspended workers may exceed `max_threads` ONLY in intermittent state.
|
||||||
|
Pool & pool = pools[pool_id];
|
||||||
|
pool.suspended_workers++;
|
||||||
|
job->suspended_waiters++;
|
||||||
|
if (canSpawnWorker(pool, lock))
|
||||||
|
spawn(pool, lock);
|
||||||
|
|
||||||
|
// TODO(serxa): it is a good idea to propagate `job` and all its dependencies in `pool.ready_queue` by introducing
|
||||||
|
// key {suspended_waiters, ready_seqno} instead of plain `ready_seqno`, to force newly spawn workers to work on jobs
|
||||||
|
// that are being waited. But it doesn't affect correctness. So let's not complicate it for time being.
|
||||||
|
}
|
||||||
|
|
||||||
bool AsyncLoader::canSpawnWorker(Pool & pool, std::unique_lock<std::mutex> &)
|
bool AsyncLoader::canSpawnWorker(Pool & pool, std::unique_lock<std::mutex> &)
|
||||||
{
|
{
|
||||||
|
// TODO(serxa): optimization: we should not spawn new worker on the first enqueue during `finish()` because current worker will take this job.
|
||||||
return is_running
|
return is_running
|
||||||
&& !pool.ready_queue.empty()
|
&& !pool.ready_queue.empty()
|
||||||
&& pool.workers < pool.max_threads
|
&& pool.workers < pool.max_threads + pool.suspended_workers
|
||||||
&& (!current_priority || *current_priority >= pool.priority);
|
&& (!current_priority || *current_priority >= pool.priority);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -632,7 +738,7 @@ bool AsyncLoader::canWorkerLive(Pool & pool, std::unique_lock<std::mutex> &)
|
|||||||
{
|
{
|
||||||
return is_running
|
return is_running
|
||||||
&& !pool.ready_queue.empty()
|
&& !pool.ready_queue.empty()
|
||||||
&& pool.workers <= pool.max_threads
|
&& pool.workers <= pool.max_threads + pool.suspended_workers
|
||||||
&& (!current_priority || *current_priority >= pool.priority);
|
&& (!current_priority || *current_priority >= pool.priority);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -705,7 +811,9 @@ void AsyncLoader::worker(Pool & pool)
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
job->execute(pool_id, job);
|
current_load_job = job.get();
|
||||||
|
SCOPE_EXIT({ current_load_job = nullptr; }); // Note that recursive job execution is not supported
|
||||||
|
job->execute(*this, pool_id, job);
|
||||||
exception_from_job = {};
|
exception_from_job = {};
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
|
@ -21,6 +21,16 @@ namespace Poco { class Logger; }
|
|||||||
namespace DB
|
namespace DB
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// TERMINOLOGY:
|
||||||
|
// Job (`LoadJob`) - The smallest part of loading process, executed by worker. Job can depend on the other jobs. Jobs are grouped in tasks.
|
||||||
|
// Task (`LoadTask`) - Owning holder of a set of jobs. Should be held during the whole job lifetime. Cancels all jobs on destruction.
|
||||||
|
// Goal jobs (goals) - a subset of "final" jobs of a task (usually no job in task depend on a goal job).
|
||||||
|
// By default all jobs in task are included in goal jobs.
|
||||||
|
// Goals should used if you need to create a job that depends on a task (to avoid placing all jobs of the task in dependencies).
|
||||||
|
// Pool (worker pool) - A set of workers with specific priority. Every job is assigned to a pool. Job can change its pool dynamically.
|
||||||
|
// Priority (pool priority) - Constant integer value showing relative priority of a pool. Lower value means higher priority.
|
||||||
|
// AsyncLoader - scheduling system responsible for job dependency tracking and worker management respecting pool priorities.
|
||||||
|
|
||||||
class LoadJob;
|
class LoadJob;
|
||||||
using LoadJobPtr = std::shared_ptr<LoadJob>;
|
using LoadJobPtr = std::shared_ptr<LoadJob>;
|
||||||
using LoadJobSet = std::unordered_set<LoadJobPtr>;
|
using LoadJobSet = std::unordered_set<LoadJobPtr>;
|
||||||
@ -43,6 +53,7 @@ enum class LoadStatus
|
|||||||
// Smallest indivisible part of a loading process. Load job can have multiple dependencies, thus jobs constitute a direct acyclic graph (DAG).
|
// Smallest indivisible part of a loading process. Load job can have multiple dependencies, thus jobs constitute a direct acyclic graph (DAG).
|
||||||
// Job encapsulates a function to be executed by `AsyncLoader` as soon as job functions of all dependencies are successfully executed.
|
// Job encapsulates a function to be executed by `AsyncLoader` as soon as job functions of all dependencies are successfully executed.
|
||||||
// Job can be waited for by an arbitrary number of threads. See `AsyncLoader` class description for more details.
|
// Job can be waited for by an arbitrary number of threads. See `AsyncLoader` class description for more details.
|
||||||
|
// WARNING: jobs are usually held with ownership by tasks (see `LoadTask`). You are encouraged to add jobs into a tasks as soon as the are created.
|
||||||
class LoadJob : private boost::noncopyable
|
class LoadJob : private boost::noncopyable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -50,6 +61,7 @@ public:
|
|||||||
LoadJob(LoadJobSetType && dependencies_, String name_, size_t pool_id_, Func && func_)
|
LoadJob(LoadJobSetType && dependencies_, String name_, size_t pool_id_, Func && func_)
|
||||||
: dependencies(std::forward<LoadJobSetType>(dependencies_))
|
: dependencies(std::forward<LoadJobSetType>(dependencies_))
|
||||||
, name(std::move(name_))
|
, name(std::move(name_))
|
||||||
|
, execution_pool_id(pool_id_)
|
||||||
, pool_id(pool_id_)
|
, pool_id(pool_id_)
|
||||||
, func(std::forward<Func>(func_))
|
, func(std::forward<Func>(func_))
|
||||||
{}
|
{}
|
||||||
@ -67,18 +79,12 @@ public:
|
|||||||
// Value may change during job execution by `prioritize()`.
|
// Value may change during job execution by `prioritize()`.
|
||||||
size_t pool() const;
|
size_t pool() const;
|
||||||
|
|
||||||
// Sync wait for a pending job to be finished: OK, FAILED or CANCELED status.
|
// Returns number of threads blocked by `wait()` calls.
|
||||||
// Throws if job is FAILED or CANCELED. Returns or throws immediately if called on non-pending job.
|
|
||||||
void wait() const;
|
|
||||||
|
|
||||||
// Wait for a job to reach any non PENDING status.
|
|
||||||
void waitNoThrow() const noexcept;
|
|
||||||
|
|
||||||
// Returns number of threads blocked by `wait()` or `waitNoThrow()` calls.
|
|
||||||
size_t waitersCount() const;
|
size_t waitersCount() const;
|
||||||
|
|
||||||
// Introspection
|
// Introspection
|
||||||
using TimePoint = std::chrono::system_clock::time_point;
|
using TimePoint = std::chrono::system_clock::time_point;
|
||||||
|
UInt64 jobId() const { return job_id; }
|
||||||
TimePoint scheduleTime() const { return schedule_time; }
|
TimePoint scheduleTime() const { return schedule_time; }
|
||||||
TimePoint enqueueTime() const { return enqueue_time; }
|
TimePoint enqueueTime() const { return enqueue_time; }
|
||||||
TimePoint startTime() const { return start_time; }
|
TimePoint startTime() const { return start_time; }
|
||||||
@ -90,22 +96,24 @@ public:
|
|||||||
private:
|
private:
|
||||||
friend class AsyncLoader;
|
friend class AsyncLoader;
|
||||||
|
|
||||||
void ok();
|
[[nodiscard]] size_t ok();
|
||||||
void failed(const std::exception_ptr & ptr);
|
[[nodiscard]] size_t failed(const std::exception_ptr & ptr);
|
||||||
void canceled(const std::exception_ptr & ptr);
|
[[nodiscard]] size_t canceled(const std::exception_ptr & ptr);
|
||||||
void finish();
|
[[nodiscard]] size_t finish();
|
||||||
|
|
||||||
void scheduled();
|
void scheduled(UInt64 job_id_);
|
||||||
void enqueued();
|
void enqueued();
|
||||||
void execute(size_t pool, const LoadJobPtr & self);
|
void execute(AsyncLoader & loader, size_t pool, const LoadJobPtr & self);
|
||||||
|
|
||||||
|
std::atomic<UInt64> job_id{0};
|
||||||
std::atomic<size_t> execution_pool_id;
|
std::atomic<size_t> execution_pool_id;
|
||||||
std::atomic<size_t> pool_id;
|
std::atomic<size_t> pool_id;
|
||||||
std::function<void(const LoadJobPtr & self)> func;
|
std::function<void(AsyncLoader & loader, const LoadJobPtr & self)> func;
|
||||||
|
|
||||||
mutable std::mutex mutex;
|
mutable std::mutex mutex;
|
||||||
mutable std::condition_variable finished;
|
mutable std::condition_variable finished;
|
||||||
mutable size_t waiters = 0;
|
mutable size_t waiters = 0; // All waiters, including suspended
|
||||||
|
mutable size_t suspended_waiters = 0;
|
||||||
LoadStatus load_status{LoadStatus::PENDING};
|
LoadStatus load_status{LoadStatus::PENDING};
|
||||||
std::exception_ptr load_exception;
|
std::exception_ptr load_exception;
|
||||||
|
|
||||||
@ -117,7 +125,7 @@ private:
|
|||||||
|
|
||||||
struct EmptyJobFunc
|
struct EmptyJobFunc
|
||||||
{
|
{
|
||||||
void operator()(const LoadJobPtr &) {}
|
void operator()(AsyncLoader &, const LoadJobPtr &) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class Func = EmptyJobFunc>
|
template <class Func = EmptyJobFunc>
|
||||||
@ -144,6 +152,7 @@ LoadJobPtr makeLoadJob(const LoadJobSet & dependencies, size_t pool_id, String n
|
|||||||
return std::make_shared<LoadJob>(dependencies, std::move(name), pool_id, std::forward<Func>(func));
|
return std::make_shared<LoadJob>(dependencies, std::move(name), pool_id, std::forward<Func>(func));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Represents a logically connected set of LoadJobs required to achieve some goals (final LoadJob in the set).
|
// Represents a logically connected set of LoadJobs required to achieve some goals (final LoadJob in the set).
|
||||||
class LoadTask : private boost::noncopyable
|
class LoadTask : private boost::noncopyable
|
||||||
{
|
{
|
||||||
@ -168,10 +177,11 @@ public:
|
|||||||
// auto load_task = loadSomethingAsync(async_loader, load_after_task.goals(), something);
|
// auto load_task = loadSomethingAsync(async_loader, load_after_task.goals(), something);
|
||||||
const LoadJobSet & goals() const { return goal_jobs.empty() ? jobs : goal_jobs; }
|
const LoadJobSet & goals() const { return goal_jobs.empty() ? jobs : goal_jobs; }
|
||||||
|
|
||||||
|
AsyncLoader & loader;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class AsyncLoader;
|
friend class AsyncLoader;
|
||||||
|
|
||||||
AsyncLoader & loader;
|
|
||||||
LoadJobSet jobs;
|
LoadJobSet jobs;
|
||||||
LoadJobSet goal_jobs;
|
LoadJobSet goal_jobs;
|
||||||
};
|
};
|
||||||
@ -181,91 +191,6 @@ inline LoadTaskPtr makeLoadTask(AsyncLoader & loader, LoadJobSet && jobs, LoadJo
|
|||||||
return std::make_shared<LoadTask>(loader, std::move(jobs), std::move(goals));
|
return std::make_shared<LoadTask>(loader, std::move(jobs), std::move(goals));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void scheduleLoad(const LoadTaskPtr & task)
|
|
||||||
{
|
|
||||||
task->schedule();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void scheduleLoad(const LoadTaskPtrs & tasks)
|
|
||||||
{
|
|
||||||
for (const auto & task : tasks)
|
|
||||||
task->schedule();
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class... Args>
|
|
||||||
inline void scheduleLoadAll(Args && ... args)
|
|
||||||
{
|
|
||||||
(scheduleLoad(std::forward<Args>(args)), ...);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void waitLoad(const LoadJobSet & jobs)
|
|
||||||
{
|
|
||||||
for (const auto & job : jobs)
|
|
||||||
job->wait();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void waitLoad(const LoadTaskPtr & task)
|
|
||||||
{
|
|
||||||
waitLoad(task->goals());
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void waitLoad(const LoadTaskPtrs & tasks)
|
|
||||||
{
|
|
||||||
for (const auto & task : tasks)
|
|
||||||
waitLoad(task->goals());
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class... Args>
|
|
||||||
inline void waitLoadAll(Args && ... args)
|
|
||||||
{
|
|
||||||
(waitLoad(std::forward<Args>(args)), ...);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class... Args>
|
|
||||||
inline void scheduleAndWaitLoadAll(Args && ... args)
|
|
||||||
{
|
|
||||||
scheduleLoadAll(std::forward<Args>(args)...);
|
|
||||||
waitLoadAll(std::forward<Args>(args)...);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline LoadJobSet getGoals(const LoadTaskPtrs & tasks)
|
|
||||||
{
|
|
||||||
LoadJobSet result;
|
|
||||||
for (const auto & task : tasks)
|
|
||||||
result.insert(task->goals().begin(), task->goals().end());
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline LoadJobSet getGoalsOr(const LoadTaskPtrs & tasks, const LoadJobSet & alternative)
|
|
||||||
{
|
|
||||||
LoadJobSet result;
|
|
||||||
for (const auto & task : tasks)
|
|
||||||
result.insert(task->goals().begin(), task->goals().end());
|
|
||||||
return result.empty() ? alternative : result;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline LoadJobSet joinJobs(const LoadJobSet & jobs1, const LoadJobSet & jobs2)
|
|
||||||
{
|
|
||||||
LoadJobSet result;
|
|
||||||
if (!jobs1.empty())
|
|
||||||
result.insert(jobs1.begin(), jobs1.end());
|
|
||||||
if (!jobs2.empty())
|
|
||||||
result.insert(jobs2.begin(), jobs2.end());
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline LoadTaskPtrs joinTasks(const LoadTaskPtrs & tasks1, const LoadTaskPtrs & tasks2)
|
|
||||||
{
|
|
||||||
if (tasks1.empty())
|
|
||||||
return tasks2;
|
|
||||||
if (tasks2.empty())
|
|
||||||
return tasks1;
|
|
||||||
LoadTaskPtrs result;
|
|
||||||
result.reserve(tasks1.size() + tasks2.size());
|
|
||||||
result.insert(result.end(), tasks1.begin(), tasks1.end());
|
|
||||||
result.insert(result.end(), tasks2.begin(), tasks2.end());
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
// `AsyncLoader` is a scheduler for DAG of `LoadJob`s. It tracks job dependencies and priorities.
|
// `AsyncLoader` is a scheduler for DAG of `LoadJob`s. It tracks job dependencies and priorities.
|
||||||
// Basic usage example:
|
// Basic usage example:
|
||||||
@ -277,8 +202,8 @@ inline LoadTaskPtrs joinTasks(const LoadTaskPtrs & tasks1, const LoadTaskPtrs &
|
|||||||
//
|
//
|
||||||
// // Create and schedule a task consisting of three jobs. Job1 has no dependencies and is run first.
|
// // Create and schedule a task consisting of three jobs. Job1 has no dependencies and is run first.
|
||||||
// // Job2 and job3 depend on job1 and are run only after job1 completion.
|
// // Job2 and job3 depend on job1 and are run only after job1 completion.
|
||||||
// auto job_func = [&] (const LoadJobPtr & self) {
|
// auto job_func = [&] (AsyncLoader & loader, const LoadJobPtr & self) {
|
||||||
// LOG_TRACE(log, "Executing load job '{}' in pool '{}'", self->name, async_loader->getPoolName(self->pool()));
|
// LOG_TRACE(log, "Executing load job '{}' in pool '{}'", self->name, loader->getPoolName(self->pool()));
|
||||||
// };
|
// };
|
||||||
// auto job1 = makeLoadJob({}, "job1", /* pool_id = */ 1, job_func);
|
// auto job1 = makeLoadJob({}, "job1", /* pool_id = */ 1, job_func);
|
||||||
// auto job2 = makeLoadJob({ job1 }, "job2", /* pool_id = */ 1, job_func);
|
// auto job2 = makeLoadJob({ job1 }, "job2", /* pool_id = */ 1, job_func);
|
||||||
@ -287,8 +212,8 @@ inline LoadTaskPtrs joinTasks(const LoadTaskPtrs & tasks1, const LoadTaskPtrs &
|
|||||||
// task.schedule();
|
// task.schedule();
|
||||||
//
|
//
|
||||||
// // Another thread may prioritize a job by changing its pool and wait for it:
|
// // Another thread may prioritize a job by changing its pool and wait for it:
|
||||||
// async_loader->prioritize(job3, /* pool_id = */ 0); // Increase priority: 1 -> 0 (lower is better)
|
// async_loader.prioritize(job3, /* pool_id = */ 0); // Increase priority: 1 -> 0 (lower is better)
|
||||||
// job3->wait(); // Blocks until job completion or cancellation and rethrow an exception (if any)
|
// async_loader.wait(job3); // Blocks until job completion or cancellation and rethrow an exception (if any)
|
||||||
//
|
//
|
||||||
// Every job has a pool associated with it. AsyncLoader starts every job in its thread pool.
|
// Every job has a pool associated with it. AsyncLoader starts every job in its thread pool.
|
||||||
// Each pool has a constant priority and a mutable maximum number of threads.
|
// Each pool has a constant priority and a mutable maximum number of threads.
|
||||||
@ -341,7 +266,8 @@ private:
|
|||||||
std::unique_ptr<ThreadPool> thread_pool; // NOTE: we avoid using a `ThreadPool` queue to be able to move jobs between pools.
|
std::unique_ptr<ThreadPool> thread_pool; // NOTE: we avoid using a `ThreadPool` queue to be able to move jobs between pools.
|
||||||
std::map<UInt64, LoadJobPtr> ready_queue; // FIFO queue of jobs to be executed in this pool. Map is used for faster erasing. Key is `ready_seqno`
|
std::map<UInt64, LoadJobPtr> ready_queue; // FIFO queue of jobs to be executed in this pool. Map is used for faster erasing. Key is `ready_seqno`
|
||||||
size_t max_threads; // Max number of workers to be spawn
|
size_t max_threads; // Max number of workers to be spawn
|
||||||
size_t workers = 0; // Number of currently execution workers
|
size_t workers = 0; // Number of currently executing workers
|
||||||
|
size_t suspended_workers = 0; // Number of workers that are blocked by `wait()` call on a job executing in the same pool (for deadlock resolution)
|
||||||
|
|
||||||
bool isActive() const { return workers > 0 || !ready_queue.empty(); }
|
bool isActive() const { return workers > 0 || !ready_queue.empty(); }
|
||||||
};
|
};
|
||||||
@ -369,7 +295,7 @@ public:
|
|||||||
Metric metric_threads;
|
Metric metric_threads;
|
||||||
Metric metric_active_threads;
|
Metric metric_active_threads;
|
||||||
Metric metric_scheduled_threads;
|
Metric metric_scheduled_threads;
|
||||||
size_t max_threads;
|
size_t max_threads; // Zero means use all CPU cores
|
||||||
Priority priority;
|
Priority priority;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -399,6 +325,7 @@ public:
|
|||||||
// and are removed from AsyncLoader, so it is thread-safe to destroy them.
|
// and are removed from AsyncLoader, so it is thread-safe to destroy them.
|
||||||
void schedule(LoadTask & task);
|
void schedule(LoadTask & task);
|
||||||
void schedule(const LoadTaskPtr & task);
|
void schedule(const LoadTaskPtr & task);
|
||||||
|
void schedule(const LoadJobSet & jobs_to_schedule);
|
||||||
|
|
||||||
// Schedule all tasks atomically. To ensure only highest priority jobs among all tasks are run first.
|
// Schedule all tasks atomically. To ensure only highest priority jobs among all tasks are run first.
|
||||||
void schedule(const LoadTaskPtrs & tasks);
|
void schedule(const LoadTaskPtrs & tasks);
|
||||||
@ -407,6 +334,11 @@ public:
|
|||||||
// Jobs from higher (than `new_pool`) priority pools are not changed.
|
// Jobs from higher (than `new_pool`) priority pools are not changed.
|
||||||
void prioritize(const LoadJobPtr & job, size_t new_pool);
|
void prioritize(const LoadJobPtr & job, size_t new_pool);
|
||||||
|
|
||||||
|
// Sync wait for a pending job to be finished: OK, FAILED or CANCELED status.
|
||||||
|
// Throws if job is FAILED or CANCELED unless `no_throw` is set. Returns or throws immediately if called on non-pending job.
|
||||||
|
// If job was not scheduled, it will be implicitly scheduled before the wait (deadlock auto-resolution).
|
||||||
|
void wait(const LoadJobPtr & job, bool no_throw = false);
|
||||||
|
|
||||||
// Remove finished jobs, cancel scheduled jobs, wait for executing jobs to finish and remove them.
|
// Remove finished jobs, cancel scheduled jobs, wait for executing jobs to finish and remove them.
|
||||||
void remove(const LoadJobSet & jobs);
|
void remove(const LoadJobSet & jobs);
|
||||||
|
|
||||||
@ -430,23 +362,26 @@ public:
|
|||||||
bool is_executing = false;
|
bool is_executing = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
// For introspection and debug only, see `system.async_loader` table
|
// For introspection and debug only, see `system.async_loader` table.
|
||||||
std::vector<JobState> getJobStates() const;
|
std::vector<JobState> getJobStates() const;
|
||||||
|
|
||||||
|
// For deadlock resolution. Should not be used directly.
|
||||||
|
void workerIsSuspendedByWait(size_t pool_id, const LoadJobPtr & job);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void checkCycle(const LoadJobSet & jobs, std::unique_lock<std::mutex> & lock);
|
void checkCycle(const LoadJobSet & jobs, std::unique_lock<std::mutex> & lock);
|
||||||
String checkCycleImpl(const LoadJobPtr & job, LoadJobSet & left, LoadJobSet & visited, std::unique_lock<std::mutex> & lock);
|
String checkCycle(const LoadJobPtr & job, LoadJobSet & left, LoadJobSet & visited, std::unique_lock<std::mutex> & lock);
|
||||||
void finish(const LoadJobPtr & job, LoadStatus status, std::exception_ptr exception_from_job, std::unique_lock<std::mutex> & lock);
|
void finish(const LoadJobPtr & job, LoadStatus status, std::exception_ptr exception_from_job, std::unique_lock<std::mutex> & lock);
|
||||||
void scheduleImpl(const LoadJobSet & input_jobs);
|
|
||||||
void gatherNotScheduled(const LoadJobPtr & job, LoadJobSet & jobs, std::unique_lock<std::mutex> & lock);
|
void gatherNotScheduled(const LoadJobPtr & job, LoadJobSet & jobs, std::unique_lock<std::mutex> & lock);
|
||||||
void prioritize(const LoadJobPtr & job, size_t new_pool_id, std::unique_lock<std::mutex> & lock);
|
void prioritize(const LoadJobPtr & job, size_t new_pool_id, std::unique_lock<std::mutex> & lock);
|
||||||
void enqueue(Info & info, const LoadJobPtr & job, std::unique_lock<std::mutex> & lock);
|
void enqueue(Info & info, const LoadJobPtr & job, std::unique_lock<std::mutex> & lock);
|
||||||
bool canSpawnWorker(Pool & pool, std::unique_lock<std::mutex> &);
|
void wait(std::unique_lock<std::mutex> & job_lock, const LoadJobPtr & job);
|
||||||
bool canWorkerLive(Pool & pool, std::unique_lock<std::mutex> &);
|
bool canSpawnWorker(Pool & pool, std::unique_lock<std::mutex> & lock);
|
||||||
void updateCurrentPriorityAndSpawn(std::unique_lock<std::mutex> &);
|
bool canWorkerLive(Pool & pool, std::unique_lock<std::mutex> & lock);
|
||||||
void spawn(Pool & pool, std::unique_lock<std::mutex> &);
|
void updateCurrentPriorityAndSpawn(std::unique_lock<std::mutex> & lock);
|
||||||
|
void spawn(Pool & pool, std::unique_lock<std::mutex> & lock);
|
||||||
void worker(Pool & pool);
|
void worker(Pool & pool);
|
||||||
bool hasWorker(std::unique_lock<std::mutex> &) const;
|
bool hasWorker(std::unique_lock<std::mutex> & lock) const;
|
||||||
|
|
||||||
// Logging
|
// Logging
|
||||||
const bool log_failures; // Worker should log all exceptions caught from job functions.
|
const bool log_failures; // Worker should log all exceptions caught from job functions.
|
||||||
@ -457,6 +392,7 @@ private:
|
|||||||
bool is_running = true;
|
bool is_running = true;
|
||||||
std::optional<Priority> current_priority; // highest priority among active pools
|
std::optional<Priority> current_priority; // highest priority among active pools
|
||||||
UInt64 last_ready_seqno = 0; // Increasing counter for ready queue keys.
|
UInt64 last_ready_seqno = 0; // Increasing counter for ready queue keys.
|
||||||
|
UInt64 last_job_id = 0; // Increasing counter for job IDs
|
||||||
std::unordered_map<LoadJobPtr, Info> scheduled_jobs; // Full set of scheduled pending jobs along with scheduling info.
|
std::unordered_map<LoadJobPtr, Info> scheduled_jobs; // Full set of scheduled pending jobs along with scheduling info.
|
||||||
std::vector<Pool> pools; // Thread pools for job execution and ready queues
|
std::vector<Pool> pools; // Thread pools for job execution and ready queues
|
||||||
LoadJobSet finished_jobs; // Set of finished jobs (for introspection only, until jobs are removed).
|
LoadJobSet finished_jobs; // Set of finished jobs (for introspection only, until jobs are removed).
|
||||||
@ -465,4 +401,136 @@ private:
|
|||||||
std::chrono::system_clock::time_point busy_period_start_time;
|
std::chrono::system_clock::time_point busy_period_start_time;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// === HELPER FUNCTIONS ===
|
||||||
|
// There are three types of helper functions:
|
||||||
|
// schedulerLoad([loader], {jobs|task|tasks}):
|
||||||
|
// Just schedule jobs for async loading.
|
||||||
|
// Note that normally function `doSomethingAsync()` returns you a task which is NOT scheduled.
|
||||||
|
// This is done to allow you:
|
||||||
|
// (1) construct complex dependency graph offline.
|
||||||
|
// (2) schedule tasks simultaneously to respect their relative priorities.
|
||||||
|
// (3) do prioritization independently, before scheduling.
|
||||||
|
// prioritizeLoad([loader], pool_id, {jobs|task|tasks}):
|
||||||
|
// Prioritize jobs w/o waiting for it.
|
||||||
|
// Note that prioritization may be done
|
||||||
|
// (1) before scheduling (to ensure all jobs are started in the correct pools)
|
||||||
|
// (2) after scheduling (for dynamic prioritization, e.g. when new query arrives)
|
||||||
|
// waitLoad([loader], pool_id, {jobs|task|tasks}, [no_throw]):
|
||||||
|
// Prioritize and wait for jobs.
|
||||||
|
// Note that to avoid deadlocks it implicitly schedules all the jobs before waiting for them.
|
||||||
|
// Also to avoid priority inversion you should never wait for a job that has lower priority.
|
||||||
|
// So it prioritizes all jobs, then schedules all jobs and waits every job.
|
||||||
|
// IMPORTANT: Any load error will be rethrown, unless `no_throw` is set.
|
||||||
|
// Common usage pattern is:
|
||||||
|
// waitLoad(currentPoolOr(foreground_pool_id), tasks);
|
||||||
|
|
||||||
|
// Returns current execution pool if it is called from load job, or `pool` otherwise
|
||||||
|
// It should be used for waiting other load jobs in places that can be executed from load jobs
|
||||||
|
size_t currentPoolOr(size_t pool);
|
||||||
|
|
||||||
|
inline void scheduleLoad(AsyncLoader & loader, const LoadJobSet & jobs)
|
||||||
|
{
|
||||||
|
loader.schedule(jobs);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void scheduleLoad(const LoadTaskPtr & task)
|
||||||
|
{
|
||||||
|
task->schedule();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void scheduleLoad(const LoadTaskPtrs & tasks)
|
||||||
|
{
|
||||||
|
if (tasks.empty())
|
||||||
|
return;
|
||||||
|
// NOTE: it is assumed that all tasks use the same `AsyncLoader`
|
||||||
|
AsyncLoader & loader = tasks.front()->loader;
|
||||||
|
loader.schedule(tasks);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void waitLoad(AsyncLoader & loader, const LoadJobSet & jobs, bool no_throw = false)
|
||||||
|
{
|
||||||
|
scheduleLoad(loader, jobs);
|
||||||
|
for (const auto & job : jobs)
|
||||||
|
loader.wait(job, no_throw);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void waitLoad(const LoadTaskPtr & task, bool no_throw = false)
|
||||||
|
{
|
||||||
|
scheduleLoad(task);
|
||||||
|
waitLoad(task->loader, task->goals(), no_throw);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void waitLoad(const LoadTaskPtrs & tasks, bool no_throw = false)
|
||||||
|
{
|
||||||
|
scheduleLoad(tasks);
|
||||||
|
for (const auto & task : tasks)
|
||||||
|
waitLoad(task->loader, task->goals(), no_throw);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void prioritizeLoad(AsyncLoader & loader, size_t pool_id, const LoadJobSet & jobs)
|
||||||
|
{
|
||||||
|
for (const auto & job : jobs)
|
||||||
|
loader.prioritize(job, pool_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void prioritizeLoad(size_t pool_id, const LoadTaskPtr & task)
|
||||||
|
{
|
||||||
|
prioritizeLoad(task->loader, pool_id, task->goals());
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void prioritizeLoad(size_t pool_id, const LoadTaskPtrs & tasks)
|
||||||
|
{
|
||||||
|
for (const auto & task : tasks)
|
||||||
|
prioritizeLoad(task->loader, pool_id, task->goals());
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void waitLoad(AsyncLoader & loader, size_t pool_id, const LoadJobSet & jobs, bool no_throw = false)
|
||||||
|
{
|
||||||
|
prioritizeLoad(loader, pool_id, jobs);
|
||||||
|
waitLoad(loader, jobs, no_throw);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void waitLoad(size_t pool_id, const LoadTaskPtr & task, bool no_throw = false)
|
||||||
|
{
|
||||||
|
prioritizeLoad(task->loader, pool_id, task->goals());
|
||||||
|
waitLoad(task->loader, task->goals(), no_throw);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void waitLoad(size_t pool_id, const LoadTaskPtrs & tasks, bool no_throw = false)
|
||||||
|
{
|
||||||
|
prioritizeLoad(pool_id, tasks);
|
||||||
|
waitLoad(tasks, no_throw);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline LoadJobSet getGoals(const LoadTaskPtrs & tasks, const LoadJobSet & alternative = {})
|
||||||
|
{
|
||||||
|
LoadJobSet result;
|
||||||
|
for (const auto & task : tasks)
|
||||||
|
result.insert(task->goals().begin(), task->goals().end());
|
||||||
|
return result.empty() ? alternative : result;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline LoadJobSet joinJobs(const LoadJobSet & jobs1, const LoadJobSet & jobs2)
|
||||||
|
{
|
||||||
|
LoadJobSet result;
|
||||||
|
if (!jobs1.empty())
|
||||||
|
result.insert(jobs1.begin(), jobs1.end());
|
||||||
|
if (!jobs2.empty())
|
||||||
|
result.insert(jobs2.begin(), jobs2.end());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline LoadTaskPtrs joinTasks(const LoadTaskPtrs & tasks1, const LoadTaskPtrs & tasks2)
|
||||||
|
{
|
||||||
|
if (tasks1.empty())
|
||||||
|
return tasks2;
|
||||||
|
if (tasks2.empty())
|
||||||
|
return tasks1;
|
||||||
|
LoadTaskPtrs result;
|
||||||
|
result.reserve(tasks1.size() + tasks2.size());
|
||||||
|
result.insert(result.end(), tasks1.begin(), tasks1.end());
|
||||||
|
result.insert(result.end(), tasks2.begin(), tasks2.end());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -110,12 +110,12 @@
|
|||||||
M(StorageHiveThreads, "Number of threads in the StorageHive thread pool.") \
|
M(StorageHiveThreads, "Number of threads in the StorageHive thread pool.") \
|
||||||
M(StorageHiveThreadsActive, "Number of threads in the StorageHive thread pool running a task.") \
|
M(StorageHiveThreadsActive, "Number of threads in the StorageHive thread pool running a task.") \
|
||||||
M(StorageHiveThreadsScheduled, "Number of queued or active jobs in the StorageHive thread pool.") \
|
M(StorageHiveThreadsScheduled, "Number of queued or active jobs in the StorageHive thread pool.") \
|
||||||
M(TablesLoaderThreads, "Number of threads in the tables loader thread pool.") \
|
M(TablesLoaderBackgroundThreads, "Number of threads in the tables loader background thread pool.") \
|
||||||
M(TablesLoaderThreadsActive, "Number of threads in the tables loader thread pool running a task.") \
|
M(TablesLoaderBackgroundThreadsActive, "Number of threads in the tables loader background thread pool running a task.") \
|
||||||
M(TablesLoaderThreadsScheduled, "Number of queued or active jobs in the tables loader thread pool.") \
|
M(TablesLoaderBackgroundThreadsScheduled, "Number of queued or active jobs in the tables loader background thread pool.") \
|
||||||
M(DatabaseOrdinaryThreads, "Number of threads in the Ordinary database thread pool.") \
|
M(TablesLoaderForegroundThreads, "Number of threads in the tables loader foreground thread pool.") \
|
||||||
M(DatabaseOrdinaryThreadsActive, "Number of threads in the Ordinary database thread pool running a task.") \
|
M(TablesLoaderForegroundThreadsActive, "Number of threads in the tables loader foreground thread pool running a task.") \
|
||||||
M(DatabaseOrdinaryThreadsScheduled, "Number of queued or active jobs in the Ordinary database thread pool.") \
|
M(TablesLoaderForegroundThreadsScheduled, "Number of queued or active jobs in the tables loader foreground thread pool.") \
|
||||||
M(DatabaseOnDiskThreads, "Number of threads in the DatabaseOnDisk thread pool.") \
|
M(DatabaseOnDiskThreads, "Number of threads in the DatabaseOnDisk thread pool.") \
|
||||||
M(DatabaseOnDiskThreadsActive, "Number of threads in the DatabaseOnDisk thread pool running a task.") \
|
M(DatabaseOnDiskThreadsActive, "Number of threads in the DatabaseOnDisk thread pool running a task.") \
|
||||||
M(DatabaseOnDiskThreadsScheduled, "Number of queued or active jobs in the DatabaseOnDisk thread pool.") \
|
M(DatabaseOnDiskThreadsScheduled, "Number of queued or active jobs in the DatabaseOnDisk thread pool.") \
|
||||||
|
32
src/Common/PoolId.h
Normal file
32
src/Common/PoolId.h
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <Common/Priority.h>
|
||||||
|
|
||||||
|
namespace DB
|
||||||
|
{
|
||||||
|
|
||||||
|
/// Indices and priorities of `AsyncLoader` pools.
|
||||||
|
|
||||||
|
/// The most important difference from regular ThreadPools is priorities of pools:
|
||||||
|
/// * Pools that have different priorities do NOT run jobs simultaneously (with small exception due to dynamic prioritization).
|
||||||
|
/// * Pools with lower priority wait for all jobs in higher priority pools to be done.
|
||||||
|
|
||||||
|
/// Note that pools also have different configurable sizes not listed here. See `Context::getAsyncLoader()` for details.
|
||||||
|
|
||||||
|
/// WARNING: `*PoolId` values must be unique and sequential w/o gaps.
|
||||||
|
|
||||||
|
/// Used for executing load jobs that are waited for by queries or in case of synchronous table loading.
|
||||||
|
constexpr size_t TablesLoaderForegroundPoolId = 0;
|
||||||
|
constexpr Priority TablesLoaderForegroundPriority{0};
|
||||||
|
|
||||||
|
/// Has lower priority and is used by table load jobs.
|
||||||
|
constexpr size_t TablesLoaderBackgroundLoadPoolId = 1;
|
||||||
|
constexpr Priority TablesLoaderBackgroundLoadPriority{1};
|
||||||
|
|
||||||
|
/// Has even lower priority and is used by startup jobs.
|
||||||
|
/// NOTE: This pool is required to begin table startup only after all tables are loaded.
|
||||||
|
/// NOTE: Which is needed to prevent heavy merges/mutations from consuming all the resources, slowing table loading down.
|
||||||
|
constexpr size_t TablesLoaderBackgroundStartupPoolId = 2;
|
||||||
|
constexpr Priority TablesLoaderBackgroundStartupPriority{2};
|
||||||
|
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <time.h>
|
#include <ctime>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <climits>
|
#include <climits>
|
||||||
#include <random>
|
#include <random>
|
||||||
@ -180,6 +180,7 @@ PoolWithFailoverBase<TNestedPool>::getShuffledPools(
|
|||||||
shuffled_pools.reserve(nested_pools.size());
|
shuffled_pools.reserve(nested_pools.size());
|
||||||
for (size_t i = 0; i < nested_pools.size(); ++i)
|
for (size_t i = 0; i < nested_pools.size(); ++i)
|
||||||
shuffled_pools.push_back(ShuffledPool{nested_pools[i].get(), &pool_states[i], i, /* error_count = */ 0, /* slowdown_count = */ 0});
|
shuffled_pools.push_back(ShuffledPool{nested_pools[i].get(), &pool_states[i], i, /* error_count = */ 0, /* slowdown_count = */ 0});
|
||||||
|
|
||||||
::sort(
|
::sort(
|
||||||
shuffled_pools.begin(), shuffled_pools.end(),
|
shuffled_pools.begin(), shuffled_pools.end(),
|
||||||
[](const ShuffledPool & lhs, const ShuffledPool & rhs)
|
[](const ShuffledPool & lhs, const ShuffledPool & rhs)
|
||||||
|
@ -574,6 +574,8 @@ The server successfully detected this situation and will download merged part fr
|
|||||||
\
|
\
|
||||||
M(ConnectionPoolIsFullMicroseconds, "Total time spent waiting for a slot in connection pool.") \
|
M(ConnectionPoolIsFullMicroseconds, "Total time spent waiting for a slot in connection pool.") \
|
||||||
\
|
\
|
||||||
|
M(AsyncLoaderWaitMicroseconds, "Total time a query was waiting for async loader jobs.") \
|
||||||
|
\
|
||||||
M(LogTest, "Number of log messages with level Test") \
|
M(LogTest, "Number of log messages with level Test") \
|
||||||
M(LogTrace, "Number of log messages with level Trace") \
|
M(LogTrace, "Number of log messages with level Trace") \
|
||||||
M(LogDebug, "Number of log messages with level Debug") \
|
M(LogDebug, "Number of log messages with level Debug") \
|
||||||
|
@ -62,7 +62,6 @@
|
|||||||
#cmakedefine01 FIU_ENABLE
|
#cmakedefine01 FIU_ENABLE
|
||||||
#cmakedefine01 USE_BCRYPT
|
#cmakedefine01 USE_BCRYPT
|
||||||
#cmakedefine01 USE_LIBARCHIVE
|
#cmakedefine01 USE_LIBARCHIVE
|
||||||
#cmakedefine01 USE_POCKETFFT
|
|
||||||
|
|
||||||
/// This is needed for .incbin in assembly. For some reason, include paths don't work there in presence of LTO.
|
/// This is needed for .incbin in assembly. For some reason, include paths don't work there in presence of LTO.
|
||||||
/// That's why we use absolute paths.
|
/// That's why we use absolute paths.
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
|
#include <boost/core/noncopyable.hpp>
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
|
#include <array>
|
||||||
|
#include <list>
|
||||||
#include <barrier>
|
#include <barrier>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
#include <shared_mutex>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -19,9 +23,9 @@ using namespace DB;
|
|||||||
|
|
||||||
namespace CurrentMetrics
|
namespace CurrentMetrics
|
||||||
{
|
{
|
||||||
extern const Metric TablesLoaderThreads;
|
extern const Metric TablesLoaderBackgroundThreads;
|
||||||
extern const Metric TablesLoaderThreadsActive;
|
extern const Metric TablesLoaderBackgroundThreadsActive;
|
||||||
extern const Metric TablesLoaderThreadsScheduled;
|
extern const Metric TablesLoaderBackgroundThreadsScheduled;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace DB::ErrorCodes
|
namespace DB::ErrorCodes
|
||||||
@ -61,9 +65,9 @@ struct AsyncLoaderTest
|
|||||||
{
|
{
|
||||||
result.push_back({
|
result.push_back({
|
||||||
.name = fmt::format("Pool{}", pool_id),
|
.name = fmt::format("Pool{}", pool_id),
|
||||||
.metric_threads = CurrentMetrics::TablesLoaderThreads,
|
.metric_threads = CurrentMetrics::TablesLoaderBackgroundThreads,
|
||||||
.metric_active_threads = CurrentMetrics::TablesLoaderThreadsActive,
|
.metric_active_threads = CurrentMetrics::TablesLoaderBackgroundThreadsActive,
|
||||||
.metric_scheduled_threads = CurrentMetrics::TablesLoaderThreadsScheduled,
|
.metric_scheduled_threads = CurrentMetrics::TablesLoaderBackgroundThreadsScheduled,
|
||||||
.max_threads = desc.max_threads,
|
.max_threads = desc.max_threads,
|
||||||
.priority = desc.priority
|
.priority = desc.priority
|
||||||
});
|
});
|
||||||
@ -155,7 +159,7 @@ TEST(AsyncLoader, Smoke)
|
|||||||
std::atomic<size_t> jobs_done{0};
|
std::atomic<size_t> jobs_done{0};
|
||||||
std::atomic<size_t> low_priority_jobs_done{0};
|
std::atomic<size_t> low_priority_jobs_done{0};
|
||||||
|
|
||||||
auto job_func = [&] (const LoadJobPtr & self) {
|
auto job_func = [&] (AsyncLoader &, const LoadJobPtr & self) {
|
||||||
jobs_done++;
|
jobs_done++;
|
||||||
if (self->pool() == low_priority_pool)
|
if (self->pool() == low_priority_pool)
|
||||||
low_priority_jobs_done++;
|
low_priority_jobs_done++;
|
||||||
@ -172,13 +176,13 @@ TEST(AsyncLoader, Smoke)
|
|||||||
auto job5 = makeLoadJob({ job3, job4 }, low_priority_pool, "job5", job_func);
|
auto job5 = makeLoadJob({ job3, job4 }, low_priority_pool, "job5", job_func);
|
||||||
task2->merge(t.schedule({ job5 }));
|
task2->merge(t.schedule({ job5 }));
|
||||||
|
|
||||||
std::thread waiter_thread([=] { job5->wait(); });
|
std::thread waiter_thread([&t, job5] { t.loader.wait(job5); });
|
||||||
|
|
||||||
t.loader.start();
|
t.loader.start();
|
||||||
|
|
||||||
job3->wait();
|
t.loader.wait(job3);
|
||||||
t.loader.wait();
|
t.loader.wait();
|
||||||
job4->wait();
|
t.loader.wait(job4);
|
||||||
|
|
||||||
waiter_thread.join();
|
waiter_thread.join();
|
||||||
|
|
||||||
@ -196,7 +200,7 @@ TEST(AsyncLoader, CycleDetection)
|
|||||||
{
|
{
|
||||||
AsyncLoaderTest t;
|
AsyncLoaderTest t;
|
||||||
|
|
||||||
auto job_func = [&] (const LoadJobPtr &) {};
|
auto job_func = [&] (AsyncLoader &, const LoadJobPtr &) {};
|
||||||
|
|
||||||
LoadJobPtr cycle_breaker; // To avoid memleak we introduce with a cycle
|
LoadJobPtr cycle_breaker; // To avoid memleak we introduce with a cycle
|
||||||
|
|
||||||
@ -241,7 +245,7 @@ TEST(AsyncLoader, CancelPendingJob)
|
|||||||
{
|
{
|
||||||
AsyncLoaderTest t;
|
AsyncLoaderTest t;
|
||||||
|
|
||||||
auto job_func = [&] (const LoadJobPtr &) {};
|
auto job_func = [&] (AsyncLoader &, const LoadJobPtr &) {};
|
||||||
|
|
||||||
auto job = makeLoadJob({}, "job", job_func);
|
auto job = makeLoadJob({}, "job", job_func);
|
||||||
auto task = t.schedule({ job });
|
auto task = t.schedule({ job });
|
||||||
@ -251,7 +255,7 @@ TEST(AsyncLoader, CancelPendingJob)
|
|||||||
ASSERT_EQ(job->status(), LoadStatus::CANCELED);
|
ASSERT_EQ(job->status(), LoadStatus::CANCELED);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
job->wait();
|
t.loader.wait(job);
|
||||||
FAIL();
|
FAIL();
|
||||||
}
|
}
|
||||||
catch (Exception & e)
|
catch (Exception & e)
|
||||||
@ -264,7 +268,7 @@ TEST(AsyncLoader, CancelPendingTask)
|
|||||||
{
|
{
|
||||||
AsyncLoaderTest t;
|
AsyncLoaderTest t;
|
||||||
|
|
||||||
auto job_func = [&] (const LoadJobPtr &) {};
|
auto job_func = [&] (AsyncLoader &, const LoadJobPtr &) {};
|
||||||
|
|
||||||
auto job1 = makeLoadJob({}, "job1", job_func);
|
auto job1 = makeLoadJob({}, "job1", job_func);
|
||||||
auto job2 = makeLoadJob({ job1 }, "job2", job_func);
|
auto job2 = makeLoadJob({ job1 }, "job2", job_func);
|
||||||
@ -277,7 +281,7 @@ TEST(AsyncLoader, CancelPendingTask)
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
job1->wait();
|
t.loader.wait(job1);
|
||||||
FAIL();
|
FAIL();
|
||||||
}
|
}
|
||||||
catch (Exception & e)
|
catch (Exception & e)
|
||||||
@ -287,7 +291,7 @@ TEST(AsyncLoader, CancelPendingTask)
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
job2->wait();
|
t.loader.wait(job2);
|
||||||
FAIL();
|
FAIL();
|
||||||
}
|
}
|
||||||
catch (Exception & e)
|
catch (Exception & e)
|
||||||
@ -300,7 +304,7 @@ TEST(AsyncLoader, CancelPendingDependency)
|
|||||||
{
|
{
|
||||||
AsyncLoaderTest t;
|
AsyncLoaderTest t;
|
||||||
|
|
||||||
auto job_func = [&] (const LoadJobPtr &) {};
|
auto job_func = [&] (AsyncLoader &, const LoadJobPtr &) {};
|
||||||
|
|
||||||
auto job1 = makeLoadJob({}, "job1", job_func);
|
auto job1 = makeLoadJob({}, "job1", job_func);
|
||||||
auto job2 = makeLoadJob({ job1 }, "job2", job_func);
|
auto job2 = makeLoadJob({ job1 }, "job2", job_func);
|
||||||
@ -314,7 +318,7 @@ TEST(AsyncLoader, CancelPendingDependency)
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
job1->wait();
|
t.loader.wait(job1);
|
||||||
FAIL();
|
FAIL();
|
||||||
}
|
}
|
||||||
catch (Exception & e)
|
catch (Exception & e)
|
||||||
@ -324,7 +328,7 @@ TEST(AsyncLoader, CancelPendingDependency)
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
job2->wait();
|
t.loader.wait(job2);
|
||||||
FAIL();
|
FAIL();
|
||||||
}
|
}
|
||||||
catch (Exception & e)
|
catch (Exception & e)
|
||||||
@ -340,7 +344,7 @@ TEST(AsyncLoader, CancelExecutingJob)
|
|||||||
|
|
||||||
std::barrier sync(2);
|
std::barrier sync(2);
|
||||||
|
|
||||||
auto job_func = [&] (const LoadJobPtr &)
|
auto job_func = [&] (AsyncLoader &, const LoadJobPtr &)
|
||||||
{
|
{
|
||||||
sync.arrive_and_wait(); // (A) sync with main thread
|
sync.arrive_and_wait(); // (A) sync with main thread
|
||||||
sync.arrive_and_wait(); // (B) wait for waiter
|
sync.arrive_and_wait(); // (B) wait for waiter
|
||||||
@ -362,7 +366,7 @@ TEST(AsyncLoader, CancelExecutingJob)
|
|||||||
canceler.join();
|
canceler.join();
|
||||||
|
|
||||||
ASSERT_EQ(job->status(), LoadStatus::OK);
|
ASSERT_EQ(job->status(), LoadStatus::OK);
|
||||||
job->wait();
|
t.loader.wait(job);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(AsyncLoader, CancelExecutingTask)
|
TEST(AsyncLoader, CancelExecutingTask)
|
||||||
@ -371,19 +375,19 @@ TEST(AsyncLoader, CancelExecutingTask)
|
|||||||
t.loader.start();
|
t.loader.start();
|
||||||
std::barrier sync(2);
|
std::barrier sync(2);
|
||||||
|
|
||||||
auto blocker_job_func = [&] (const LoadJobPtr &)
|
auto blocker_job_func = [&] (AsyncLoader &, const LoadJobPtr &)
|
||||||
{
|
{
|
||||||
sync.arrive_and_wait(); // (A) sync with main thread
|
sync.arrive_and_wait(); // (A) sync with main thread
|
||||||
sync.arrive_and_wait(); // (B) wait for waiter
|
sync.arrive_and_wait(); // (B) wait for waiter
|
||||||
// signals (C)
|
// signals (C)
|
||||||
};
|
};
|
||||||
|
|
||||||
auto job_to_cancel_func = [&] (const LoadJobPtr &)
|
auto job_to_cancel_func = [&] (AsyncLoader &, const LoadJobPtr &)
|
||||||
{
|
{
|
||||||
FAIL(); // this job should be canceled
|
FAIL(); // this job should be canceled
|
||||||
};
|
};
|
||||||
|
|
||||||
auto job_to_succeed_func = [&] (const LoadJobPtr &)
|
auto job_to_succeed_func = [&] (AsyncLoader &, const LoadJobPtr &)
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -430,7 +434,7 @@ TEST(AsyncLoader, DISABLED_JobFailure)
|
|||||||
|
|
||||||
std::string error_message = "test job failure";
|
std::string error_message = "test job failure";
|
||||||
|
|
||||||
auto job_func = [&] (const LoadJobPtr &) {
|
auto job_func = [&] (AsyncLoader &, const LoadJobPtr &) {
|
||||||
throw std::runtime_error(error_message);
|
throw std::runtime_error(error_message);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -442,7 +446,7 @@ TEST(AsyncLoader, DISABLED_JobFailure)
|
|||||||
ASSERT_EQ(job->status(), LoadStatus::FAILED);
|
ASSERT_EQ(job->status(), LoadStatus::FAILED);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
job->wait();
|
t.loader.wait(job);
|
||||||
FAIL();
|
FAIL();
|
||||||
}
|
}
|
||||||
catch (Exception & e)
|
catch (Exception & e)
|
||||||
@ -459,7 +463,7 @@ TEST(AsyncLoader, ScheduleJobWithFailedDependencies)
|
|||||||
|
|
||||||
std::string_view error_message = "test job failure";
|
std::string_view error_message = "test job failure";
|
||||||
|
|
||||||
auto failed_job_func = [&] (const LoadJobPtr &) {
|
auto failed_job_func = [&] (AsyncLoader &, const LoadJobPtr &) {
|
||||||
throw Exception(ErrorCodes::ASYNC_LOAD_FAILED, "{}", error_message);
|
throw Exception(ErrorCodes::ASYNC_LOAD_FAILED, "{}", error_message);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -468,7 +472,7 @@ TEST(AsyncLoader, ScheduleJobWithFailedDependencies)
|
|||||||
|
|
||||||
t.loader.wait();
|
t.loader.wait();
|
||||||
|
|
||||||
auto job_func = [&] (const LoadJobPtr &) {};
|
auto job_func = [&] (AsyncLoader &, const LoadJobPtr &) {};
|
||||||
|
|
||||||
auto job1 = makeLoadJob({ failed_job }, "job1", job_func);
|
auto job1 = makeLoadJob({ failed_job }, "job1", job_func);
|
||||||
auto job2 = makeLoadJob({ job1 }, "job2", job_func);
|
auto job2 = makeLoadJob({ job1 }, "job2", job_func);
|
||||||
@ -480,7 +484,7 @@ TEST(AsyncLoader, ScheduleJobWithFailedDependencies)
|
|||||||
ASSERT_EQ(job2->status(), LoadStatus::CANCELED);
|
ASSERT_EQ(job2->status(), LoadStatus::CANCELED);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
job1->wait();
|
t.loader.wait(job1);
|
||||||
FAIL();
|
FAIL();
|
||||||
}
|
}
|
||||||
catch (Exception & e)
|
catch (Exception & e)
|
||||||
@ -490,7 +494,7 @@ TEST(AsyncLoader, ScheduleJobWithFailedDependencies)
|
|||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
job2->wait();
|
t.loader.wait(job2);
|
||||||
FAIL();
|
FAIL();
|
||||||
}
|
}
|
||||||
catch (Exception & e)
|
catch (Exception & e)
|
||||||
@ -504,14 +508,14 @@ TEST(AsyncLoader, ScheduleJobWithCanceledDependencies)
|
|||||||
{
|
{
|
||||||
AsyncLoaderTest t;
|
AsyncLoaderTest t;
|
||||||
|
|
||||||
auto canceled_job_func = [&] (const LoadJobPtr &) {};
|
auto canceled_job_func = [&] (AsyncLoader &, const LoadJobPtr &) {};
|
||||||
auto canceled_job = makeLoadJob({}, "canceled_job", canceled_job_func);
|
auto canceled_job = makeLoadJob({}, "canceled_job", canceled_job_func);
|
||||||
auto canceled_task = t.schedule({ canceled_job });
|
auto canceled_task = t.schedule({ canceled_job });
|
||||||
canceled_task->remove();
|
canceled_task->remove();
|
||||||
|
|
||||||
t.loader.start();
|
t.loader.start();
|
||||||
|
|
||||||
auto job_func = [&] (const LoadJobPtr &) {};
|
auto job_func = [&] (AsyncLoader &, const LoadJobPtr &) {};
|
||||||
auto job1 = makeLoadJob({ canceled_job }, "job1", job_func);
|
auto job1 = makeLoadJob({ canceled_job }, "job1", job_func);
|
||||||
auto job2 = makeLoadJob({ job1 }, "job2", job_func);
|
auto job2 = makeLoadJob({ job1 }, "job2", job_func);
|
||||||
auto task = t.schedule({ job1, job2 });
|
auto task = t.schedule({ job1, job2 });
|
||||||
@ -522,7 +526,7 @@ TEST(AsyncLoader, ScheduleJobWithCanceledDependencies)
|
|||||||
ASSERT_EQ(job2->status(), LoadStatus::CANCELED);
|
ASSERT_EQ(job2->status(), LoadStatus::CANCELED);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
job1->wait();
|
t.loader.wait(job1);
|
||||||
FAIL();
|
FAIL();
|
||||||
}
|
}
|
||||||
catch (Exception & e)
|
catch (Exception & e)
|
||||||
@ -531,7 +535,7 @@ TEST(AsyncLoader, ScheduleJobWithCanceledDependencies)
|
|||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
job2->wait();
|
t.loader.wait(job2);
|
||||||
FAIL();
|
FAIL();
|
||||||
}
|
}
|
||||||
catch (Exception & e)
|
catch (Exception & e)
|
||||||
@ -550,7 +554,7 @@ TEST(AsyncLoader, TestConcurrency)
|
|||||||
std::barrier sync(concurrency);
|
std::barrier sync(concurrency);
|
||||||
|
|
||||||
std::atomic<int> executing{0};
|
std::atomic<int> executing{0};
|
||||||
auto job_func = [&] (const LoadJobPtr &)
|
auto job_func = [&] (AsyncLoader &, const LoadJobPtr &)
|
||||||
{
|
{
|
||||||
executing++;
|
executing++;
|
||||||
ASSERT_LE(executing, concurrency);
|
ASSERT_LE(executing, concurrency);
|
||||||
@ -577,7 +581,7 @@ TEST(AsyncLoader, TestOverload)
|
|||||||
|
|
||||||
for (int concurrency = 4; concurrency <= 8; concurrency++)
|
for (int concurrency = 4; concurrency <= 8; concurrency++)
|
||||||
{
|
{
|
||||||
auto job_func = [&] (const LoadJobPtr &)
|
auto job_func = [&] (AsyncLoader &, const LoadJobPtr &)
|
||||||
{
|
{
|
||||||
executing++;
|
executing++;
|
||||||
t.randomSleepUs(100, 200, 100);
|
t.randomSleepUs(100, 200, 100);
|
||||||
@ -613,7 +617,7 @@ TEST(AsyncLoader, StaticPriorities)
|
|||||||
|
|
||||||
std::string schedule;
|
std::string schedule;
|
||||||
|
|
||||||
auto job_func = [&] (const LoadJobPtr & self)
|
auto job_func = [&] (AsyncLoader &, const LoadJobPtr & self)
|
||||||
{
|
{
|
||||||
schedule += fmt::format("{}{}", self->name, self->pool());
|
schedule += fmt::format("{}{}", self->name, self->pool());
|
||||||
};
|
};
|
||||||
@ -656,18 +660,18 @@ TEST(AsyncLoader, SimplePrioritization)
|
|||||||
std::atomic<int> executed{0}; // Number of previously executed jobs (to test execution order)
|
std::atomic<int> executed{0}; // Number of previously executed jobs (to test execution order)
|
||||||
LoadJobPtr job_to_prioritize;
|
LoadJobPtr job_to_prioritize;
|
||||||
|
|
||||||
auto job_func_A_booster = [&] (const LoadJobPtr &)
|
auto job_func_A_booster = [&] (AsyncLoader &, const LoadJobPtr &)
|
||||||
{
|
{
|
||||||
ASSERT_EQ(executed++, 0);
|
ASSERT_EQ(executed++, 0);
|
||||||
t.loader.prioritize(job_to_prioritize, 2);
|
t.loader.prioritize(job_to_prioritize, 2);
|
||||||
};
|
};
|
||||||
|
|
||||||
auto job_func_B_tester = [&] (const LoadJobPtr &)
|
auto job_func_B_tester = [&] (AsyncLoader &, const LoadJobPtr &)
|
||||||
{
|
{
|
||||||
ASSERT_EQ(executed++, 2);
|
ASSERT_EQ(executed++, 2);
|
||||||
};
|
};
|
||||||
|
|
||||||
auto job_func_C_boosted = [&] (const LoadJobPtr &)
|
auto job_func_C_boosted = [&] (AsyncLoader &, const LoadJobPtr &)
|
||||||
{
|
{
|
||||||
ASSERT_EQ(executed++, 1);
|
ASSERT_EQ(executed++, 1);
|
||||||
};
|
};
|
||||||
@ -680,7 +684,8 @@ TEST(AsyncLoader, SimplePrioritization)
|
|||||||
|
|
||||||
job_to_prioritize = jobs[2]; // C
|
job_to_prioritize = jobs[2]; // C
|
||||||
|
|
||||||
scheduleAndWaitLoadAll(task);
|
scheduleLoad(task);
|
||||||
|
waitLoad(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(AsyncLoader, DynamicPriorities)
|
TEST(AsyncLoader, DynamicPriorities)
|
||||||
@ -714,7 +719,7 @@ TEST(AsyncLoader, DynamicPriorities)
|
|||||||
UInt64 ready_seqno_D = 0;
|
UInt64 ready_seqno_D = 0;
|
||||||
UInt64 ready_seqno_E = 0;
|
UInt64 ready_seqno_E = 0;
|
||||||
|
|
||||||
auto job_func = [&] (const LoadJobPtr & self)
|
auto job_func = [&] (AsyncLoader &, const LoadJobPtr & self)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
std::unique_lock lock{schedule_mutex};
|
std::unique_lock lock{schedule_mutex};
|
||||||
@ -791,7 +796,7 @@ TEST(AsyncLoader, RandomIndependentTasks)
|
|||||||
AsyncLoaderTest t(16);
|
AsyncLoaderTest t(16);
|
||||||
t.loader.start();
|
t.loader.start();
|
||||||
|
|
||||||
auto job_func = [&] (const LoadJobPtr & self)
|
auto job_func = [&] (AsyncLoader &, const LoadJobPtr & self)
|
||||||
{
|
{
|
||||||
for (const auto & dep : self->dependencies)
|
for (const auto & dep : self->dependencies)
|
||||||
ASSERT_EQ(dep->status(), LoadStatus::OK);
|
ASSERT_EQ(dep->status(), LoadStatus::OK);
|
||||||
@ -818,7 +823,7 @@ TEST(AsyncLoader, RandomDependentTasks)
|
|||||||
std::vector<LoadTaskPtr> tasks;
|
std::vector<LoadTaskPtr> tasks;
|
||||||
std::vector<LoadJobPtr> all_jobs;
|
std::vector<LoadJobPtr> all_jobs;
|
||||||
|
|
||||||
auto job_func = [&] (const LoadJobPtr & self)
|
auto job_func = [&] (AsyncLoader &, const LoadJobPtr & self)
|
||||||
{
|
{
|
||||||
for (const auto & dep : self->dependencies)
|
for (const auto & dep : self->dependencies)
|
||||||
ASSERT_EQ(dep->status(), LoadStatus::OK);
|
ASSERT_EQ(dep->status(), LoadStatus::OK);
|
||||||
@ -860,7 +865,7 @@ TEST(AsyncLoader, SetMaxThreads)
|
|||||||
syncs.push_back(std::make_unique<std::barrier<>>(max_threads + 1));
|
syncs.push_back(std::make_unique<std::barrier<>>(max_threads + 1));
|
||||||
|
|
||||||
|
|
||||||
auto job_func = [&] (const LoadJobPtr &)
|
auto job_func = [&] (AsyncLoader &, const LoadJobPtr &)
|
||||||
{
|
{
|
||||||
int idx = sync_index;
|
int idx = sync_index;
|
||||||
if (idx < syncs.size())
|
if (idx < syncs.size())
|
||||||
@ -914,10 +919,11 @@ TEST(AsyncLoader, DynamicPools)
|
|||||||
{
|
{
|
||||||
std::atomic<bool> boosted{false}; // Visible concurrency was increased
|
std::atomic<bool> boosted{false}; // Visible concurrency was increased
|
||||||
std::atomic<int> left{concurrency * jobs_in_chain / 2}; // Number of jobs to start before `prioritize()` call
|
std::atomic<int> left{concurrency * jobs_in_chain / 2}; // Number of jobs to start before `prioritize()` call
|
||||||
|
std::shared_mutex prioritization_mutex; // To slow down job execution during prioritization to avoid race condition
|
||||||
|
|
||||||
LoadJobSet jobs_to_prioritize;
|
LoadJobSet jobs_to_prioritize;
|
||||||
|
|
||||||
auto job_func = [&] (const LoadJobPtr & self)
|
auto job_func = [&] (AsyncLoader & loader, const LoadJobPtr & self)
|
||||||
{
|
{
|
||||||
auto pool_id = self->executionPool();
|
auto pool_id = self->executionPool();
|
||||||
executing[pool_id]++;
|
executing[pool_id]++;
|
||||||
@ -928,10 +934,12 @@ TEST(AsyncLoader, DynamicPools)
|
|||||||
// Dynamic prioritization
|
// Dynamic prioritization
|
||||||
if (--left == 0)
|
if (--left == 0)
|
||||||
{
|
{
|
||||||
|
std::unique_lock lock{prioritization_mutex};
|
||||||
for (const auto & job : jobs_to_prioritize)
|
for (const auto & job : jobs_to_prioritize)
|
||||||
t.loader.prioritize(job, 1);
|
loader.prioritize(job, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::shared_lock lock{prioritization_mutex};
|
||||||
t.randomSleepUs(100, 200, 100);
|
t.randomSleepUs(100, 200, 100);
|
||||||
|
|
||||||
ASSERT_LE(executing[pool_id], max_threads[pool_id]);
|
ASSERT_LE(executing[pool_id], max_threads[pool_id]);
|
||||||
@ -941,9 +949,10 @@ TEST(AsyncLoader, DynamicPools)
|
|||||||
std::vector<LoadTaskPtr> tasks;
|
std::vector<LoadTaskPtr> tasks;
|
||||||
tasks.reserve(concurrency);
|
tasks.reserve(concurrency);
|
||||||
for (int i = 0; i < concurrency; i++)
|
for (int i = 0; i < concurrency; i++)
|
||||||
tasks.push_back(makeLoadTask(t.loader, t.chainJobSet(jobs_in_chain, job_func)));
|
tasks.push_back(makeLoadTask(t.loader, t.chainJobSet(jobs_in_chain, job_func, fmt::format("c{}-j", i))));
|
||||||
jobs_to_prioritize = getGoals(tasks); // All jobs
|
jobs_to_prioritize = getGoals(tasks); // All jobs
|
||||||
scheduleAndWaitLoadAll(tasks);
|
scheduleLoad(tasks);
|
||||||
|
waitLoad(tasks);
|
||||||
|
|
||||||
ASSERT_EQ(executing[0], 0);
|
ASSERT_EQ(executing[0], 0);
|
||||||
ASSERT_EQ(executing[1], 0);
|
ASSERT_EQ(executing[1], 0);
|
||||||
@ -952,3 +961,136 @@ TEST(AsyncLoader, DynamicPools)
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(AsyncLoader, SubJobs)
|
||||||
|
{
|
||||||
|
AsyncLoaderTest t(1);
|
||||||
|
t.loader.start();
|
||||||
|
|
||||||
|
// An example of component with an asynchronous loading interface
|
||||||
|
class MyComponent : boost::noncopyable {
|
||||||
|
public:
|
||||||
|
MyComponent(AsyncLoader & loader_, int jobs)
|
||||||
|
: loader(loader_)
|
||||||
|
, jobs_left(jobs)
|
||||||
|
{}
|
||||||
|
|
||||||
|
[[nodiscard]] LoadTaskPtr loadAsync()
|
||||||
|
{
|
||||||
|
auto job_func = [this] (AsyncLoader &, const LoadJobPtr &) {
|
||||||
|
auto sub_job_func = [this] (AsyncLoader &, const LoadJobPtr &) {
|
||||||
|
--jobs_left;
|
||||||
|
};
|
||||||
|
LoadJobSet jobs;
|
||||||
|
for (size_t j = 0; j < jobs_left; j++)
|
||||||
|
jobs.insert(makeLoadJob({}, fmt::format("sub job {}", j), sub_job_func));
|
||||||
|
waitLoad(makeLoadTask(loader, std::move(jobs)));
|
||||||
|
};
|
||||||
|
auto job = makeLoadJob({}, "main job", job_func);
|
||||||
|
return load_task = makeLoadTask(loader, { job });
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isLoaded() const
|
||||||
|
{
|
||||||
|
return jobs_left == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
AsyncLoader & loader;
|
||||||
|
std::atomic<int> jobs_left;
|
||||||
|
// It is a good practice to keep load task inside the component:
|
||||||
|
// 1) to make sure it outlives its load jobs;
|
||||||
|
// 2) to avoid removing load jobs from `system.async_loader` while we use the component
|
||||||
|
LoadTaskPtr load_task;
|
||||||
|
};
|
||||||
|
|
||||||
|
for (double jobs_per_thread : std::array{0.5, 1.0, 2.0})
|
||||||
|
{
|
||||||
|
for (size_t threads = 1; threads <= 32; threads *= 2)
|
||||||
|
{
|
||||||
|
t.loader.setMaxThreads(0, threads);
|
||||||
|
std::list<MyComponent> components;
|
||||||
|
LoadTaskPtrs tasks;
|
||||||
|
size_t size = static_cast<size_t>(jobs_per_thread * threads);
|
||||||
|
tasks.reserve(size);
|
||||||
|
for (size_t j = 0; j < size; j++)
|
||||||
|
{
|
||||||
|
components.emplace_back(t.loader, 5);
|
||||||
|
tasks.emplace_back(components.back().loadAsync());
|
||||||
|
}
|
||||||
|
waitLoad(tasks);
|
||||||
|
for (const auto & component: components)
|
||||||
|
ASSERT_TRUE(component.isLoaded());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(AsyncLoader, RecursiveJob)
|
||||||
|
{
|
||||||
|
AsyncLoaderTest t(1);
|
||||||
|
t.loader.start();
|
||||||
|
|
||||||
|
// An example of component with an asynchronous loading interface (a complicated one)
|
||||||
|
class MyComponent : boost::noncopyable {
|
||||||
|
public:
|
||||||
|
MyComponent(AsyncLoader & loader_, int jobs)
|
||||||
|
: loader(loader_)
|
||||||
|
, jobs_left(jobs)
|
||||||
|
{}
|
||||||
|
|
||||||
|
[[nodiscard]] LoadTaskPtr loadAsync()
|
||||||
|
{
|
||||||
|
return load_task = loadAsyncImpl(jobs_left);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isLoaded() const
|
||||||
|
{
|
||||||
|
return jobs_left == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
[[nodiscard]] LoadTaskPtr loadAsyncImpl(int id)
|
||||||
|
{
|
||||||
|
auto job_func = [this] (AsyncLoader &, const LoadJobPtr & self) {
|
||||||
|
jobFunction(self);
|
||||||
|
};
|
||||||
|
auto job = makeLoadJob({}, fmt::format("job{}", id), job_func);
|
||||||
|
auto task = makeLoadTask(loader, { job });
|
||||||
|
return task;
|
||||||
|
}
|
||||||
|
|
||||||
|
void jobFunction(const LoadJobPtr & self)
|
||||||
|
{
|
||||||
|
int next = --jobs_left;
|
||||||
|
if (next > 0)
|
||||||
|
waitLoad(self->pool(), loadAsyncImpl(next));
|
||||||
|
}
|
||||||
|
|
||||||
|
AsyncLoader & loader;
|
||||||
|
std::atomic<int> jobs_left;
|
||||||
|
// It is a good practice to keep load task inside the component:
|
||||||
|
// 1) to make sure it outlives its load jobs;
|
||||||
|
// 2) to avoid removing load jobs from `system.async_loader` while we use the component
|
||||||
|
LoadTaskPtr load_task;
|
||||||
|
};
|
||||||
|
|
||||||
|
for (double jobs_per_thread : std::array{0.5, 1.0, 2.0})
|
||||||
|
{
|
||||||
|
for (size_t threads = 1; threads <= 32; threads *= 2)
|
||||||
|
{
|
||||||
|
t.loader.setMaxThreads(0, threads);
|
||||||
|
std::list<MyComponent> components;
|
||||||
|
LoadTaskPtrs tasks;
|
||||||
|
size_t size = static_cast<size_t>(jobs_per_thread * threads);
|
||||||
|
tasks.reserve(size);
|
||||||
|
for (size_t j = 0; j < size; j++)
|
||||||
|
{
|
||||||
|
components.emplace_back(t.loader, 5);
|
||||||
|
tasks.emplace_back(components.back().loadAsync());
|
||||||
|
}
|
||||||
|
waitLoad(tasks);
|
||||||
|
for (const auto & component: components)
|
||||||
|
ASSERT_TRUE(component.isLoaded());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -69,7 +69,7 @@ void KeeperContext::initialize(const Poco::Util::AbstractConfiguration & config,
|
|||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
|
||||||
bool diskValidator(const Poco::Util::AbstractConfiguration & config, const std::string & disk_config_prefix)
|
bool diskValidator(const Poco::Util::AbstractConfiguration & config, const std::string & disk_config_prefix, const std::string &)
|
||||||
{
|
{
|
||||||
const auto disk_type = config.getString(disk_config_prefix + ".type", "local");
|
const auto disk_type = config.getString(disk_config_prefix + ".type", "local");
|
||||||
|
|
||||||
|
@ -101,6 +101,7 @@ void KeeperSnapshotManagerS3::updateS3Configuration(const Poco::Util::AbstractCo
|
|||||||
auto client = S3::ClientFactory::instance().create(
|
auto client = S3::ClientFactory::instance().create(
|
||||||
client_configuration,
|
client_configuration,
|
||||||
new_uri.is_virtual_hosted_style,
|
new_uri.is_virtual_hosted_style,
|
||||||
|
/* disable_checksum= */ false,
|
||||||
credentials.GetAWSAccessKeyId(),
|
credentials.GetAWSAccessKeyId(),
|
||||||
credentials.GetAWSSecretKey(),
|
credentials.GetAWSSecretKey(),
|
||||||
auth_settings.server_side_encryption_customer_key_base64,
|
auth_settings.server_side_encryption_customer_key_base64,
|
||||||
|
@ -92,14 +92,15 @@ namespace DB
|
|||||||
M(UInt64, background_schedule_pool_size, 512, "The maximum number of threads that will be used for constantly executing some lightweight periodic operations.", 0) \
|
M(UInt64, background_schedule_pool_size, 512, "The maximum number of threads that will be used for constantly executing some lightweight periodic operations.", 0) \
|
||||||
M(UInt64, background_message_broker_schedule_pool_size, 16, "The maximum number of threads that will be used for executing background operations for message streaming.", 0) \
|
M(UInt64, background_message_broker_schedule_pool_size, 16, "The maximum number of threads that will be used for executing background operations for message streaming.", 0) \
|
||||||
M(UInt64, background_distributed_schedule_pool_size, 16, "The maximum number of threads that will be used for executing distributed sends.", 0) \
|
M(UInt64, background_distributed_schedule_pool_size, 16, "The maximum number of threads that will be used for executing distributed sends.", 0) \
|
||||||
|
M(UInt64, tables_loader_foreground_pool_size, 0, "The maximum number of threads that will be used for foreground (that is being waited for by a query) loading of tables. Also used for synchronous loading of tables before the server start. Zero means use all CPUs.", 0) \
|
||||||
|
M(UInt64, tables_loader_background_pool_size, 0, "The maximum number of threads that will be used for background async loading of tables. Zero means use all CPUs.", 0) \
|
||||||
|
M(Bool, async_load_databases, false, "Enable asynchronous loading of databases and tables to speedup server startup. Queries to not yet loaded entity will be blocked until load is finished.", 0) \
|
||||||
M(Bool, display_secrets_in_show_and_select, false, "Allow showing secrets in SHOW and SELECT queries via a format setting and a grant", 0) \
|
M(Bool, display_secrets_in_show_and_select, false, "Allow showing secrets in SHOW and SELECT queries via a format setting and a grant", 0) \
|
||||||
\
|
\
|
||||||
M(UInt64, total_memory_profiler_step, 0, "Whenever server memory usage becomes larger than every next step in number of bytes the memory profiler will collect the allocating stack trace. Zero means disabled memory profiler. Values lower than a few megabytes will slow down server.", 0) \
|
M(UInt64, total_memory_profiler_step, 0, "Whenever server memory usage becomes larger than every next step in number of bytes the memory profiler will collect the allocating stack trace. Zero means disabled memory profiler. Values lower than a few megabytes will slow down server.", 0) \
|
||||||
M(Double, total_memory_tracker_sample_probability, 0, "Collect random allocations and deallocations and write them into system.trace_log with 'MemorySample' trace_type. The probability is for every alloc/free regardless to the size of the allocation (can be changed with `memory_profiler_sample_min_allocation_size` and `memory_profiler_sample_max_allocation_size`). Note that sampling happens only when the amount of untracked memory exceeds 'max_untracked_memory'. You may want to set 'max_untracked_memory' to 0 for extra fine grained sampling.", 0) \
|
M(Double, total_memory_tracker_sample_probability, 0, "Collect random allocations and deallocations and write them into system.trace_log with 'MemorySample' trace_type. The probability is for every alloc/free regardless to the size of the allocation (can be changed with `memory_profiler_sample_min_allocation_size` and `memory_profiler_sample_max_allocation_size`). Note that sampling happens only when the amount of untracked memory exceeds 'max_untracked_memory'. You may want to set 'max_untracked_memory' to 0 for extra fine grained sampling.", 0) \
|
||||||
M(UInt64, total_memory_profiler_sample_min_allocation_size, 0, "Collect random allocations of size greater or equal than specified value with probability equal to `total_memory_profiler_sample_probability`. 0 means disabled. You may want to set 'max_untracked_memory' to 0 to make this threshold to work as expected.", 0) \
|
M(UInt64, total_memory_profiler_sample_min_allocation_size, 0, "Collect random allocations of size greater or equal than specified value with probability equal to `total_memory_profiler_sample_probability`. 0 means disabled. You may want to set 'max_untracked_memory' to 0 to make this threshold to work as expected.", 0) \
|
||||||
M(UInt64, total_memory_profiler_sample_max_allocation_size, 0, "Collect random allocations of size less or equal than specified value with probability equal to `total_memory_profiler_sample_probability`. 0 means disabled. You may want to set 'max_untracked_memory' to 0 to make this threshold to work as expected.", 0) \
|
M(UInt64, total_memory_profiler_sample_max_allocation_size, 0, "Collect random allocations of size less or equal than specified value with probability equal to `total_memory_profiler_sample_probability`. 0 means disabled. You may want to set 'max_untracked_memory' to 0 to make this threshold to work as expected.", 0) \
|
||||||
M(String, get_client_http_header_forbidden_headers, "", "Comma separated list of http header names that will not be returned by function getClientHTTPHeader.", 0) \
|
|
||||||
M(Bool, allow_get_client_http_header, false, "Allow function getClientHTTPHeader", 0) \
|
|
||||||
M(Bool, validate_tcp_client_information, false, "Validate client_information in the query packet over the native TCP protocol.", 0) \
|
M(Bool, validate_tcp_client_information, false, "Validate client_information in the query packet over the native TCP protocol.", 0) \
|
||||||
M(Bool, storage_metadata_write_full_object_key, false, "Write disk metadata files with VERSION_FULL_OBJECT_KEY format", 0) \
|
M(Bool, storage_metadata_write_full_object_key, false, "Write disk metadata files with VERSION_FULL_OBJECT_KEY format", 0) \
|
||||||
|
|
||||||
|
@ -104,9 +104,10 @@ class IColumn;
|
|||||||
M(Bool, s3_check_objects_after_upload, false, "Check each uploaded object to s3 with head request to be sure that upload was successful", 0) \
|
M(Bool, s3_check_objects_after_upload, false, "Check each uploaded object to s3 with head request to be sure that upload was successful", 0) \
|
||||||
M(Bool, s3_allow_parallel_part_upload, true, "Use multiple threads for s3 multipart upload. It may lead to slightly higher memory usage", 0) \
|
M(Bool, s3_allow_parallel_part_upload, true, "Use multiple threads for s3 multipart upload. It may lead to slightly higher memory usage", 0) \
|
||||||
M(Bool, s3_throw_on_zero_files_match, false, "Throw an error, when ListObjects request cannot match any files", 0) \
|
M(Bool, s3_throw_on_zero_files_match, false, "Throw an error, when ListObjects request cannot match any files", 0) \
|
||||||
|
M(Bool, s3_disable_checksum, false, "Do not calculate a checksum when sending a file to S3. This speeds up writes by avoiding excessive processing passes on a file. It is mostly safe as the data of MergeTree tables is checksummed by ClickHouse anyway, and when S3 is accessed with HTTPS, the TLS layer already provides integrity while transferring through the network. While additional checksums on S3 give defense in depth.", 0) \
|
||||||
M(UInt64, s3_retry_attempts, 100, "Setting for Aws::Client::RetryStrategy, Aws::Client does retries itself, 0 means no retries", 0) \
|
M(UInt64, s3_retry_attempts, 100, "Setting for Aws::Client::RetryStrategy, Aws::Client does retries itself, 0 means no retries", 0) \
|
||||||
M(UInt64, s3_request_timeout_ms, 30000, "Idleness timeout for sending and receiving data to/from S3. Fail if a single TCP read or write call blocks for this long.", 0) \
|
M(UInt64, s3_request_timeout_ms, 30000, "Idleness timeout for sending and receiving data to/from S3. Fail if a single TCP read or write call blocks for this long.", 0) \
|
||||||
M(UInt64, s3_http_connection_pool_size, 1000, "How many reusable open connections to keep per S3 endpoint. Only applies to the S3 table engine and table function, not to S3 disks (for disks, use disk config instead). Global setting, can only be set in config, overriding it per session or per query has no effect.", 0) \
|
M(UInt64, s3_http_connection_pool_size, 1000, "How many reusable open connections to keep per S3 endpoint. This only applies to the S3 table engine and table function, not to S3 disks (for disks, use disk config instead). Global setting, can only be set in config, overriding it per session or per query has no effect.", 0) \
|
||||||
M(Bool, enable_s3_requests_logging, false, "Enable very explicit logging of S3 requests. Makes sense for debug only.", 0) \
|
M(Bool, enable_s3_requests_logging, false, "Enable very explicit logging of S3 requests. Makes sense for debug only.", 0) \
|
||||||
M(String, s3queue_default_zookeeper_path, "/clickhouse/s3queue/", "Default zookeeper path prefix for S3Queue engine", 0) \
|
M(String, s3queue_default_zookeeper_path, "/clickhouse/s3queue/", "Default zookeeper path prefix for S3Queue engine", 0) \
|
||||||
M(Bool, s3queue_enable_logging_to_s3queue_log, false, "Enable writing to system.s3queue_log. The value can be overwritten per table with table settings", 0) \
|
M(Bool, s3queue_enable_logging_to_s3queue_log, false, "Enable writing to system.s3queue_log. The value can be overwritten per table with table settings", 0) \
|
||||||
@ -122,10 +123,10 @@ class IColumn;
|
|||||||
M(UInt64, max_remote_write_network_bandwidth, 0, "The maximum speed of data exchange over the network in bytes per second for write.", 0) \
|
M(UInt64, max_remote_write_network_bandwidth, 0, "The maximum speed of data exchange over the network in bytes per second for write.", 0) \
|
||||||
M(UInt64, max_local_read_bandwidth, 0, "The maximum speed of local reads in bytes per second.", 0) \
|
M(UInt64, max_local_read_bandwidth, 0, "The maximum speed of local reads in bytes per second.", 0) \
|
||||||
M(UInt64, max_local_write_bandwidth, 0, "The maximum speed of local writes in bytes per second.", 0) \
|
M(UInt64, max_local_write_bandwidth, 0, "The maximum speed of local writes in bytes per second.", 0) \
|
||||||
M(Bool, stream_like_engine_allow_direct_select, false, "Allow direct SELECT query for Kafka, RabbitMQ, FileLog, Redis Streams and NATS engines. In case there are attached materialized views, SELECT query is not allowed even if this setting is enabled.", 0) \
|
M(Bool, stream_like_engine_allow_direct_select, false, "Allow direct SELECT query for Kafka, RabbitMQ, FileLog, Redis Streams, and NATS engines. In case there are attached materialized views, SELECT query is not allowed even if this setting is enabled.", 0) \
|
||||||
M(String, stream_like_engine_insert_queue, "", "When stream like engine reads from multiple queues, user will need to select one queue to insert into when writing. Used by Redis Streams and NATS.", 0) \
|
M(String, stream_like_engine_insert_queue, "", "When stream like engine reads from multiple queues, user will need to select one queue to insert into when writing. Used by Redis Streams and NATS.", 0) \
|
||||||
\
|
\
|
||||||
M(Bool, distributed_foreground_insert, false, "If setting is enabled, insert query into distributed waits until data will be sent to all nodes in cluster. \n\nEnables or disables synchronous data insertion into a `Distributed` table.\n\nBy default, when inserting data into a Distributed table, the ClickHouse server sends data to cluster nodes in background. When `distributed_foreground_insert` = 1, the data is processed synchronously, and the `INSERT` operation succeeds only after all the data is saved on all shards (at least one replica for each shard if `internal_replication` is true).", 0) ALIAS(insert_distributed_sync) \
|
M(Bool, distributed_foreground_insert, false, "If setting is enabled, insert query into distributed waits until data are sent to all nodes in a cluster. \n\nEnables or disables synchronous data insertion into a `Distributed` table.\n\nBy default, when inserting data into a Distributed table, the ClickHouse server sends data to cluster nodes in the background. When `distributed_foreground_insert` = 1, the data is processed synchronously, and the `INSERT` operation succeeds only after all the data is saved on all shards (at least one replica for each shard if `internal_replication` is true).", 0) ALIAS(insert_distributed_sync) \
|
||||||
M(UInt64, distributed_background_insert_timeout, 0, "Timeout for insert query into distributed. Setting is used only with insert_distributed_sync enabled. Zero value means no timeout.", 0) ALIAS(insert_distributed_timeout) \
|
M(UInt64, distributed_background_insert_timeout, 0, "Timeout for insert query into distributed. Setting is used only with insert_distributed_sync enabled. Zero value means no timeout.", 0) ALIAS(insert_distributed_timeout) \
|
||||||
M(Milliseconds, distributed_background_insert_sleep_time_ms, 100, "Sleep time for background INSERTs into Distributed, in case of any errors delay grows exponentially.", 0) ALIAS(distributed_directory_monitor_sleep_time_ms) \
|
M(Milliseconds, distributed_background_insert_sleep_time_ms, 100, "Sleep time for background INSERTs into Distributed, in case of any errors delay grows exponentially.", 0) ALIAS(distributed_directory_monitor_sleep_time_ms) \
|
||||||
M(Milliseconds, distributed_background_insert_max_sleep_time_ms, 30000, "Maximum sleep time for background INSERTs into Distributed, it limits exponential growth too.", 0) ALIAS(distributed_directory_monitor_max_sleep_time_ms) \
|
M(Milliseconds, distributed_background_insert_max_sleep_time_ms, 30000, "Maximum sleep time for background INSERTs into Distributed, it limits exponential growth too.", 0) ALIAS(distributed_directory_monitor_max_sleep_time_ms) \
|
||||||
@ -749,7 +750,7 @@ class IColumn;
|
|||||||
M(UInt64, prefetch_buffer_size, DBMS_DEFAULT_BUFFER_SIZE, "The maximum size of the prefetch buffer to read from the filesystem.", 0) \
|
M(UInt64, prefetch_buffer_size, DBMS_DEFAULT_BUFFER_SIZE, "The maximum size of the prefetch buffer to read from the filesystem.", 0) \
|
||||||
M(UInt64, filesystem_prefetch_step_bytes, 0, "Prefetch step in bytes. Zero means `auto` - approximately the best prefetch step will be auto deduced, but might not be 100% the best. The actual value might be different because of setting filesystem_prefetch_min_bytes_for_single_read_task", 0) \
|
M(UInt64, filesystem_prefetch_step_bytes, 0, "Prefetch step in bytes. Zero means `auto` - approximately the best prefetch step will be auto deduced, but might not be 100% the best. The actual value might be different because of setting filesystem_prefetch_min_bytes_for_single_read_task", 0) \
|
||||||
M(UInt64, filesystem_prefetch_step_marks, 0, "Prefetch step in marks. Zero means `auto` - approximately the best prefetch step will be auto deduced, but might not be 100% the best. The actual value might be different because of setting filesystem_prefetch_min_bytes_for_single_read_task", 0) \
|
M(UInt64, filesystem_prefetch_step_marks, 0, "Prefetch step in marks. Zero means `auto` - approximately the best prefetch step will be auto deduced, but might not be 100% the best. The actual value might be different because of setting filesystem_prefetch_min_bytes_for_single_read_task", 0) \
|
||||||
M(UInt64, filesystem_prefetch_min_bytes_for_single_read_task, "8Mi", "Do not parallelize within one file read less than this amount of bytes. E.g. one reader will not receive a read task of size less than this amount. This setting is recommended to avoid spikes of time for aws getObject requests to aws", 0) \
|
M(UInt64, filesystem_prefetch_min_bytes_for_single_read_task, "2Mi", "Do not parallelize within one file read less than this amount of bytes. E.g. one reader will not receive a read task of size less than this amount. This setting is recommended to avoid spikes of time for aws getObject requests to aws", 0) \
|
||||||
M(UInt64, filesystem_prefetch_max_memory_usage, "1Gi", "Maximum memory usage for prefetches.", 0) \
|
M(UInt64, filesystem_prefetch_max_memory_usage, "1Gi", "Maximum memory usage for prefetches.", 0) \
|
||||||
M(UInt64, filesystem_prefetches_limit, 200, "Maximum number of prefetches. Zero means unlimited. A setting `filesystem_prefetches_max_memory_usage` is more recommended if you want to limit the number of prefetches", 0) \
|
M(UInt64, filesystem_prefetches_limit, 200, "Maximum number of prefetches. Zero means unlimited. A setting `filesystem_prefetches_max_memory_usage` is more recommended if you want to limit the number of prefetches", 0) \
|
||||||
\
|
\
|
||||||
@ -816,7 +817,6 @@ class IColumn;
|
|||||||
M(Bool, allow_experimental_object_type, false, "Allow Object and JSON data types", 0) \
|
M(Bool, allow_experimental_object_type, false, "Allow Object and JSON data types", 0) \
|
||||||
M(Bool, allow_experimental_annoy_index, false, "Allows to use Annoy index. Disabled by default because this feature is experimental", 0) \
|
M(Bool, allow_experimental_annoy_index, false, "Allows to use Annoy index. Disabled by default because this feature is experimental", 0) \
|
||||||
M(Bool, allow_experimental_usearch_index, false, "Allows to use USearch index. Disabled by default because this feature is experimental", 0) \
|
M(Bool, allow_experimental_usearch_index, false, "Allows to use USearch index. Disabled by default because this feature is experimental", 0) \
|
||||||
M(Bool, allow_experimental_s3queue, false, "Allows to use S3Queue engine. Disabled by default, because this feature is experimental", 0) \
|
|
||||||
M(UInt64, max_limit_for_ann_queries, 1'000'000, "SELECT queries with LIMIT bigger than this setting cannot use ANN indexes. Helps to prevent memory overflows in ANN search indexes.", 0) \
|
M(UInt64, max_limit_for_ann_queries, 1'000'000, "SELECT queries with LIMIT bigger than this setting cannot use ANN indexes. Helps to prevent memory overflows in ANN search indexes.", 0) \
|
||||||
M(UInt64, max_threads_for_annoy_index_creation, 4, "Number of threads used to build Annoy indexes (0 means all cores, not recommended)", 0) \
|
M(UInt64, max_threads_for_annoy_index_creation, 4, "Number of threads used to build Annoy indexes (0 means all cores, not recommended)", 0) \
|
||||||
M(Int64, annoy_index_search_k_nodes, -1, "SELECT queries search up to this many nodes in Annoy indexes.", 0) \
|
M(Int64, annoy_index_search_k_nodes, -1, "SELECT queries search up to this many nodes in Annoy indexes.", 0) \
|
||||||
@ -898,6 +898,7 @@ class IColumn;
|
|||||||
MAKE_OBSOLETE(M, Bool, query_cache_store_results_of_queries_with_nondeterministic_functions, false) \
|
MAKE_OBSOLETE(M, Bool, query_cache_store_results_of_queries_with_nondeterministic_functions, false) \
|
||||||
MAKE_OBSOLETE(M, Bool, optimize_move_functions_out_of_any, false) \
|
MAKE_OBSOLETE(M, Bool, optimize_move_functions_out_of_any, false) \
|
||||||
MAKE_OBSOLETE(M, Bool, allow_experimental_undrop_table_query, true) \
|
MAKE_OBSOLETE(M, Bool, allow_experimental_undrop_table_query, true) \
|
||||||
|
MAKE_OBSOLETE(M, Bool, allow_experimental_s3queue, true) \
|
||||||
|
|
||||||
/** The section above is for obsolete settings. Do not add anything there. */
|
/** The section above is for obsolete settings. Do not add anything there. */
|
||||||
|
|
||||||
|
@ -22,8 +22,6 @@ public:
|
|||||||
virtual ~IDataTypeCustomName() = default;
|
virtual ~IDataTypeCustomName() = default;
|
||||||
|
|
||||||
virtual String getName() const = 0;
|
virtual String getName() const = 0;
|
||||||
|
|
||||||
virtual bool identical(const IDataTypeCustomName & rhs) const = 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
using DataTypeCustomNamePtr = std::unique_ptr<const IDataTypeCustomName>;
|
using DataTypeCustomNamePtr = std::unique_ptr<const IDataTypeCustomName>;
|
||||||
@ -53,12 +51,6 @@ private:
|
|||||||
public:
|
public:
|
||||||
explicit DataTypeCustomFixedName(String name_) : name(name_) {}
|
explicit DataTypeCustomFixedName(String name_) : name(name_) {}
|
||||||
String getName() const override { return name; }
|
String getName() const override { return name; }
|
||||||
bool identical(const IDataTypeCustomName & rhs_) const override
|
|
||||||
{
|
|
||||||
if (const auto * rhs = typeid_cast<decltype(this)>(&rhs_))
|
|
||||||
return name == rhs->getName();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -169,19 +169,4 @@ void registerDataTypeDomainSimpleAggregateFunction(DataTypeFactory & factory)
|
|||||||
factory.registerDataTypeCustom("SimpleAggregateFunction", create);
|
factory.registerDataTypeCustom("SimpleAggregateFunction", create);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DataTypeCustomSimpleAggregateFunction::identical(const IDataTypeCustomName & rhs_) const
|
|
||||||
{
|
|
||||||
if (const auto * rhs = typeid_cast<decltype(this)>(&rhs_))
|
|
||||||
{
|
|
||||||
if (parameters != rhs->parameters)
|
|
||||||
return false;
|
|
||||||
if (argument_types.size() != rhs->argument_types.size())
|
|
||||||
return false;
|
|
||||||
for (size_t i = 0; i < argument_types.size(); ++i)
|
|
||||||
if (!argument_types[i]->identical(*rhs->argument_types[i]))
|
|
||||||
return false;
|
|
||||||
return function->getName() == rhs->function->getName();
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,6 @@ public:
|
|||||||
|
|
||||||
AggregateFunctionPtr getFunction() const { return function; }
|
AggregateFunctionPtr getFunction() const { return function; }
|
||||||
String getName() const override;
|
String getName() const override;
|
||||||
bool identical(const IDataTypeCustomName & rhs_) const override;
|
|
||||||
static void checkSupportedFunctions(const AggregateFunctionPtr & function);
|
static void checkSupportedFunctions(const AggregateFunctionPtr & function);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -72,19 +72,4 @@ DataTypePtr createNested(const DataTypes & types, const Names & names)
|
|||||||
return DataTypeFactory::instance().getCustom(std::move(custom_desc));
|
return DataTypeFactory::instance().getCustom(std::move(custom_desc));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DataTypeNestedCustomName::identical(const IDataTypeCustomName & rhs_) const
|
|
||||||
{
|
|
||||||
if (const auto * rhs = typeid_cast<decltype(this)>(&rhs_))
|
|
||||||
{
|
|
||||||
if (names != rhs->names)
|
|
||||||
return false;
|
|
||||||
if (elems.size() != rhs->elems.size())
|
|
||||||
return false;
|
|
||||||
for (size_t i = 0; i < elems.size(); ++i)
|
|
||||||
if (!elems[i]->identical(*rhs->elems[i]))
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,6 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
String getName() const override;
|
String getName() const override;
|
||||||
bool identical(const IDataTypeCustomName & rhs_) const override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
DataTypePtr createNested(const DataTypes & types, const Names & names);
|
DataTypePtr createNested(const DataTypes & types, const Names & names);
|
||||||
|
@ -252,17 +252,4 @@ SerializationPtr IDataType::getSerialization(const NameAndTypePair & column)
|
|||||||
return column.type->getDefaultSerialization();
|
return column.type->getDefaultSerialization();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IDataType::identical(const IDataType & rhs) const
|
|
||||||
{
|
|
||||||
const auto * rhs_custom_name = rhs.getCustomName();
|
|
||||||
if (custom_name && rhs_custom_name)
|
|
||||||
{
|
|
||||||
return custom_name->identical(*rhs_custom_name);
|
|
||||||
}
|
|
||||||
else if (custom_name || rhs_custom_name)
|
|
||||||
return false;
|
|
||||||
else
|
|
||||||
return equals(rhs);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -177,12 +177,6 @@ public:
|
|||||||
/// Checks that two instances belong to the same type
|
/// Checks that two instances belong to the same type
|
||||||
virtual bool equals(const IDataType & rhs) const = 0;
|
virtual bool equals(const IDataType & rhs) const = 0;
|
||||||
|
|
||||||
/** Checks that two types are exactly identical. Note that two types may be equal but not identical.
|
|
||||||
* For example, `SimpleAggregateFunction(max, String)` and `SimpleAggregateFunction(anyLast, String)`
|
|
||||||
* This is used when creating a replicated table. Column types in different replicas must be identical
|
|
||||||
*/
|
|
||||||
virtual bool identical(const IDataType & rhs) const;
|
|
||||||
|
|
||||||
/// Various properties on behaviour of data type.
|
/// Various properties on behaviour of data type.
|
||||||
|
|
||||||
/** The data type is dependent on parameters and types with different parameters are different.
|
/** The data type is dependent on parameters and types with different parameters are different.
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include <IO/WriteHelpers.h>
|
#include <IO/WriteHelpers.h>
|
||||||
#include <IO/ReadBufferFromFile.h>
|
#include <IO/ReadBufferFromFile.h>
|
||||||
#include <Parsers/formatAST.h>
|
#include <Parsers/formatAST.h>
|
||||||
|
#include <Common/PoolId.h>
|
||||||
#include <Common/atomicRename.h>
|
#include <Common/atomicRename.h>
|
||||||
#include <Common/filesystemHelpers.h>
|
#include <Common/filesystemHelpers.h>
|
||||||
#include <Storages/StorageMaterializedView.h>
|
#include <Storages/StorageMaterializedView.h>
|
||||||
@ -74,6 +75,7 @@ String DatabaseAtomic::getTableDataPath(const ASTCreateQuery & query) const
|
|||||||
|
|
||||||
void DatabaseAtomic::drop(ContextPtr)
|
void DatabaseAtomic::drop(ContextPtr)
|
||||||
{
|
{
|
||||||
|
waitDatabaseStarted(false);
|
||||||
assert(TSA_SUPPRESS_WARNING_FOR_READ(tables).empty());
|
assert(TSA_SUPPRESS_WARNING_FOR_READ(tables).empty());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -112,6 +114,7 @@ StoragePtr DatabaseAtomic::detachTable(ContextPtr /* context */, const String &
|
|||||||
|
|
||||||
void DatabaseAtomic::dropTable(ContextPtr local_context, const String & table_name, bool sync)
|
void DatabaseAtomic::dropTable(ContextPtr local_context, const String & table_name, bool sync)
|
||||||
{
|
{
|
||||||
|
waitDatabaseStarted(false);
|
||||||
auto table = tryGetTable(table_name, local_context);
|
auto table = tryGetTable(table_name, local_context);
|
||||||
/// Remove the inner table (if any) to avoid deadlock
|
/// Remove the inner table (if any) to avoid deadlock
|
||||||
/// (due to attempt to execute DROP from the worker thread)
|
/// (due to attempt to execute DROP from the worker thread)
|
||||||
@ -175,6 +178,8 @@ void DatabaseAtomic::renameTable(ContextPtr local_context, const String & table_
|
|||||||
if (exchange && !supportsAtomicRename())
|
if (exchange && !supportsAtomicRename())
|
||||||
throw Exception(ErrorCodes::NOT_IMPLEMENTED, "RENAME EXCHANGE is not supported");
|
throw Exception(ErrorCodes::NOT_IMPLEMENTED, "RENAME EXCHANGE is not supported");
|
||||||
|
|
||||||
|
waitDatabaseStarted(false);
|
||||||
|
|
||||||
auto & other_db = dynamic_cast<DatabaseAtomic &>(to_database);
|
auto & other_db = dynamic_cast<DatabaseAtomic &>(to_database);
|
||||||
bool inside_database = this == &other_db;
|
bool inside_database = this == &other_db;
|
||||||
|
|
||||||
@ -412,7 +417,7 @@ void DatabaseAtomic::assertCanBeDetached(bool cleanup)
|
|||||||
DatabaseTablesIteratorPtr
|
DatabaseTablesIteratorPtr
|
||||||
DatabaseAtomic::getTablesIterator(ContextPtr local_context, const IDatabase::FilterByNameFunction & filter_by_table_name) const
|
DatabaseAtomic::getTablesIterator(ContextPtr local_context, const IDatabase::FilterByNameFunction & filter_by_table_name) const
|
||||||
{
|
{
|
||||||
auto base_iter = DatabaseWithOwnTablesBase::getTablesIterator(local_context, filter_by_table_name);
|
auto base_iter = DatabaseOrdinary::getTablesIterator(local_context, filter_by_table_name);
|
||||||
return std::make_unique<AtomicDatabaseTablesSnapshotIterator>(std::move(typeid_cast<DatabaseTablesSnapshotIterator &>(*base_iter)));
|
return std::make_unique<AtomicDatabaseTablesSnapshotIterator>(std::move(typeid_cast<DatabaseTablesSnapshotIterator &>(*base_iter)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -441,28 +446,34 @@ void DatabaseAtomic::beforeLoadingMetadata(ContextMutablePtr /*context*/, Loadin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DatabaseAtomic::loadStoredObjects(ContextMutablePtr local_context, LoadingStrictnessLevel mode)
|
LoadTaskPtr DatabaseAtomic::startupDatabaseAsync(AsyncLoader & async_loader, LoadJobSet startup_after, LoadingStrictnessLevel mode)
|
||||||
{
|
{
|
||||||
beforeLoadingMetadata(local_context, mode);
|
auto base = DatabaseOrdinary::startupDatabaseAsync(async_loader, std::move(startup_after), mode);
|
||||||
DatabaseOrdinary::loadStoredObjects(local_context, mode);
|
auto job = makeLoadJob(
|
||||||
|
base->goals(),
|
||||||
|
TablesLoaderBackgroundStartupPoolId,
|
||||||
|
fmt::format("startup Atomic database {}", getDatabaseName()),
|
||||||
|
[this, mode] (AsyncLoader &, const LoadJobPtr &)
|
||||||
|
{
|
||||||
|
if (mode < LoadingStrictnessLevel::FORCE_RESTORE)
|
||||||
|
return;
|
||||||
|
NameToPathMap table_names;
|
||||||
|
{
|
||||||
|
std::lock_guard lock{mutex};
|
||||||
|
table_names = table_name_to_path;
|
||||||
|
}
|
||||||
|
|
||||||
|
fs::create_directories(path_to_table_symlinks);
|
||||||
|
for (const auto & table : table_names)
|
||||||
|
tryCreateSymlink(table.first, table.second, true);
|
||||||
|
});
|
||||||
|
return startup_atomic_database_task = makeLoadTask(async_loader, {job});
|
||||||
}
|
}
|
||||||
|
|
||||||
void DatabaseAtomic::startupTables(ThreadPool & thread_pool, LoadingStrictnessLevel mode)
|
void DatabaseAtomic::waitDatabaseStarted(bool no_throw) const
|
||||||
{
|
{
|
||||||
DatabaseOrdinary::startupTables(thread_pool, mode);
|
if (startup_atomic_database_task)
|
||||||
|
waitLoad(currentPoolOr(TablesLoaderForegroundPoolId), startup_atomic_database_task, no_throw);
|
||||||
if (mode < LoadingStrictnessLevel::FORCE_RESTORE)
|
|
||||||
return;
|
|
||||||
|
|
||||||
NameToPathMap table_names;
|
|
||||||
{
|
|
||||||
std::lock_guard lock{mutex};
|
|
||||||
table_names = table_name_to_path;
|
|
||||||
}
|
|
||||||
|
|
||||||
fs::create_directories(path_to_table_symlinks);
|
|
||||||
for (const auto & table : table_names)
|
|
||||||
tryCreateSymlink(table.first, table.second, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DatabaseAtomic::tryCreateSymlink(const String & table_name, const String & actual_data_path, bool if_data_path_exist)
|
void DatabaseAtomic::tryCreateSymlink(const String & table_name, const String & actual_data_path, bool if_data_path_exist)
|
||||||
@ -532,6 +543,8 @@ void DatabaseAtomic::renameDatabase(ContextPtr query_context, const String & new
|
|||||||
{
|
{
|
||||||
/// CREATE, ATTACH, DROP, DETACH and RENAME DATABASE must hold DDLGuard
|
/// CREATE, ATTACH, DROP, DETACH and RENAME DATABASE must hold DDLGuard
|
||||||
|
|
||||||
|
waitDatabaseStarted(false);
|
||||||
|
|
||||||
bool check_ref_deps = query_context->getSettingsRef().check_referential_table_dependencies;
|
bool check_ref_deps = query_context->getSettingsRef().check_referential_table_dependencies;
|
||||||
bool check_loading_deps = !check_ref_deps && query_context->getSettingsRef().check_table_dependencies;
|
bool check_loading_deps = !check_ref_deps && query_context->getSettingsRef().check_table_dependencies;
|
||||||
if (check_ref_deps || check_loading_deps)
|
if (check_ref_deps || check_loading_deps)
|
||||||
|
@ -48,11 +48,10 @@ public:
|
|||||||
|
|
||||||
DatabaseTablesIteratorPtr getTablesIterator(ContextPtr context, const FilterByNameFunction & filter_by_table_name) const override;
|
DatabaseTablesIteratorPtr getTablesIterator(ContextPtr context, const FilterByNameFunction & filter_by_table_name) const override;
|
||||||
|
|
||||||
void loadStoredObjects(ContextMutablePtr context, LoadingStrictnessLevel mode) override;
|
|
||||||
|
|
||||||
void beforeLoadingMetadata(ContextMutablePtr context, LoadingStrictnessLevel mode) override;
|
void beforeLoadingMetadata(ContextMutablePtr context, LoadingStrictnessLevel mode) override;
|
||||||
|
|
||||||
void startupTables(ThreadPool & thread_pool, LoadingStrictnessLevel mode) override;
|
LoadTaskPtr startupDatabaseAsync(AsyncLoader & async_loader, LoadJobSet startup_after, LoadingStrictnessLevel mode) override;
|
||||||
|
void waitDatabaseStarted(bool no_throw) const override;
|
||||||
|
|
||||||
/// Atomic database cannot be detached if there is detached table which still in use
|
/// Atomic database cannot be detached if there is detached table which still in use
|
||||||
void assertCanBeDetached(bool cleanup) override;
|
void assertCanBeDetached(bool cleanup) override;
|
||||||
@ -87,6 +86,8 @@ protected:
|
|||||||
String path_to_table_symlinks;
|
String path_to_table_symlinks;
|
||||||
String path_to_metadata_symlink;
|
String path_to_metadata_symlink;
|
||||||
const UUID db_uuid;
|
const UUID db_uuid;
|
||||||
|
|
||||||
|
LoadTaskPtr startup_atomic_database_task;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -163,6 +163,13 @@ DatabaseOnDisk::DatabaseOnDisk(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void DatabaseOnDisk::shutdown()
|
||||||
|
{
|
||||||
|
waitDatabaseStarted(/* no_throw = */ true);
|
||||||
|
DatabaseWithOwnTablesBase::shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void DatabaseOnDisk::createTable(
|
void DatabaseOnDisk::createTable(
|
||||||
ContextPtr local_context,
|
ContextPtr local_context,
|
||||||
const String & table_name,
|
const String & table_name,
|
||||||
@ -189,6 +196,8 @@ void DatabaseOnDisk::createTable(
|
|||||||
throw Exception(
|
throw Exception(
|
||||||
ErrorCodes::TABLE_ALREADY_EXISTS, "Table {}.{} already exists", backQuote(getDatabaseName()), backQuote(table_name));
|
ErrorCodes::TABLE_ALREADY_EXISTS, "Table {}.{} already exists", backQuote(getDatabaseName()), backQuote(table_name));
|
||||||
|
|
||||||
|
waitDatabaseStarted(false);
|
||||||
|
|
||||||
String table_metadata_path = getObjectMetadataPath(table_name);
|
String table_metadata_path = getObjectMetadataPath(table_name);
|
||||||
|
|
||||||
if (create.attach_short_syntax)
|
if (create.attach_short_syntax)
|
||||||
@ -278,6 +287,8 @@ void DatabaseOnDisk::commitCreateTable(const ASTCreateQuery & query, const Stora
|
|||||||
|
|
||||||
void DatabaseOnDisk::detachTablePermanently(ContextPtr query_context, const String & table_name)
|
void DatabaseOnDisk::detachTablePermanently(ContextPtr query_context, const String & table_name)
|
||||||
{
|
{
|
||||||
|
waitDatabaseStarted(false);
|
||||||
|
|
||||||
auto table = detachTable(query_context, table_name);
|
auto table = detachTable(query_context, table_name);
|
||||||
|
|
||||||
fs::path detached_permanently_flag(getObjectMetadataPath(table_name) + detached_suffix);
|
fs::path detached_permanently_flag(getObjectMetadataPath(table_name) + detached_suffix);
|
||||||
@ -294,6 +305,8 @@ void DatabaseOnDisk::detachTablePermanently(ContextPtr query_context, const Stri
|
|||||||
|
|
||||||
void DatabaseOnDisk::dropTable(ContextPtr local_context, const String & table_name, bool /*sync*/)
|
void DatabaseOnDisk::dropTable(ContextPtr local_context, const String & table_name, bool /*sync*/)
|
||||||
{
|
{
|
||||||
|
waitDatabaseStarted(false);
|
||||||
|
|
||||||
String table_metadata_path = getObjectMetadataPath(table_name);
|
String table_metadata_path = getObjectMetadataPath(table_name);
|
||||||
String table_metadata_path_drop = table_metadata_path + drop_suffix;
|
String table_metadata_path_drop = table_metadata_path + drop_suffix;
|
||||||
String table_data_path_relative = getTableDataPath(table_name);
|
String table_data_path_relative = getTableDataPath(table_name);
|
||||||
@ -378,6 +391,8 @@ void DatabaseOnDisk::renameTable(
|
|||||||
throw Exception(ErrorCodes::NOT_IMPLEMENTED, "Moving tables between databases of different engines is not supported");
|
throw Exception(ErrorCodes::NOT_IMPLEMENTED, "Moving tables between databases of different engines is not supported");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
waitDatabaseStarted(false);
|
||||||
|
|
||||||
auto table_data_relative_path = getTableDataPath(table_name);
|
auto table_data_relative_path = getTableDataPath(table_name);
|
||||||
TableExclusiveLockHolder table_lock;
|
TableExclusiveLockHolder table_lock;
|
||||||
String table_metadata_path;
|
String table_metadata_path;
|
||||||
@ -519,6 +534,8 @@ ASTPtr DatabaseOnDisk::getCreateDatabaseQuery() const
|
|||||||
|
|
||||||
void DatabaseOnDisk::drop(ContextPtr local_context)
|
void DatabaseOnDisk::drop(ContextPtr local_context)
|
||||||
{
|
{
|
||||||
|
waitDatabaseStarted(false);
|
||||||
|
|
||||||
assert(TSA_SUPPRESS_WARNING_FOR_READ(tables).empty());
|
assert(TSA_SUPPRESS_WARNING_FOR_READ(tables).empty());
|
||||||
if (local_context->getSettingsRef().force_remove_data_recursively_on_drop)
|
if (local_context->getSettingsRef().force_remove_data_recursively_on_drop)
|
||||||
{
|
{
|
||||||
|
@ -32,6 +32,8 @@ class DatabaseOnDisk : public DatabaseWithOwnTablesBase
|
|||||||
public:
|
public:
|
||||||
DatabaseOnDisk(const String & name, const String & metadata_path_, const String & data_path_, const String & logger, ContextPtr context);
|
DatabaseOnDisk(const String & name, const String & metadata_path_, const String & data_path_, const String & logger, ContextPtr context);
|
||||||
|
|
||||||
|
void shutdown() override;
|
||||||
|
|
||||||
void createTable(
|
void createTable(
|
||||||
ContextPtr context,
|
ContextPtr context,
|
||||||
const String & table_name,
|
const String & table_name,
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include <Parsers/queryToString.h>
|
#include <Parsers/queryToString.h>
|
||||||
#include <Common/Stopwatch.h>
|
#include <Common/Stopwatch.h>
|
||||||
#include <Common/ThreadPool.h>
|
#include <Common/ThreadPool.h>
|
||||||
|
#include <Common/PoolId.h>
|
||||||
#include <Common/escapeForFileName.h>
|
#include <Common/escapeForFileName.h>
|
||||||
#include <Common/quoteString.h>
|
#include <Common/quoteString.h>
|
||||||
#include <Common/typeid_cast.h>
|
#include <Common/typeid_cast.h>
|
||||||
@ -30,13 +31,6 @@
|
|||||||
|
|
||||||
namespace fs = std::filesystem;
|
namespace fs = std::filesystem;
|
||||||
|
|
||||||
namespace CurrentMetrics
|
|
||||||
{
|
|
||||||
extern const Metric DatabaseOrdinaryThreads;
|
|
||||||
extern const Metric DatabaseOrdinaryThreadsActive;
|
|
||||||
extern const Metric DatabaseOrdinaryThreadsScheduled;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace DB
|
namespace DB
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -47,38 +41,6 @@ namespace ErrorCodes
|
|||||||
|
|
||||||
static constexpr size_t METADATA_FILE_BUFFER_SIZE = 32768;
|
static constexpr size_t METADATA_FILE_BUFFER_SIZE = 32768;
|
||||||
|
|
||||||
namespace
|
|
||||||
{
|
|
||||||
void tryAttachTable(
|
|
||||||
ContextMutablePtr context,
|
|
||||||
const ASTCreateQuery & query,
|
|
||||||
DatabaseOrdinary & database,
|
|
||||||
const String & database_name,
|
|
||||||
const String & metadata_path,
|
|
||||||
bool force_restore)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
auto [table_name, table] = createTableFromAST(
|
|
||||||
query,
|
|
||||||
database_name,
|
|
||||||
database.getTableDataPath(query),
|
|
||||||
context,
|
|
||||||
force_restore);
|
|
||||||
|
|
||||||
database.attachTable(context, table_name, table, database.getTableDataPath(query));
|
|
||||||
}
|
|
||||||
catch (Exception & e)
|
|
||||||
{
|
|
||||||
e.addMessage(
|
|
||||||
"Cannot attach table " + backQuote(database_name) + "." + backQuote(query.getTable()) + " from metadata file " + metadata_path
|
|
||||||
+ " from query " + serializeAST(query));
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
DatabaseOrdinary::DatabaseOrdinary(const String & name_, const String & metadata_path_, ContextPtr context_)
|
DatabaseOrdinary::DatabaseOrdinary(const String & name_, const String & metadata_path_, ContextPtr context_)
|
||||||
: DatabaseOrdinary(name_, metadata_path_, "data/" + escapeForFileName(name_) + "/", "DatabaseOrdinary (" + name_ + ")", context_)
|
: DatabaseOrdinary(name_, metadata_path_, "data/" + escapeForFileName(name_) + "/", "DatabaseOrdinary (" + name_ + ")", context_)
|
||||||
{
|
{
|
||||||
@ -90,75 +52,10 @@ DatabaseOrdinary::DatabaseOrdinary(
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void DatabaseOrdinary::loadStoredObjects(ContextMutablePtr local_context, LoadingStrictnessLevel mode)
|
void DatabaseOrdinary::loadStoredObjects(ContextMutablePtr, LoadingStrictnessLevel)
|
||||||
{
|
{
|
||||||
/** Tables load faster if they are loaded in sorted (by name) order.
|
// Because it supportsLoadingInTopologicalOrder, we don't need this loading method.
|
||||||
* Otherwise (for the ext4 filesystem), `DirectoryIterator` iterates through them in some order,
|
throw Exception(ErrorCodes::LOGICAL_ERROR, "Not implemented");
|
||||||
* which does not correspond to order tables creation and does not correspond to order of their location on disk.
|
|
||||||
*/
|
|
||||||
|
|
||||||
ParsedTablesMetadata metadata;
|
|
||||||
bool force_attach = LoadingStrictnessLevel::FORCE_ATTACH <= mode;
|
|
||||||
loadTablesMetadata(local_context, metadata, force_attach);
|
|
||||||
|
|
||||||
size_t total_tables = metadata.parsed_tables.size() - metadata.total_dictionaries;
|
|
||||||
|
|
||||||
AtomicStopwatch watch;
|
|
||||||
std::atomic<size_t> dictionaries_processed{0};
|
|
||||||
std::atomic<size_t> tables_processed{0};
|
|
||||||
|
|
||||||
ThreadPool pool(CurrentMetrics::DatabaseOrdinaryThreads, CurrentMetrics::DatabaseOrdinaryThreadsActive, CurrentMetrics::DatabaseOrdinaryThreadsScheduled);
|
|
||||||
|
|
||||||
/// We must attach dictionaries before attaching tables
|
|
||||||
/// because while we're attaching tables we may need to have some dictionaries attached
|
|
||||||
/// (for example, dictionaries can be used in the default expressions for some tables).
|
|
||||||
/// On the other hand we can attach any dictionary (even sourced from ClickHouse table)
|
|
||||||
/// without having any tables attached. It is so because attaching of a dictionary means
|
|
||||||
/// loading of its config only, it doesn't involve loading the dictionary itself.
|
|
||||||
|
|
||||||
/// Attach dictionaries.
|
|
||||||
for (const auto & name_with_path_and_query : metadata.parsed_tables)
|
|
||||||
{
|
|
||||||
const auto & name = name_with_path_and_query.first;
|
|
||||||
const auto & path = name_with_path_and_query.second.path;
|
|
||||||
const auto & ast = name_with_path_and_query.second.ast;
|
|
||||||
const auto & create_query = ast->as<const ASTCreateQuery &>();
|
|
||||||
|
|
||||||
if (create_query.is_dictionary)
|
|
||||||
{
|
|
||||||
pool.scheduleOrThrowOnError([&]()
|
|
||||||
{
|
|
||||||
loadTableFromMetadata(local_context, path, name, ast, mode);
|
|
||||||
|
|
||||||
/// Messages, so that it's not boring to wait for the server to load for a long time.
|
|
||||||
logAboutProgress(log, ++dictionaries_processed, metadata.total_dictionaries, watch);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pool.wait();
|
|
||||||
|
|
||||||
/// Attach tables.
|
|
||||||
for (const auto & name_with_path_and_query : metadata.parsed_tables)
|
|
||||||
{
|
|
||||||
const auto & name = name_with_path_and_query.first;
|
|
||||||
const auto & path = name_with_path_and_query.second.path;
|
|
||||||
const auto & ast = name_with_path_and_query.second.ast;
|
|
||||||
const auto & create_query = ast->as<const ASTCreateQuery &>();
|
|
||||||
|
|
||||||
if (!create_query.is_dictionary)
|
|
||||||
{
|
|
||||||
pool.scheduleOrThrowOnError([&]()
|
|
||||||
{
|
|
||||||
loadTableFromMetadata(local_context, path, name, ast, mode);
|
|
||||||
|
|
||||||
/// Messages, so that it's not boring to wait for the server to load for a long time.
|
|
||||||
logAboutProgress(log, ++tables_processed, total_tables, watch);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pool.wait();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DatabaseOrdinary::loadTablesMetadata(ContextPtr local_context, ParsedTablesMetadata & metadata, bool is_startup)
|
void DatabaseOrdinary::loadTablesMetadata(ContextPtr local_context, ParsedTablesMetadata & metadata, bool is_startup)
|
||||||
@ -232,59 +129,143 @@ void DatabaseOrdinary::loadTablesMetadata(ContextPtr local_context, ParsedTables
|
|||||||
TSA_SUPPRESS_WARNING_FOR_READ(database_name), tables_in_database, dictionaries_in_database);
|
TSA_SUPPRESS_WARNING_FOR_READ(database_name), tables_in_database, dictionaries_in_database);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DatabaseOrdinary::loadTableFromMetadata(ContextMutablePtr local_context, const String & file_path, const QualifiedTableName & name, const ASTPtr & ast,
|
void DatabaseOrdinary::loadTableFromMetadata(
|
||||||
|
ContextMutablePtr local_context,
|
||||||
|
const String & file_path,
|
||||||
|
const QualifiedTableName & name,
|
||||||
|
const ASTPtr & ast,
|
||||||
LoadingStrictnessLevel mode)
|
LoadingStrictnessLevel mode)
|
||||||
{
|
{
|
||||||
assert(name.database == TSA_SUPPRESS_WARNING_FOR_READ(database_name));
|
assert(name.database == TSA_SUPPRESS_WARNING_FOR_READ(database_name));
|
||||||
const auto & create_query = ast->as<const ASTCreateQuery &>();
|
const auto & query = ast->as<const ASTCreateQuery &>();
|
||||||
|
|
||||||
tryAttachTable(
|
|
||||||
local_context,
|
|
||||||
create_query,
|
|
||||||
*this,
|
|
||||||
name.database,
|
|
||||||
file_path, LoadingStrictnessLevel::FORCE_RESTORE <= mode);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DatabaseOrdinary::startupTables(ThreadPool & thread_pool, LoadingStrictnessLevel /*mode*/)
|
|
||||||
{
|
|
||||||
LOG_INFO(log, "Starting up tables.");
|
|
||||||
|
|
||||||
/// NOTE No concurrent writes are possible during database loading
|
|
||||||
const size_t total_tables = TSA_SUPPRESS_WARNING_FOR_READ(tables).size();
|
|
||||||
if (!total_tables)
|
|
||||||
return;
|
|
||||||
|
|
||||||
AtomicStopwatch watch;
|
|
||||||
std::atomic<size_t> tables_processed{0};
|
|
||||||
|
|
||||||
auto startup_one_table = [&](const StoragePtr & table)
|
|
||||||
{
|
|
||||||
/// Since startup() method can use physical paths on disk we don't allow any exclusive actions (rename, drop so on)
|
|
||||||
/// until startup finished.
|
|
||||||
auto table_lock_holder = table->lockForShare(RWLockImpl::NO_QUERY, getContext()->getSettingsRef().lock_acquire_timeout);
|
|
||||||
table->startup();
|
|
||||||
logAboutProgress(log, ++tables_processed, total_tables, watch);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
for (const auto & table : TSA_SUPPRESS_WARNING_FOR_READ(tables))
|
auto [table_name, table] = createTableFromAST(
|
||||||
thread_pool.scheduleOrThrowOnError([&]() { startup_one_table(table.second); });
|
query,
|
||||||
|
name.database,
|
||||||
|
getTableDataPath(query),
|
||||||
|
local_context,
|
||||||
|
LoadingStrictnessLevel::FORCE_RESTORE <= mode);
|
||||||
|
|
||||||
|
attachTable(local_context, table_name, table, getTableDataPath(query));
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (Exception & e)
|
||||||
{
|
{
|
||||||
/// We have to wait for jobs to finish here, because job function has reference to variables on the stack of current thread.
|
e.addMessage(
|
||||||
thread_pool.wait();
|
"Cannot attach table " + backQuote(name.database) + "." + backQuote(query.getTable()) + " from metadata file " + file_path
|
||||||
|
+ " from query " + serializeAST(query));
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
thread_pool.wait();
|
}
|
||||||
|
|
||||||
|
LoadTaskPtr DatabaseOrdinary::loadTableFromMetadataAsync(
|
||||||
|
AsyncLoader & async_loader,
|
||||||
|
LoadJobSet load_after,
|
||||||
|
ContextMutablePtr local_context,
|
||||||
|
const String & file_path,
|
||||||
|
const QualifiedTableName & name,
|
||||||
|
const ASTPtr & ast,
|
||||||
|
LoadingStrictnessLevel mode)
|
||||||
|
{
|
||||||
|
std::scoped_lock lock(mutex);
|
||||||
|
auto job = makeLoadJob(
|
||||||
|
std::move(load_after),
|
||||||
|
TablesLoaderBackgroundLoadPoolId,
|
||||||
|
fmt::format("load table {}", name.getFullName()),
|
||||||
|
[this, local_context, file_path, name, ast, mode] (AsyncLoader &, const LoadJobPtr &)
|
||||||
|
{
|
||||||
|
loadTableFromMetadata(local_context, file_path, name, ast, mode);
|
||||||
|
});
|
||||||
|
|
||||||
|
return load_table[name.table] = makeLoadTask(async_loader, {job});
|
||||||
|
}
|
||||||
|
|
||||||
|
LoadTaskPtr DatabaseOrdinary::startupTableAsync(
|
||||||
|
AsyncLoader & async_loader,
|
||||||
|
LoadJobSet startup_after,
|
||||||
|
const QualifiedTableName & name,
|
||||||
|
LoadingStrictnessLevel /*mode*/)
|
||||||
|
{
|
||||||
|
std::scoped_lock lock(mutex);
|
||||||
|
|
||||||
|
/// Initialize progress indication on the first call
|
||||||
|
if (total_tables_to_startup == 0)
|
||||||
|
{
|
||||||
|
total_tables_to_startup = tables.size();
|
||||||
|
startup_watch.restart();
|
||||||
|
}
|
||||||
|
|
||||||
|
auto job = makeLoadJob(
|
||||||
|
std::move(startup_after),
|
||||||
|
TablesLoaderBackgroundStartupPoolId,
|
||||||
|
fmt::format("startup table {}", name.getFullName()),
|
||||||
|
[this, name] (AsyncLoader &, const LoadJobPtr &)
|
||||||
|
{
|
||||||
|
if (auto table = tryGetTableNoWait(name.table))
|
||||||
|
{
|
||||||
|
/// Since startup() method can use physical paths on disk we don't allow any exclusive actions (rename, drop so on)
|
||||||
|
/// until startup finished.
|
||||||
|
auto table_lock_holder = table->lockForShare(RWLockImpl::NO_QUERY, getContext()->getSettingsRef().lock_acquire_timeout);
|
||||||
|
table->startup();
|
||||||
|
logAboutProgress(log, ++tables_started, total_tables_to_startup, startup_watch);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
throw Exception(ErrorCodes::LOGICAL_ERROR, "Table {}.{} doesn't exist during startup",
|
||||||
|
backQuote(name.database), backQuote(name.table));
|
||||||
|
});
|
||||||
|
|
||||||
|
return startup_table[name.table] = makeLoadTask(async_loader, {job});
|
||||||
|
}
|
||||||
|
|
||||||
|
LoadTaskPtr DatabaseOrdinary::startupDatabaseAsync(
|
||||||
|
AsyncLoader & async_loader,
|
||||||
|
LoadJobSet startup_after,
|
||||||
|
LoadingStrictnessLevel /*mode*/)
|
||||||
|
{
|
||||||
|
// NOTE: this task is empty, but it is required for correct dependency handling (startup should be done after tables loading)
|
||||||
|
auto job = makeLoadJob(
|
||||||
|
std::move(startup_after),
|
||||||
|
TablesLoaderBackgroundStartupPoolId,
|
||||||
|
fmt::format("startup Ordinary database {}", getDatabaseName()));
|
||||||
|
return startup_database_task = makeLoadTask(async_loader, {job});
|
||||||
|
}
|
||||||
|
|
||||||
|
void DatabaseOrdinary::waitTableStarted(const String & name) const
|
||||||
|
{
|
||||||
|
/// Prioritize jobs (load and startup the table) to be executed in foreground pool and wait for them synchronously
|
||||||
|
LoadTaskPtr task;
|
||||||
|
{
|
||||||
|
std::scoped_lock lock(mutex);
|
||||||
|
if (auto it = startup_table.find(name); it != startup_table.end())
|
||||||
|
task = it->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (task)
|
||||||
|
waitLoad(currentPoolOr(TablesLoaderForegroundPoolId), task);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DatabaseOrdinary::waitDatabaseStarted(bool no_throw) const
|
||||||
|
{
|
||||||
|
/// Prioritize load and startup of all tables and database itself and wait for them synchronously
|
||||||
|
if (startup_database_task)
|
||||||
|
waitLoad(currentPoolOr(TablesLoaderForegroundPoolId), startup_database_task, no_throw);
|
||||||
|
}
|
||||||
|
|
||||||
|
DatabaseTablesIteratorPtr DatabaseOrdinary::getTablesIterator(ContextPtr local_context, const DatabaseOnDisk::FilterByNameFunction & filter_by_table_name) const
|
||||||
|
{
|
||||||
|
auto result = DatabaseWithOwnTablesBase::getTablesIterator(local_context, filter_by_table_name);
|
||||||
|
std::scoped_lock lock(mutex);
|
||||||
|
typeid_cast<DatabaseTablesSnapshotIterator &>(*result).setLoadTasks(startup_table);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DatabaseOrdinary::alterTable(ContextPtr local_context, const StorageID & table_id, const StorageInMemoryMetadata & metadata)
|
void DatabaseOrdinary::alterTable(ContextPtr local_context, const StorageID & table_id, const StorageInMemoryMetadata & metadata)
|
||||||
{
|
{
|
||||||
|
waitDatabaseStarted(false);
|
||||||
|
|
||||||
String table_name = table_id.table_name;
|
String table_name = table_id.table_name;
|
||||||
|
|
||||||
/// Read the definition of the table and replace the necessary parts with new ones.
|
/// Read the definition of the table and replace the necessary parts with new ones.
|
||||||
String table_metadata_path = getObjectMetadataPath(table_name);
|
String table_metadata_path = getObjectMetadataPath(table_name);
|
||||||
String table_metadata_tmp_path = table_metadata_path + ".tmp";
|
String table_metadata_tmp_path = table_metadata_path + ".tmp";
|
||||||
|
@ -27,10 +27,35 @@ public:
|
|||||||
|
|
||||||
void loadTablesMetadata(ContextPtr context, ParsedTablesMetadata & metadata, bool is_startup) override;
|
void loadTablesMetadata(ContextPtr context, ParsedTablesMetadata & metadata, bool is_startup) override;
|
||||||
|
|
||||||
void loadTableFromMetadata(ContextMutablePtr local_context, const String & file_path, const QualifiedTableName & name, const ASTPtr & ast,
|
void loadTableFromMetadata(
|
||||||
|
ContextMutablePtr local_context,
|
||||||
|
const String & file_path,
|
||||||
|
const QualifiedTableName & name,
|
||||||
|
const ASTPtr & ast,
|
||||||
LoadingStrictnessLevel mode) override;
|
LoadingStrictnessLevel mode) override;
|
||||||
|
|
||||||
void startupTables(ThreadPool & thread_pool, LoadingStrictnessLevel mode) override;
|
LoadTaskPtr loadTableFromMetadataAsync(
|
||||||
|
AsyncLoader & async_loader,
|
||||||
|
LoadJobSet load_after,
|
||||||
|
ContextMutablePtr local_context,
|
||||||
|
const String & file_path,
|
||||||
|
const QualifiedTableName & name,
|
||||||
|
const ASTPtr & ast,
|
||||||
|
LoadingStrictnessLevel mode) override;
|
||||||
|
|
||||||
|
LoadTaskPtr startupTableAsync(
|
||||||
|
AsyncLoader & async_loader,
|
||||||
|
LoadJobSet startup_after,
|
||||||
|
const QualifiedTableName & name,
|
||||||
|
LoadingStrictnessLevel mode) override;
|
||||||
|
|
||||||
|
void waitTableStarted(const String & name) const override;
|
||||||
|
|
||||||
|
void waitDatabaseStarted(bool no_throw) const override;
|
||||||
|
|
||||||
|
LoadTaskPtr startupDatabaseAsync(AsyncLoader & async_loader, LoadJobSet startup_after, LoadingStrictnessLevel mode) override;
|
||||||
|
|
||||||
|
DatabaseTablesIteratorPtr getTablesIterator(ContextPtr local_context, const DatabaseOnDisk::FilterByNameFunction & filter_by_table_name) const override;
|
||||||
|
|
||||||
void alterTable(
|
void alterTable(
|
||||||
ContextPtr context,
|
ContextPtr context,
|
||||||
@ -48,6 +73,13 @@ protected:
|
|||||||
ContextPtr query_context);
|
ContextPtr query_context);
|
||||||
|
|
||||||
Strings permanently_detached_tables;
|
Strings permanently_detached_tables;
|
||||||
|
|
||||||
|
std::unordered_map<String, LoadTaskPtr> load_table TSA_GUARDED_BY(mutex);
|
||||||
|
std::unordered_map<String, LoadTaskPtr> startup_table TSA_GUARDED_BY(mutex);
|
||||||
|
LoadTaskPtr startup_database_task;
|
||||||
|
std::atomic<size_t> total_tables_to_startup{0};
|
||||||
|
std::atomic<size_t> tables_started{0};
|
||||||
|
AtomicStopwatch startup_watch;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include <Common/ZooKeeper/KeeperException.h>
|
#include <Common/ZooKeeper/KeeperException.h>
|
||||||
#include <Common/ZooKeeper/Types.h>
|
#include <Common/ZooKeeper/Types.h>
|
||||||
#include <Common/ZooKeeper/ZooKeeper.h>
|
#include <Common/ZooKeeper/ZooKeeper.h>
|
||||||
|
#include <Common/PoolId.h>
|
||||||
#include <Databases/DatabaseReplicated.h>
|
#include <Databases/DatabaseReplicated.h>
|
||||||
#include <Databases/DatabaseReplicatedWorker.h>
|
#include <Databases/DatabaseReplicatedWorker.h>
|
||||||
#include <Databases/DDLDependencyVisitor.h>
|
#include <Databases/DDLDependencyVisitor.h>
|
||||||
@ -533,41 +534,54 @@ void DatabaseReplicated::createReplicaNodesInZooKeeper(const zkutil::ZooKeeperPt
|
|||||||
createEmptyLogEntry(current_zookeeper);
|
createEmptyLogEntry(current_zookeeper);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DatabaseReplicated::beforeLoadingMetadata(ContextMutablePtr /*context*/, LoadingStrictnessLevel mode)
|
void DatabaseReplicated::beforeLoadingMetadata(ContextMutablePtr context_, LoadingStrictnessLevel mode)
|
||||||
{
|
{
|
||||||
|
DatabaseAtomic::beforeLoadingMetadata(context_, mode);
|
||||||
tryConnectToZooKeeperAndInitDatabase(mode);
|
tryConnectToZooKeeperAndInitDatabase(mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DatabaseReplicated::loadStoredObjects(ContextMutablePtr local_context, LoadingStrictnessLevel mode)
|
|
||||||
{
|
|
||||||
beforeLoadingMetadata(local_context, mode);
|
|
||||||
DatabaseAtomic::loadStoredObjects(local_context, mode);
|
|
||||||
}
|
|
||||||
|
|
||||||
UInt64 DatabaseReplicated::getMetadataHash(const String & table_name) const
|
UInt64 DatabaseReplicated::getMetadataHash(const String & table_name) const
|
||||||
{
|
{
|
||||||
return DB::getMetadataHash(table_name, readMetadataFile(table_name));
|
return DB::getMetadataHash(table_name, readMetadataFile(table_name));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DatabaseReplicated::startupTables(ThreadPool & thread_pool, LoadingStrictnessLevel mode)
|
LoadTaskPtr DatabaseReplicated::startupDatabaseAsync(AsyncLoader & async_loader, LoadJobSet startup_after, LoadingStrictnessLevel mode)
|
||||||
{
|
{
|
||||||
DatabaseAtomic::startupTables(thread_pool, mode);
|
auto base = DatabaseAtomic::startupDatabaseAsync(async_loader, std::move(startup_after), mode);
|
||||||
|
auto job = makeLoadJob(
|
||||||
|
base->goals(),
|
||||||
|
TablesLoaderBackgroundStartupPoolId,
|
||||||
|
fmt::format("startup Replicated database {}", getDatabaseName()),
|
||||||
|
[this] (AsyncLoader &, const LoadJobPtr &)
|
||||||
|
{
|
||||||
|
UInt64 digest = 0;
|
||||||
|
{
|
||||||
|
std::lock_guard lock{mutex};
|
||||||
|
for (const auto & table : tables)
|
||||||
|
digest += getMetadataHash(table.first);
|
||||||
|
LOG_DEBUG(log, "Calculated metadata digest of {} tables: {}", tables.size(), digest);
|
||||||
|
}
|
||||||
|
|
||||||
/// TSA: No concurrent writes are possible during loading
|
{
|
||||||
UInt64 digest = 0;
|
std::lock_guard lock{metadata_mutex};
|
||||||
for (const auto & table : TSA_SUPPRESS_WARNING_FOR_READ(tables))
|
chassert(!tables_metadata_digest);
|
||||||
digest += getMetadataHash(table.first);
|
tables_metadata_digest = digest;
|
||||||
|
}
|
||||||
|
|
||||||
LOG_DEBUG(log, "Calculated metadata digest of {} tables: {}", TSA_SUPPRESS_WARNING_FOR_READ(tables).size(), digest);
|
if (is_probably_dropped)
|
||||||
chassert(!TSA_SUPPRESS_WARNING_FOR_READ(tables_metadata_digest));
|
return;
|
||||||
TSA_SUPPRESS_WARNING_FOR_WRITE(tables_metadata_digest) = digest;
|
|
||||||
|
|
||||||
if (is_probably_dropped)
|
ddl_worker = std::make_unique<DatabaseReplicatedDDLWorker>(this, getContext());
|
||||||
return;
|
ddl_worker->startup();
|
||||||
|
ddl_worker_initialized = true;
|
||||||
|
});
|
||||||
|
return startup_replicated_database_task = makeLoadTask(async_loader, {job});
|
||||||
|
}
|
||||||
|
|
||||||
ddl_worker = std::make_unique<DatabaseReplicatedDDLWorker>(this, getContext());
|
void DatabaseReplicated::waitDatabaseStarted(bool no_throw) const
|
||||||
ddl_worker->startup();
|
{
|
||||||
ddl_worker_initialized = true;
|
if (startup_replicated_database_task)
|
||||||
|
waitLoad(currentPoolOr(TablesLoaderForegroundPoolId), startup_replicated_database_task, no_throw);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DatabaseReplicated::checkDigestValid(const ContextPtr & local_context, bool debug_check /* = true */) const
|
bool DatabaseReplicated::checkDigestValid(const ContextPtr & local_context, bool debug_check /* = true */) const
|
||||||
@ -728,6 +742,7 @@ void DatabaseReplicated::checkQueryValid(const ASTPtr & query, ContextPtr query_
|
|||||||
|
|
||||||
BlockIO DatabaseReplicated::tryEnqueueReplicatedDDL(const ASTPtr & query, ContextPtr query_context, QueryFlags flags)
|
BlockIO DatabaseReplicated::tryEnqueueReplicatedDDL(const ASTPtr & query, ContextPtr query_context, QueryFlags flags)
|
||||||
{
|
{
|
||||||
|
waitDatabaseStarted(false);
|
||||||
|
|
||||||
if (query_context->getCurrentTransaction() && query_context->getSettingsRef().throw_on_unsupported_query_inside_transaction)
|
if (query_context->getCurrentTransaction() && query_context->getSettingsRef().throw_on_unsupported_query_inside_transaction)
|
||||||
throw Exception(ErrorCodes::NOT_IMPLEMENTED, "Distributed DDL queries inside transactions are not supported");
|
throw Exception(ErrorCodes::NOT_IMPLEMENTED, "Distributed DDL queries inside transactions are not supported");
|
||||||
@ -791,6 +806,8 @@ static UUID getTableUUIDIfReplicated(const String & metadata, ContextPtr context
|
|||||||
|
|
||||||
void DatabaseReplicated::recoverLostReplica(const ZooKeeperPtr & current_zookeeper, UInt32 our_log_ptr, UInt32 & max_log_ptr)
|
void DatabaseReplicated::recoverLostReplica(const ZooKeeperPtr & current_zookeeper, UInt32 our_log_ptr, UInt32 & max_log_ptr)
|
||||||
{
|
{
|
||||||
|
waitDatabaseStarted(false);
|
||||||
|
|
||||||
is_recovering = true;
|
is_recovering = true;
|
||||||
SCOPE_EXIT({ is_recovering = false; });
|
SCOPE_EXIT({ is_recovering = false; });
|
||||||
|
|
||||||
@ -1233,6 +1250,8 @@ void DatabaseReplicated::drop(ContextPtr context_)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
waitDatabaseStarted(false);
|
||||||
|
|
||||||
auto current_zookeeper = getZooKeeper();
|
auto current_zookeeper = getZooKeeper();
|
||||||
current_zookeeper->set(replica_path, DROPPED_MARK, -1);
|
current_zookeeper->set(replica_path, DROPPED_MARK, -1);
|
||||||
createEmptyLogEntry(current_zookeeper);
|
createEmptyLogEntry(current_zookeeper);
|
||||||
@ -1250,6 +1269,7 @@ void DatabaseReplicated::drop(ContextPtr context_)
|
|||||||
|
|
||||||
void DatabaseReplicated::stopReplication()
|
void DatabaseReplicated::stopReplication()
|
||||||
{
|
{
|
||||||
|
waitDatabaseStarted(/* no_throw = */ true);
|
||||||
if (ddl_worker)
|
if (ddl_worker)
|
||||||
ddl_worker->shutdown();
|
ddl_worker->shutdown();
|
||||||
}
|
}
|
||||||
@ -1265,6 +1285,8 @@ void DatabaseReplicated::shutdown()
|
|||||||
|
|
||||||
void DatabaseReplicated::dropTable(ContextPtr local_context, const String & table_name, bool sync)
|
void DatabaseReplicated::dropTable(ContextPtr local_context, const String & table_name, bool sync)
|
||||||
{
|
{
|
||||||
|
waitDatabaseStarted(false);
|
||||||
|
|
||||||
auto txn = local_context->getZooKeeperMetadataTransaction();
|
auto txn = local_context->getZooKeeperMetadataTransaction();
|
||||||
assert(!ddl_worker || !ddl_worker->isCurrentlyActive() || txn || startsWith(table_name, ".inner_id."));
|
assert(!ddl_worker || !ddl_worker->isCurrentlyActive() || txn || startsWith(table_name, ".inner_id."));
|
||||||
if (txn && txn->isInitialQuery() && !txn->isCreateOrReplaceQuery())
|
if (txn && txn->isInitialQuery() && !txn->isCreateOrReplaceQuery())
|
||||||
@ -1307,6 +1329,8 @@ void DatabaseReplicated::renameTable(ContextPtr local_context, const String & ta
|
|||||||
if (exchange && !to_database.isTableExist(to_table_name, local_context))
|
if (exchange && !to_database.isTableExist(to_table_name, local_context))
|
||||||
throw Exception(ErrorCodes::UNKNOWN_TABLE, "Table {} does not exist", to_table_name);
|
throw Exception(ErrorCodes::UNKNOWN_TABLE, "Table {} does not exist", to_table_name);
|
||||||
|
|
||||||
|
waitDatabaseStarted(false);
|
||||||
|
|
||||||
String statement = readMetadataFile(table_name);
|
String statement = readMetadataFile(table_name);
|
||||||
String statement_to;
|
String statement_to;
|
||||||
if (exchange)
|
if (exchange)
|
||||||
@ -1407,6 +1431,8 @@ bool DatabaseReplicated::canExecuteReplicatedMetadataAlter() const
|
|||||||
|
|
||||||
void DatabaseReplicated::detachTablePermanently(ContextPtr local_context, const String & table_name)
|
void DatabaseReplicated::detachTablePermanently(ContextPtr local_context, const String & table_name)
|
||||||
{
|
{
|
||||||
|
waitDatabaseStarted(false);
|
||||||
|
|
||||||
auto txn = local_context->getZooKeeperMetadataTransaction();
|
auto txn = local_context->getZooKeeperMetadataTransaction();
|
||||||
assert(!ddl_worker->isCurrentlyActive() || txn);
|
assert(!ddl_worker->isCurrentlyActive() || txn);
|
||||||
if (txn && txn->isInitialQuery())
|
if (txn && txn->isInitialQuery())
|
||||||
@ -1430,6 +1456,8 @@ void DatabaseReplicated::detachTablePermanently(ContextPtr local_context, const
|
|||||||
|
|
||||||
void DatabaseReplicated::removeDetachedPermanentlyFlag(ContextPtr local_context, const String & table_name, const String & table_metadata_path, bool attach)
|
void DatabaseReplicated::removeDetachedPermanentlyFlag(ContextPtr local_context, const String & table_name, const String & table_metadata_path, bool attach)
|
||||||
{
|
{
|
||||||
|
waitDatabaseStarted(false);
|
||||||
|
|
||||||
auto txn = local_context->getZooKeeperMetadataTransaction();
|
auto txn = local_context->getZooKeeperMetadataTransaction();
|
||||||
assert(!ddl_worker->isCurrentlyActive() || txn);
|
assert(!ddl_worker->isCurrentlyActive() || txn);
|
||||||
if (txn && txn->isInitialQuery() && attach)
|
if (txn && txn->isInitialQuery() && attach)
|
||||||
@ -1466,6 +1494,8 @@ String DatabaseReplicated::readMetadataFile(const String & table_name) const
|
|||||||
std::vector<std::pair<ASTPtr, StoragePtr>>
|
std::vector<std::pair<ASTPtr, StoragePtr>>
|
||||||
DatabaseReplicated::getTablesForBackup(const FilterByNameFunction & filter, const ContextPtr &) const
|
DatabaseReplicated::getTablesForBackup(const FilterByNameFunction & filter, const ContextPtr &) const
|
||||||
{
|
{
|
||||||
|
waitDatabaseStarted(false);
|
||||||
|
|
||||||
/// Here we read metadata from ZooKeeper. We could do that by simple call of DatabaseAtomic::getTablesForBackup() however
|
/// Here we read metadata from ZooKeeper. We could do that by simple call of DatabaseAtomic::getTablesForBackup() however
|
||||||
/// reading from ZooKeeper is better because thus we won't be dependent on how fast the replication queue of this database is.
|
/// reading from ZooKeeper is better because thus we won't be dependent on how fast the replication queue of this database is.
|
||||||
auto zookeeper = getContext()->getZooKeeper();
|
auto zookeeper = getContext()->getZooKeeper();
|
||||||
@ -1507,6 +1537,8 @@ void DatabaseReplicated::createTableRestoredFromBackup(
|
|||||||
std::shared_ptr<IRestoreCoordination> restore_coordination,
|
std::shared_ptr<IRestoreCoordination> restore_coordination,
|
||||||
UInt64 timeout_ms)
|
UInt64 timeout_ms)
|
||||||
{
|
{
|
||||||
|
waitDatabaseStarted(false);
|
||||||
|
|
||||||
/// Because of the replication multiple nodes can try to restore the same tables again and failed with "Table already exists"
|
/// Because of the replication multiple nodes can try to restore the same tables again and failed with "Table already exists"
|
||||||
/// because of some table could be restored already on other node and then replicated to this node.
|
/// because of some table could be restored already on other node and then replicated to this node.
|
||||||
/// To solve this problem we use the restore coordination: the first node calls
|
/// To solve this problem we use the restore coordination: the first node calls
|
||||||
|
@ -68,11 +68,9 @@ public:
|
|||||||
|
|
||||||
void drop(ContextPtr /*context*/) override;
|
void drop(ContextPtr /*context*/) override;
|
||||||
|
|
||||||
void loadStoredObjects(ContextMutablePtr context, LoadingStrictnessLevel mode) override;
|
void beforeLoadingMetadata(ContextMutablePtr context_, LoadingStrictnessLevel mode) override;
|
||||||
|
|
||||||
void beforeLoadingMetadata(ContextMutablePtr context, LoadingStrictnessLevel mode) override;
|
LoadTaskPtr startupDatabaseAsync(AsyncLoader & async_loader, LoadJobSet startup_after, LoadingStrictnessLevel mode) override;
|
||||||
|
|
||||||
void startupTables(ThreadPool & thread_pool, LoadingStrictnessLevel mode) override;
|
|
||||||
|
|
||||||
void shutdown() override;
|
void shutdown() override;
|
||||||
|
|
||||||
@ -128,6 +126,8 @@ private:
|
|||||||
UInt64 getMetadataHash(const String & table_name) const;
|
UInt64 getMetadataHash(const String & table_name) const;
|
||||||
bool checkDigestValid(const ContextPtr & local_context, bool debug_check = true) const TSA_REQUIRES(metadata_mutex);
|
bool checkDigestValid(const ContextPtr & local_context, bool debug_check = true) const TSA_REQUIRES(metadata_mutex);
|
||||||
|
|
||||||
|
void waitDatabaseStarted(bool no_throw) const override;
|
||||||
|
|
||||||
String zookeeper_path;
|
String zookeeper_path;
|
||||||
String shard_name;
|
String shard_name;
|
||||||
String replica_name;
|
String replica_name;
|
||||||
@ -154,6 +154,8 @@ private:
|
|||||||
UInt64 tables_metadata_digest TSA_GUARDED_BY(metadata_mutex);
|
UInt64 tables_metadata_digest TSA_GUARDED_BY(metadata_mutex);
|
||||||
|
|
||||||
mutable ClusterPtr cluster;
|
mutable ClusterPtr cluster;
|
||||||
|
|
||||||
|
LoadTaskPtr startup_replicated_database_task;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -198,11 +198,8 @@ bool DatabaseWithOwnTablesBase::isTableExist(const String & table_name, ContextP
|
|||||||
|
|
||||||
StoragePtr DatabaseWithOwnTablesBase::tryGetTable(const String & table_name, ContextPtr) const
|
StoragePtr DatabaseWithOwnTablesBase::tryGetTable(const String & table_name, ContextPtr) const
|
||||||
{
|
{
|
||||||
std::lock_guard lock(mutex);
|
waitTableStarted(table_name);
|
||||||
auto it = tables.find(table_name);
|
return tryGetTableNoWait(table_name);
|
||||||
if (it != tables.end())
|
|
||||||
return it->second;
|
|
||||||
return {};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DatabaseTablesIteratorPtr DatabaseWithOwnTablesBase::getTablesIterator(ContextPtr, const FilterByNameFunction & filter_by_table_name) const
|
DatabaseTablesIteratorPtr DatabaseWithOwnTablesBase::getTablesIterator(ContextPtr, const FilterByNameFunction & filter_by_table_name) const
|
||||||
@ -381,4 +378,13 @@ void DatabaseWithOwnTablesBase::createTableRestoredFromBackup(const ASTPtr & cre
|
|||||||
interpreter.execute();
|
interpreter.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StoragePtr DatabaseWithOwnTablesBase::tryGetTableNoWait(const String & table_name) const
|
||||||
|
{
|
||||||
|
std::lock_guard lock(mutex);
|
||||||
|
auto it = tables.find(table_name);
|
||||||
|
if (it != tables.end())
|
||||||
|
return it->second;
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user