diff --git a/.github/workflows/backport_branches.yml b/.github/workflows/backport_branches.yml
index e1980ec9ef2..64c3d2f8342 100644
--- a/.github/workflows/backport_branches.yml
+++ b/.github/workflows/backport_branches.yml
@@ -159,33 +159,24 @@ jobs:
############################################################################################
##################################### BUILD REPORTER #######################################
############################################################################################
- BuilderReport:
+ Builds_Report:
# run report check for failed builds to indicate the CI error
- if: ${{ !cancelled() }}
- needs:
- - RunConfig
- - BuilderDebAarch64
- - BuilderDebAsan
- - BuilderDebDebug
- - BuilderDebRelease
- - BuilderDebTsan
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: ClickHouse build check
- runner_type: style-checker-aarch64
- data: ${{ needs.RunConfig.outputs.data }}
- BuilderSpecialReport:
- # run report check for failed builds to indicate the CI error
- if: ${{ !cancelled() }}
- needs:
- - RunConfig
- - BuilderBinDarwin
- - BuilderBinDarwinAarch64
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: ClickHouse special build check
- runner_type: style-checker-aarch64
- data: ${{ needs.RunConfig.outputs.data }}
+ if: ${{ !cancelled() && needs.RunConfig.result == 'success' && contains(fromJson(needs.RunConfig.outputs.data).jobs_data.jobs_to_do, 'Builds') }}
+ needs: [RunConfig, BuilderDebAarch64, BuilderDebAsan, BuilderDebDebug, BuilderDebRelease, BuilderDebTsan, BuilderBinDarwin, BuilderBinDarwinAarch64]
+ runs-on: [self-hosted, style-checker-aarch64]
+ steps:
+ - name: Check out repository code
+ uses: ClickHouse/checkout@v1
+ - name: Download reports
+ run: |
+ python3 "$GITHUB_WORKSPACE/tests/ci/ci.py" --infile ${{ toJson(needs.RunConfig.outputs.data) }} --pre --job-name Builds
+ - name: Builds report
+ run: |
+ cd "$GITHUB_WORKSPACE/tests/ci"
+ python3 ./build_report_check.py --reports package_release package_aarch64 package_asan package_tsan package_debug binary_darwin binary_darwin_aarch64
+ - name: Set status
+ run: |
+ python3 "$GITHUB_WORKSPACE/tests/ci/ci.py" --infile ${{ toJson(needs.RunConfig.outputs.data) }} --post --job-name Builds
############################################################################################
#################################### INSTALL PACKAGES ######################################
############################################################################################
@@ -256,8 +247,7 @@ jobs:
FinishCheck:
if: ${{ !failure() && !cancelled() }}
needs:
- - BuilderReport
- - BuilderSpecialReport
+ - Builds_Report
- FunctionalStatelessTestAsan
- FunctionalStatefulTestDebug
- StressTestTsan
@@ -273,5 +263,8 @@ jobs:
- name: Finish label
run: |
cd "$GITHUB_WORKSPACE/tests/ci"
+ # update mergeable check
+ python3 merge_pr.py --set-ci-status --wf-status ${{ contains(needs.*.result, 'failure') && 'failure' || 'success' }}
+ # update overall ci report
python3 finish_check.py --wf-status ${{ contains(needs.*.result, 'failure') && 'failure' || 'success' }}
python3 merge_pr.py
diff --git a/.github/workflows/create_release.yml b/.github/workflows/create_release.yml
new file mode 100644
index 00000000000..3988df3b2b1
--- /dev/null
+++ b/.github/workflows/create_release.yml
@@ -0,0 +1,29 @@
+name: CreateRelease
+
+concurrency:
+ group: release
+
+'on':
+ workflow_dispatch:
+ inputs:
+ sha:
+ description: 'The SHA hash of the commit from which to create the release'
+ required: true
+ type: string
+ type:
+ description: 'The type of release: "new" for a new release or "patch" for a patch release'
+ required: true
+ type: choice
+ options:
+ - new
+ - patch
+
+jobs:
+ Release:
+ runs-on: [self-hosted, style-checker-aarch64]
+ steps:
+ - name: Check out repository code
+ uses: ClickHouse/checkout@v1
+ - name: Print greeting
+ run: |
+ python3 ./tests/ci/release.py --commit ${{ inputs.sha }} --type ${{ inputs.type }} --dry-run
diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml
index 384bf6825f9..2a7e6f737ab 100644
--- a/.github/workflows/master.yml
+++ b/.github/workflows/master.yml
@@ -117,11 +117,11 @@ jobs:
# Reports should run even if Builds_1/2 fail - run them separately, not in Tests_1/2/3
Builds_Report:
# run report check for failed builds to indicate the CI error
- if: ${{ !cancelled() && needs.RunConfig.result == 'success' && contains(fromJson(needs.RunConfig.outputs.data).jobs_data.jobs_to_do, 'ClickHouse build check') }}
+ if: ${{ !cancelled() && needs.RunConfig.result == 'success' && contains(fromJson(needs.RunConfig.outputs.data).jobs_data.jobs_to_do, 'Builds') }}
needs: [RunConfig, Builds_1, Builds_2]
uses: ./.github/workflows/reusable_test.yml
with:
- test_name: ClickHouse build check
+ test_name: Builds
runner_type: style-checker-aarch64
data: ${{ needs.RunConfig.outputs.data }}
diff --git a/.github/workflows/merge_queue.yml b/.github/workflows/merge_queue.yml
index cfa01b0e8f3..01685ee1f5a 100644
--- a/.github/workflows/merge_queue.yml
+++ b/.github/workflows/merge_queue.yml
@@ -96,20 +96,15 @@ jobs:
stage: Tests_1
data: ${{ needs.RunConfig.outputs.data }}
- ################################# Stage Final #################################
- #
- FinishCheck:
- if: ${{ !cancelled() }}
+ CheckReadyForMerge:
+ if: ${{ !cancelled() && needs.StyleCheck.result == 'success' }}
+ # Test_2 or Test_3 must not have jobs required for Mergeable check
needs: [RunConfig, BuildDockers, StyleCheck, FastTest, Builds_1, Tests_1]
runs-on: [self-hosted, style-checker-aarch64]
steps:
- name: Check out repository code
uses: ClickHouse/checkout@v1
- - name: Check sync status
+ - name: Check and set merge status
run: |
cd "$GITHUB_WORKSPACE/tests/ci"
- python3 sync_pr.py --status
- - name: Finish label
- run: |
- cd "$GITHUB_WORKSPACE/tests/ci"
- python3 finish_check.py --wf-status ${{ contains(needs.*.result, 'failure') && 'failure' || 'success' }}
+ python3 merge_pr.py --set-ci-status --wf-status ${{ contains(needs.*.result, 'failure') && 'failure' || 'success' }}
diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml
index 84dd4222e36..4764e6d3c1a 100644
--- a/.github/workflows/pull_request.yml
+++ b/.github/workflows/pull_request.yml
@@ -146,11 +146,11 @@ jobs:
# Reports should run even if Builds_1/2 fail - run them separately (not in Tests_1/2/3)
Builds_Report:
# run report check for failed builds to indicate the CI error
- if: ${{ !cancelled() && needs.RunConfig.result == 'success' && contains(fromJson(needs.RunConfig.outputs.data).jobs_data.jobs_to_do, 'ClickHouse build check') }}
+ if: ${{ !cancelled() && needs.RunConfig.result == 'success' && contains(fromJson(needs.RunConfig.outputs.data).jobs_data.jobs_to_do, 'Builds') }}
needs: [RunConfig, StyleCheck, Builds_1, Builds_2]
uses: ./.github/workflows/reusable_test.yml
with:
- test_name: ClickHouse build check
+ test_name: Builds
runner_type: style-checker-aarch64
data: ${{ needs.RunConfig.outputs.data }}
diff --git a/.github/workflows/release_branches.yml b/.github/workflows/release_branches.yml
index 45eb7431bb4..6bf846d7535 100644
--- a/.github/workflows/release_branches.yml
+++ b/.github/workflows/release_branches.yml
@@ -176,35 +176,24 @@ jobs:
############################################################################################
##################################### BUILD REPORTER #######################################
############################################################################################
- BuilderReport:
+ Builds_Report:
# run report check for failed builds to indicate the CI error
- if: ${{ !cancelled() }}
- needs:
- - RunConfig
- - BuilderDebRelease
- - BuilderDebAarch64
- - BuilderDebAsan
- - BuilderDebTsan
- - BuilderDebUBsan
- - BuilderDebMsan
- - BuilderDebDebug
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: ClickHouse build check
- runner_type: style-checker-aarch64
- data: ${{ needs.RunConfig.outputs.data }}
- BuilderSpecialReport:
- # run report check for failed builds to indicate the CI error
- if: ${{ !cancelled() }}
- needs:
- - RunConfig
- - BuilderBinDarwin
- - BuilderBinDarwinAarch64
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: ClickHouse special build check
- runner_type: style-checker-aarch64
- data: ${{ needs.RunConfig.outputs.data }}
+ if: ${{ !cancelled() && needs.RunConfig.result == 'success' && contains(fromJson(needs.RunConfig.outputs.data).jobs_data.jobs_to_do, 'Builds') }}
+ needs: [RunConfig, BuilderDebRelease, BuilderDebAarch64, BuilderDebAsan, BuilderDebUBsan, BuilderDebMsan, BuilderDebTsan, BuilderDebDebug, BuilderBinDarwin, BuilderBinDarwinAarch64]
+ runs-on: [self-hosted, style-checker-aarch64]
+ steps:
+ - name: Check out repository code
+ uses: ClickHouse/checkout@v1
+ - name: Download reports
+ run: |
+ python3 "$GITHUB_WORKSPACE/tests/ci/ci.py" --infile ${{ toJson(needs.RunConfig.outputs.data) }} --pre --job-name Builds
+ - name: Builds report
+ run: |
+ cd "$GITHUB_WORKSPACE/tests/ci"
+ python3 ./build_report_check.py --reports package_release package_aarch64 package_asan package_msan package_ubsan package_tsan package_debug binary_darwin binary_darwin_aarch64
+ - name: Set status
+ run: |
+ python3 "$GITHUB_WORKSPACE/tests/ci/ci.py" --infile ${{ toJson(needs.RunConfig.outputs.data) }} --post --job-name Builds
MarkReleaseReady:
if: ${{ !failure() && !cancelled() }}
needs:
@@ -460,8 +449,7 @@ jobs:
needs:
- DockerServerImage
- DockerKeeperImage
- - BuilderReport
- - BuilderSpecialReport
+ - Builds_Report
- MarkReleaseReady
- FunctionalStatelessTestDebug
- FunctionalStatelessTestRelease
@@ -496,4 +484,7 @@ jobs:
- name: Finish label
run: |
cd "$GITHUB_WORKSPACE/tests/ci"
+ # update mergeable check
+ python3 merge_pr.py --set-ci-status --wf-status ${{ contains(needs.*.result, 'failure') && 'failure' || 'success' }}
+ # update overall ci report
python3 finish_check.py --wf-status ${{ contains(needs.*.result, 'failure') && 'failure' || 'success' }}
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ddff2f7cdc5..19258f469c2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,5 @@
### Table of Contents
-**[ClickHouse release v24.6, 2024-06-27](#246)**
+**[ClickHouse release v24.6, 2024-06-30](#246)**
**[ClickHouse release v24.5, 2024-05-30](#245)**
**[ClickHouse release v24.4, 2024-04-30](#244)**
**[ClickHouse release v24.3 LTS, 2024-03-26](#243)**
@@ -9,107 +9,105 @@
# 2024 Changelog
-### ClickHouse release 24.6, 2024-06-27
+### ClickHouse release 24.6, 2024-06-30
#### Backward Incompatible Change
* Enable asynchronous load of databases and tables by default. See the `async_load_databases` in config.xml. While this change is fully compatible, it can introduce a difference in behavior. When `async_load_databases` is false, as in the previous versions, the server will not accept connections until all tables are loaded. When `async_load_databases` is true, as in the new version, the server can accept connections before all the tables are loaded. If a query is made to a table that is not yet loaded, it will wait for the table's loading, which can take considerable time. It can change the behavior of the server if it is part of a large distributed system under a load balancer. In the first case, the load balancer can get a connection refusal and quickly failover to another server. In the second case, the load balancer can connect to a server that is still loading the tables, and the query will have a higher latency. Moreover, if many queries accumulate in the waiting state, it can lead to a "thundering herd" problem when they start processing simultaneously. This can make a difference only for highly loaded distributed backends. You can set the value of `async_load_databases` to false to avoid this problem. [#57695](https://github.com/ClickHouse/ClickHouse/pull/57695) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
+* Setting `replace_long_file_name_to_hash` is enabled by default for `MergeTree` tables. [#64457](https://github.com/ClickHouse/ClickHouse/pull/64457) ([Anton Popov](https://github.com/CurtizJ)). This setting is fully compatible, and no actions needed during upgrade. The new data format is supported from all versions starting from 23.9. After enabling this setting, you can no longer downgrade to a version 23.8 or older.
* Some invalid queries will fail earlier during parsing. Note: disabled the support for inline KQL expressions (the experimental Kusto language) when they are put into a `kql` table function without a string literal, e.g. `kql(garbage | trash)` instead of `kql('garbage | trash')` or `kql($$garbage | trash$$)`. This feature was introduced unintentionally and should not exist. [#61500](https://github.com/ClickHouse/ClickHouse/pull/61500) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
* Rework parallel processing in `Ordered` mode of storage `S3Queue`. This PR is backward incompatible for Ordered mode if you used settings `s3queue_processing_threads_num` or `s3queue_total_shards_num`. Setting `s3queue_total_shards_num` is deleted, previously it was allowed to use only under `s3queue_allow_experimental_sharded_mode`, which is now deprecated. A new setting is added - `s3queue_buckets`. [#64349](https://github.com/ClickHouse/ClickHouse/pull/64349) ([Kseniia Sumarokova](https://github.com/kssenii)).
* New functions `snowflakeIDToDateTime`, `snowflakeIDToDateTime64`, `dateTimeToSnowflakeID`, and `dateTime64ToSnowflakeID` were added. Unlike the existing functions `snowflakeToDateTime`, `snowflakeToDateTime64`, `dateTimeToSnowflake`, and `dateTime64ToSnowflake`, the new functions are compatible with function `generateSnowflakeID`, i.e. they accept the snowflake IDs generated by `generateSnowflakeID` and produce snowflake IDs of the same type as `generateSnowflakeID` (i.e. `UInt64`). Furthermore, the new functions default to the UNIX epoch (aka. 1970-01-01), just like `generateSnowflakeID`. If necessary, a different epoch, e.g. Twitter's/X's epoch 2010-11-04 aka. 1288834974657 msec since UNIX epoch, can be passed. The old conversion functions are deprecated and will be removed after a transition period: to use them regardless, enable setting `allow_deprecated_snowflake_conversion_functions`. [#64948](https://github.com/ClickHouse/ClickHouse/pull/64948) ([Robert Schulze](https://github.com/rschu1ze)).
#### New Feature
-* Introduce statistics of type "number of distinct values". [#59357](https://github.com/ClickHouse/ClickHouse/pull/59357) ([Han Fei](https://github.com/hanfei1991)).
+* Allow to store named collections in ClickHouse Keeper. [#64574](https://github.com/ClickHouse/ClickHouse/pull/64574) ([Kseniia Sumarokova](https://github.com/kssenii)).
+* Support empty tuples. [#55061](https://github.com/ClickHouse/ClickHouse/pull/55061) ([Amos Bird](https://github.com/amosbird)).
* Add Hilbert Curve encode and decode functions. [#60156](https://github.com/ClickHouse/ClickHouse/pull/60156) ([Artem Mustafin](https://github.com/Artemmm91)).
-* Added support for reading LINESTRING geometry in WKT format using function `readWKTLineString`. [#62519](https://github.com/ClickHouse/ClickHouse/pull/62519) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)).
-* Allow to attach parts from a different disk. [#63087](https://github.com/ClickHouse/ClickHouse/pull/63087) ([Unalian](https://github.com/Unalian)).
-* Allow proxy to be bypassed for hosts specified in `no_proxy` env variable and ClickHouse proxy configuration. [#63314](https://github.com/ClickHouse/ClickHouse/pull/63314) ([Arthur Passos](https://github.com/arthurpassos)).
-* Added a new table function `loop` to support returning query results in an infinite loop. [#63452](https://github.com/ClickHouse/ClickHouse/pull/63452) ([Sariel](https://github.com/sarielwxm)).
-* Added new SQL functions `generateSnowflakeID` for generating Twitter-style Snowflake IDs. [#63577](https://github.com/ClickHouse/ClickHouse/pull/63577) ([Danila Puzov](https://github.com/kazalika)).
-* Add the ability to reshuffle rows during insert to optimize for size without violating the order set by `PRIMARY KEY`. It's controlled by the setting `optimize_row_order` (off by default). [#63578](https://github.com/ClickHouse/ClickHouse/pull/63578) ([Igor Markelov](https://github.com/ElderlyPassionFruit)).
-* Added `merge_workload` and `mutation_workload` settings to regulate how resources are utilized and shared between merges, mutations and other workloads. [#64061](https://github.com/ClickHouse/ClickHouse/pull/64061) ([Sergei Trifonov](https://github.com/serxa)).
-* Add support for comparing IPv4 and IPv6 types using the `=` operator. [#64292](https://github.com/ClickHouse/ClickHouse/pull/64292) ([Francisco J. Jurado Moreno](https://github.com/Beetelbrox)).
-* Allow to store named collections in zookeeper. [#64574](https://github.com/ClickHouse/ClickHouse/pull/64574) ([Kseniia Sumarokova](https://github.com/kssenii)).
-* Support decimal arguments in binary math functions (pow(), atan2(), max2, min2(), hypot(). [#64582](https://github.com/ClickHouse/ClickHouse/pull/64582) ([Mikhail Gorshkov](https://github.com/mgorshkov)).
* Add support for index analysis over `hilbertEncode`. [#64662](https://github.com/ClickHouse/ClickHouse/pull/64662) ([Artem Mustafin](https://github.com/Artemmm91)).
+* Added support for reading `LINESTRING` geometry in the WKT format using function `readWKTLineString`. [#62519](https://github.com/ClickHouse/ClickHouse/pull/62519) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)).
+* Allow to attach parts from a different disk. [#63087](https://github.com/ClickHouse/ClickHouse/pull/63087) ([Unalian](https://github.com/Unalian)).
+* Added new SQL functions `generateSnowflakeID` for generating Twitter-style Snowflake IDs. [#63577](https://github.com/ClickHouse/ClickHouse/pull/63577) ([Danila Puzov](https://github.com/kazalika)).
+* Added `merge_workload` and `mutation_workload` settings to regulate how resources are utilized and shared between merges, mutations and other workloads. [#64061](https://github.com/ClickHouse/ClickHouse/pull/64061) ([Sergei Trifonov](https://github.com/serxa)).
+* Add support for comparing `IPv4` and `IPv6` types using the `=` operator. [#64292](https://github.com/ClickHouse/ClickHouse/pull/64292) ([Francisco J. Jurado Moreno](https://github.com/Beetelbrox)).
+* Support decimal arguments in binary math functions (pow, atan2, max2, min2, hypot). [#64582](https://github.com/ClickHouse/ClickHouse/pull/64582) ([Mikhail Gorshkov](https://github.com/mgorshkov)).
* Added SQL functions `parseReadableSize` (along with `OrNull` and `OrZero` variants). [#64742](https://github.com/ClickHouse/ClickHouse/pull/64742) ([Francisco J. Jurado Moreno](https://github.com/Beetelbrox)).
* Add server settings `max_table_num_to_throw` and `max_database_num_to_throw` to limit the number of databases or tables on `CREATE` queries. [#64781](https://github.com/ClickHouse/ClickHouse/pull/64781) ([Xu Jia](https://github.com/XuJia0210)).
-* Add _time virtual column to file alike storages (s3/file/hdfs/url/azureBlobStorage). [#64947](https://github.com/ClickHouse/ClickHouse/pull/64947) ([Ilya Golshtein](https://github.com/ilejn)).
-* Introduced new functions `base64UrlEncode`, `base64UrlDecode` and `tryBase64UrlDecode`. [#64991](https://github.com/ClickHouse/ClickHouse/pull/64991) ([Mikhail Gorshkov](https://github.com/mgorshkov)).
+* Add `_time` virtual column to file alike storages (s3/file/hdfs/url/azureBlobStorage). [#64947](https://github.com/ClickHouse/ClickHouse/pull/64947) ([Ilya Golshtein](https://github.com/ilejn)).
+* Introduced new functions `base64URLEncode`, `base64URLDecode` and `tryBase64URLDecode`. [#64991](https://github.com/ClickHouse/ClickHouse/pull/64991) ([Mikhail Gorshkov](https://github.com/mgorshkov)).
* Add new function `editDistanceUTF8`, which calculates the [edit distance](https://en.wikipedia.org/wiki/Edit_distance) between two UTF8 strings. [#65269](https://github.com/ClickHouse/ClickHouse/pull/65269) ([LiuNeng](https://github.com/liuneng1994)).
+* Add `http_response_headers` setting to support custom response headers in custom HTTP handlers. [#63562](https://github.com/ClickHouse/ClickHouse/pull/63562) ([Grigorii](https://github.com/GSokol)).
+* Added a new table function `loop` to support returning query results in an infinite loop. [#63452](https://github.com/ClickHouse/ClickHouse/pull/63452) ([Sariel](https://github.com/sarielwxm)). This is useful for testing.
+* Introduced two additional columns in the `system.query_log`: `used_privileges` and `missing_privileges`. `used_privileges` is populated with the privileges that were checked during query execution, and `missing_privileges` contains required privileges that are missing. [#64597](https://github.com/ClickHouse/ClickHouse/pull/64597) ([Alexey Katsman](https://github.com/alexkats)).
+* Added a setting `output_format_pretty_display_footer_column_names` which when enabled displays column names at the end of the table for long tables (50 rows by default), with the threshold value for minimum number of rows controlled by `output_format_pretty_display_footer_column_names_min_rows`. [#65144](https://github.com/ClickHouse/ClickHouse/pull/65144) ([Shaun Struwig](https://github.com/Blargian)).
+
+#### Experimental Feature
+* Introduce statistics of type "number of distinct values". [#59357](https://github.com/ClickHouse/ClickHouse/pull/59357) ([Han Fei](https://github.com/hanfei1991)).
+* Support statistics with ReplicatedMergeTree. [#64934](https://github.com/ClickHouse/ClickHouse/pull/64934) ([Han Fei](https://github.com/hanfei1991)).
+* If "replica group" is configured for a `Replicated` database, automatically create a cluster that includes replicas from all groups. [#64312](https://github.com/ClickHouse/ClickHouse/pull/64312) ([Alexander Tokmakov](https://github.com/tavplubix)).
+* Add settings `parallel_replicas_custom_key_range_lower` and `parallel_replicas_custom_key_range_upper` to control how parallel replicas with dynamic shards parallelizes queries when using a range filter. [#64604](https://github.com/ClickHouse/ClickHouse/pull/64604) ([josh-hildred](https://github.com/josh-hildred)).
#### Performance Improvement
+* Add the ability to reshuffle rows during insert to optimize for size without violating the order set by `PRIMARY KEY`. It's controlled by the setting `optimize_row_order` (off by default). [#63578](https://github.com/ClickHouse/ClickHouse/pull/63578) ([Igor Markelov](https://github.com/ElderlyPassionFruit)).
* Add a native parquet reader, which can read parquet binary to ClickHouse Columns directly. It's controlled by the setting `input_format_parquet_use_native_reader` (disabled by default). [#60361](https://github.com/ClickHouse/ClickHouse/pull/60361) ([ZhiHong Zhang](https://github.com/copperybean)).
-* Reduce the number of virtual function calls in ColumnNullable::size(). [#60556](https://github.com/ClickHouse/ClickHouse/pull/60556) ([HappenLee](https://github.com/HappenLee)).
-* Speedup `splitByRegexp` when the regular expression argument is a single-character. [#62696](https://github.com/ClickHouse/ClickHouse/pull/62696) ([Robert Schulze](https://github.com/rschu1ze)).
-* Speed up FixedHashTable by keeping track of the min and max keys used. This allows to reduce the number of cells that need to be verified. [#62746](https://github.com/ClickHouse/ClickHouse/pull/62746) ([Jiebin Sun](https://github.com/jiebinn)).
-* Optimize the resolution of in(LowCardinality, ConstantSet). [#64060](https://github.com/ClickHouse/ClickHouse/pull/64060) ([Zhiguo Zhou](https://github.com/ZhiguoZh)).
-* Use a thread pool to initialize and destroy hash tables inside `ConcurrentHashJoin`. [#64241](https://github.com/ClickHouse/ClickHouse/pull/64241) ([Nikita Taranov](https://github.com/nickitat)).
-* Optimized vertical merges in tables with sparse columns. [#64311](https://github.com/ClickHouse/ClickHouse/pull/64311) ([Anton Popov](https://github.com/CurtizJ)).
-* Enabled prefetches of data from remote filesystem during vertical merges. It improves latency of vertical merges in tables with data stored on remote filesystem. [#64314](https://github.com/ClickHouse/ClickHouse/pull/64314) ([Anton Popov](https://github.com/CurtizJ)).
-* Reduce redundant calls to `isDefault()` of `ColumnSparse::filter` to improve performance. [#64426](https://github.com/ClickHouse/ClickHouse/pull/64426) ([Jiebin Sun](https://github.com/jiebinn)).
-* Speedup `find_super_nodes` and `find_big_family` keeper-client commands by making multiple asynchronous getChildren requests. [#64628](https://github.com/ClickHouse/ClickHouse/pull/64628) ([Alexander Gololobov](https://github.com/davenger)).
-* Improve function least/greatest for nullable numberic type arguments. [#64668](https://github.com/ClickHouse/ClickHouse/pull/64668) ([KevinyhZou](https://github.com/KevinyhZou)).
-* Allow merging two consequent `FilterSteps` of a query plan. This improves filter-push-down optimization if the filter condition can be pushed down from the parent step. [#64760](https://github.com/ClickHouse/ClickHouse/pull/64760) ([Nikolai Kochetov](https://github.com/KochetovNicolai)).
-* Remove bad optimization in vertical final implementation and re-enable vertical final algorithm by default. [#64783](https://github.com/ClickHouse/ClickHouse/pull/64783) ([Duc Canh Le](https://github.com/canhld94)).
-* Remove ALIAS nodes from the filter expression. This slightly improves performance for queries with `PREWHERE` (with new analyzer). [#64793](https://github.com/ClickHouse/ClickHouse/pull/64793) ([Nikolai Kochetov](https://github.com/KochetovNicolai)).
-* Fix performance regression in cross join introduced in [#60459](https://github.com/ClickHouse/ClickHouse/issues/60459) (24.5). [#65243](https://github.com/ClickHouse/ClickHouse/pull/65243) ([Nikita Taranov](https://github.com/nickitat)).
-
-#### Improvement
-* Support empty tuples. [#55061](https://github.com/ClickHouse/ClickHouse/pull/55061) ([Amos Bird](https://github.com/amosbird)).
-* Hot reload storage policy for distributed tables when adding a new disk. [#58285](https://github.com/ClickHouse/ClickHouse/pull/58285) ([Duc Canh Le](https://github.com/canhld94)).
-* Avoid possible deadlock during MergeTree index analysis when scheduling threads in a saturated service. [#59427](https://github.com/ClickHouse/ClickHouse/pull/59427) ([Sean Haynes](https://github.com/seandhaynes)).
* Support partial trivial count optimization when the query filter is able to select exact ranges from merge tree tables. [#60463](https://github.com/ClickHouse/ClickHouse/pull/60463) ([Amos Bird](https://github.com/amosbird)).
* Reduce max memory usage of multithreaded `INSERT`s by collecting chunks of multiple threads in a single transform. [#61047](https://github.com/ClickHouse/ClickHouse/pull/61047) ([Yarik Briukhovetskyi](https://github.com/yariks5s)).
* Reduce the memory usage when using Azure object storage by using fixed memory allocation, avoiding the allocation of an extra buffer. [#63160](https://github.com/ClickHouse/ClickHouse/pull/63160) ([SmitaRKulkarni](https://github.com/SmitaRKulkarni)).
-* Several minor corner case fixes to proxy support & tunneling. [#63427](https://github.com/ClickHouse/ClickHouse/pull/63427) ([Arthur Passos](https://github.com/arthurpassos)).
-* Add `http_response_headers` setting to support custom response headers in custom HTTP handlers. [#63562](https://github.com/ClickHouse/ClickHouse/pull/63562) ([Grigorii](https://github.com/GSokol)).
-* Improve io_uring resubmits visibility. Rename profile event `IOUringSQEsResubmits` -> `IOUringSQEsResubmitsAsync` and add a new one `IOUringSQEsResubmitsSync`. [#63699](https://github.com/ClickHouse/ClickHouse/pull/63699) ([Tomer Shafir](https://github.com/tomershafir)).
-* Introduce assertions to verify all functions are called with columns of the right size. [#63723](https://github.com/ClickHouse/ClickHouse/pull/63723) ([Raúl Marín](https://github.com/Algunenano)).
+* Reduce the number of virtual function calls in `ColumnNullable::size`. [#60556](https://github.com/ClickHouse/ClickHouse/pull/60556) ([HappenLee](https://github.com/HappenLee)).
+* Speedup `splitByRegexp` when the regular expression argument is a single-character. [#62696](https://github.com/ClickHouse/ClickHouse/pull/62696) ([Robert Schulze](https://github.com/rschu1ze)).
+* Speed up aggregation by 8-bit and 16-bit keys by keeping track of the min and max keys used. This allows to reduce the number of cells that need to be verified. [#62746](https://github.com/ClickHouse/ClickHouse/pull/62746) ([Jiebin Sun](https://github.com/jiebinn)).
+* Optimize operator IN when the left hand side is `LowCardinality` and the right is a set of constants. [#64060](https://github.com/ClickHouse/ClickHouse/pull/64060) ([Zhiguo Zhou](https://github.com/ZhiguoZh)).
+* Use a thread pool to initialize and destroy hash tables inside `ConcurrentHashJoin`. [#64241](https://github.com/ClickHouse/ClickHouse/pull/64241) ([Nikita Taranov](https://github.com/nickitat)).
+* Optimized vertical merges in tables with sparse columns. [#64311](https://github.com/ClickHouse/ClickHouse/pull/64311) ([Anton Popov](https://github.com/CurtizJ)).
+* Enabled prefetches of data from remote filesystem during vertical merges. It improves latency of vertical merges in tables with data stored on remote filesystem. [#64314](https://github.com/ClickHouse/ClickHouse/pull/64314) ([Anton Popov](https://github.com/CurtizJ)).
+* Reduce redundant calls to `isDefault` of `ColumnSparse::filter` to improve performance. [#64426](https://github.com/ClickHouse/ClickHouse/pull/64426) ([Jiebin Sun](https://github.com/jiebinn)).
+* Speedup `find_super_nodes` and `find_big_family` keeper-client commands by making multiple asynchronous getChildren requests. [#64628](https://github.com/ClickHouse/ClickHouse/pull/64628) ([Alexander Gololobov](https://github.com/davenger)).
+* Improve function `least`/`greatest` for nullable numberic type arguments. [#64668](https://github.com/ClickHouse/ClickHouse/pull/64668) ([KevinyhZou](https://github.com/KevinyhZou)).
+* Allow merging two consequent filtering steps of a query plan. This improves filter-push-down optimization if the filter condition can be pushed down from the parent step. [#64760](https://github.com/ClickHouse/ClickHouse/pull/64760) ([Nikolai Kochetov](https://github.com/KochetovNicolai)).
+* Remove bad optimization in the vertical final implementation and re-enable vertical final algorithm by default. [#64783](https://github.com/ClickHouse/ClickHouse/pull/64783) ([Duc Canh Le](https://github.com/canhld94)).
+* Remove ALIAS nodes from the filter expression. This slightly improves performance for queries with `PREWHERE` (with the new analyzer). [#64793](https://github.com/ClickHouse/ClickHouse/pull/64793) ([Nikolai Kochetov](https://github.com/KochetovNicolai)).
+* Re-enable OpenSSL session caching. [#65111](https://github.com/ClickHouse/ClickHouse/pull/65111) ([Robert Schulze](https://github.com/rschu1ze)).
+* Added settings to disable materialization of skip indexes and statistics on inserts (`materialize_skip_indexes_on_insert` and `materialize_statistics_on_insert`). [#64391](https://github.com/ClickHouse/ClickHouse/pull/64391) ([Anton Popov](https://github.com/CurtizJ)).
+* Use the allocated memory size to calculate the row group size and reduce the peak memory of the parquet writer in the single-threaded mode. [#64424](https://github.com/ClickHouse/ClickHouse/pull/64424) ([LiuNeng](https://github.com/liuneng1994)).
+* Improve the iterator of sparse column to reduce call of `size`. [#64497](https://github.com/ClickHouse/ClickHouse/pull/64497) ([Jiebin Sun](https://github.com/jiebinn)).
+* Update condition to use server-side copy for backups to Azure blob storage. [#64518](https://github.com/ClickHouse/ClickHouse/pull/64518) ([SmitaRKulkarni](https://github.com/SmitaRKulkarni)).
+* Optimized memory usage of vertical merges for tables with high number of skip indexes. [#64580](https://github.com/ClickHouse/ClickHouse/pull/64580) ([Anton Popov](https://github.com/CurtizJ)).
+
+#### Improvement
* `SHOW CREATE TABLE` executed on top of system tables will now show the super handy comment unique for each table which will explain why this table is needed. [#63788](https://github.com/ClickHouse/ClickHouse/pull/63788) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)).
-* Added setting `metadata_storage_type` to keep free space on metadata storage disk. [#64128](https://github.com/ClickHouse/ClickHouse/pull/64128) ([MikhailBurdukov](https://github.com/MikhailBurdukov)).
-* Add metrics to track the number of directories created and removed by the plain_rewritable metadata storage, and the number of entries in the local-to-remote in-memory map. [#64175](https://github.com/ClickHouse/ClickHouse/pull/64175) ([Julia Kartseva](https://github.com/jkartseva)).
+* The second argument (scale) of functions `round()`, `roundBankers()`, `floor()`, `ceil()` and `trunc()` can now be non-const. [#64798](https://github.com/ClickHouse/ClickHouse/pull/64798) ([Mikhail Gorshkov](https://github.com/mgorshkov)).
+* Hot reload storage policy for `Distributed` tables when adding a new disk. [#58285](https://github.com/ClickHouse/ClickHouse/pull/58285) ([Duc Canh Le](https://github.com/canhld94)).
+* Avoid possible deadlock during MergeTree index analysis when scheduling threads in a saturated service. [#59427](https://github.com/ClickHouse/ClickHouse/pull/59427) ([Sean Haynes](https://github.com/seandhaynes)).
+* Several minor corner case fixes to S3 proxy support & tunneling. [#63427](https://github.com/ClickHouse/ClickHouse/pull/63427) ([Arthur Passos](https://github.com/arthurpassos)).
+* Improve io_uring resubmit visibility. Rename profile event `IOUringSQEsResubmits` -> `IOUringSQEsResubmitsAsync` and add a new one `IOUringSQEsResubmitsSync`. [#63699](https://github.com/ClickHouse/ClickHouse/pull/63699) ([Tomer Shafir](https://github.com/tomershafir)).
+* Added a new setting, `metadata_keep_free_space_bytes` to keep free space on the metadata storage disk. [#64128](https://github.com/ClickHouse/ClickHouse/pull/64128) ([MikhailBurdukov](https://github.com/MikhailBurdukov)).
+* Add metrics to track the number of directories created and removed by the `plain_rewritable` metadata storage, and the number of entries in the local-to-remote in-memory map. [#64175](https://github.com/ClickHouse/ClickHouse/pull/64175) ([Julia Kartseva](https://github.com/jkartseva)).
* The query cache now considers identical queries with different settings as different. This increases robustness in cases where different settings (e.g. `limit` or `additional_table_filters`) would affect the query result. [#64205](https://github.com/ClickHouse/ClickHouse/pull/64205) ([Robert Schulze](https://github.com/rschu1ze)).
-* Better Exception Message in Delete Table with Projection, users can understand the error and the steps should be taken. [#64212](https://github.com/ClickHouse/ClickHouse/pull/64212) ([jsc0218](https://github.com/jsc0218)).
* Support the non standard error code `QpsLimitExceeded` in object storage as a retryable error. [#64225](https://github.com/ClickHouse/ClickHouse/pull/64225) ([Sema Checherinda](https://github.com/CheSema)).
* Forbid converting a MergeTree table to replicated if the zookeeper path for this table already exists. [#64244](https://github.com/ClickHouse/ClickHouse/pull/64244) ([Kirill](https://github.com/kirillgarbar)).
-* If "replica group" is configured for a `Replicated` database, automatically create a cluster that includes replicas from all groups. [#64312](https://github.com/ClickHouse/ClickHouse/pull/64312) ([Alexander Tokmakov](https://github.com/tavplubix)).
-* Added settings to disable materialization of skip indexes and statistics on inserts (`materialize_skip_indexes_on_insert` and `materialize_statistics_on_insert`). [#64391](https://github.com/ClickHouse/ClickHouse/pull/64391) ([Anton Popov](https://github.com/CurtizJ)).
-* Use the allocated memory size to calculate the row group size and reduce the peak memory of the parquet writer in single-threaded mode. [#64424](https://github.com/ClickHouse/ClickHouse/pull/64424) ([LiuNeng](https://github.com/liuneng1994)).
-* Added new configuration input_format_parquet_prefer_block_bytes to control the average output block bytes, and modified the default value of input_format_parquet_max_block_size to 65409. [#64427](https://github.com/ClickHouse/ClickHouse/pull/64427) ([LiuNeng](https://github.com/liuneng1994)).
+* Added a new setting `input_format_parquet_prefer_block_bytes` to control the average output block bytes, and modified the default value of `input_format_parquet_max_block_size` to 65409. [#64427](https://github.com/ClickHouse/ClickHouse/pull/64427) ([LiuNeng](https://github.com/liuneng1994)).
+* Allow proxy to be bypassed for hosts specified in `no_proxy` env variable and ClickHouse proxy configuration. [#63314](https://github.com/ClickHouse/ClickHouse/pull/63314) ([Arthur Passos](https://github.com/arthurpassos)).
* Always start Keeper with sufficient amount of threads in global thread pool. [#64444](https://github.com/ClickHouse/ClickHouse/pull/64444) ([Duc Canh Le](https://github.com/canhld94)).
-* Settings from user config doesn't affect merges and mutations for MergeTree on top of object storage. [#64456](https://github.com/ClickHouse/ClickHouse/pull/64456) ([alesapin](https://github.com/alesapin)).
-* Setting `replace_long_file_name_to_hash` is enabled by default for `MergeTree` tables. [#64457](https://github.com/ClickHouse/ClickHouse/pull/64457) ([Anton Popov](https://github.com/CurtizJ)).
-* Improve the iterator of sparse column to reduce call of size(). [#64497](https://github.com/ClickHouse/ClickHouse/pull/64497) ([Jiebin Sun](https://github.com/jiebinn)).
-* Update condition to use copy for azure blob storage. [#64518](https://github.com/ClickHouse/ClickHouse/pull/64518) ([SmitaRKulkarni](https://github.com/SmitaRKulkarni)).
+* Settings from the user's config don't affect merges and mutations for `MergeTree` on top of object storage. [#64456](https://github.com/ClickHouse/ClickHouse/pull/64456) ([alesapin](https://github.com/alesapin)).
* Support the non standard error code `TotalQpsLimitExceeded` in object storage as a retryable error. [#64520](https://github.com/ClickHouse/ClickHouse/pull/64520) ([Sema Checherinda](https://github.com/CheSema)).
-* Optimized memory usage of vertical merges for tables with high number of skip indexes. [#64580](https://github.com/ClickHouse/ClickHouse/pull/64580) ([Anton Popov](https://github.com/CurtizJ)).
-* Introduced two additional columns in the `system.query_log`: `used_privileges` and `missing_privileges`. `used_privileges` is populated with the privileges that were checked during query execution, and `missing_privileges` contains required privileges that are missing. [#64597](https://github.com/ClickHouse/ClickHouse/pull/64597) ([Alexey Katsman](https://github.com/alexkats)).
-* Add settings `parallel_replicas_custom_key_range_lower` and `parallel_replicas_custom_key_range_upper` to control how parallel replicas with dynamic shards parallelizes queries when using a range filter. [#64604](https://github.com/ClickHouse/ClickHouse/pull/64604) ([josh-hildred](https://github.com/josh-hildred)).
* Updated Advanced Dashboard for both open-source and ClickHouse Cloud versions to include a chart for 'Maximum concurrent network connections'. [#64610](https://github.com/ClickHouse/ClickHouse/pull/64610) ([Thom O'Connor](https://github.com/thomoco)).
-* The second argument (scale) of functions `round()`, `roundBankers()`, `floor()`, `ceil()` and `trunc()` can now be non-const. [#64798](https://github.com/ClickHouse/ClickHouse/pull/64798) ([Mikhail Gorshkov](https://github.com/mgorshkov)).
-* Improve progress report on zeros_mt and generateRandom. [#64804](https://github.com/ClickHouse/ClickHouse/pull/64804) ([Raúl Marín](https://github.com/Algunenano)).
-* Add an asynchronous metric jemalloc.profile.active to show whether sampling is currently active. This is an activation mechanism in addition to prof.active; both must be active for the calling thread to sample. [#64842](https://github.com/ClickHouse/ClickHouse/pull/64842) ([Unalian](https://github.com/Unalian)).
-* Support statistics with ReplicatedMergeTree. [#64934](https://github.com/ClickHouse/ClickHouse/pull/64934) ([Han Fei](https://github.com/hanfei1991)).
+* Improve progress report on `zeros_mt` and `generateRandom`. [#64804](https://github.com/ClickHouse/ClickHouse/pull/64804) ([Raúl Marín](https://github.com/Algunenano)).
+* Add an asynchronous metric `jemalloc.profile.active` to show whether sampling is currently active. This is an activation mechanism in addition to prof.active; both must be active for the calling thread to sample. [#64842](https://github.com/ClickHouse/ClickHouse/pull/64842) ([Unalian](https://github.com/Unalian)).
* Remove mark of `allow_experimental_join_condition` as important. This mark may have prevented distributed queries in a mixed versions cluster from being executed successfully. [#65008](https://github.com/ClickHouse/ClickHouse/pull/65008) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)).
* Added server Asynchronous metrics `DiskGetObjectThrottler*` and `DiskGetObjectThrottler*` reflecting request per second rate limit defined with `s3_max_get_rps` and `s3_max_put_rps` disk settings and currently available number of requests that could be sent without hitting throttling limit on the disk. Metrics are defined for every disk that has a configured limit. [#65050](https://github.com/ClickHouse/ClickHouse/pull/65050) ([Sergei Trifonov](https://github.com/serxa)).
-* Added a setting `output_format_pretty_display_footer_column_names` which when enabled displays column names at the end of the table for long tables (50 rows by default), with the threshold value for minimum number of rows controlled by `output_format_pretty_display_footer_column_names_min_rows`. [#65144](https://github.com/ClickHouse/ClickHouse/pull/65144) ([Shaun Struwig](https://github.com/Blargian)).
-* Returned back the behaviour of how ClickHouse works and interprets Tuples in CSV format. This change effectively reverts https://github.com/ClickHouse/ClickHouse/pull/60994 and makes it available only under a few settings: `output_format_csv_serialize_tuple_into_separate_columns`, `input_format_csv_deserialize_separate_columns_into_tuple` and `input_format_csv_try_infer_strings_from_quoted_tuples`. [#65170](https://github.com/ClickHouse/ClickHouse/pull/65170) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)).
-* Initialize global trace collector for Poco::ThreadPool (needed for keeper, etc). [#65239](https://github.com/ClickHouse/ClickHouse/pull/65239) ([Kseniia Sumarokova](https://github.com/kssenii)).
-* Add validation when creating a user with bcrypt_hash. [#65242](https://github.com/ClickHouse/ClickHouse/pull/65242) ([Raúl Marín](https://github.com/Algunenano)).
-* Unite s3/hdfs/azure storage implementations into a single class working with IObjectStorage. Same for *Cluster, data lakes and Queue storages. [#59767](https://github.com/ClickHouse/ClickHouse/pull/59767) ([Kseniia Sumarokova](https://github.com/kssenii)).
-* Refactor data part writer to remove dependencies on MergeTreeData and DataPart. [#63620](https://github.com/ClickHouse/ClickHouse/pull/63620) ([Alexander Gololobov](https://github.com/davenger)).
-* Add profile events for number of rows read during/after prewhere. [#64198](https://github.com/ClickHouse/ClickHouse/pull/64198) ([Nikita Taranov](https://github.com/nickitat)).
-* Print query in explain plan with parallel replicas. [#64298](https://github.com/ClickHouse/ClickHouse/pull/64298) ([vdimir](https://github.com/vdimir)).
+* Initialize global trace collector for `Poco::ThreadPool` (needed for Keeper, etc). [#65239](https://github.com/ClickHouse/ClickHouse/pull/65239) ([Kseniia Sumarokova](https://github.com/kssenii)).
+* Add a validation when creating a user with `bcrypt_hash`. [#65242](https://github.com/ClickHouse/ClickHouse/pull/65242) ([Raúl Marín](https://github.com/Algunenano)).
+* Add profile events for number of rows read during/after `PREWHERE`. [#64198](https://github.com/ClickHouse/ClickHouse/pull/64198) ([Nikita Taranov](https://github.com/nickitat)).
+* Print query in `EXPLAIN PLAN` with parallel replicas. [#64298](https://github.com/ClickHouse/ClickHouse/pull/64298) ([vdimir](https://github.com/vdimir)).
* Rename `allow_deprecated_functions` to `allow_deprecated_error_prone_window_functions`. [#64358](https://github.com/ClickHouse/ClickHouse/pull/64358) ([Raúl Marín](https://github.com/Algunenano)).
-* Respect `max_read_buffer_size` setting for file descriptors as well in file() table function. [#64532](https://github.com/ClickHouse/ClickHouse/pull/64532) ([Azat Khuzhin](https://github.com/azat)).
+* Respect `max_read_buffer_size` setting for file descriptors as well in the `file` table function. [#64532](https://github.com/ClickHouse/ClickHouse/pull/64532) ([Azat Khuzhin](https://github.com/azat)).
* Disable transactions for unsupported storages even for materialized views. [#64918](https://github.com/ClickHouse/ClickHouse/pull/64918) ([alesapin](https://github.com/alesapin)).
-* Refactor `KeyCondition` and key analysis to improve PartitionPruner and trivial count optimization. This is separated from [#60463](https://github.com/ClickHouse/ClickHouse/issues/60463) . [#61459](https://github.com/ClickHouse/ClickHouse/pull/61459) ([Amos Bird](https://github.com/amosbird)).
+* Forbid `QUALIFY` clause in the old analyzer. The old analyzer ignored `QUALIFY`, so it could lead to unexpected data removal in mutations. [#65356](https://github.com/ClickHouse/ClickHouse/pull/65356) ([Dmitry Novik](https://github.com/novikd)).
#### Bug Fix (user-visible misbehavior in an official stable release)
+* A bug in Apache ORC library was fixed: Fixed ORC statistics calculation, when writing, for unsigned types on all platforms and Int8 on ARM. [#64563](https://github.com/ClickHouse/ClickHouse/pull/64563) ([Michael Kolupaev](https://github.com/al13n321)).
+* Returned back the behaviour of how ClickHouse works and interprets Tuples in CSV format. This change effectively reverts https://github.com/ClickHouse/ClickHouse/pull/60994 and makes it available only under a few settings: `output_format_csv_serialize_tuple_into_separate_columns`, `input_format_csv_deserialize_separate_columns_into_tuple` and `input_format_csv_try_infer_strings_from_quoted_tuples`. [#65170](https://github.com/ClickHouse/ClickHouse/pull/65170) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)).
* Fix a permission error where a user in a specific situation can escalate their privileges on the default database without necessary grants. [#64769](https://github.com/ClickHouse/ClickHouse/pull/64769) ([pufit](https://github.com/pufit)).
* Fix crash with UniqInjectiveFunctionsEliminationPass and uniqCombined. [#65188](https://github.com/ClickHouse/ClickHouse/pull/65188) ([Raúl Marín](https://github.com/Algunenano)).
* Fix a bug in ClickHouse Keeper that causes digest mismatch during closing session. [#65198](https://github.com/ClickHouse/ClickHouse/pull/65198) ([Aleksei Filatov](https://github.com/aalexfvk)).
-* Forbid `QUALIFY` clause in the old analyzer. The old analyzer ignored `QUALIFY`, so it could lead to unexpected data removal in mutations. [#65356](https://github.com/ClickHouse/ClickHouse/pull/65356) ([Dmitry Novik](https://github.com/novikd)).
* Use correct memory alignment for Distinct combinator. Previously, crash could happen because of invalid memory allocation when the combinator was used. [#65379](https://github.com/ClickHouse/ClickHouse/pull/65379) ([Antonio Andelic](https://github.com/antonio2368)).
* Fix crash with `DISTINCT` and window functions. [#64767](https://github.com/ClickHouse/ClickHouse/pull/64767) ([Igor Nikonov](https://github.com/devcrafter)).
* Fixed 'set' skip index not working with IN and indexHint(). [#62083](https://github.com/ClickHouse/ClickHouse/pull/62083) ([Michael Kolupaev](https://github.com/al13n321)).
@@ -132,7 +130,6 @@
* Fixed `optimize_read_in_order` behaviour for ORDER BY ... NULLS FIRST / LAST on tables with nullable keys. [#64483](https://github.com/ClickHouse/ClickHouse/pull/64483) ([Eduard Karacharov](https://github.com/korowa)).
* Fix the `Expression nodes list expected 1 projection names` and `Unknown expression or identifier` errors for queries with aliases to `GLOBAL IN.`. [#64517](https://github.com/ClickHouse/ClickHouse/pull/64517) ([Nikolai Kochetov](https://github.com/KochetovNicolai)).
* Fix an error `Cannot find column` in distributed queries with constant CTE in the `GROUP BY` key. [#64519](https://github.com/ClickHouse/ClickHouse/pull/64519) ([Nikolai Kochetov](https://github.com/KochetovNicolai)).
-* Fixed ORC statistics calculation, when writing, for unsigned types on all platforms and Int8 on ARM. [#64563](https://github.com/ClickHouse/ClickHouse/pull/64563) ([Michael Kolupaev](https://github.com/al13n321)).
* Fix the crash loop when restoring from backup is blocked by creating an MV with a definer that hasn't been restored yet. [#64595](https://github.com/ClickHouse/ClickHouse/pull/64595) ([pufit](https://github.com/pufit)).
* Fix the output of function `formatDateTimeInJodaSyntax` when a formatter generates an uneven number of characters and the last character is `0`. For example, `SELECT formatDateTimeInJodaSyntax(toDate('2012-05-29'), 'D')` now correctly returns `150` instead of previously `15`. [#64614](https://github.com/ClickHouse/ClickHouse/pull/64614) ([LiuNeng](https://github.com/liuneng1994)).
* Do not rewrite aggregation if `-If` combinator is already used. [#64638](https://github.com/ClickHouse/ClickHouse/pull/64638) ([Dmitry Novik](https://github.com/novikd)).
@@ -166,21 +163,14 @@
* This PR ensures that the type of the constant(IN operator's second parameter) is always visible during the IN operator's type conversion process. Otherwise, losing type information may cause some conversions to fail, such as the conversion from DateTime to Date. This fixes ([#64487](https://github.com/ClickHouse/ClickHouse/issues/64487)). [#65315](https://github.com/ClickHouse/ClickHouse/pull/65315) ([pn](https://github.com/chloro-pn)).
#### Build/Testing/Packaging Improvement
-* Make `network` service be required when using the rc init script to start the ClickHouse server daemon. [#60650](https://github.com/ClickHouse/ClickHouse/pull/60650) ([Chun-Sheng, Li](https://github.com/peter279k)).
-* Fix typo in test_hdfsCluster_unset_skip_unavailable_shards. The test writes data to unskip_unavailable_shards, but uses skip_unavailable_shards from the previous test. [#64243](https://github.com/ClickHouse/ClickHouse/pull/64243) ([Mikhail Artemenko](https://github.com/Michicosun)).
-* Reduce the size of some slow tests. [#64387](https://github.com/ClickHouse/ClickHouse/pull/64387) ([Raúl Marín](https://github.com/Algunenano)).
-* Reduce the size of some slow tests. [#64452](https://github.com/ClickHouse/ClickHouse/pull/64452) ([Raúl Marín](https://github.com/Algunenano)).
-* Fix test_lost_part_other_replica. [#64512](https://github.com/ClickHouse/ClickHouse/pull/64512) ([Raúl Marín](https://github.com/Algunenano)).
-* Add tests for experimental unequal joins and randomize new settings in clickhouse-test. [#64535](https://github.com/ClickHouse/ClickHouse/pull/64535) ([Nikita Fomichev](https://github.com/fm4v)).
-* Upgrade tests: Update config and work with release candidates. [#64542](https://github.com/ClickHouse/ClickHouse/pull/64542) ([Raúl Marín](https://github.com/Algunenano)).
-* Add support for LLVM XRay. [#64592](https://github.com/ClickHouse/ClickHouse/pull/64592) ([Tomer Shafir](https://github.com/tomershafir)).
-* Speed up 02995_forget_partition. [#64761](https://github.com/ClickHouse/ClickHouse/pull/64761) ([Raúl Marín](https://github.com/Algunenano)).
-* Fix 02790_async_queries_in_query_log. [#64764](https://github.com/ClickHouse/ClickHouse/pull/64764) ([Raúl Marín](https://github.com/Algunenano)).
-* Support LLVM XRay on Linux amd64 only. [#64837](https://github.com/ClickHouse/ClickHouse/pull/64837) ([Tomer Shafir](https://github.com/tomershafir)).
-* Get rid of custom code in `tests/ci/download_release_packages.py` and `tests/ci/get_previous_release_tag.py` to avoid issues after the https://github.com/ClickHouse/ClickHouse/pull/64759 is merged. [#64848](https://github.com/ClickHouse/ClickHouse/pull/64848) ([Mikhail f. Shiryaev](https://github.com/Felixoid)).
-* Decrease the `unit-test` image a few times. [#65102](https://github.com/ClickHouse/ClickHouse/pull/65102) ([Mikhail f. Shiryaev](https://github.com/Felixoid)).
+* Add support for LLVM XRay. [#64592](https://github.com/ClickHouse/ClickHouse/pull/64592) [#64837](https://github.com/ClickHouse/ClickHouse/pull/64837) ([Tomer Shafir](https://github.com/tomershafir)).
+* Unite s3/hdfs/azure storage implementations into a single class working with IObjectStorage. Same for *Cluster, data lakes and Queue storages. [#59767](https://github.com/ClickHouse/ClickHouse/pull/59767) ([Kseniia Sumarokova](https://github.com/kssenii)).
+* Refactor data part writer to remove dependencies on MergeTreeData and DataPart. [#63620](https://github.com/ClickHouse/ClickHouse/pull/63620) ([Alexander Gololobov](https://github.com/davenger)).
+* Refactor `KeyCondition` and key analysis to improve PartitionPruner and trivial count optimization. This is separated from [#60463](https://github.com/ClickHouse/ClickHouse/issues/60463) . [#61459](https://github.com/ClickHouse/ClickHouse/pull/61459) ([Amos Bird](https://github.com/amosbird)).
+* Introduce assertions to verify all functions are called with columns of the right size. [#63723](https://github.com/ClickHouse/ClickHouse/pull/63723) ([Raúl Marín](https://github.com/Algunenano)).
+* Make `network` service be required when using the `rc` init script to start the ClickHouse server daemon. [#60650](https://github.com/ClickHouse/ClickHouse/pull/60650) ([Chun-Sheng, Li](https://github.com/peter279k)).
+* Reduce the size of some slow tests. [#64387](https://github.com/ClickHouse/ClickHouse/pull/64387) [#64452](https://github.com/ClickHouse/ClickHouse/pull/64452) ([Raúl Marín](https://github.com/Algunenano)).
* Replay ZooKeeper logs using keeper-bench. [#62481](https://github.com/ClickHouse/ClickHouse/pull/62481) ([Antonio Andelic](https://github.com/antonio2368)).
-* Re-enable OpenSSL session caching. [#65111](https://github.com/ClickHouse/ClickHouse/pull/65111) ([Robert Schulze](https://github.com/rschu1ze)).
### ClickHouse release 24.5, 2024-05-30
diff --git a/base/base/getFQDNOrHostName.cpp b/base/base/getFQDNOrHostName.cpp
index 2a4ba8e2e11..6b3da9699b9 100644
--- a/base/base/getFQDNOrHostName.cpp
+++ b/base/base/getFQDNOrHostName.cpp
@@ -6,6 +6,9 @@ namespace
{
std::string getFQDNOrHostNameImpl()
{
+#if defined(OS_DARWIN)
+ return Poco::Net::DNS::hostName();
+#else
try
{
return Poco::Net::DNS::thisHost().name();
@@ -14,6 +17,7 @@ namespace
{
return Poco::Net::DNS::hostName();
}
+#endif
}
}
diff --git a/contrib/jemalloc-cmake/CMakeLists.txt b/contrib/jemalloc-cmake/CMakeLists.txt
index b633f0fda50..023fdcf103a 100644
--- a/contrib/jemalloc-cmake/CMakeLists.txt
+++ b/contrib/jemalloc-cmake/CMakeLists.txt
@@ -34,7 +34,7 @@ if (OS_LINUX)
# avoid spurious latencies and additional work associated with
# MADV_DONTNEED. See
# https://github.com/ClickHouse/ClickHouse/issues/11121 for motivation.
- set (JEMALLOC_CONFIG_MALLOC_CONF "percpu_arena:percpu,oversize_threshold:0,muzzy_decay_ms:0,dirty_decay_ms:5000")
+ set (JEMALLOC_CONFIG_MALLOC_CONF "percpu_arena:percpu,oversize_threshold:0,muzzy_decay_ms:0,dirty_decay_ms:5000,prof:true,prof_active:false,background_thread:true")
else()
set (JEMALLOC_CONFIG_MALLOC_CONF "oversize_threshold:0,muzzy_decay_ms:0,dirty_decay_ms:5000")
endif()
diff --git a/docs/en/development/developer-instruction.md b/docs/en/development/developer-instruction.md
index ec5760541e8..0a1fe58b16f 100644
--- a/docs/en/development/developer-instruction.md
+++ b/docs/en/development/developer-instruction.md
@@ -267,7 +267,7 @@ A pull request can be created even if the work is not completed yet. In this cas
Testing will commence as soon as ClickHouse employees label your PR with a tag “can be tested”. The results of some first checks (e.g. code style) will come in within several minutes. Build check results will arrive within half an hour. And the main set of tests will report itself within an hour.
-The system will prepare ClickHouse binary builds for your pull request individually. To retrieve these builds click the “Details” link next to “ClickHouse build check” entry in the list of checks. There you will find direct links to the built .deb packages of ClickHouse which you can deploy even on your production servers (if you have no fear).
+The system will prepare ClickHouse binary builds for your pull request individually. To retrieve these builds click the “Details” link next to “Builds” entry in the list of checks. There you will find direct links to the built .deb packages of ClickHouse which you can deploy even on your production servers (if you have no fear).
Most probably some of the builds will fail at first times. This is due to the fact that we check builds both with gcc as well as with clang, with almost all of existing warnings (always with the `-Werror` flag) enabled for clang. On that same page, you can find all of the build logs so that you do not have to build ClickHouse in all of the possible ways.
diff --git a/docs/en/development/tests.md b/docs/en/development/tests.md
index 8dff6f0ed1d..269995a1a96 100644
--- a/docs/en/development/tests.md
+++ b/docs/en/development/tests.md
@@ -28,7 +28,7 @@ run, for example, the test `01428_hash_set_nan_key`, change to the repository
folder and run the following command:
```
-PATH=$PATH: tests/clickhouse-test 01428_hash_set_nan_key
+PATH=:$PATH tests/clickhouse-test 01428_hash_set_nan_key
```
Test results (`stderr` and `stdout`) are written to files `01428_hash_set_nan_key.[stderr|stdout]` which
diff --git a/docs/en/engines/table-engines/integrations/azureBlobStorage.md b/docs/en/engines/table-engines/integrations/azureBlobStorage.md
index dfc27d6b8cf..bdf96832e9d 100644
--- a/docs/en/engines/table-engines/integrations/azureBlobStorage.md
+++ b/docs/en/engines/table-engines/integrations/azureBlobStorage.md
@@ -56,6 +56,15 @@ SELECT * FROM test_table;
- `_size` — Size of the file in bytes. Type: `Nullable(UInt64)`. If the size is unknown, the value is `NULL`.
- `_time` — Last modified time of the file. Type: `Nullable(DateTime)`. If the time is unknown, the value is `NULL`.
+## Authentication
+
+Currently there are 3 ways to authenticate:
+- `Managed Identity` - Can be used by providing an `endpoint`, `connection_string` or `storage_account_url`.
+- `SAS Token` - Can be used by providing an `endpoint`, `connection_string` or `storage_account_url`. It is identified by presence of '?' in the url.
+- `Workload Identity` - Can be used by providing an `endpoint` or `storage_account_url`. If `use_workload_identity` parameter is set in config, ([workload identity](https://github.com/Azure/azure-sdk-for-cpp/tree/main/sdk/identity/azure-identity#authenticate-azure-hosted-applications)) is used for authentication.
+
+
+
## See also
[Azure Blob Storage Table Function](/docs/en/sql-reference/table-functions/azureBlobStorage)
diff --git a/docs/en/engines/table-engines/integrations/s3queue.md b/docs/en/engines/table-engines/integrations/s3queue.md
index 97ca79501a7..11181703645 100644
--- a/docs/en/engines/table-engines/integrations/s3queue.md
+++ b/docs/en/engines/table-engines/integrations/s3queue.md
@@ -28,6 +28,8 @@ CREATE TABLE s3_queue_engine_table (name String, value UInt32)
[s3queue_cleanup_interval_max_ms = 30000,]
```
+Starting with `24.7` settings without `s3queue_` prefix are also supported.
+
**Engine parameters**
- `path` — Bucket url with path to file. Supports following wildcards in readonly mode: `*`, `**`, `?`, `{abc,def}` and `{N..M}` where `N`, `M` — numbers, `'abc'`, `'def'` — strings. For more information see [below](#wildcards-in-path).
diff --git a/docs/en/getting-started/example-datasets/images/stackoverflow.png b/docs/en/getting-started/example-datasets/images/stackoverflow.png
new file mode 100644
index 00000000000..f31acdc8cc3
Binary files /dev/null and b/docs/en/getting-started/example-datasets/images/stackoverflow.png differ
diff --git a/docs/en/getting-started/example-datasets/stackoverflow.md b/docs/en/getting-started/example-datasets/stackoverflow.md
new file mode 100644
index 00000000000..e982a3c3dfc
--- /dev/null
+++ b/docs/en/getting-started/example-datasets/stackoverflow.md
@@ -0,0 +1,394 @@
+---
+slug: /en/getting-started/example-datasets/stackoverflow
+sidebar_label: Stack Overflow
+sidebar_position: 1
+description: Analyzing Stack Overflow data with ClickHouse
+---
+
+# Analyzing Stack Overflow data with ClickHouse
+
+This dataset contains every `Post`, `User`, `Vote`, `Comment`, `Badge, `PostHistory`, and `PostLink` that has occurred on Stack Overflow.
+
+Users can either download pre-prepared Parquet versions of the data, containing every post up to April 2024, or download the latest data in XML format and load this. Stack Overflow provide updates to this data periodically - historically every 3 months.
+
+The following diagram shows the schema for the available tables assuming Parquet format.
+
+![Stack Overflow schema](./images/stackoverflow.png)
+
+A description of the schema of this data can be found [here](https://meta.stackexchange.com/questions/2677/database-schema-documentation-for-the-public-data-dump-and-sede).
+
+## Pre-prepared data
+
+We provide a copy of this data in Parquet format, up to date as of April 2024. While small for ClickHouse with respect to the number of rows (60 million posts), this dataset contains significant volumes of text and large String columns.
+
+```sql
+CREATE DATABASE stackoverflow
+```
+
+The following timings are for a 96 GiB, 24 vCPU ClickHouse Cloud cluster located in `eu-west-2`. The dataset is located in `eu-west-3`.
+
+### Posts
+
+```sql
+CREATE TABLE stackoverflow.posts
+(
+ `Id` Int32 CODEC(Delta(4), ZSTD(1)),
+ `PostTypeId` Enum8('Question' = 1, 'Answer' = 2, 'Wiki' = 3, 'TagWikiExcerpt' = 4, 'TagWiki' = 5, 'ModeratorNomination' = 6, 'WikiPlaceholder' = 7, 'PrivilegeWiki' = 8),
+ `AcceptedAnswerId` UInt32,
+ `CreationDate` DateTime64(3, 'UTC'),
+ `Score` Int32,
+ `ViewCount` UInt32 CODEC(Delta(4), ZSTD(1)),
+ `Body` String,
+ `OwnerUserId` Int32,
+ `OwnerDisplayName` String,
+ `LastEditorUserId` Int32,
+ `LastEditorDisplayName` String,
+ `LastEditDate` DateTime64(3, 'UTC') CODEC(Delta(8), ZSTD(1)),
+ `LastActivityDate` DateTime64(3, 'UTC'),
+ `Title` String,
+ `Tags` String,
+ `AnswerCount` UInt16 CODEC(Delta(2), ZSTD(1)),
+ `CommentCount` UInt8,
+ `FavoriteCount` UInt8,
+ `ContentLicense` LowCardinality(String),
+ `ParentId` String,
+ `CommunityOwnedDate` DateTime64(3, 'UTC'),
+ `ClosedDate` DateTime64(3, 'UTC')
+)
+ENGINE = MergeTree
+PARTITION BY toYear(CreationDate)
+ORDER BY (PostTypeId, toDate(CreationDate), CreationDate)
+
+INSERT INTO stackoverflow.posts SELECT * FROM s3('https://datasets-documentation.s3.eu-west-3.amazonaws.com/stackoverflow/parquet/posts/*.parquet')
+
+0 rows in set. Elapsed: 265.466 sec. Processed 59.82 million rows, 38.07 GB (225.34 thousand rows/s., 143.42 MB/s.)
+```
+
+Posts are also available by year e.g. [https://datasets-documentation.s3.eu-west-3.amazonaws.com/stackoverflow/parquet/posts/2020.parquet](https://datasets-documentation.s3.eu-west-3.amazonaws.com/stackoverflow/parquet/posts/2020.parquet)
+
+
+### Votes
+
+```sql
+CREATE TABLE stackoverflow.votes
+(
+ `Id` UInt32,
+ `PostId` Int32,
+ `VoteTypeId` UInt8,
+ `CreationDate` DateTime64(3, 'UTC'),
+ `UserId` Int32,
+ `BountyAmount` UInt8
+)
+ENGINE = MergeTree
+ORDER BY (VoteTypeId, CreationDate, PostId, UserId)
+
+INSERT INTO stackoverflow.votes SELECT * FROM s3('https://datasets-documentation.s3.eu-west-3.amazonaws.com/stackoverflow/parquet/votes/*.parquet')
+
+0 rows in set. Elapsed: 21.605 sec. Processed 238.98 million rows, 2.13 GB (11.06 million rows/s., 98.46 MB/s.)
+```
+
+Votes are also available by year e.g. [https://datasets-documentation.s3.eu-west-3.amazonaws.com/stackoverflow/parquet/posts/2020.parquet](https://datasets-documentation.s3.eu-west-3.amazonaws.com/stackoverflow/parquet/votes/2020.parquet)
+
+
+### Comments
+
+```sql
+CREATE TABLE stackoverflow.comments
+(
+ `Id` UInt32,
+ `PostId` UInt32,
+ `Score` UInt16,
+ `Text` String,
+ `CreationDate` DateTime64(3, 'UTC'),
+ `UserId` Int32,
+ `UserDisplayName` LowCardinality(String)
+)
+ENGINE = MergeTree
+ORDER BY CreationDate
+
+INSERT INTO stackoverflow.comments SELECT * FROM s3('https://datasets-documentation.s3.eu-west-3.amazonaws.com/stackoverflow/parquet/comments/*.parquet')
+
+0 rows in set. Elapsed: 56.593 sec. Processed 90.38 million rows, 11.14 GB (1.60 million rows/s., 196.78 MB/s.)
+```
+
+Comments are also available by year e.g. [https://datasets-documentation.s3.eu-west-3.amazonaws.com/stackoverflow/parquet/posts/2020.parquet](https://datasets-documentation.s3.eu-west-3.amazonaws.com/stackoverflow/parquet/comments/2020.parquet)
+
+### Users
+
+```sql
+CREATE TABLE stackoverflow.users
+(
+ `Id` Int32,
+ `Reputation` LowCardinality(String),
+ `CreationDate` DateTime64(3, 'UTC') CODEC(Delta(8), ZSTD(1)),
+ `DisplayName` String,
+ `LastAccessDate` DateTime64(3, 'UTC'),
+ `AboutMe` String,
+ `Views` UInt32,
+ `UpVotes` UInt32,
+ `DownVotes` UInt32,
+ `WebsiteUrl` String,
+ `Location` LowCardinality(String),
+ `AccountId` Int32
+)
+ENGINE = MergeTree
+ORDER BY (Id, CreationDate)
+
+INSERT INTO stackoverflow.users SELECT * FROM s3('https://datasets-documentation.s3.eu-west-3.amazonaws.com/stackoverflow/parquet/users.parquet')
+
+0 rows in set. Elapsed: 10.988 sec. Processed 22.48 million rows, 1.36 GB (2.05 million rows/s., 124.10 MB/s.)
+```
+
+### Badges
+
+```sql
+CREATE TABLE stackoverflow.badges
+(
+ `Id` UInt32,
+ `UserId` Int32,
+ `Name` LowCardinality(String),
+ `Date` DateTime64(3, 'UTC'),
+ `Class` Enum8('Gold' = 1, 'Silver' = 2, 'Bronze' = 3),
+ `TagBased` Bool
+)
+ENGINE = MergeTree
+ORDER BY UserId
+
+INSERT INTO stackoverflow.badges SELECT * FROM s3('https://datasets-documentation.s3.eu-west-3.amazonaws.com/stackoverflow/parquet/badges.parquet')
+
+0 rows in set. Elapsed: 6.635 sec. Processed 51.29 million rows, 797.05 MB (7.73 million rows/s., 120.13 MB/s.)
+```
+
+### `PostLinks`
+
+```sql
+CREATE TABLE stackoverflow.postlinks
+(
+ `Id` UInt64,
+ `CreationDate` DateTime64(3, 'UTC'),
+ `PostId` Int32,
+ `RelatedPostId` Int32,
+ `LinkTypeId` Enum8('Linked' = 1, 'Duplicate' = 3)
+)
+ENGINE = MergeTree
+ORDER BY (PostId, RelatedPostId)
+
+INSERT INTO stackoverflow.postlinks SELECT * FROM s3('https://datasets-documentation.s3.eu-west-3.amazonaws.com/stackoverflow/parquet/postlinks.parquet')
+
+0 rows in set. Elapsed: 1.534 sec. Processed 6.55 million rows, 129.70 MB (4.27 million rows/s., 84.57 MB/s.)
+```
+
+### `PostHistory`
+
+```sql
+CREATE TABLE stackoverflow.posthistory
+(
+ `Id` UInt64,
+ `PostHistoryTypeId` UInt8,
+ `PostId` Int32,
+ `RevisionGUID` String,
+ `CreationDate` DateTime64(3, 'UTC'),
+ `UserId` Int32,
+ `Text` String,
+ `ContentLicense` LowCardinality(String),
+ `Comment` String,
+ `UserDisplayName` String
+)
+ENGINE = MergeTree
+ORDER BY (CreationDate, PostId)
+
+INSERT INTO stackoverflow.posthistory SELECT * FROM s3('https://datasets-documentation.s3.eu-west-3.amazonaws.com/stackoverflow/parquet/posthistory/*.parquet')
+
+0 rows in set. Elapsed: 422.795 sec. Processed 160.79 million rows, 67.08 GB (380.30 thousand rows/s., 158.67 MB/s.)
+```
+
+## Original dataset
+
+The original dataset is available in compressed (7zip) XML format at [https://archive.org/download/stackexchange](https://archive.org/download/stackexchange) - files with prefix `stackoverflow.com*`.
+
+### Download
+
+```bash
+wget https://archive.org/download/stackexchange/stackoverflow.com-Badges.7z
+wget https://archive.org/download/stackexchange/stackoverflow.com-Comments.7z
+wget https://archive.org/download/stackexchange/stackoverflow.com-PostHistory.7z
+wget https://archive.org/download/stackexchange/stackoverflow.com-PostLinks.7z
+wget https://archive.org/download/stackexchange/stackoverflow.com-Posts.7z
+wget https://archive.org/download/stackexchange/stackoverflow.com-Users.7z
+wget https://archive.org/download/stackexchange/stackoverflow.com-Votes.7z
+```
+
+These files are up to 35GB and can take around 30 mins to download depending on internet connection - the download server throttles at around 20MB/sec.
+
+### Convert to JSON
+
+At the time of writing, ClickHouse does not have native support for XML as an input format. To load the data into ClickHouse we first convert to NDJSON.
+
+To convert XML to JSON we recommend the [`xq`](https://github.com/kislyuk/yq) linux tool, a simple `jq` wrapper for XML documents.
+
+Install xq and jq:
+
+```bash
+sudo apt install jq
+pip install yq
+```
+
+The following steps apply to any of the above files. We use the `stackoverflow.com-Posts.7z` file as an example. Modify as required.
+
+Extract the file using [p7zip](https://p7zip.sourceforge.net/). This will produce a single xml file - in this case `Posts.xml`.
+
+> Files are compressed approximately 4.5x. At 22GB compressed, the posts file requires around 97G uncompressed.
+
+```bash
+p7zip -d stackoverflow.com-Posts.7z
+```
+
+The following splits the xml file into files, each containing 10000 rows.
+
+```bash
+mkdir posts
+cd posts
+# the following splits the input xml file into sub files of 10000 rows
+tail +3 ../Posts.xml | head -n -1 | split -l 10000 --filter='{ printf "\n"; cat - ; printf "\n"; } > $FILE' -
+```
+
+After running the above users will have a set of files, each with 10000 lines. This ensures the memory overhead of the next command is not excessive (xml to JSON conversion is done in memory).
+
+```bash
+find . -maxdepth 1 -type f -exec xq -c '.rows.row[]' {} \; | sed -e 's:"@:":g' > posts_v2.json
+```
+
+The above command will produce a single `posts.json` file.
+
+Load into ClickHouse with the following command. Note the schema is specified for the `posts.json` file. This will need to be adjusted per data type to align with the target table.
+
+```bash
+clickhouse local --query "SELECT * FROM file('posts.json', JSONEachRow, 'Id Int32, PostTypeId UInt8, AcceptedAnswerId UInt32, CreationDate DateTime64(3, \'UTC\'), Score Int32, ViewCount UInt32, Body String, OwnerUserId Int32, OwnerDisplayName String, LastEditorUserId Int32, LastEditorDisplayName String, LastEditDate DateTime64(3, \'UTC\'), LastActivityDate DateTime64(3, \'UTC\'), Title String, Tags String, AnswerCount UInt16, CommentCount UInt8, FavoriteCount UInt8, ContentLicense String, ParentId String, CommunityOwnedDate DateTime64(3, \'UTC\'), ClosedDate DateTime64(3, \'UTC\')') FORMAT Native" | clickhouse client --host --secure --password --query "INSERT INTO stackoverflow.posts_v2 FORMAT Native"
+```
+
+## Example queries
+
+A few simple questions to you get started.
+
+### Most popular tags on Stack Overflow
+
+```sql
+
+SELECT
+ arrayJoin(arrayFilter(t -> (t != ''), splitByChar('|', Tags))) AS Tags,
+ count() AS c
+FROM stackoverflow.posts
+GROUP BY Tags
+ORDER BY c DESC
+LIMIT 10
+
+┌─Tags───────┬───────c─┐
+│ javascript │ 2527130 │
+│ python │ 2189638 │
+│ java │ 1916156 │
+│ c# │ 1614236 │
+│ php │ 1463901 │
+│ android │ 1416442 │
+│ html │ 1186567 │
+│ jquery │ 1034621 │
+│ c++ │ 806202 │
+│ css │ 803755 │
+└────────────┴─────────┘
+
+10 rows in set. Elapsed: 1.013 sec. Processed 59.82 million rows, 1.21 GB (59.07 million rows/s., 1.19 GB/s.)
+Peak memory usage: 224.03 MiB.
+```
+
+### User with the most answers (active accounts)
+
+Account requires a `UserId`.
+
+```sql
+SELECT
+ any(OwnerUserId) UserId,
+ OwnerDisplayName,
+ count() AS c
+FROM stackoverflow.posts WHERE OwnerDisplayName != '' AND PostTypeId='Answer' AND OwnerUserId != 0
+GROUP BY OwnerDisplayName
+ORDER BY c DESC
+LIMIT 5
+
+┌─UserId─┬─OwnerDisplayName─┬────c─┐
+│ 22656 │ Jon Skeet │ 2727 │
+│ 23354 │ Marc Gravell │ 2150 │
+│ 12950 │ tvanfosson │ 1530 │
+│ 3043 │ Joel Coehoorn │ 1438 │
+│ 10661 │ S.Lott │ 1087 │
+└────────┴──────────────────┴──────┘
+
+5 rows in set. Elapsed: 0.154 sec. Processed 35.83 million rows, 193.39 MB (232.33 million rows/s., 1.25 GB/s.)
+Peak memory usage: 206.45 MiB.
+```
+
+### ClickHouse related posts with the most views
+
+```sql
+SELECT
+ Id,
+ Title,
+ ViewCount,
+ AnswerCount
+FROM stackoverflow.posts
+WHERE Title ILIKE '%ClickHouse%'
+ORDER BY ViewCount DESC
+LIMIT 10
+
+┌───────Id─┬─Title────────────────────────────────────────────────────────────────────────────┬─ViewCount─┬─AnswerCount─┐
+│ 52355143 │ Is it possible to delete old records from clickhouse table? │ 41462 │ 3 │
+│ 37954203 │ Clickhouse Data Import │ 38735 │ 3 │
+│ 37901642 │ Updating data in Clickhouse │ 36236 │ 6 │
+│ 58422110 │ Pandas: How to insert dataframe into Clickhouse │ 29731 │ 4 │
+│ 63621318 │ DBeaver - Clickhouse - SQL Error [159] .. Read timed out │ 27350 │ 1 │
+│ 47591813 │ How to filter clickhouse table by array column contents? │ 27078 │ 2 │
+│ 58728436 │ How to search the string in query with case insensitive on Clickhouse database? │ 26567 │ 3 │
+│ 65316905 │ Clickhouse: DB::Exception: Memory limit (for query) exceeded │ 24899 │ 2 │
+│ 49944865 │ How to add a column in clickhouse │ 24424 │ 1 │
+│ 59712399 │ How to cast date Strings to DateTime format with extended parsing in ClickHouse? │ 22620 │ 1 │
+└──────────┴──────────────────────────────────────────────────────────────────────────────────┴───────────┴─────────────┘
+
+10 rows in set. Elapsed: 0.472 sec. Processed 59.82 million rows, 1.91 GB (126.63 million rows/s., 4.03 GB/s.)
+Peak memory usage: 240.01 MiB.
+```
+
+### Most controversial posts
+
+```sql
+SELECT
+ Id,
+ Title,
+ UpVotes,
+ DownVotes,
+ abs(UpVotes - DownVotes) AS Controversial_ratio
+FROM stackoverflow.posts
+INNER JOIN
+(
+ SELECT
+ PostId,
+ countIf(VoteTypeId = 2) AS UpVotes,
+ countIf(VoteTypeId = 3) AS DownVotes
+ FROM stackoverflow.votes
+ GROUP BY PostId
+ HAVING (UpVotes > 10) AND (DownVotes > 10)
+) AS votes ON posts.Id = votes.PostId
+WHERE Title != ''
+ORDER BY Controversial_ratio ASC
+LIMIT 3
+
+┌───────Id─┬─Title─────────────────────────────────────────────┬─UpVotes─┬─DownVotes─┬─Controversial_ratio─┐
+│ 583177 │ VB.NET Infinite For Loop │ 12 │ 12 │ 0 │
+│ 9756797 │ Read console input as enumerable - one statement? │ 16 │ 16 │ 0 │
+│ 13329132 │ What's the point of ARGV in Ruby? │ 22 │ 22 │ 0 │
+└──────────┴───────────────────────────────────────────────────┴─────────┴───────────┴─────────────────────┘
+
+3 rows in set. Elapsed: 4.779 sec. Processed 298.80 million rows, 3.16 GB (62.52 million rows/s., 661.05 MB/s.)
+Peak memory usage: 6.05 GiB.
+```
+
+## Attribution
+
+We thank Stack Overflow for providing this data under the `cc-by-sa 4.0` license, acknowledging their efforts and the original source of the data at [https://archive.org/details/stackexchange](https://archive.org/details/stackexchange).
diff --git a/docs/en/getting-started/install.md b/docs/en/getting-started/install.md
index 67752f223ce..98e73dec451 100644
--- a/docs/en/getting-started/install.md
+++ b/docs/en/getting-started/install.md
@@ -314,7 +314,7 @@ For example, to download a aarch64 binary for ClickHouse v23.4, follow these ste
- Find the GitHub pull request for release v23.4: [Release pull request for branch 23.4](https://github.com/ClickHouse/ClickHouse/pull/49238)
- Click "Commits", then click a commit similar to "Update autogenerated version to 23.4.2.1 and contributors" for the particular version you like to install.
- Click the green check / yellow dot / red cross to open the list of CI checks.
-- Click "Details" next to "ClickHouse Build Check" in the list, it will open a page similar to [this page](https://s3.amazonaws.com/clickhouse-test-reports/46793/b460eb70bf29b19eadd19a1f959b15d186705394/clickhouse_build_check/report.html)
+- Click "Details" next to "Builds" in the list, it will open a page similar to [this page](https://s3.amazonaws.com/clickhouse-test-reports/46793/b460eb70bf29b19eadd19a1f959b15d186705394/clickhouse_build_check/report.html)
- Find the rows with compiler = "clang-*-aarch64" - there are multiple rows.
- Download the artifacts for these builds.
diff --git a/docs/en/interfaces/formats.md b/docs/en/interfaces/formats.md
index ffdd7e2ca25..a81a17e65d6 100644
--- a/docs/en/interfaces/formats.md
+++ b/docs/en/interfaces/formats.md
@@ -2169,6 +2169,7 @@ To exchange data with Hadoop, you can use [HDFS table engine](/docs/en/engines/t
- [output_format_parquet_compression_method](/docs/en/operations/settings/settings-formats.md/#output_format_parquet_compression_method) - compression method used in output Parquet format. Default value - `lz4`.
- [input_format_parquet_max_block_size](/docs/en/operations/settings/settings-formats.md/#input_format_parquet_max_block_size) - Max block row size for parquet reader. Default value - `65409`.
- [input_format_parquet_prefer_block_bytes](/docs/en/operations/settings/settings-formats.md/#input_format_parquet_prefer_block_bytes) - Average block bytes output by parquet reader. Default value - `16744704`.
+- [output_format_parquet_write_page_index](/docs/en/operations/settings/settings-formats.md/#input_format_parquet_max_block_size) - Add a possibility to write page index into parquet files. Need to disable `output_format_parquet_use_custom_encoder` at present. Default value - `true`.
## ParquetMetadata {data-format-parquet-metadata}
diff --git a/docs/en/operations/named-collections.md b/docs/en/operations/named-collections.md
index 91438cfb675..59ee05d1f9e 100644
--- a/docs/en/operations/named-collections.md
+++ b/docs/en/operations/named-collections.md
@@ -5,6 +5,10 @@ sidebar_label: "Named collections"
title: "Named collections"
---
+import CloudNotSupportedBadge from '@theme/badges/CloudNotSupportedBadge';
+
+
+
Named collections provide a way to store collections of key-value pairs to be
used to configure integrations with external sources. You can use named collections with
dictionaries, tables, table functions, and object storage.
diff --git a/docs/en/operations/server-configuration-parameters/settings.md b/docs/en/operations/server-configuration-parameters/settings.md
index cdbb42a4ee7..8278f8c8699 100644
--- a/docs/en/operations/server-configuration-parameters/settings.md
+++ b/docs/en/operations/server-configuration-parameters/settings.md
@@ -498,6 +498,8 @@ Default: 0.9
Interval in seconds during which the server's maximum allowed memory consumption is adjusted by the corresponding threshold in cgroups. (see
settings `cgroup_memory_watcher_hard_limit_ratio` and `cgroup_memory_watcher_soft_limit_ratio`).
+To disable the cgroup observer, set this value to `0`.
+
Type: UInt64
Default: 15
@@ -1463,6 +1465,9 @@ Keys:
- `size` – Size of the file. Applies to `log` and `errorlog`. Once the file reaches `size`, ClickHouse archives and renames it, and creates a new log file in its place.
- `count` – The number of archived log files that ClickHouse stores.
- `console` – Send `log` and `errorlog` to the console instead of file. To enable, set to `1` or `true`.
+- `console_log_level` – Logging level for console. Default to `level`.
+- `use_syslog` - Log to syslog as well.
+- `syslog_level` - Logging level for logging to syslog.
- `stream_compress` – Compress `log` and `errorlog` with `lz4` stream compression. To enable, set to `1` or `true`.
- `formatting` – Specify log format to be printed in console log (currently only `json` supported).
diff --git a/docs/en/operations/settings/settings-formats.md b/docs/en/operations/settings/settings-formats.md
index 670c9c6cbf1..530023df5b7 100644
--- a/docs/en/operations/settings/settings-formats.md
+++ b/docs/en/operations/settings/settings-formats.md
@@ -1428,6 +1428,13 @@ Average block bytes output by parquet reader. Lowering the configuration in the
Default value: `65409 * 256 = 16744704`
+### output_format_parquet_write_page_index {#input_format_parquet_max_block_size}
+
+Could add page index into parquet files. To enable this, need set `output_format_parquet_use_custom_encoder`=`false` and
+`output_format_parquet_write_page_index`=`true`.
+
+Enable by default.
+
## Hive format settings {#hive-format-settings}
### input_format_hive_text_fields_delimiter {#input_format_hive_text_fields_delimiter}
diff --git a/docs/en/operations/utilities/clickhouse-local.md b/docs/en/operations/utilities/clickhouse-local.md
index 93a3fecf3c6..f19643a3fa5 100644
--- a/docs/en/operations/utilities/clickhouse-local.md
+++ b/docs/en/operations/utilities/clickhouse-local.md
@@ -236,10 +236,10 @@ Read 2 rows, 32.00 B in 0.000 sec., 5182 rows/sec., 80.97 KiB/sec.
Previous example is the same as:
``` bash
-$ echo -e "1,2\n3,4" | clickhouse-local --query "
+$ echo -e "1,2\n3,4" | clickhouse-local -n --query "
CREATE TABLE table (a Int64, b Int64) ENGINE = File(CSV, stdin);
SELECT a, b FROM table;
- DROP TABLE table"
+ DROP TABLE table;"
Read 2 rows, 32.00 B in 0.000 sec., 4987 rows/sec., 77.93 KiB/sec.
1 2
3 4
diff --git a/docs/en/sql-reference/functions/string-functions.md b/docs/en/sql-reference/functions/string-functions.md
index a258456345e..c068b0e9d17 100644
--- a/docs/en/sql-reference/functions/string-functions.md
+++ b/docs/en/sql-reference/functions/string-functions.md
@@ -1168,14 +1168,14 @@ Result:
└────────────────────────────┘
```
-## base64UrlEncode
+## base64URLEncode
Encodes an URL (String or FixedString) as base64 with URL-specific modifications, according to [RFC 4648](https://datatracker.ietf.org/doc/html/rfc4648#section-5).
**Syntax**
```sql
-base64UrlEncode(url)
+base64URLEncode(url)
```
**Arguments**
@@ -1189,13 +1189,13 @@ base64UrlEncode(url)
**Example**
``` sql
-SELECT base64UrlEncode('https://clickhouse.com');
+SELECT base64URLEncode('https://clickhouse.com');
```
Result:
```result
-┌─base64UrlEncode('https://clickhouse.com')─┐
+┌─base64URLEncode('https://clickhouse.com')─┐
│ aHR0cDovL2NsaWNraG91c2UuY29t │
└───────────────────────────────────────────┘
```
@@ -1234,19 +1234,19 @@ Result:
└──────────────────────────────────┘
```
-## base64UrlDecode
+## base64URLDecode
Accepts a base64-encoded URL and decodes it from base64 with URL-specific modifications, according to [RFC 4648](https://datatracker.ietf.org/doc/html/rfc4648#section-5). Throws an exception in case of an error.
**Syntax**
```sql
-base64UrlDecode(encodedUrl)
+base64URLDecode(encodedUrl)
```
**Arguments**
-- `encodedUrl` — [String](../data-types/string.md) column or constant. If the string is not a valid Base64-encoded value with URL-specific modifications, an exception is thrown.
+- `encodedURL` — [String](../data-types/string.md) column or constant. If the string is not a valid Base64-encoded value with URL-specific modifications, an exception is thrown.
**Returned value**
@@ -1255,13 +1255,13 @@ base64UrlDecode(encodedUrl)
**Example**
``` sql
-SELECT base64UrlDecode('aHR0cDovL2NsaWNraG91c2UuY29t');
+SELECT base64URLDecode('aHR0cDovL2NsaWNraG91c2UuY29t');
```
Result:
```result
-┌─base64UrlDecode('aHR0cDovL2NsaWNraG91c2UuY29t')─┐
+┌─base64URLDecode('aHR0cDovL2NsaWNraG91c2UuY29t')─┐
│ https://clickhouse.com │
└─────────────────────────────────────────────────┘
```
@@ -1298,19 +1298,19 @@ SELECT tryBase64Decode('RW5jb2RlZA==') as res, tryBase64Decode('invalid') as res
└────────────┴─────────────┘
```
-## tryBase64UrlDecode
+## tryBase64URLDecode
-Like `base64UrlDecode` but returns an empty string in case of error.
+Like `base64URLDecode` but returns an empty string in case of error.
**Syntax**
```sql
-tryBase64UrlDecode(encodedUrl)
+tryBase64URLDecode(encodedUrl)
```
**Parameters**
-- `encodedUrl`: [String](../data-types/string.md) column or constant. If the string is not a valid Base64-encoded value with URL-specific modifications, returns an empty string.
+- `encodedURL`: [String](../data-types/string.md) column or constant. If the string is not a valid Base64-encoded value with URL-specific modifications, returns an empty string.
**Returned value**
@@ -1321,7 +1321,7 @@ tryBase64UrlDecode(encodedUrl)
Query:
```sql
-SELECT tryBase64UrlDecode('aHR0cDovL2NsaWNraG91c2UuY29t') as res, tryBase64Decode('aHR0cHM6Ly9jbGlja') as res_invalid;
+SELECT tryBase64URLDecode('aHR0cDovL2NsaWNraG91c2UuY29t') as res, tryBase64Decode('aHR0cHM6Ly9jbGlja') as res_invalid;
```
```response
diff --git a/docs/en/sql-reference/functions/url-functions.md b/docs/en/sql-reference/functions/url-functions.md
index 8b3e4f44840..76c0141ac8b 100644
--- a/docs/en/sql-reference/functions/url-functions.md
+++ b/docs/en/sql-reference/functions/url-functions.md
@@ -818,6 +818,40 @@ The same as above, but including query string and fragment.
Example: `/top/news.html?page=2#comments`.
+### protocol
+
+Extracts the protocol from a URL.
+
+**Syntax**
+
+```sql
+protocol(url)
+```
+
+**Arguments**
+
+- `url` — URL to extract protocol from. [String](../data-types/string.md).
+
+**Returned value**
+
+- Protocol, or an empty string if it cannot be determined. [String](../data-types/string.md).
+
+**Example**
+
+Query:
+
+```sql
+SELECT protocol('https://clickhouse.com/');
+```
+
+Result:
+
+```response
+┌─protocol('https://clickhouse.com/')─┐
+│ https │
+└─────────────────────────────────────┘
+```
+
### queryString
Returns the query string without the initial question mark, `#` and everything after `#`.
diff --git a/docs/en/sql-reference/statements/alter/named-collection.md b/docs/en/sql-reference/statements/alter/named-collection.md
index 71d4bfadd9c..ab772fe4dcf 100644
--- a/docs/en/sql-reference/statements/alter/named-collection.md
+++ b/docs/en/sql-reference/statements/alter/named-collection.md
@@ -3,6 +3,10 @@ slug: /en/sql-reference/statements/alter/named-collection
sidebar_label: NAMED COLLECTION
---
+import CloudNotSupportedBadge from '@theme/badges/CloudNotSupportedBadge';
+
+
+
# ALTER NAMED COLLECTION
This query intends to modify already existing named collections.
diff --git a/docs/en/sql-reference/statements/alter/view.md b/docs/en/sql-reference/statements/alter/view.md
index fb7a5bd7c03..5f3dae0a9c0 100644
--- a/docs/en/sql-reference/statements/alter/view.md
+++ b/docs/en/sql-reference/statements/alter/view.md
@@ -134,8 +134,8 @@ PRIMARY KEY (event_type, ts)
ORDER BY (event_type, ts, browser)
SETTINGS index_granularity = 8192
--- !!! The columns' definition is unchanged but it does not matter, we are not quering
--- MATERIALIZED VIEW, we are quering TO (storage) table.
+-- !!! The columns' definition is unchanged but it does not matter, we are not querying
+-- MATERIALIZED VIEW, we are querying TO (storage) table.
-- SELECT section is updated.
SHOW CREATE TABLE mv FORMAT TSVRaw;
diff --git a/docs/en/sql-reference/statements/create/named-collection.md b/docs/en/sql-reference/statements/create/named-collection.md
index f69fa2e3678..a4e146c814c 100644
--- a/docs/en/sql-reference/statements/create/named-collection.md
+++ b/docs/en/sql-reference/statements/create/named-collection.md
@@ -3,6 +3,10 @@ slug: /en/sql-reference/statements/create/named-collection
sidebar_label: NAMED COLLECTION
---
+import CloudNotSupportedBadge from '@theme/badges/CloudNotSupportedBadge';
+
+
+
# CREATE NAMED COLLECTION
Creates a new named collection.
diff --git a/docs/ru/development/developer-instruction.md b/docs/ru/development/developer-instruction.md
index 01ff4dd5f28..bf42edf89ff 100644
--- a/docs/ru/development/developer-instruction.md
+++ b/docs/ru/development/developer-instruction.md
@@ -283,7 +283,7 @@ Pull request можно создать, даже если работа над з
Тесты будут запущены, как только сотрудники ClickHouse поставят для pull request тег «Can be tested». Результаты первых проверок (стиль кода) появятся уже через несколько минут. Результаты сборки появятся примерно через пол часа. Результаты основного набора тестов будут доступны в пределах часа.
-Система подготовит сборки ClickHouse специально для вашего pull request. Для их получения, нажмите на ссылку «Details» у проверки «Clickhouse build check». Там вы сможете найти прямые ссылки на собранные .deb пакеты ClickHouse, которые, при желании, вы даже сможете установить на свои продакшен серверы (если не страшно).
+Система подготовит сборки ClickHouse специально для вашего pull request. Для их получения, нажмите на ссылку «Details» у проверки «Builds». Там вы сможете найти прямые ссылки на собранные .deb пакеты ClickHouse, которые, при желании, вы даже сможете установить на свои продакшен серверы (если не страшно).
Вероятнее всего, часть сборок не будет успешной с первого раза. Ведь мы проверяем сборку кода и gcc и clang, а при сборке с помощью clang включаются почти все существующие в природе warnings (всегда с флагом `-Werror`). На той же странице, вы сможете найти логи сборки - вам не обязательно самому собирать ClickHouse всеми возможными способами.
diff --git a/docs/ru/sql-reference/functions/string-functions.md b/docs/ru/sql-reference/functions/string-functions.md
index fa76e84f130..2436581fc7f 100644
--- a/docs/ru/sql-reference/functions/string-functions.md
+++ b/docs/ru/sql-reference/functions/string-functions.md
@@ -538,7 +538,7 @@ SELECT base58Decode('3dc8KtHrwM');
Синоним: `TO_BASE64`.
-## base64UrlEncode(s)
+## base64URLEncode(s)
Производит кодирование URL (String или FixedString) в base64-представление в соответствии с [RFC 4648](https://tools.ietf.org/html/rfc4648).
@@ -548,7 +548,7 @@ SELECT base58Decode('3dc8KtHrwM');
Синоним: `FROM_BASE64`.
-## base64UrlDecode(s)
+## base64URLDecode(s)
Декодирует base64-представление URL в исходную строку в соответствии с [RFC 4648](https://tools.ietf.org/html/rfc4648). При невозможности декодирования выбрасывает исключение
@@ -556,9 +556,9 @@ SELECT base58Decode('3dc8KtHrwM');
Функционал аналогичен base64Decode, но при невозможности декодирования возвращает пустую строку.
-## tryBase64UrlDecode(s)
+## tryBase64URLDecode(s)
-Функционал аналогичен base64UrlDecode, но при невозможности декодирования возвращает пустую строку.
+Функционал аналогичен base64URLDecode, но при невозможности декодирования возвращает пустую строку.
## endsWith(s, suffix) {#endswith}
diff --git a/docs/zh/engines/table-engines/mergetree-family/mergetree.md b/docs/zh/engines/table-engines/mergetree-family/mergetree.md
index 67bd681269b..d5ece5b23a9 100644
--- a/docs/zh/engines/table-engines/mergetree-family/mergetree.md
+++ b/docs/zh/engines/table-engines/mergetree-family/mergetree.md
@@ -201,18 +201,18 @@ ClickHouse 不要求主键唯一,所以您可以插入多条具有相同主键
主键中列的数量并没有明确的限制。依据数据结构,您可以在主键包含多些或少些列。这样可以:
- - 改善索引的性能。
+- 改善索引的性能。
- - 如果当前主键是 `(a, b)` ,在下列情况下添加另一个 `c` 列会提升性能:
+ 如果当前主键是 `(a, b)` ,在下列情况下添加另一个 `c` 列会提升性能:
- - 查询会使用 `c` 列作为条件
- - 很长的数据范围( `index_granularity` 的数倍)里 `(a, b)` 都是相同的值,并且这样的情况很普遍。换言之,就是加入另一列后,可以让您的查询略过很长的数据范围。
+ - 查询会使用 `c` 列作为条件
+ - 很长的数据范围( `index_granularity` 的数倍)里 `(a, b)` 都是相同的值,并且这样的情况很普遍。换言之,就是加入另一列后,可以让您的查询略过很长的数据范围。
- - 改善数据压缩。
+- 改善数据压缩。
- ClickHouse 以主键排序片段数据,所以,数据的一致性越高,压缩越好。
+ ClickHouse 以主键排序片段数据,所以,数据的一致性越高,压缩越好。
- - 在[CollapsingMergeTree](collapsingmergetree.md#table_engine-collapsingmergetree) 和 [SummingMergeTree](summingmergetree.md) 引擎里进行数据合并时会提供额外的处理逻辑。
+- 在[CollapsingMergeTree](collapsingmergetree.md#table_engine-collapsingmergetree) 和 [SummingMergeTree](summingmergetree.md) 引擎里进行数据合并时会提供额外的处理逻辑。
在这种情况下,指定与主键不同的 *排序键* 也是有意义的。
diff --git a/programs/client/Client.cpp b/programs/client/Client.cpp
index c4878b18f00..6343dc85d00 100644
--- a/programs/client/Client.cpp
+++ b/programs/client/Client.cpp
@@ -248,6 +248,10 @@ std::vector Client::loadWarningMessages()
}
}
+Poco::Util::LayeredConfiguration & Client::getClientConfiguration()
+{
+ return config();
+}
void Client::initialize(Poco::Util::Application & self)
{
@@ -697,9 +701,7 @@ bool Client::processWithFuzzing(const String & full_query)
const char * begin = full_query.data();
orig_ast = parseQuery(begin, begin + full_query.size(),
global_context->getSettingsRef(),
- /*allow_multi_statements=*/ true,
- /*is_interactive=*/ is_interactive,
- /*ignore_error=*/ ignore_error);
+ /*allow_multi_statements=*/ true);
}
catch (const Exception & e)
{
diff --git a/programs/client/Client.h b/programs/client/Client.h
index bef948b3c1e..229608f787d 100644
--- a/programs/client/Client.h
+++ b/programs/client/Client.h
@@ -16,6 +16,9 @@ public:
int main(const std::vector & /*args*/) override;
protected:
+
+ Poco::Util::LayeredConfiguration & getClientConfiguration() override;
+
bool processWithFuzzing(const String & full_query) override;
std::optional processFuzzingStep(const String & query_to_execute, const ASTPtr & parsed_query);
diff --git a/programs/keeper-client/KeeperClient.cpp b/programs/keeper-client/KeeperClient.cpp
index 68adc2c2aac..a20c1f686f3 100644
--- a/programs/keeper-client/KeeperClient.cpp
+++ b/programs/keeper-client/KeeperClient.cpp
@@ -383,6 +383,9 @@ int KeeperClient::main(const std::vector & /* args */)
for (const auto & key : keys)
{
+ if (key != "node")
+ continue;
+
String prefix = "zookeeper." + key;
String host = clickhouse_config.configuration->getString(prefix + ".host");
String port = clickhouse_config.configuration->getString(prefix + ".port");
@@ -401,6 +404,7 @@ int KeeperClient::main(const std::vector & /* args */)
zk_args.hosts.push_back(host + ":" + port);
}
+ zk_args.availability_zones.resize(zk_args.hosts.size());
zk_args.connection_timeout_ms = config().getInt("connection-timeout", 10) * 1000;
zk_args.session_timeout_ms = config().getInt("session-timeout", 10) * 1000;
zk_args.operation_timeout_ms = config().getInt("operation-timeout", 10) * 1000;
diff --git a/programs/keeper/Keeper.cpp b/programs/keeper/Keeper.cpp
index bb04ff88936..f14ef2e5552 100644
--- a/programs/keeper/Keeper.cpp
+++ b/programs/keeper/Keeper.cpp
@@ -355,10 +355,7 @@ try
std::string include_from_path = config().getString("include_from", "/etc/metrika.xml");
- if (config().has(DB::PlacementInfo::PLACEMENT_CONFIG_PREFIX))
- {
- PlacementInfo::PlacementInfo::instance().initialize(config());
- }
+ PlacementInfo::PlacementInfo::instance().initialize(config());
GlobalThreadPool::initialize(
/// We need to have sufficient amount of threads for connections + nuraft workers + keeper workers, 1000 is an estimation
diff --git a/programs/library-bridge/CMakeLists.txt b/programs/library-bridge/CMakeLists.txt
index 2fca10ce4d7..86410d712ec 100644
--- a/programs/library-bridge/CMakeLists.txt
+++ b/programs/library-bridge/CMakeLists.txt
@@ -11,7 +11,6 @@ set (CLICKHOUSE_LIBRARY_BRIDGE_SOURCES
LibraryBridgeHandlers.cpp
SharedLibrary.cpp
library-bridge.cpp
- createFunctionBaseCast.cpp
)
clickhouse_add_executable(clickhouse-library-bridge ${CLICKHOUSE_LIBRARY_BRIDGE_SOURCES})
@@ -20,6 +19,7 @@ target_link_libraries(clickhouse-library-bridge PRIVATE
daemon
dbms
bridge
+ clickhouse_functions
)
set_target_properties(clickhouse-library-bridge PROPERTIES RUNTIME_OUTPUT_DIRECTORY ..)
diff --git a/programs/local/LocalServer.cpp b/programs/local/LocalServer.cpp
index cb1c35743b2..b33e1595056 100644
--- a/programs/local/LocalServer.cpp
+++ b/programs/local/LocalServer.cpp
@@ -32,6 +32,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -59,8 +60,13 @@
# include
#endif
+
namespace fs = std::filesystem;
+namespace CurrentMetrics
+{
+ extern const Metric MemoryTracking;
+}
namespace DB
{
@@ -82,6 +88,11 @@ void applySettingsOverridesForLocal(ContextMutablePtr context)
context->setSettings(settings);
}
+Poco::Util::LayeredConfiguration & LocalServer::getClientConfiguration()
+{
+ return config();
+}
+
void LocalServer::processError(const String &) const
{
if (ignore_error)
@@ -117,20 +128,21 @@ void LocalServer::initialize(Poco::Util::Application & self)
Poco::Util::Application::initialize(self);
/// Load config files if exists
- if (config().has("config-file") || fs::exists("config.xml"))
+ if (getClientConfiguration().has("config-file") || fs::exists("config.xml"))
{
- const auto config_path = config().getString("config-file", "config.xml");
+ const auto config_path = getClientConfiguration().getString("config-file", "config.xml");
ConfigProcessor config_processor(config_path, false, true);
ConfigProcessor::setConfigPath(fs::path(config_path).parent_path());
auto loaded_config = config_processor.loadConfig();
- config().add(loaded_config.configuration.duplicate(), PRIO_DEFAULT, false);
+ getClientConfiguration().add(loaded_config.configuration.duplicate(), PRIO_DEFAULT, false);
}
+ server_settings.loadSettingsFromConfig(config());
+
GlobalThreadPool::initialize(
- config().getUInt("max_thread_pool_size", 10000),
- config().getUInt("max_thread_pool_free_size", 1000),
- config().getUInt("thread_pool_queue_size", 10000)
- );
+ server_settings.max_thread_pool_size,
+ server_settings.max_thread_pool_free_size,
+ server_settings.thread_pool_queue_size);
#if USE_AZURE_BLOB_STORAGE
/// See the explanation near the same line in Server.cpp
@@ -141,18 +153,17 @@ void LocalServer::initialize(Poco::Util::Application & self)
#endif
getIOThreadPool().initialize(
- config().getUInt("max_io_thread_pool_size", 100),
- config().getUInt("max_io_thread_pool_free_size", 0),
- config().getUInt("io_thread_pool_queue_size", 10000));
+ server_settings.max_io_thread_pool_size,
+ server_settings.max_io_thread_pool_free_size,
+ server_settings.io_thread_pool_queue_size);
-
- const size_t active_parts_loading_threads = config().getUInt("max_active_parts_loading_thread_pool_size", 64);
+ const size_t active_parts_loading_threads = server_settings.max_active_parts_loading_thread_pool_size;
getActivePartsLoadingThreadPool().initialize(
active_parts_loading_threads,
0, // We don't need any threads one all the parts will be loaded
active_parts_loading_threads);
- const size_t outdated_parts_loading_threads = config().getUInt("max_outdated_parts_loading_thread_pool_size", 32);
+ const size_t outdated_parts_loading_threads = server_settings.max_outdated_parts_loading_thread_pool_size;
getOutdatedPartsLoadingThreadPool().initialize(
outdated_parts_loading_threads,
0, // We don't need any threads one all the parts will be loaded
@@ -160,7 +171,7 @@ void LocalServer::initialize(Poco::Util::Application & self)
getOutdatedPartsLoadingThreadPool().setMaxTurboThreads(active_parts_loading_threads);
- const size_t unexpected_parts_loading_threads = config().getUInt("max_unexpected_parts_loading_thread_pool_size", 32);
+ const size_t unexpected_parts_loading_threads = server_settings.max_unexpected_parts_loading_thread_pool_size;
getUnexpectedPartsLoadingThreadPool().initialize(
unexpected_parts_loading_threads,
0, // We don't need any threads one all the parts will be loaded
@@ -168,7 +179,7 @@ void LocalServer::initialize(Poco::Util::Application & self)
getUnexpectedPartsLoadingThreadPool().setMaxTurboThreads(active_parts_loading_threads);
- const size_t cleanup_threads = config().getUInt("max_parts_cleaning_thread_pool_size", 128);
+ const size_t cleanup_threads = server_settings.max_parts_cleaning_thread_pool_size;
getPartsCleaningThreadPool().initialize(
cleanup_threads,
0, // We don't need any threads one all the parts will be deleted
@@ -201,10 +212,10 @@ void LocalServer::tryInitPath()
{
std::string path;
- if (config().has("path"))
+ if (getClientConfiguration().has("path"))
{
// User-supplied path.
- path = config().getString("path");
+ path = getClientConfiguration().getString("path");
Poco::trimInPlace(path);
if (path.empty())
@@ -263,13 +274,13 @@ void LocalServer::tryInitPath()
global_context->setUserFilesPath(""); /// user's files are everywhere
- std::string user_scripts_path = config().getString("user_scripts_path", fs::path(path) / "user_scripts/");
+ std::string user_scripts_path = getClientConfiguration().getString("user_scripts_path", fs::path(path) / "user_scripts/");
global_context->setUserScriptsPath(user_scripts_path);
/// top_level_domains_lists
- const std::string & top_level_domains_path = config().getString("top_level_domains_path", fs::path(path) / "top_level_domains/");
+ const std::string & top_level_domains_path = getClientConfiguration().getString("top_level_domains_path", fs::path(path) / "top_level_domains/");
if (!top_level_domains_path.empty())
- TLDListsHolder::getInstance().parseConfig(fs::path(top_level_domains_path) / "", config());
+ TLDListsHolder::getInstance().parseConfig(fs::path(top_level_domains_path) / "", getClientConfiguration());
}
@@ -311,14 +322,14 @@ void LocalServer::cleanup()
std::string LocalServer::getInitialCreateTableQuery()
{
- if (!config().has("table-structure") && !config().has("table-file") && !config().has("table-data-format") && (!isRegularFile(STDIN_FILENO) || queries.empty()))
+ if (!getClientConfiguration().has("table-structure") && !getClientConfiguration().has("table-file") && !getClientConfiguration().has("table-data-format") && (!isRegularFile(STDIN_FILENO) || queries.empty()))
return {};
- auto table_name = backQuoteIfNeed(config().getString("table-name", "table"));
- auto table_structure = config().getString("table-structure", "auto");
+ auto table_name = backQuoteIfNeed(getClientConfiguration().getString("table-name", "table"));
+ auto table_structure = getClientConfiguration().getString("table-structure", "auto");
String table_file;
- if (!config().has("table-file") || config().getString("table-file") == "-")
+ if (!getClientConfiguration().has("table-file") || getClientConfiguration().getString("table-file") == "-")
{
/// Use Unix tools stdin naming convention
table_file = "stdin";
@@ -326,7 +337,7 @@ std::string LocalServer::getInitialCreateTableQuery()
else
{
/// Use regular file
- auto file_name = config().getString("table-file");
+ auto file_name = getClientConfiguration().getString("table-file");
table_file = quoteString(file_name);
}
@@ -374,18 +385,18 @@ void LocalServer::setupUsers()
ConfigurationPtr users_config;
auto & access_control = global_context->getAccessControl();
- access_control.setNoPasswordAllowed(config().getBool("allow_no_password", true));
- access_control.setPlaintextPasswordAllowed(config().getBool("allow_plaintext_password", true));
- if (config().has("config-file") || fs::exists("config.xml"))
+ access_control.setNoPasswordAllowed(getClientConfiguration().getBool("allow_no_password", true));
+ access_control.setPlaintextPasswordAllowed(getClientConfiguration().getBool("allow_plaintext_password", true));
+ if (getClientConfiguration().has("config-file") || fs::exists("config.xml"))
{
- String config_path = config().getString("config-file", "");
- bool has_user_directories = config().has("user_directories");
+ String config_path = getClientConfiguration().getString("config-file", "");
+ bool has_user_directories = getClientConfiguration().has("user_directories");
const auto config_dir = fs::path{config_path}.remove_filename().string();
- String users_config_path = config().getString("users_config", "");
+ String users_config_path = getClientConfiguration().getString("users_config", "");
if (users_config_path.empty() && has_user_directories)
{
- users_config_path = config().getString("user_directories.users_xml.path");
+ users_config_path = getClientConfiguration().getString("user_directories.users_xml.path");
if (fs::path(users_config_path).is_relative() && fs::exists(fs::path(config_dir) / users_config_path))
users_config_path = fs::path(config_dir) / users_config_path;
}
@@ -409,10 +420,10 @@ void LocalServer::setupUsers()
void LocalServer::connect()
{
- connection_parameters = ConnectionParameters(config(), "localhost");
+ connection_parameters = ConnectionParameters(getClientConfiguration(), "localhost");
ReadBuffer * in;
- auto table_file = config().getString("table-file", "-");
+ auto table_file = getClientConfiguration().getString("table-file", "-");
if (table_file == "-" || table_file == "stdin")
{
in = &std_in;
@@ -433,7 +444,7 @@ try
UseSSL use_ssl;
thread_status.emplace();
- StackTrace::setShowAddresses(config().getBool("show_addresses_in_stack_traces", true));
+ StackTrace::setShowAddresses(server_settings.show_addresses_in_stack_traces);
setupSignalHandler();
@@ -448,7 +459,7 @@ try
if (rlim.rlim_cur < rlim.rlim_max)
{
- rlim.rlim_cur = config().getUInt("max_open_files", static_cast(rlim.rlim_max));
+ rlim.rlim_cur = getClientConfiguration().getUInt("max_open_files", static_cast(rlim.rlim_max));
int rc = setrlimit(RLIMIT_NOFILE, &rlim);
if (rc != 0)
std::cerr << fmt::format("Cannot set max number of file descriptors to {}. Try to specify max_open_files according to your system limits. error: {}", rlim.rlim_cur, errnoToString()) << '\n';
@@ -456,8 +467,8 @@ try
}
is_interactive = stdin_is_a_tty
- && (config().hasOption("interactive")
- || (queries.empty() && !config().has("table-structure") && queries_files.empty() && !config().has("table-file")));
+ && (getClientConfiguration().hasOption("interactive")
+ || (queries.empty() && !getClientConfiguration().has("table-structure") && queries_files.empty() && !getClientConfiguration().has("table-file")));
if (!is_interactive)
{
@@ -481,7 +492,7 @@ try
SCOPE_EXIT({ cleanup(); });
- initTTYBuffer(toProgressOption(config().getString("progress", "default")));
+ initTTYBuffer(toProgressOption(getClientConfiguration().getString("progress", "default")));
ASTAlterCommand::setFormatAlterCommandsWithParentheses(true);
applyCmdSettings(global_context);
@@ -489,7 +500,7 @@ try
/// try to load user defined executable functions, throw on error and die
try
{
- global_context->loadOrReloadUserDefinedExecutableFunctions(config());
+ global_context->loadOrReloadUserDefinedExecutableFunctions(getClientConfiguration());
}
catch (...)
{
@@ -530,7 +541,7 @@ try
}
catch (const DB::Exception & e)
{
- bool need_print_stack_trace = config().getBool("stacktrace", false);
+ bool need_print_stack_trace = getClientConfiguration().getBool("stacktrace", false);
std::cerr << getExceptionMessage(e, need_print_stack_trace, true) << std::endl;
return e.code() ? e.code() : -1;
}
@@ -542,42 +553,42 @@ catch (...)
void LocalServer::updateLoggerLevel(const String & logs_level)
{
- config().setString("logger.level", logs_level);
- updateLevels(config(), logger());
+ getClientConfiguration().setString("logger.level", logs_level);
+ updateLevels(getClientConfiguration(), logger());
}
void LocalServer::processConfig()
{
- if (!queries.empty() && config().has("queries-file"))
+ if (!queries.empty() && getClientConfiguration().has("queries-file"))
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Options '--query' and '--queries-file' cannot be specified at the same time");
- if (config().has("multiquery"))
+ if (getClientConfiguration().has("multiquery"))
is_multiquery = true;
- pager = config().getString("pager", "");
+ pager = getClientConfiguration().getString("pager", "");
- delayed_interactive = config().has("interactive") && (!queries.empty() || config().has("queries-file"));
+ delayed_interactive = getClientConfiguration().has("interactive") && (!queries.empty() || getClientConfiguration().has("queries-file"));
if (!is_interactive || delayed_interactive)
{
- echo_queries = config().hasOption("echo") || config().hasOption("verbose");
- ignore_error = config().getBool("ignore-error", false);
+ echo_queries = getClientConfiguration().hasOption("echo") || getClientConfiguration().hasOption("verbose");
+ ignore_error = getClientConfiguration().getBool("ignore-error", false);
}
- print_stack_trace = config().getBool("stacktrace", false);
+ print_stack_trace = getClientConfiguration().getBool("stacktrace", false);
const std::string clickhouse_dialect{"clickhouse"};
- load_suggestions = (is_interactive || delayed_interactive) && !config().getBool("disable_suggestion", false)
- && config().getString("dialect", clickhouse_dialect) == clickhouse_dialect;
- wait_for_suggestions_to_load = config().getBool("wait_for_suggestions_to_load", false);
+ load_suggestions = (is_interactive || delayed_interactive) && !getClientConfiguration().getBool("disable_suggestion", false)
+ && getClientConfiguration().getString("dialect", clickhouse_dialect) == clickhouse_dialect;
+ wait_for_suggestions_to_load = getClientConfiguration().getBool("wait_for_suggestions_to_load", false);
- auto logging = (config().has("logger.console")
- || config().has("logger.level")
- || config().has("log-level")
- || config().has("send_logs_level")
- || config().has("logger.log"));
+ auto logging = (getClientConfiguration().has("logger.console")
+ || getClientConfiguration().has("logger.level")
+ || getClientConfiguration().has("log-level")
+ || getClientConfiguration().has("send_logs_level")
+ || getClientConfiguration().has("logger.log"));
- auto level = config().getString("log-level", "trace");
+ auto level = getClientConfiguration().getString("log-level", "trace");
- if (config().has("server_logs_file"))
+ if (getClientConfiguration().has("server_logs_file"))
{
auto poco_logs_level = Poco::Logger::parseLevel(level);
Poco::Logger::root().setLevel(poco_logs_level);
@@ -587,10 +598,10 @@ void LocalServer::processConfig()
}
else
{
- config().setString("logger", "logger");
+ getClientConfiguration().setString("logger", "logger");
auto log_level_default = logging ? level : "fatal";
- config().setString("logger.level", config().getString("log-level", config().getString("send_logs_level", log_level_default)));
- buildLoggers(config(), logger(), "clickhouse-local");
+ getClientConfiguration().setString("logger.level", getClientConfiguration().getString("log-level", getClientConfiguration().getString("send_logs_level", log_level_default)));
+ buildLoggers(getClientConfiguration(), logger(), "clickhouse-local");
}
shared_context = Context::createShared();
@@ -604,13 +615,13 @@ void LocalServer::processConfig()
LoggerRawPtr log = &logger();
/// Maybe useless
- if (config().has("macros"))
- global_context->setMacros(std::make_unique(config(), "macros", log));
+ if (getClientConfiguration().has("macros"))
+ global_context->setMacros(std::make_unique(getClientConfiguration(), "macros", log));
setDefaultFormatsAndCompressionFromConfiguration();
/// Sets external authenticators config (LDAP, Kerberos).
- global_context->setExternalAuthenticatorsConfig(config());
+ global_context->setExternalAuthenticatorsConfig(getClientConfiguration());
setupUsers();
@@ -619,12 +630,43 @@ void LocalServer::processConfig()
global_context->getProcessList().setMaxSize(0);
const size_t physical_server_memory = getMemoryAmount();
- const double cache_size_to_ram_max_ratio = config().getDouble("cache_size_to_ram_max_ratio", 0.5);
+
+ size_t max_server_memory_usage = server_settings.max_server_memory_usage;
+ double max_server_memory_usage_to_ram_ratio = server_settings.max_server_memory_usage_to_ram_ratio;
+
+ size_t default_max_server_memory_usage = static_cast(physical_server_memory * max_server_memory_usage_to_ram_ratio);
+
+ if (max_server_memory_usage == 0)
+ {
+ max_server_memory_usage = default_max_server_memory_usage;
+ LOG_INFO(log, "Setting max_server_memory_usage was set to {}"
+ " ({} available * {:.2f} max_server_memory_usage_to_ram_ratio)",
+ formatReadableSizeWithBinarySuffix(max_server_memory_usage),
+ formatReadableSizeWithBinarySuffix(physical_server_memory),
+ max_server_memory_usage_to_ram_ratio);
+ }
+ else if (max_server_memory_usage > default_max_server_memory_usage)
+ {
+ max_server_memory_usage = default_max_server_memory_usage;
+ LOG_INFO(log, "Setting max_server_memory_usage was lowered to {}"
+ " because the system has low amount of memory. The amount was"
+ " calculated as {} available"
+ " * {:.2f} max_server_memory_usage_to_ram_ratio",
+ formatReadableSizeWithBinarySuffix(max_server_memory_usage),
+ formatReadableSizeWithBinarySuffix(physical_server_memory),
+ max_server_memory_usage_to_ram_ratio);
+ }
+
+ total_memory_tracker.setHardLimit(max_server_memory_usage);
+ total_memory_tracker.setDescription("(total)");
+ total_memory_tracker.setMetric(CurrentMetrics::MemoryTracking);
+
+ const double cache_size_to_ram_max_ratio = server_settings.cache_size_to_ram_max_ratio;
const size_t max_cache_size = static_cast(physical_server_memory * cache_size_to_ram_max_ratio);
- String uncompressed_cache_policy = config().getString("uncompressed_cache_policy", DEFAULT_UNCOMPRESSED_CACHE_POLICY);
- size_t uncompressed_cache_size = config().getUInt64("uncompressed_cache_size", DEFAULT_UNCOMPRESSED_CACHE_MAX_SIZE);
- double uncompressed_cache_size_ratio = config().getDouble("uncompressed_cache_size_ratio", DEFAULT_UNCOMPRESSED_CACHE_SIZE_RATIO);
+ String uncompressed_cache_policy = server_settings.uncompressed_cache_policy;
+ size_t uncompressed_cache_size = server_settings.uncompressed_cache_size;
+ double uncompressed_cache_size_ratio = server_settings.uncompressed_cache_size_ratio;
if (uncompressed_cache_size > max_cache_size)
{
uncompressed_cache_size = max_cache_size;
@@ -632,9 +674,9 @@ void LocalServer::processConfig()
}
global_context->setUncompressedCache(uncompressed_cache_policy, uncompressed_cache_size, uncompressed_cache_size_ratio);
- String mark_cache_policy = config().getString("mark_cache_policy", DEFAULT_MARK_CACHE_POLICY);
- size_t mark_cache_size = config().getUInt64("mark_cache_size", DEFAULT_MARK_CACHE_MAX_SIZE);
- double mark_cache_size_ratio = config().getDouble("mark_cache_size_ratio", DEFAULT_MARK_CACHE_SIZE_RATIO);
+ String mark_cache_policy = server_settings.mark_cache_policy;
+ size_t mark_cache_size = server_settings.mark_cache_size;
+ double mark_cache_size_ratio = server_settings.mark_cache_size_ratio;
if (!mark_cache_size)
LOG_ERROR(log, "Too low mark cache size will lead to severe performance degradation.");
if (mark_cache_size > max_cache_size)
@@ -644,9 +686,9 @@ void LocalServer::processConfig()
}
global_context->setMarkCache(mark_cache_policy, mark_cache_size, mark_cache_size_ratio);
- String index_uncompressed_cache_policy = config().getString("index_uncompressed_cache_policy", DEFAULT_INDEX_UNCOMPRESSED_CACHE_POLICY);
- size_t index_uncompressed_cache_size = config().getUInt64("index_uncompressed_cache_size", DEFAULT_INDEX_UNCOMPRESSED_CACHE_MAX_SIZE);
- double index_uncompressed_cache_size_ratio = config().getDouble("index_uncompressed_cache_size_ratio", DEFAULT_INDEX_UNCOMPRESSED_CACHE_SIZE_RATIO);
+ String index_uncompressed_cache_policy = server_settings.index_uncompressed_cache_policy;
+ size_t index_uncompressed_cache_size = server_settings.index_uncompressed_cache_size;
+ double index_uncompressed_cache_size_ratio = server_settings.index_uncompressed_cache_size_ratio;
if (index_uncompressed_cache_size > max_cache_size)
{
index_uncompressed_cache_size = max_cache_size;
@@ -654,9 +696,9 @@ void LocalServer::processConfig()
}
global_context->setIndexUncompressedCache(index_uncompressed_cache_policy, index_uncompressed_cache_size, index_uncompressed_cache_size_ratio);
- String index_mark_cache_policy = config().getString("index_mark_cache_policy", DEFAULT_INDEX_MARK_CACHE_POLICY);
- size_t index_mark_cache_size = config().getUInt64("index_mark_cache_size", DEFAULT_INDEX_MARK_CACHE_MAX_SIZE);
- double index_mark_cache_size_ratio = config().getDouble("index_mark_cache_size_ratio", DEFAULT_INDEX_MARK_CACHE_SIZE_RATIO);
+ String index_mark_cache_policy = server_settings.index_mark_cache_policy;
+ size_t index_mark_cache_size = server_settings.index_mark_cache_size;
+ double index_mark_cache_size_ratio = server_settings.index_mark_cache_size_ratio;
if (index_mark_cache_size > max_cache_size)
{
index_mark_cache_size = max_cache_size;
@@ -664,7 +706,7 @@ void LocalServer::processConfig()
}
global_context->setIndexMarkCache(index_mark_cache_policy, index_mark_cache_size, index_mark_cache_size_ratio);
- size_t mmap_cache_size = config().getUInt64("mmap_cache_size", DEFAULT_MMAP_CACHE_MAX_SIZE);
+ size_t mmap_cache_size = server_settings.mmap_cache_size;
if (mmap_cache_size > max_cache_size)
{
mmap_cache_size = max_cache_size;
@@ -676,8 +718,8 @@ void LocalServer::processConfig()
global_context->setQueryCache(0, 0, 0, 0);
#if USE_EMBEDDED_COMPILER
- size_t compiled_expression_cache_max_size_in_bytes = config().getUInt64("compiled_expression_cache_size", DEFAULT_COMPILED_EXPRESSION_CACHE_MAX_SIZE);
- size_t compiled_expression_cache_max_elements = config().getUInt64("compiled_expression_cache_elements_size", DEFAULT_COMPILED_EXPRESSION_CACHE_MAX_ENTRIES);
+ size_t compiled_expression_cache_max_size_in_bytes = server_settings.compiled_expression_cache_size;
+ size_t compiled_expression_cache_max_elements = server_settings.compiled_expression_cache_elements_size;
CompiledExpressionCacheFactory::instance().init(compiled_expression_cache_max_size_in_bytes, compiled_expression_cache_max_elements);
#endif
@@ -689,16 +731,16 @@ void LocalServer::processConfig()
applyCmdOptions(global_context);
/// Load global settings from default_profile and system_profile.
- global_context->setDefaultProfiles(config());
+ global_context->setDefaultProfiles(getClientConfiguration());
/// We load temporary database first, because projections need it.
DatabaseCatalog::instance().initializeAndLoadTemporaryDatabase();
- std::string default_database = config().getString("default_database", "default");
+ std::string default_database = server_settings.default_database;
DatabaseCatalog::instance().attachDatabase(default_database, createClickHouseLocalDatabaseOverlay(default_database, global_context));
global_context->setCurrentDatabase(default_database);
- if (config().has("path"))
+ if (getClientConfiguration().has("path"))
{
String path = global_context->getPath();
fs::create_directories(fs::path(path));
@@ -713,7 +755,7 @@ void LocalServer::processConfig()
attachInformationSchema(global_context, *createMemoryDatabaseIfNotExists(global_context, DatabaseCatalog::INFORMATION_SCHEMA_UPPERCASE));
waitLoad(TablesLoaderForegroundPoolId, startup_system_tasks);
- if (!config().has("only-system-tables"))
+ if (!getClientConfiguration().has("only-system-tables"))
{
DatabaseCatalog::instance().createBackgroundTasks();
waitLoad(loadMetadata(global_context));
@@ -725,15 +767,15 @@ void LocalServer::processConfig()
LOG_DEBUG(log, "Loaded metadata.");
}
- else if (!config().has("no-system-tables"))
+ else if (!getClientConfiguration().has("no-system-tables"))
{
attachSystemTablesServer(global_context, *createMemoryDatabaseIfNotExists(global_context, DatabaseCatalog::SYSTEM_DATABASE), false);
attachInformationSchema(global_context, *createMemoryDatabaseIfNotExists(global_context, DatabaseCatalog::INFORMATION_SCHEMA));
attachInformationSchema(global_context, *createMemoryDatabaseIfNotExists(global_context, DatabaseCatalog::INFORMATION_SCHEMA_UPPERCASE));
}
- server_display_name = config().getString("display_name", "");
- prompt_by_server_display_name = config().getRawString("prompt_by_server_display_name.default", ":) ");
+ server_display_name = getClientConfiguration().getString("display_name", "");
+ prompt_by_server_display_name = getClientConfiguration().getRawString("prompt_by_server_display_name.default", ":) ");
global_context->setQueryKindInitial();
global_context->setQueryKind(query_kind);
@@ -811,7 +853,7 @@ void LocalServer::applyCmdSettings(ContextMutablePtr context)
void LocalServer::applyCmdOptions(ContextMutablePtr context)
{
- context->setDefaultFormat(config().getString("output-format", config().getString("format", is_interactive ? "PrettyCompact" : "TSV")));
+ context->setDefaultFormat(getClientConfiguration().getString("output-format", getClientConfiguration().getString("format", is_interactive ? "PrettyCompact" : "TSV")));
applyCmdSettings(context);
}
@@ -819,33 +861,33 @@ void LocalServer::applyCmdOptions(ContextMutablePtr context)
void LocalServer::processOptions(const OptionsDescription &, const CommandLineOptions & options, const std::vector &, const std::vector &)
{
if (options.count("table"))
- config().setString("table-name", options["table"].as());
+ getClientConfiguration().setString("table-name", options["table"].as());
if (options.count("file"))
- config().setString("table-file", options["file"].as());
+ getClientConfiguration().setString("table-file", options["file"].as());
if (options.count("structure"))
- config().setString("table-structure", options["structure"].as());
+ getClientConfiguration().setString("table-structure", options["structure"].as());
if (options.count("no-system-tables"))
- config().setBool("no-system-tables", true);
+ getClientConfiguration().setBool("no-system-tables", true);
if (options.count("only-system-tables"))
- config().setBool("only-system-tables", true);
+ getClientConfiguration().setBool("only-system-tables", true);
if (options.count("database"))
- config().setString("default_database", options["database"].as());
+ getClientConfiguration().setString("default_database", options["database"].as());
if (options.count("input-format"))
- config().setString("table-data-format", options["input-format"].as());
+ getClientConfiguration().setString("table-data-format", options["input-format"].as());
if (options.count("output-format"))
- config().setString("output-format", options["output-format"].as());
+ getClientConfiguration().setString("output-format", options["output-format"].as());
if (options.count("logger.console"))
- config().setBool("logger.console", options["logger.console"].as());
+ getClientConfiguration().setBool("logger.console", options["logger.console"].as());
if (options.count("logger.log"))
- config().setString("logger.log", options["logger.log"].as());
+ getClientConfiguration().setString("logger.log", options["logger.log"].as());
if (options.count("logger.level"))
- config().setString("logger.level", options["logger.level"].as());
+ getClientConfiguration().setString("logger.level", options["logger.level"].as());
if (options.count("send_logs_level"))
- config().setString("send_logs_level", options["send_logs_level"].as());
+ getClientConfiguration().setString("send_logs_level", options["send_logs_level"].as());
if (options.count("wait_for_suggestions_to_load"))
- config().setBool("wait_for_suggestions_to_load", true);
+ getClientConfiguration().setBool("wait_for_suggestions_to_load", true);
}
void LocalServer::readArguments(int argc, char ** argv, Arguments & common_arguments, std::vector &, std::vector &)
diff --git a/programs/local/LocalServer.h b/programs/local/LocalServer.h
index 4856e68ff9b..da2466650a7 100644
--- a/programs/local/LocalServer.h
+++ b/programs/local/LocalServer.h
@@ -30,6 +30,9 @@ public:
int main(const std::vector & /*args*/) override;
protected:
+
+ Poco::Util::LayeredConfiguration & getClientConfiguration() override;
+
void connect() override;
void processError(const String & query) const override;
@@ -63,6 +66,8 @@ private:
void applyCmdOptions(ContextMutablePtr context);
void applyCmdSettings(ContextMutablePtr context);
+ ServerSettings server_settings;
+
std::optional status;
std::optional temporary_directory_to_delete;
diff --git a/programs/main.cpp b/programs/main.cpp
index c270388f17f..61e2bc18ed7 100644
--- a/programs/main.cpp
+++ b/programs/main.cpp
@@ -13,6 +13,7 @@
#include
+#include "config.h"
#include "config_tools.h"
#include
@@ -439,6 +440,14 @@ extern "C"
}
#endif
+/// Prevent messages from JeMalloc in the release build.
+/// Some of these messages are non-actionable for the users, such as:
+/// : Number of CPUs detected is not deterministic. Per-CPU arena disabled.
+#if USE_JEMALLOC && defined(NDEBUG) && !defined(SANITIZER)
+extern "C" void (*malloc_message)(void *, const char *s);
+__attribute__((constructor(0))) void init_je_malloc_message() { malloc_message = [](void *, const char *){}; }
+#endif
+
/// This allows to implement assert to forbid initialization of a class in static constructors.
/// Usage:
///
diff --git a/programs/odbc-bridge/CMakeLists.txt b/programs/odbc-bridge/CMakeLists.txt
index 83839cc21ac..14af330f788 100644
--- a/programs/odbc-bridge/CMakeLists.txt
+++ b/programs/odbc-bridge/CMakeLists.txt
@@ -13,7 +13,6 @@ set (CLICKHOUSE_ODBC_BRIDGE_SOURCES
getIdentifierQuote.cpp
odbc-bridge.cpp
validateODBCConnectionString.cpp
- createFunctionBaseCast.cpp
)
clickhouse_add_executable(clickhouse-odbc-bridge ${CLICKHOUSE_ODBC_BRIDGE_SOURCES})
@@ -25,6 +24,7 @@ target_link_libraries(clickhouse-odbc-bridge PRIVATE
clickhouse_parsers
ch_contrib::nanodbc
ch_contrib::unixodbc
+ clickhouse_functions
)
set_target_properties(clickhouse-odbc-bridge PROPERTIES RUNTIME_OUTPUT_DIRECTORY ..)
diff --git a/programs/server/Server.cpp b/programs/server/Server.cpp
index e2554a6ff03..4cb3b5f45c7 100644
--- a/programs/server/Server.cpp
+++ b/programs/server/Server.cpp
@@ -1003,6 +1003,8 @@ try
ServerUUID::load(path / "uuid", log);
+ PlacementInfo::PlacementInfo::instance().initialize(config());
+
zkutil::validateZooKeeperConfig(config());
bool has_zookeeper = zkutil::hasZooKeeperConfig(config());
@@ -1817,11 +1819,6 @@ try
}
- if (config().has(DB::PlacementInfo::PLACEMENT_CONFIG_PREFIX))
- {
- PlacementInfo::PlacementInfo::instance().initialize(config());
- }
-
{
std::lock_guard lock(servers_lock);
/// We should start interserver communications before (and more important shutdown after) tables.
diff --git a/programs/server/config.xml b/programs/server/config.xml
index 8c824125dac..94825a55f67 100644
--- a/programs/server/config.xml
+++ b/programs/server/config.xml
@@ -29,7 +29,14 @@
-->
1000M
10
+
+
+
+
+
+
+
+ random
+
+ 1
+
+
+ 0
+ 1
+
+
+
+ zoo1
+ 2181
+ az1
+
+
+ zoo2
+ 2181
+ az2
+
+
+ zoo3
+ 2181
+ az3
+
+ 3000
+
+
+
+ 0
+ az2
+
+
diff --git a/tests/integration/test_zookeeper_config_load_balancing/test.py b/tests/integration/test_zookeeper_config_load_balancing/test.py
index f17e0c3f03f..9cdf7db2b08 100644
--- a/tests/integration/test_zookeeper_config_load_balancing/test.py
+++ b/tests/integration/test_zookeeper_config_load_balancing/test.py
@@ -1,6 +1,8 @@
+import time
import pytest
from helpers.cluster import ClickHouseCluster
from helpers.network import PartitionManager
+from helpers.test_tools import assert_eq_with_retry
cluster = ClickHouseCluster(
__file__, zookeeper_config_path="configs/zookeeper_load_balancing.xml"
@@ -17,6 +19,10 @@ node3 = cluster.add_instance(
"nod3", with_zookeeper=True, main_configs=["configs/zookeeper_load_balancing.xml"]
)
+node4 = cluster.add_instance(
+ "nod4", with_zookeeper=True, main_configs=["configs/zookeeper_load_balancing2.xml"]
+)
+
def change_balancing(old, new, reload=True):
line = "{}<"
@@ -405,113 +411,57 @@ def test_hostname_levenshtein_distance(started_cluster):
def test_round_robin(started_cluster):
pm = PartitionManager()
try:
- pm._add_rule(
- {
- "source": node1.ip_address,
- "destination": cluster.get_instance_ip("zoo1"),
- "action": "REJECT --reject-with tcp-reset",
- }
- )
- pm._add_rule(
- {
- "source": node2.ip_address,
- "destination": cluster.get_instance_ip("zoo1"),
- "action": "REJECT --reject-with tcp-reset",
- }
- )
- pm._add_rule(
- {
- "source": node3.ip_address,
- "destination": cluster.get_instance_ip("zoo1"),
- "action": "REJECT --reject-with tcp-reset",
- }
- )
change_balancing("random", "round_robin")
-
- print(
- str(
- node1.exec_in_container(
- [
- "bash",
- "-c",
- "lsof -a -i4 -i6 -itcp -w | grep ':2181' | grep ESTABLISHED",
- ],
- privileged=True,
- user="root",
- )
+ for node in [node1, node2, node3]:
+ idx = int(
+ node.query("select index from system.zookeeper_connection").strip()
)
- )
- assert (
- "1"
- == str(
- node1.exec_in_container(
- [
- "bash",
- "-c",
- "lsof -a -i4 -i6 -itcp -w | grep 'testzookeeperconfigloadbalancing_zoo2_1.*testzookeeperconfigloadbalancing_default:2181' | grep ESTABLISHED | wc -l",
- ],
- privileged=True,
- user="root",
- )
- ).strip()
- )
+ new_idx = (idx + 1) % 3
- print(
- str(
- node2.exec_in_container(
- [
- "bash",
- "-c",
- "lsof -a -i4 -i6 -itcp -w | grep ':2181' | grep ESTABLISHED",
- ],
- privileged=True,
- user="root",
- )
+ pm._add_rule(
+ {
+ "source": node.ip_address,
+ "destination": cluster.get_instance_ip("zoo" + str(idx + 1)),
+ "action": "REJECT --reject-with tcp-reset",
+ }
)
- )
- assert (
- "1"
- == str(
- node2.exec_in_container(
- [
- "bash",
- "-c",
- "lsof -a -i4 -i6 -itcp -w | grep 'testzookeeperconfigloadbalancing_zoo2_1.*testzookeeperconfigloadbalancing_default:2181' | grep ESTABLISHED | wc -l",
- ],
- privileged=True,
- user="root",
- )
- ).strip()
- )
- print(
- str(
- node3.exec_in_container(
- [
- "bash",
- "-c",
- "lsof -a -i4 -i6 -itcp -w | grep ':2181' | grep ESTABLISHED",
- ],
- privileged=True,
- user="root",
- )
+ assert_eq_with_retry(
+ node,
+ "select index from system.zookeeper_connection",
+ str(new_idx) + "\n",
)
- )
- assert (
- "1"
- == str(
- node3.exec_in_container(
- [
- "bash",
- "-c",
- "lsof -a -i4 -i6 -itcp -w | grep 'testzookeeperconfigloadbalancing_zoo2_1.*testzookeeperconfigloadbalancing_default:2181' | grep ESTABLISHED | wc -l",
- ],
- privileged=True,
- user="root",
- )
- ).strip()
- )
-
+ pm.heal_all()
finally:
pm.heal_all()
change_balancing("round_robin", "random", reload=False)
+
+
+def test_az(started_cluster):
+ pm = PartitionManager()
+ try:
+ # make sure it disconnects from the optimal node
+ pm._add_rule(
+ {
+ "source": node4.ip_address,
+ "destination": cluster.get_instance_ip("zoo2"),
+ "action": "REJECT --reject-with tcp-reset",
+ }
+ )
+
+ node4.query_with_retry("select * from system.zookeeper where path='/'")
+ assert "az2\n" != node4.query(
+ "select availability_zone from system.zookeeper_connection"
+ )
+
+ # fallback_session_lifetime.max is 1 second, but it shouldn't drop current session until the node becomes available
+
+ time.sleep(5) # this is fine
+ assert 5 <= int(node4.query("select zookeeperSessionUptime()").strip())
+
+ pm.heal_all()
+ assert_eq_with_retry(
+ node4, "select availability_zone from system.zookeeper_connection", "az2\n"
+ )
+ finally:
+ pm.heal_all()
diff --git a/tests/integration/test_zookeeper_fallback_session/test.py b/tests/integration/test_zookeeper_fallback_session/test.py
index 9afabfa3da3..932bbe482d2 100644
--- a/tests/integration/test_zookeeper_fallback_session/test.py
+++ b/tests/integration/test_zookeeper_fallback_session/test.py
@@ -84,10 +84,28 @@ def test_fallback_session(started_cluster: ClickHouseCluster):
)
# at this point network partitioning has been reverted.
- # the nodes should switch to zoo1 automatically because of `in_order` load-balancing.
+ # the nodes should switch to zoo1 because of `in_order` load-balancing.
# otherwise they would connect to a random replica
+
+ # but there's no reason to reconnect because current session works
+ # and there's no "optimal" node with `in_order` load-balancing
+ # so we need to break the current session
+
for node in [node1, node2, node3]:
- assert_uses_zk_node(node, "zoo1")
+ assert_uses_zk_node(node, "zoo3")
+
+ with PartitionManager() as pm:
+ for node in started_cluster.instances.values():
+ pm._add_rule(
+ {
+ "source": node.ip_address,
+ "destination": cluster.get_instance_ip("zoo3"),
+ "action": "REJECT --reject-with tcp-reset",
+ }
+ )
+
+ for node in [node1, node2, node3]:
+ assert_uses_zk_node(node, "zoo1")
node1.query_with_retry("INSERT INTO simple VALUES ({0}, {0})".format(2))
for node in [node2, node3]:
diff --git a/tests/performance/scripts/compare.sh b/tests/performance/scripts/compare.sh
index 9a0fb5b335c..cb56ab6c5bf 100755
--- a/tests/performance/scripts/compare.sh
+++ b/tests/performance/scripts/compare.sh
@@ -87,6 +87,7 @@ function configure
--path db0
--user_files_path db0/user_files
--top_level_domains_path "$(left_or_right right top_level_domains)"
+ --keeper_server.storage_path coordination0
--tcp_port $LEFT_SERVER_PORT
)
left/clickhouse-server "${setup_left_server_opts[@]}" &> setup-server-log.log &
@@ -113,8 +114,12 @@ function configure
rm -r db0/preprocessed_configs ||:
rm -r db0/{data,metadata}/system ||:
rm db0/status ||:
+
cp -al db0/ left/db/
+ cp -R coordination0 left/coordination
+
cp -al db0/ right/db/
+ cp -R coordination0 right/coordination
}
function restart
@@ -135,6 +140,7 @@ function restart
--tcp_port $LEFT_SERVER_PORT
--keeper_server.tcp_port $LEFT_SERVER_KEEPER_PORT
--keeper_server.raft_configuration.server.port $LEFT_SERVER_KEEPER_RAFT_PORT
+ --keeper_server.storage_path left/coordination
--zookeeper.node.port $LEFT_SERVER_KEEPER_PORT
--interserver_http_port $LEFT_SERVER_INTERSERVER_PORT
)
@@ -154,6 +160,7 @@ function restart
--tcp_port $RIGHT_SERVER_PORT
--keeper_server.tcp_port $RIGHT_SERVER_KEEPER_PORT
--keeper_server.raft_configuration.server.port $RIGHT_SERVER_KEEPER_RAFT_PORT
+ --keeper_server.storage_path right/coordination
--zookeeper.node.port $RIGHT_SERVER_KEEPER_PORT
--interserver_http_port $RIGHT_SERVER_INTERSERVER_PORT
)
diff --git a/tests/queries/0_stateless/00731_long_merge_tree_select_opened_files.sh b/tests/queries/0_stateless/00731_long_merge_tree_select_opened_files.sh
index 1bb4dbd34de..af746c43da9 100755
--- a/tests/queries/0_stateless/00731_long_merge_tree_select_opened_files.sh
+++ b/tests/queries/0_stateless/00731_long_merge_tree_select_opened_files.sh
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
-# Tags: long, no-s3-storage
+# Tags: long, no-s3-storage, no-tsan
# no-s3 because read FileOpen metric
set -e
@@ -31,6 +31,6 @@ $CLICKHOUSE_CLIENT $settings -q "$touching_many_parts_query" &> /dev/null
$CLICKHOUSE_CLIENT $settings -q "SYSTEM FLUSH LOGS"
-$CLICKHOUSE_CLIENT $settings -q "SELECT ProfileEvents['FileOpen'] as opened_files FROM system.query_log WHERE query='$touching_many_parts_query' and current_database = currentDatabase() ORDER BY event_time DESC, opened_files DESC LIMIT 1;"
+$CLICKHOUSE_CLIENT $settings -q "SELECT ProfileEvents['FileOpen'] as opened_files FROM system.query_log WHERE query = '$touching_many_parts_query' AND current_database = currentDatabase() AND event_date >= yesterday() ORDER BY event_time DESC, opened_files DESC LIMIT 1;"
$CLICKHOUSE_CLIENT $settings -q "DROP TABLE IF EXISTS merge_tree_table;"
diff --git a/tests/queries/0_stateless/00763_lock_buffer_long.sh b/tests/queries/0_stateless/00763_lock_buffer_long.sh
index 50680724149..046e4efaa85 100755
--- a/tests/queries/0_stateless/00763_lock_buffer_long.sh
+++ b/tests/queries/0_stateless/00763_lock_buffer_long.sh
@@ -1,5 +1,6 @@
#!/usr/bin/env bash
-# Tags: long
+# Tags: long, no-s3-storage, no-msan, no-asan, no-tsan, no-debug
+# Some kind of stress test, it doesn't make sense to test in a non-release build
set -e
@@ -15,7 +16,7 @@ ${CLICKHOUSE_CLIENT} --query="CREATE TABLE buffer_00763_2 (s String) ENGINE = Bu
function thread1()
{
- seq 1 500 | sed -r -e 's/.+/DROP TABLE IF EXISTS mt_00763_2; CREATE TABLE mt_00763_2 (s String) ENGINE = MergeTree ORDER BY s; INSERT INTO mt_00763_2 SELECT toString(number) FROM numbers(10);/' | ${CLICKHOUSE_CLIENT} --multiquery --ignore-error ||:
+ seq 1 500 | sed -r -e 's/.+/DROP TABLE IF EXISTS mt_00763_2; CREATE TABLE mt_00763_2 (s String) ENGINE = MergeTree ORDER BY s; INSERT INTO mt_00763_2 SELECT toString(number) FROM numbers(10);/' | ${CLICKHOUSE_CLIENT} --fsync-metadata 0 --multiquery --ignore-error ||:
}
function thread2()
diff --git a/tests/queries/0_stateless/00830_join_overwrite.reference b/tests/queries/0_stateless/00830_join_overwrite.reference
index 4792e70f333..e7d6081b647 100644
--- a/tests/queries/0_stateless/00830_join_overwrite.reference
+++ b/tests/queries/0_stateless/00830_join_overwrite.reference
@@ -1,2 +1,4 @@
2
3
+2
+3
diff --git a/tests/queries/0_stateless/00830_join_overwrite.sql b/tests/queries/0_stateless/00830_join_overwrite.sql
index cb7e277906b..bc3662528db 100644
--- a/tests/queries/0_stateless/00830_join_overwrite.sql
+++ b/tests/queries/0_stateless/00830_join_overwrite.sql
@@ -9,5 +9,14 @@ INSERT INTO kv_overwrite VALUES (1, 2);
INSERT INTO kv_overwrite VALUES (1, 3);
SELECT joinGet('kv_overwrite', 'v', toUInt32(1));
+
+CREATE TABLE t2 (k UInt32, v UInt32) ENGINE = Memory;
+INSERT INTO t2 VALUES (1, 2), (1, 3);
+
+SET allow_experimental_analyzer = 1;
+
+SELECT v FROM (SELECT 1 as k) t1 ANY INNER JOIN t2 USING (k) SETTINGS join_any_take_last_row = 0;
+SELECT v FROM (SELECT 1 as k) t1 ANY INNER JOIN t2 USING (k) SETTINGS join_any_take_last_row = 1;
+
DROP TABLE kv;
DROP TABLE kv_overwrite;
diff --git a/tests/queries/0_stateless/00987_distributed_stack_overflow.sql b/tests/queries/0_stateless/00987_distributed_stack_overflow.sql
index 5a22ac56413..ba58713fe0e 100644
--- a/tests/queries/0_stateless/00987_distributed_stack_overflow.sql
+++ b/tests/queries/0_stateless/00987_distributed_stack_overflow.sql
@@ -9,10 +9,6 @@ CREATE TABLE distr (x UInt8) ENGINE = Distributed(test_shard_localhost, currentD
CREATE TABLE distr0 (x UInt8) ENGINE = Distributed(test_shard_localhost, '', distr0); -- { serverError INFINITE_LOOP }
CREATE TABLE distr1 (x UInt8) ENGINE = Distributed(test_shard_localhost, currentDatabase(), distr2);
-CREATE TABLE distr2 (x UInt8) ENGINE = Distributed(test_shard_localhost, currentDatabase(), distr1);
-
-SELECT * FROM distr1; -- { serverError TOO_LARGE_DISTRIBUTED_DEPTH }
-SELECT * FROM distr2; -- { serverError TOO_LARGE_DISTRIBUTED_DEPTH }
+CREATE TABLE distr2 (x UInt8) ENGINE = Distributed(test_shard_localhost, currentDatabase(), distr1); -- { serverError INFINITE_LOOP }
DROP TABLE distr1;
-DROP TABLE distr2;
diff --git a/tests/queries/0_stateless/01083_expressions_in_engine_arguments.sql b/tests/queries/0_stateless/01083_expressions_in_engine_arguments.sql
index 6268765aa27..bdfbf2a47cf 100644
--- a/tests/queries/0_stateless/01083_expressions_in_engine_arguments.sql
+++ b/tests/queries/0_stateless/01083_expressions_in_engine_arguments.sql
@@ -88,6 +88,7 @@ SELECT sum(n) from rich_syntax;
SYSTEM DROP DNS CACHE;
DROP TABLE file;
+DROP DICTIONARY dict;
DROP TABLE url;
DROP TABLE view;
DROP TABLE buffer;
@@ -96,4 +97,3 @@ DROP TABLE merge_tf;
DROP TABLE distributed;
DROP TABLE distributed_tf;
DROP TABLE rich_syntax;
-DROP DICTIONARY dict;
diff --git a/tests/queries/0_stateless/01103_check_cpu_instructions_at_startup.reference b/tests/queries/0_stateless/01103_check_cpu_instructions_at_startup.reference
index 8984d35930a..03ed07cf1a4 100644
--- a/tests/queries/0_stateless/01103_check_cpu_instructions_at_startup.reference
+++ b/tests/queries/0_stateless/01103_check_cpu_instructions_at_startup.reference
@@ -2,6 +2,4 @@ Instruction check fail. The CPU does not support SSSE3 instruction set.
Instruction check fail. The CPU does not support SSE4.1 instruction set.
Instruction check fail. The CPU does not support SSE4.2 instruction set.
Instruction check fail. The CPU does not support POPCNT instruction set.
-: MADV_DONTNEED does not work (memset will be used instead)
-: (This is the expected behaviour if you are running under QEMU)
1
diff --git a/tests/queries/0_stateless/01103_check_cpu_instructions_at_startup.sh b/tests/queries/0_stateless/01103_check_cpu_instructions_at_startup.sh
index 01047aeb9ab..c37f1f95374 100755
--- a/tests/queries/0_stateless/01103_check_cpu_instructions_at_startup.sh
+++ b/tests/queries/0_stateless/01103_check_cpu_instructions_at_startup.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
# Tags: no-tsan, no-asan, no-ubsan, no-msan, no-debug, no-fasttest, no-cpu-aarch64
-# Tag no-fasttest: avoid dependency on qemu -- invonvenient when running locally
+# Tag no-fasttest: avoid dependency on qemu -- inconvenient when running locally
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=../shell_config.sh
diff --git a/tests/queries/0_stateless/01191_rename_dictionary.sql b/tests/queries/0_stateless/01191_rename_dictionary.sql
index 6666c3308ca..c5012dabc81 100644
--- a/tests/queries/0_stateless/01191_rename_dictionary.sql
+++ b/tests/queries/0_stateless/01191_rename_dictionary.sql
@@ -17,7 +17,7 @@ SELECT name, status FROM system.dictionaries WHERE database='test_01191';
SELECT name, engine FROM system.tables WHERE database='test_01191' ORDER BY name;
RENAME DICTIONARY test_01191.table TO test_01191.table1; -- {serverError UNKNOWN_TABLE}
-EXCHANGE DICTIONARIES test_01191._ AND test_01191.dict; -- {serverError INCORRECT_QUERY}
+EXCHANGE DICTIONARIES test_01191._ AND test_01191.dict; -- {serverError INFINITE_LOOP}
EXCHANGE TABLES test_01191.t AND test_01191.dict;
SELECT name, status FROM system.dictionaries WHERE database='test_01191';
SELECT name, engine FROM system.tables WHERE database='test_01191' ORDER BY name;
diff --git a/tests/queries/0_stateless/01502_jemalloc_percpu_arena.reference b/tests/queries/0_stateless/01502_jemalloc_percpu_arena.reference
index fe093e39a56..5accb577786 100644
--- a/tests/queries/0_stateless/01502_jemalloc_percpu_arena.reference
+++ b/tests/queries/0_stateless/01502_jemalloc_percpu_arena.reference
@@ -1,5 +1,3 @@
-: Number of CPUs detected is not deterministic. Per-CPU arena disabled.
1
-: Number of CPUs detected is not deterministic. Per-CPU arena disabled.
100000000
1
diff --git a/tests/queries/0_stateless/01502_jemalloc_percpu_arena.sh b/tests/queries/0_stateless/01502_jemalloc_percpu_arena.sh
index b3ea6eca3f4..c1bd1e0e1fa 100755
--- a/tests/queries/0_stateless/01502_jemalloc_percpu_arena.sh
+++ b/tests/queries/0_stateless/01502_jemalloc_percpu_arena.sh
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
-# Tags: no-tsan, no-asan, no-msan, no-ubsan, no-fasttest
+# Tags: no-tsan, no-asan, no-msan, no-ubsan, no-fasttest, no-debug
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# NOTE: jemalloc is disabled under sanitizers
diff --git a/tests/queries/0_stateless/01505_pipeline_executor_UAF.sh b/tests/queries/0_stateless/01505_pipeline_executor_UAF.sh
index c2750ad31b2..35c2b796570 100755
--- a/tests/queries/0_stateless/01505_pipeline_executor_UAF.sh
+++ b/tests/queries/0_stateless/01505_pipeline_executor_UAF.sh
@@ -14,7 +14,7 @@ for _ in {1..10}; do
${CLICKHOUSE_LOCAL} -q 'select * from numbers_mt(100000000) settings max_threads=100 FORMAT Null'
# Binding to specific CPU is not required, but this makes the test more reliable.
taskset --cpu-list 0 ${CLICKHOUSE_LOCAL} -q 'select * from numbers_mt(100000000) settings max_threads=100 FORMAT Null' 2>&1 | {
- # build with santiziers does not have jemalloc
+ # build with sanitiziers does not have jemalloc
# and for jemalloc we have separate test
# 01502_jemalloc_percpu_arena
grep -v ': Number of CPUs detected is not deterministic. Per-CPU arena disabled.'
diff --git a/tests/queries/0_stateless/01552_dict_fixedstring.sql b/tests/queries/0_stateless/01552_dict_fixedstring.sql
index 01d55656e3c..0b19c9980a4 100644
--- a/tests/queries/0_stateless/01552_dict_fixedstring.sql
+++ b/tests/queries/0_stateless/01552_dict_fixedstring.sql
@@ -16,5 +16,5 @@ LIFETIME(MIN 10 MAX 10);
SELECT dictGet(currentDatabase() || '.dict', 's', number) FROM numbers(2);
-DROP TABLE src;
DROP DICTIONARY dict;
+DROP TABLE src;
diff --git a/tests/queries/0_stateless/01559_misplaced_codec_diagnostics.reference b/tests/queries/0_stateless/01559_misplaced_codec_diagnostics.reference
index d5bdb816bf2..e69de29bb2d 100644
--- a/tests/queries/0_stateless/01559_misplaced_codec_diagnostics.reference
+++ b/tests/queries/0_stateless/01559_misplaced_codec_diagnostics.reference
@@ -1 +0,0 @@
-Unknown data type family: CODEC
diff --git a/tests/queries/0_stateless/01559_misplaced_codec_diagnostics.sh b/tests/queries/0_stateless/01559_misplaced_codec_diagnostics.sh
deleted file mode 100755
index 8a3242c7036..00000000000
--- a/tests/queries/0_stateless/01559_misplaced_codec_diagnostics.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/usr/bin/env bash
-
-CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
-# shellcheck source=../shell_config.sh
-. "$CURDIR"/../shell_config.sh
-
-${CLICKHOUSE_CLIENT} --query "CREATE TABLE t (c CODEC(NONE)) ENGINE = Memory" 2>&1 | grep -oF 'Unknown data type family: CODEC' | uniq
diff --git a/tests/queries/0_stateless/01559_misplaced_codec_diagnostics.sql b/tests/queries/0_stateless/01559_misplaced_codec_diagnostics.sql
new file mode 100644
index 00000000000..ab1cfc89be1
--- /dev/null
+++ b/tests/queries/0_stateless/01559_misplaced_codec_diagnostics.sql
@@ -0,0 +1 @@
+CREATE TABLE t (c CODEC(NONE)) ENGINE = Memory -- { clientError SYNTAX_ERROR }
\ No newline at end of file
diff --git a/tests/queries/0_stateless/01760_ddl_dictionary_use_current_database_name.sql b/tests/queries/0_stateless/01760_ddl_dictionary_use_current_database_name.sql
index 55c0d1e3678..a7f04921f1f 100644
--- a/tests/queries/0_stateless/01760_ddl_dictionary_use_current_database_name.sql
+++ b/tests/queries/0_stateless/01760_ddl_dictionary_use_current_database_name.sql
@@ -27,5 +27,5 @@ SELECT dictGet('ddl_dictionary_test', 'value', number) FROM system.numbers LIMIT
SELECT 'dictHas';
SELECT dictHas('ddl_dictionary_test', number) FROM system.numbers LIMIT 3;
-DROP TABLE ddl_dictonary_test_source;
DROP DICTIONARY ddl_dictionary_test;
+DROP TABLE ddl_dictonary_test_source;
diff --git a/tests/queries/0_stateless/01760_system_dictionaries.sql b/tests/queries/0_stateless/01760_system_dictionaries.sql
index a5609281e49..2e7d4184811 100644
--- a/tests/queries/0_stateless/01760_system_dictionaries.sql
+++ b/tests/queries/0_stateless/01760_system_dictionaries.sql
@@ -25,8 +25,8 @@ SELECT * FROM 01760_db.example_simple_key_dictionary;
SELECT name, database, key.names, key.types, attribute.names, attribute.types, status FROM system.dictionaries WHERE database='01760_db';
-DROP TABLE 01760_db.example_simple_key_source;
DROP DICTIONARY 01760_db.example_simple_key_dictionary;
+DROP TABLE 01760_db.example_simple_key_source;
SELECT name, database, key.names, key.types, attribute.names, attribute.types, status FROM system.dictionaries WHERE database='01760_db';
@@ -53,7 +53,7 @@ SELECT * FROM 01760_db.example_complex_key_dictionary;
SELECT name, database, key.names, key.types, attribute.names, attribute.types, status FROM system.dictionaries WHERE database='01760_db';
-DROP TABLE 01760_db.example_complex_key_source;
DROP DICTIONARY 01760_db.example_complex_key_dictionary;
+DROP TABLE 01760_db.example_complex_key_source;
DROP DATABASE 01760_db;
diff --git a/tests/queries/0_stateless/01763_max_distributed_depth.sql b/tests/queries/0_stateless/01763_max_distributed_depth.sql
index 08dc533876d..f722a88226d 100644
--- a/tests/queries/0_stateless/01763_max_distributed_depth.sql
+++ b/tests/queries/0_stateless/01763_max_distributed_depth.sql
@@ -17,19 +17,6 @@ ENGINE = Distributed('test_shard_localhost', '', 'tt7', rand());
DROP TABLE IF EXISTS tt7;
-CREATE TABLE tt7 as tt6 ENGINE = Distributed('test_shard_localhost', '', 'tt6', rand());
-
-INSERT INTO tt6 VALUES (1, 1, 1, 1, 'ok'); -- { serverError TOO_LARGE_DISTRIBUTED_DEPTH }
-
-SELECT * FROM tt6; -- { serverError TOO_LARGE_DISTRIBUTED_DEPTH }
-
-SET max_distributed_depth = 0;
-
--- stack overflow
-INSERT INTO tt6 VALUES (1, 1, 1, 1, 'ok'); -- { serverError TOO_DEEP_RECURSION}
-
--- stack overflow
-SELECT * FROM tt6; -- { serverError TOO_DEEP_RECURSION }
+CREATE TABLE tt7 as tt6 ENGINE = Distributed('test_shard_localhost', '', 'tt6', rand()); -- {serverError INFINITE_LOOP}
DROP TABLE tt6;
-DROP TABLE tt7;
diff --git a/tests/queries/0_stateless/01764_table_function_dictionary.sql b/tests/queries/0_stateless/01764_table_function_dictionary.sql
index b642fdd741e..76e7213b367 100644
--- a/tests/queries/0_stateless/01764_table_function_dictionary.sql
+++ b/tests/queries/0_stateless/01764_table_function_dictionary.sql
@@ -23,5 +23,5 @@ LAYOUT(DIRECT());
SELECT * FROM dictionary('table_function_dictionary_test_dictionary');
-DROP TABLE table_function_dictionary_source_table;
DROP DICTIONARY table_function_dictionary_test_dictionary;
+DROP TABLE table_function_dictionary_source_table;
diff --git a/tests/queries/0_stateless/01804_dictionary_decimal256_type.sql b/tests/queries/0_stateless/01804_dictionary_decimal256_type.sql
index 77e9abfb742..08a8d0feb27 100644
--- a/tests/queries/0_stateless/01804_dictionary_decimal256_type.sql
+++ b/tests/queries/0_stateless/01804_dictionary_decimal256_type.sql
@@ -25,6 +25,8 @@ LAYOUT(FLAT());
SELECT 'Flat dictionary';
SELECT dictGet('flat_dictionary', 'decimal_value', toUInt64(1));
+DROP DICTIONARY flat_dictionary;
+
DROP DICTIONARY IF EXISTS hashed_dictionary;
CREATE DICTIONARY hashed_dictionary
(
diff --git a/tests/queries/0_stateless/01852_dictionary_found_rate_long.sql b/tests/queries/0_stateless/01852_dictionary_found_rate_long.sql
index d5108e98510..da364403893 100644
--- a/tests/queries/0_stateless/01852_dictionary_found_rate_long.sql
+++ b/tests/queries/0_stateless/01852_dictionary_found_rate_long.sql
@@ -310,6 +310,6 @@ SELECT name, found_rate FROM system.dictionaries WHERE database = currentDatabas
SELECT tuple(x, y) as key, dictGet('polygon_dictionary_01862', 'name', key) FROM points_01862 FORMAT Null;
SELECT name, found_rate FROM system.dictionaries WHERE database = currentDatabase() AND name = 'polygon_dictionary_01862';
+DROP DICTIONARY polygon_dictionary_01862;
DROP TABLE polygons_01862;
DROP TABLE points_01862;
-DROP DICTIONARY polygon_dictionary_01862;
diff --git a/tests/queries/0_stateless/01904_dictionary_default_nullable_type.sql b/tests/queries/0_stateless/01904_dictionary_default_nullable_type.sql
index 4c623941a19..d28f9e5c4e6 100644
--- a/tests/queries/0_stateless/01904_dictionary_default_nullable_type.sql
+++ b/tests/queries/0_stateless/01904_dictionary_default_nullable_type.sql
@@ -111,6 +111,8 @@ LAYOUT(IP_TRIE());
SELECT 'IPTrie dictionary';
SELECT dictGet('ip_trie_dictionary', 'value', tuple(IPv4StringToNum('127.0.0.0'))); --{serverError UNSUPPORTED_METHOD}
+DROP DICTIONARY ip_trie_dictionary;
+
DROP TABLE dictionary_nullable_source_table;
DROP TABLE dictionary_nullable_default_source_table;
diff --git a/tests/queries/0_stateless/01910_view_dictionary.sql b/tests/queries/0_stateless/01910_view_dictionary.sql
index 1f9928735b4..05a67889825 100644
--- a/tests/queries/0_stateless/01910_view_dictionary.sql
+++ b/tests/queries/0_stateless/01910_view_dictionary.sql
@@ -45,5 +45,5 @@ FROM numbers(3);
DROP TABLE dictionary_source_en;
DROP TABLE dictionary_source_ru;
-DROP TABLE dictionary_source_view;
DROP DICTIONARY flat_dictionary;
+DROP TABLE dictionary_source_view;
diff --git a/tests/queries/0_stateless/02008_complex_key_range_hashed_dictionary.sql b/tests/queries/0_stateless/02008_complex_key_range_hashed_dictionary.sql
index 72cac481376..ea2dad5c732 100644
--- a/tests/queries/0_stateless/02008_complex_key_range_hashed_dictionary.sql
+++ b/tests/queries/0_stateless/02008_complex_key_range_hashed_dictionary.sql
@@ -53,8 +53,8 @@ SELECT CountryID, StartDate, Tax FROM range_dictionary ORDER BY CountryID, Start
SELECT 'onlySpecificColumn';
SELECT Tax FROM range_dictionary ORDER BY CountryID, StartDate, EndDate;
-DROP TABLE date_table;
DROP DICTIONARY range_dictionary;
+DROP TABLE date_table;
CREATE TABLE date_table
(
@@ -107,5 +107,5 @@ SELECT CountryID, StartDate, Tax FROM range_dictionary_nullable ORDER BY Country
SELECT 'onlySpecificColumn';
SELECT Tax FROM range_dictionary_nullable ORDER BY CountryID, StartDate, EndDate;
-DROP TABLE date_table;
DROP DICTIONARY range_dictionary_nullable;
+DROP TABLE date_table;
diff --git a/tests/queries/0_stateless/02155_dictionary_comment.sql b/tests/queries/0_stateless/02155_dictionary_comment.sql
index 30b85e16a7c..8ebc7b259fc 100644
--- a/tests/queries/0_stateless/02155_dictionary_comment.sql
+++ b/tests/queries/0_stateless/02155_dictionary_comment.sql
@@ -49,5 +49,5 @@ SELECT name, comment FROM system.tables WHERE name == '02155_test_dictionary_vie
SELECT name, comment FROM system.tables WHERE name == '02155_test_dictionary_view' AND database == currentDatabase();
DROP TABLE 02155_test_dictionary_view;
-DROP TABLE 02155_test_table;
DROP DICTIONARY 02155_test_dictionary;
+DROP TABLE 02155_test_table;
diff --git a/tests/queries/0_stateless/02183_dictionary_date_types.sql b/tests/queries/0_stateless/02183_dictionary_date_types.sql
index e06863d5e53..5671f47cdab 100644
--- a/tests/queries/0_stateless/02183_dictionary_date_types.sql
+++ b/tests/queries/0_stateless/02183_dictionary_date_types.sql
@@ -170,8 +170,8 @@ LIFETIME(0);
SELECT 'Polygon dictionary';
SELECT * FROM 02183_polygon_dictionary;
-DROP TABLE 02183_polygon_dictionary_source_table;
DROP DICTIONARY 02183_polygon_dictionary;
+DROP TABLE 02183_polygon_dictionary_source_table;
DROP TABLE IF EXISTS 02183_range_dictionary_source_table;
CREATE TABLE 02183_range_dictionary_source_table
diff --git a/tests/queries/0_stateless/02185_range_hashed_dictionary_open_ranges.sql b/tests/queries/0_stateless/02185_range_hashed_dictionary_open_ranges.sql
index e6edee2ea18..a36c72de0ac 100644
--- a/tests/queries/0_stateless/02185_range_hashed_dictionary_open_ranges.sql
+++ b/tests/queries/0_stateless/02185_range_hashed_dictionary_open_ranges.sql
@@ -60,4 +60,5 @@ SELECT dictHas('02185_range_dictionary', 0, 0);
SELECT dictHas('02185_range_dictionary', 0, 5001);
SELECT dictHas('02185_range_dictionary', 0, 10001);
+DROP DICTIONARY 02185_range_dictionary;
DROP TABLE 02185_range_dictionary_source_table;
diff --git a/tests/queries/0_stateless/02240_system_filesystem_cache_table.reference b/tests/queries/0_stateless/02240_system_filesystem_cache_table.reference
index 93b6d4de94f..6b5dd182112 100644
--- a/tests/queries/0_stateless/02240_system_filesystem_cache_table.reference
+++ b/tests/queries/0_stateless/02240_system_filesystem_cache_table.reference
@@ -34,3 +34,21 @@ DOWNLOADED 0 79 80
DOWNLOADED 0 745 746
2
Expect no cache
+Using storage policy: azure_cache
+0
+Expect cache
+DOWNLOADED 0 0 1
+DOWNLOADED 0 79 80
+DOWNLOADED 0 745 746
+3
+Expect cache
+DOWNLOADED 0 0 1
+DOWNLOADED 0 79 80
+DOWNLOADED 0 745 746
+3
+Expect no cache
+Expect cache
+DOWNLOADED 0 79 80
+DOWNLOADED 0 745 746
+2
+Expect no cache
diff --git a/tests/queries/0_stateless/02240_system_filesystem_cache_table.sh b/tests/queries/0_stateless/02240_system_filesystem_cache_table.sh
index 9aa631c5d0a..57b8cec7864 100755
--- a/tests/queries/0_stateless/02240_system_filesystem_cache_table.sh
+++ b/tests/queries/0_stateless/02240_system_filesystem_cache_table.sh
@@ -7,7 +7,7 @@ CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=../shell_config.sh
. "$CUR_DIR"/../shell_config.sh
-for STORAGE_POLICY in 's3_cache' 'local_cache'; do
+for STORAGE_POLICY in 's3_cache' 'local_cache' 'azure_cache'; do
echo "Using storage policy: $STORAGE_POLICY"
${CLICKHOUSE_CLIENT} --query "SYSTEM DROP FILESYSTEM CACHE"
${CLICKHOUSE_CLIENT} --query "SYSTEM DROP MARK CACHE"
diff --git a/tests/queries/0_stateless/02241_filesystem_cache_on_write_operations.reference b/tests/queries/0_stateless/02241_filesystem_cache_on_write_operations.reference
index 186dcc1eeb2..f53f00992e7 100644
--- a/tests/queries/0_stateless/02241_filesystem_cache_on_write_operations.reference
+++ b/tests/queries/0_stateless/02241_filesystem_cache_on_write_operations.reference
@@ -218,3 +218,113 @@ SELECT count() FROM test_02241
5010500
SELECT count() FROM test_02241 WHERE value LIKE '%010%'
18816
+Using storage policy: azure_cache
+DROP TABLE IF EXISTS test_02241
+CREATE TABLE test_02241 (key UInt32, value String) Engine=MergeTree() ORDER BY key SETTINGS storage_policy='azure_cache', min_bytes_for_wide_part = 10485760, compress_marks=false, compress_primary_key=false, ratio_of_defaults_for_sparse_serialization = 1
+SYSTEM STOP MERGES test_02241
+SYSTEM DROP FILESYSTEM CACHE
+SELECT file_segment_range_begin, file_segment_range_end, size, state
+ FROM
+ (
+ SELECT file_segment_range_begin, file_segment_range_end, size, state, local_path
+ FROM
+ (
+ SELECT arrayJoin(cache_paths) AS cache_path, local_path, remote_path
+ FROM system.remote_data_paths
+ ) AS data_paths
+ INNER JOIN
+ system.filesystem_cache AS caches
+ ON data_paths.cache_path = caches.cache_path
+ )
+ WHERE endsWith(local_path, 'data.bin')
+ FORMAT Vertical
+SELECT count() FROM (SELECT arrayJoin(cache_paths) AS cache_path, local_path, remote_path FROM system.remote_data_paths ) AS data_paths INNER JOIN system.filesystem_cache AS caches ON data_paths.cache_path = caches.cache_path
+0
+SELECT count(), sum(size) FROM system.filesystem_cache
+0 0
+INSERT INTO test_02241 SELECT number, toString(number) FROM numbers(100)
+SELECT file_segment_range_begin, file_segment_range_end, size, state
+ FROM
+ (
+ SELECT file_segment_range_begin, file_segment_range_end, size, state, local_path
+ FROM
+ (
+ SELECT arrayJoin(cache_paths) AS cache_path, local_path, remote_path
+ FROM system.remote_data_paths
+ ) AS data_paths
+ INNER JOIN
+ system.filesystem_cache AS caches
+ ON data_paths.cache_path = caches.cache_path
+ )
+ WHERE endsWith(local_path, 'data.bin')
+ FORMAT Vertical
+Row 1:
+──────
+file_segment_range_begin: 0
+file_segment_range_end: 745
+size: 746
+state: DOWNLOADED
+SELECT count() FROM (SELECT arrayJoin(cache_paths) AS cache_path, local_path, remote_path FROM system.remote_data_paths ) AS data_paths INNER JOIN system.filesystem_cache AS caches ON data_paths.cache_path = caches.cache_path
+8
+SELECT count(), sum(size) FROM system.filesystem_cache
+8 1100
+SELECT count() FROM system.filesystem_cache WHERE cache_hits > 0
+0
+SELECT * FROM test_02241 FORMAT Null
+SELECT count() FROM system.filesystem_cache WHERE cache_hits > 0
+2
+SELECT * FROM test_02241 FORMAT Null
+SELECT count() FROM system.filesystem_cache WHERE cache_hits > 0
+2
+SELECT count(), sum(size) size FROM system.filesystem_cache
+8 1100
+SYSTEM DROP FILESYSTEM CACHE
+INSERT INTO test_02241 SELECT number, toString(number) FROM numbers(100, 200)
+SELECT file_segment_range_begin, file_segment_range_end, size, state
+ FROM
+ (
+ SELECT file_segment_range_begin, file_segment_range_end, size, state, local_path
+ FROM
+ (
+ SELECT arrayJoin(cache_paths) AS cache_path, local_path, remote_path
+ FROM system.remote_data_paths
+ ) AS data_paths
+ INNER JOIN
+ system.filesystem_cache AS caches
+ ON data_paths.cache_path = caches.cache_path
+ )
+ WHERE endsWith(local_path, 'data.bin')
+ FORMAT Vertical;
+Row 1:
+──────
+file_segment_range_begin: 0
+file_segment_range_end: 1659
+size: 1660
+state: DOWNLOADED
+SELECT count() FROM (SELECT arrayJoin(cache_paths) AS cache_path, local_path, remote_path FROM system.remote_data_paths ) AS data_paths INNER JOIN system.filesystem_cache AS caches ON data_paths.cache_path = caches.cache_path
+8
+SELECT count(), sum(size) FROM system.filesystem_cache
+8 2014
+SELECT count(), sum(size) FROM system.filesystem_cache
+8 2014
+INSERT INTO test_02241 SELECT number, toString(number) FROM numbers(100) SETTINGS enable_filesystem_cache_on_write_operations=0
+SELECT count(), sum(size) FROM system.filesystem_cache
+8 2014
+INSERT INTO test_02241 SELECT number, toString(number) FROM numbers(100)
+INSERT INTO test_02241 SELECT number, toString(number) FROM numbers(300, 10000)
+SELECT count(), sum(size) FROM system.filesystem_cache
+24 84045
+SYSTEM START MERGES test_02241
+OPTIMIZE TABLE test_02241 FINAL
+SELECT count(), sum(size) FROM system.filesystem_cache
+32 167243
+ALTER TABLE test_02241 UPDATE value = 'kek' WHERE key = 100
+SELECT count(), sum(size) FROM system.filesystem_cache
+41 250541
+INSERT INTO test_02241 SELECT number, toString(number) FROM numbers(5000000)
+SYSTEM FLUSH LOGS
+INSERT INTO test_02241 SELECT number, toString(number) FROM numbers(5000000) 0
+SELECT count() FROM test_02241
+5010500
+SELECT count() FROM test_02241 WHERE value LIKE '%010%'
+18816
diff --git a/tests/queries/0_stateless/02241_filesystem_cache_on_write_operations.sh b/tests/queries/0_stateless/02241_filesystem_cache_on_write_operations.sh
index c1d930f54a7..1028fba76f5 100755
--- a/tests/queries/0_stateless/02241_filesystem_cache_on_write_operations.sh
+++ b/tests/queries/0_stateless/02241_filesystem_cache_on_write_operations.sh
@@ -7,7 +7,7 @@ CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=../shell_config.sh
. "$CUR_DIR"/../shell_config.sh
-for STORAGE_POLICY in 's3_cache' 'local_cache'; do
+for STORAGE_POLICY in 's3_cache' 'local_cache' 'azure_cache'; do
echo "Using storage policy: $STORAGE_POLICY"
$CLICKHOUSE_CLIENT --echo --query "DROP TABLE IF EXISTS test_02241"
diff --git a/tests/queries/0_stateless/02242_system_filesystem_cache_log_table.reference b/tests/queries/0_stateless/02242_system_filesystem_cache_log_table.reference
index 99f31df7def..447e1a275fc 100644
--- a/tests/queries/0_stateless/02242_system_filesystem_cache_log_table.reference
+++ b/tests/queries/0_stateless/02242_system_filesystem_cache_log_table.reference
@@ -6,3 +6,7 @@ Using storage policy: local_cache
(0,519) READ_FROM_FS_AND_DOWNLOADED_TO_CACHE
(0,808110) READ_FROM_FS_AND_DOWNLOADED_TO_CACHE
(0,808110) READ_FROM_CACHE
+Using storage policy: azure_cache
+(0,519) READ_FROM_FS_AND_DOWNLOADED_TO_CACHE
+(0,808110) READ_FROM_FS_AND_DOWNLOADED_TO_CACHE
+(0,808110) READ_FROM_CACHE
diff --git a/tests/queries/0_stateless/02242_system_filesystem_cache_log_table.sh b/tests/queries/0_stateless/02242_system_filesystem_cache_log_table.sh
index 4c92d1d2954..7a665d81eab 100755
--- a/tests/queries/0_stateless/02242_system_filesystem_cache_log_table.sh
+++ b/tests/queries/0_stateless/02242_system_filesystem_cache_log_table.sh
@@ -7,7 +7,7 @@ CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=../shell_config.sh
. "$CUR_DIR"/../shell_config.sh
-for STORAGE_POLICY in 's3_cache' 'local_cache'; do
+for STORAGE_POLICY in 's3_cache' 'local_cache' 'azure_cache'; do
echo "Using storage policy: $STORAGE_POLICY"
$CLICKHOUSE_CLIENT --query "SYSTEM DROP FILESYSTEM CACHE"
diff --git a/tests/queries/0_stateless/02265_column_ttl.sql b/tests/queries/0_stateless/02265_column_ttl.sql
index 16ae2da2a2b..ac64dd9457a 100644
--- a/tests/queries/0_stateless/02265_column_ttl.sql
+++ b/tests/queries/0_stateless/02265_column_ttl.sql
@@ -16,7 +16,8 @@ insert into ttl_02265 values ('2010-01-01', 2010, 'foo');
optimize table ttl_02265 final;
-- after, 20100101_0_0_2 will not have ttl.txt, but will have value.bin
optimize table ttl_02265 final;
-system sync replica ttl_02265;
+system sync replica ttl_02265 STRICT;
+system sync replica ttl_02265_r2 STRICT;
-- after detach/attach it will not have TTL in-memory, and will not have ttl.txt
detach table ttl_02265;
diff --git a/tests/queries/0_stateless/02286_drop_filesystem_cache.reference b/tests/queries/0_stateless/02286_drop_filesystem_cache.reference
index b4e5b6715de..e3875dbabe1 100644
--- a/tests/queries/0_stateless/02286_drop_filesystem_cache.reference
+++ b/tests/queries/0_stateless/02286_drop_filesystem_cache.reference
@@ -16,3 +16,12 @@ Using storage policy: local_cache
1
1
0
+Using storage policy: azure_cache
+0
+2
+0
+1
+1
+1
+1
+0
diff --git a/tests/queries/0_stateless/02286_drop_filesystem_cache.sh b/tests/queries/0_stateless/02286_drop_filesystem_cache.sh
index 1e1841862e9..a2c9352b7aa 100755
--- a/tests/queries/0_stateless/02286_drop_filesystem_cache.sh
+++ b/tests/queries/0_stateless/02286_drop_filesystem_cache.sh
@@ -7,7 +7,7 @@ CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=../shell_config.sh
. "$CUR_DIR"/../shell_config.sh
-for STORAGE_POLICY in 's3_cache' 'local_cache'; do
+for STORAGE_POLICY in 's3_cache' 'local_cache' 'azure_cache'; do
echo "Using storage policy: $STORAGE_POLICY"
$CLICKHOUSE_CLIENT --query "DROP TABLE IF EXISTS test_02286"
diff --git a/tests/queries/0_stateless/02302_column_decl_null_before_defaul_value.sql b/tests/queries/0_stateless/02302_column_decl_null_before_defaul_value.sql
index 3825df1e557..a2c2fc7cba2 100644
--- a/tests/queries/0_stateless/02302_column_decl_null_before_defaul_value.sql
+++ b/tests/queries/0_stateless/02302_column_decl_null_before_defaul_value.sql
@@ -56,6 +56,6 @@ ALTER TABLE null_before ALTER COLUMN id TYPE INT NULL; -- { clientError SYNTAX_E
select 'modify column, NULL modifier is not allowed';
DROP TABLE IF EXISTS null_before SYNC;
CREATE TABLE null_before (id INT NOT NULL) ENGINE=MergeTree() ORDER BY tuple();
-ALTER TABLE null_before MODIFY COLUMN id NULL DEFAULT 1; -- { serverError UNKNOWN_TYPE }
+ALTER TABLE null_before MODIFY COLUMN id NULL DEFAULT 1; -- { clientError SYNTAX_ERROR }
DROP TABLE IF EXISTS null_before SYNC;
diff --git a/tests/queries/0_stateless/02313_filesystem_cache_seeks.reference b/tests/queries/0_stateless/02313_filesystem_cache_seeks.reference
index 062aac259a4..0a9e1c20b59 100644
--- a/tests/queries/0_stateless/02313_filesystem_cache_seeks.reference
+++ b/tests/queries/0_stateless/02313_filesystem_cache_seeks.reference
@@ -1,3 +1,4 @@
Using storage policy: s3_cache
Using storage policy: local_cache
Using storage policy: s3_cache_multi
+Using storage policy: azure_cache
diff --git a/tests/queries/0_stateless/02313_filesystem_cache_seeks.sh b/tests/queries/0_stateless/02313_filesystem_cache_seeks.sh
index f5de4346fd6..fbaec1ffaa7 100755
--- a/tests/queries/0_stateless/02313_filesystem_cache_seeks.sh
+++ b/tests/queries/0_stateless/02313_filesystem_cache_seeks.sh
@@ -8,7 +8,7 @@ CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. "$CUR_DIR"/../shell_config.sh
-for STORAGE_POLICY in 's3_cache' 'local_cache' 's3_cache_multi'; do
+for STORAGE_POLICY in 's3_cache' 'local_cache' 's3_cache_multi' 'azure_cache'; do
echo "Using storage policy: $STORAGE_POLICY"
$CLICKHOUSE_CLIENT --query "SYSTEM DROP FILESYSTEM CACHE"
diff --git a/tests/queries/0_stateless/02391_recursive_buffer.sql b/tests/queries/0_stateless/02391_recursive_buffer.sql
index 1a630722b5a..60a2f0d1af1 100644
--- a/tests/queries/0_stateless/02391_recursive_buffer.sql
+++ b/tests/queries/0_stateless/02391_recursive_buffer.sql
@@ -10,9 +10,5 @@ DROP TABLE test;
DROP TABLE IF EXISTS test1;
DROP TABLE IF EXISTS test2;
CREATE TABLE test1 (key UInt32) Engine = Buffer(currentDatabase(), test2, 16, 10, 100, 10000, 1000000, 10000000, 100000000);
-CREATE TABLE test2 (key UInt32) Engine = Buffer(currentDatabase(), test1, 16, 10, 100, 10000, 1000000, 10000000, 100000000);
-SELECT * FROM test1; -- { serverError TOO_DEEP_RECURSION }
-SELECT * FROM test2; -- { serverError TOO_DEEP_RECURSION }
-SELECT * FROM system.tables WHERE table IN ('test1', 'test2') AND database = currentDatabase(); -- { serverError TOO_DEEP_RECURSION }
+CREATE TABLE test2 (key UInt32) Engine = Buffer(currentDatabase(), test1, 16, 10, 100, 10000, 1000000, 10000000, 100000000); -- { serverError INFINITE_LOOP }
DROP TABLE test1;
-DROP TABLE test2;
diff --git a/tests/queries/0_stateless/02859_replicated_db_name_zookeeper.reference b/tests/queries/0_stateless/02859_replicated_db_name_zookeeper.reference
new file mode 100644
index 00000000000..e7d63a6add3
--- /dev/null
+++ b/tests/queries/0_stateless/02859_replicated_db_name_zookeeper.reference
@@ -0,0 +1,2 @@
+rdb1_default 1
+rdb3_default 1
diff --git a/tests/queries/0_stateless/02859_replicated_db_name_zookeeper.sh b/tests/queries/0_stateless/02859_replicated_db_name_zookeeper.sh
new file mode 100755
index 00000000000..3c14c569257
--- /dev/null
+++ b/tests/queries/0_stateless/02859_replicated_db_name_zookeeper.sh
@@ -0,0 +1,34 @@
+#!/usr/bin/env bash
+
+CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
+# shellcheck source=../shell_config.sh
+. "$CURDIR"/../shell_config.sh
+
+$CLICKHOUSE_CLIENT --distributed_ddl_output_mode=none -q "CREATE DATABASE rdb1_$CLICKHOUSE_DATABASE ON CLUSTER test_shard_localhost ENGINE=Replicated('/clickhouse/databases/{uuid}', '{shard}', '{replica}')";
+$CLICKHOUSE_CLIENT --distributed_ddl_output_mode=none -q "CREATE DATABASE rdb2_$CLICKHOUSE_DATABASE ON CLUSTER test_shard_localhost ENGINE=Replicated('/clickhouse/databases/{uuid}', '{shard}', '{replica}')";
+$CLICKHOUSE_CLIENT --distributed_ddl_output_mode=none -q "RENAME DATABASE rdb2_$CLICKHOUSE_DATABASE to rdb3_$CLICKHOUSE_DATABASE ON CLUSTER test_shard_localhost"
+
+$CLICKHOUSE_CLIENT -q "
+SELECT
+ db_name,
+ t1.uuid = t2.uuid
+FROM
+(
+ WITH '/clickhouse/databases/' AS prefix
+ SELECT
+ toUUID(substr(path, length(prefix) + 1)) AS uuid,
+ value AS db_name
+ FROM system.zookeeper
+ WHERE (path IN (
+ SELECT concat(path, name)
+ FROM system.zookeeper
+ WHERE path = prefix
+ )) AND (name = 'first_replica_database_name')
+) AS t1
+INNER JOIN system.databases AS t2 USING (uuid)
+WHERE db_name like '%$CLICKHOUSE_DATABASE%'
+ORDER BY db_name
+"
+
+$CLICKHOUSE_CLIENT -q "DROP DATABASE rdb1_$CLICKHOUSE_DATABASE"
+$CLICKHOUSE_CLIENT -q "DROP DATABASE rdb3_$CLICKHOUSE_DATABASE"
diff --git a/tests/queries/0_stateless/02931_rewrite_sum_column_and_constant.reference b/tests/queries/0_stateless/02931_rewrite_sum_column_and_constant.reference
index 3124698d218..f9b72ba9c6a 100644
--- a/tests/queries/0_stateless/02931_rewrite_sum_column_and_constant.reference
+++ b/tests/queries/0_stateless/02931_rewrite_sum_column_and_constant.reference
@@ -245,21 +245,21 @@ EXPLAIN SYNTAX (SELECT 2 * count(uint64) - sum(uint64) From test_table);
SELECT (2 * count(uint64)) - sum(uint64)
FROM test_table
SELECT sum(float64 + 2) From test_table;
-26.5
+26.875
SELECT sum(2 + float64) From test_table;
-26.5
+26.875
SELECT sum(float64 - 2) From test_table;
-6.5
+6.875
SELECT sum(2 - float64) From test_table;
--6.5
+-6.875
SELECT sum(float64) + 2 * count(float64) From test_table;
-26.5
+26.875
SELECT 2 * count(float64) + sum(float64) From test_table;
-26.5
+26.875
SELECT sum(float64) - 2 * count(float64) From test_table;
-6.5
+6.875
SELECT 2 * count(float64) - sum(float64) From test_table;
--6.5
+-6.875
EXPLAIN SYNTAX (SELECT sum(float64 + 2) From test_table);
SELECT sum(float64) + (2 * count(float64))
FROM test_table
@@ -375,25 +375,25 @@ EXPLAIN SYNTAX (SELECT (2 * count(uint64) - sum(uint64)) + (3 * count(uint64) -
SELECT ((2 * count(uint64)) - sum(uint64)) + ((3 * count(uint64)) - sum(uint64))
FROM test_table
SELECT sum(float64 + 2) + sum(float64 + 3) From test_table;
-58
+58.75
SELECT sum(float64 + 2) - sum(float64 + 3) From test_table;
-5
SELECT sum(float64 - 2) + sum(float64 - 3) From test_table;
-8
+8.75
SELECT sum(float64 - 2) - sum(float64 - 3) From test_table;
5
SELECT sum(2 - float64) - sum(3 - float64) From test_table;
-5
SELECT (sum(float64) + 2 * count(float64)) + (sum(float64) + 3 * count(float64)) From test_table;
-58
+58.75
SELECT (sum(float64) + 2 * count(float64)) - (sum(float64) + 3 * count(float64)) From test_table;
-5
SELECT (sum(float64) - 2 * count(float64)) + (sum(float64) - 3 * count(float64)) From test_table;
-8
+8.75
SELECT (sum(float64) - 2 * count(float64)) - (sum(float64) - 3 * count(float64)) From test_table;
5
SELECT (2 * count(float64) - sum(float64)) + (3 * count(float64) - sum(float64)) From test_table;
--8
+-8.75
EXPLAIN SYNTAX (SELECT sum(float64 + 2) + sum(float64 + 3) From test_table);
SELECT (sum(float64) + (2 * count(float64))) + (sum(float64) + (3 * count(float64)))
FROM test_table
diff --git a/tests/queries/0_stateless/02931_rewrite_sum_column_and_constant.sql b/tests/queries/0_stateless/02931_rewrite_sum_column_and_constant.sql
index c7b0ff82442..94baee6f1ba 100644
--- a/tests/queries/0_stateless/02931_rewrite_sum_column_and_constant.sql
+++ b/tests/queries/0_stateless/02931_rewrite_sum_column_and_constant.sql
@@ -23,11 +23,12 @@ CREATE TABLE test_table
decimal32 Decimal32(5),
) ENGINE=MergeTree ORDER BY uint64;
-INSERT INTO test_table VALUES (1, 1.1, 1.11);
-INSERT INTO test_table VALUES (2, 2.2, 2.22);
-INSERT INTO test_table VALUES (3, 3.3, 3.33);
-INSERT INTO test_table VALUES (4, 4.4, 4.44);
-INSERT INTO test_table VALUES (5, 5.5, 5.55);
+-- Use Float64 numbers divisible by 1/16 (or some other small power of two), so that their sum doesn't depend on summation order.
+INSERT INTO test_table VALUES (1, 1.125, 1.11);
+INSERT INTO test_table VALUES (2, 2.250, 2.22);
+INSERT INTO test_table VALUES (3, 3.375, 3.33);
+INSERT INTO test_table VALUES (4, 4.500, 4.44);
+INSERT INTO test_table VALUES (5, 5.625, 5.55);
-- { echoOn }
SELECT sum(uint64 + 1 AS i) from test_table where i > 0;
diff --git a/tests/queries/0_stateless/02956_rocksdb_bulk_sink.sh b/tests/queries/0_stateless/02956_rocksdb_bulk_sink.sh
index 45e65b18e07..b1d1c483396 100755
--- a/tests/queries/0_stateless/02956_rocksdb_bulk_sink.sh
+++ b/tests/queries/0_stateless/02956_rocksdb_bulk_sink.sh
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
-# Tags: no-ordinary-database, use-rocksdb
+# Tags: no-ordinary-database, use-rocksdb, no-random-settings
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=../shell_config.sh
@@ -45,4 +45,3 @@ ${CLICKHOUSE_CLIENT} --query "INSERT INTO rocksdb_worm SELECT number, number+1 F
${CLICKHOUSE_CLIENT} --query "INSERT INTO rocksdb_worm SELECT number, number+1 FROM numbers_mt(1000000)" &
wait
${CLICKHOUSE_CLIENT} --query "SELECT count() FROM rocksdb_worm;"
-
diff --git a/tests/queries/0_stateless/02963_test_flexible_disk_configuration.sql b/tests/queries/0_stateless/02963_test_flexible_disk_configuration.sql
index 8f67cd7e030..7ebef866360 100644
--- a/tests/queries/0_stateless/02963_test_flexible_disk_configuration.sql
+++ b/tests/queries/0_stateless/02963_test_flexible_disk_configuration.sql
@@ -22,7 +22,7 @@ create table test (a Int32) engine = MergeTree() order by tuple()
settings disk=disk(name='test2',
type = object_storage,
object_storage_type = s3,
- metadata_storage_type = local,
+ metadata_type = local,
endpoint = 'http://localhost:11111/test/common/',
access_key_id = clickhouse,
secret_access_key = clickhouse);
@@ -32,7 +32,7 @@ create table test (a Int32) engine = MergeTree() order by tuple()
settings disk=disk(name='test3',
type = object_storage,
object_storage_type = s3,
- metadata_storage_type = local,
+ metadata_type = local,
metadata_keep_free_space_bytes = 1024,
endpoint = 'http://localhost:11111/test/common/',
access_key_id = clickhouse,
@@ -43,7 +43,7 @@ create table test (a Int32) engine = MergeTree() order by tuple()
settings disk=disk(name='test4',
type = object_storage,
object_storage_type = s3,
- metadata_storage_type = local,
+ metadata_type = local,
metadata_keep_free_space_bytes = 0,
endpoint = 'http://localhost:11111/test/common/',
access_key_id = clickhouse,
diff --git a/tests/queries/0_stateless/02982_aggregation_states_destruction.reference b/tests/queries/0_stateless/02982_aggregation_states_destruction.reference
index d00491fd7e5..72749c905a3 100644
--- a/tests/queries/0_stateless/02982_aggregation_states_destruction.reference
+++ b/tests/queries/0_stateless/02982_aggregation_states_destruction.reference
@@ -1 +1 @@
-1
+1 1 1
diff --git a/tests/queries/0_stateless/02982_aggregation_states_destruction.sh b/tests/queries/0_stateless/02982_aggregation_states_destruction.sh
index 1c72cf2b8c1..263a4535c0e 100755
--- a/tests/queries/0_stateless/02982_aggregation_states_destruction.sh
+++ b/tests/queries/0_stateless/02982_aggregation_states_destruction.sh
@@ -11,4 +11,4 @@ $CLICKHOUSE_CLIENT --query_id $query_id --log_query_threads 1 --query="select nu
$CLICKHOUSE_CLIENT -q "system flush logs;"
-$CLICKHOUSE_CLIENT -q "select count() > 1 from system.query_thread_log where query_id = '$query_id' and current_database = currentDatabase() and thread_name = 'AggregDestruct';"
+$CLICKHOUSE_CLIENT -q "select count() > 0, (countIf(thread_name = 'AggregDestruct') as aggs) > 0, aggs > 1 from system.query_thread_log where query_id = '$query_id' and current_database = currentDatabase();"
diff --git a/tests/queries/0_stateless/03002_part_log_rmt_fetch_mutate_error.sql b/tests/queries/0_stateless/03002_part_log_rmt_fetch_mutate_error.sql
index 34ba034f798..d8b5ebb3148 100644
--- a/tests/queries/0_stateless/03002_part_log_rmt_fetch_mutate_error.sql
+++ b/tests/queries/0_stateless/03002_part_log_rmt_fetch_mutate_error.sql
@@ -4,9 +4,9 @@
drop table if exists rmt_master;
drop table if exists rmt_slave;
-create table rmt_master (key Int) engine=ReplicatedMergeTree('/clickhouse/{database}', 'master') order by tuple() settings always_fetch_merged_part=0;
+create table rmt_master (key Int) engine=ReplicatedMergeTree('/clickhouse/{database}', 'master') order by tuple() settings always_fetch_merged_part=0, old_parts_lifetime=600;
-- prefer_fetch_merged_part_*_threshold=0, consider this table as a "slave"
-create table rmt_slave (key Int) engine=ReplicatedMergeTree('/clickhouse/{database}', 'slave') order by tuple() settings prefer_fetch_merged_part_time_threshold=0, prefer_fetch_merged_part_size_threshold=0;
+create table rmt_slave (key Int) engine=ReplicatedMergeTree('/clickhouse/{database}', 'slave') order by tuple() settings prefer_fetch_merged_part_time_threshold=0, prefer_fetch_merged_part_size_threshold=0, old_parts_lifetime=600;
insert into rmt_master values (1);
diff --git a/tests/queries/0_stateless/03013_json_key_ignore_case.reference b/tests/queries/0_stateless/03013_json_key_ignore_case.reference
new file mode 100644
index 00000000000..54683d8fbc5
--- /dev/null
+++ b/tests/queries/0_stateless/03013_json_key_ignore_case.reference
@@ -0,0 +1,3 @@
+1 77328912 Ben
+2 77328913 Jim
+3 77328914 Bill
diff --git a/tests/queries/0_stateless/03013_json_key_ignore_case.sh b/tests/queries/0_stateless/03013_json_key_ignore_case.sh
new file mode 100755
index 00000000000..807e743b22a
--- /dev/null
+++ b/tests/queries/0_stateless/03013_json_key_ignore_case.sh
@@ -0,0 +1,18 @@
+#!/usr/bin/env bash
+
+# NOTE: this sh wrapper is required because of shell_config
+
+CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
+# shellcheck source=../shell_config.sh
+. "$CURDIR"/../shell_config.sh
+
+
+USER_FILES_PATH=$($CLICKHOUSE_CLIENT --query "select _path,_file from file('nonexist.txt', 'CSV', 'val1 char')" 2>&1 | grep -E '^Code: 107.*FILE_DOESNT_EXIST' | head -1 | awk '{gsub("/nonexist.txt","",$9); print $9}')
+
+cp "$CURDIR"/data_json/key_ignore_case.json $USER_FILES_PATH/
+
+$CLICKHOUSE_CLIENT -q "drop table if exists test_tbl"
+$CLICKHOUSE_CLIENT -q "create table test_tbl (id UInt16, reqid UInt32, name String) engine=MergeTree order by id"
+$CLICKHOUSE_CLIENT -q "INSERT INTO test_tbl SELECT * FROM file('key_ignore_case.json', 'JSONEachRow') SETTINGS input_format_json_ignore_key_case=true"
+$CLICKHOUSE_CLIENT -q "select * from test_tbl"
+$CLICKHOUSE_CLIENT -q "drop table test_tbl"
\ No newline at end of file
diff --git a/tests/queries/0_stateless/03071_fix_short_circuit_logic.reference b/tests/queries/0_stateless/03071_fix_short_circuit_logic.reference
new file mode 100644
index 00000000000..48aedfc3958
--- /dev/null
+++ b/tests/queries/0_stateless/03071_fix_short_circuit_logic.reference
@@ -0,0 +1 @@
+2024-01-02 16:54:59
diff --git a/tests/queries/0_stateless/03071_fix_short_circuit_logic.sql b/tests/queries/0_stateless/03071_fix_short_circuit_logic.sql
new file mode 100644
index 00000000000..7745bceca0b
--- /dev/null
+++ b/tests/queries/0_stateless/03071_fix_short_circuit_logic.sql
@@ -0,0 +1,62 @@
+
+
+CREATE FUNCTION IF NOT EXISTS unhexPrefixed AS value -> unhex(substring(value, 3));
+CREATE FUNCTION IF NOT EXISTS hex2bytes AS address -> CAST(unhexPrefixed(address), 'FixedString(20)');
+CREATE FUNCTION IF NOT EXISTS bytes2hex AS address -> concat('0x', lower(hex(address)));
+
+CREATE TABLE test
+(
+ `transfer_id` String,
+ `address` FixedString(20),
+ `value` UInt256,
+ `block_timestamp` DateTime('UTC'),
+ `token_address` FixedString(20)
+)
+ENGINE = MergeTree
+PARTITION BY toYYYYMM(block_timestamp)
+PRIMARY KEY (address, block_timestamp)
+ORDER BY (address, block_timestamp);
+
+INSERT INTO test SELECT 'token-transfer-0x758f1bbabb160683e1c80ed52dcd24a32b599d40edf1cec91b5f1199c0e392a2-56', hex2bytes('0xd387a6e4e84a6c86bd90c158c6028a58cc8ac459'), 3000000000000000000000, '2024-01-02 16:54:59', 'abc';
+
+CREATE TABLE token_data
+(
+ token_address_hex String,
+ chain String,
+ is_blacklisted Bool
+)
+ENGINE = TinyLog;
+
+INSERT INTO token_data SELECT bytes2hex('abc'), 'zksync', false;
+
+CREATE DICTIONARY token_data_map
+(
+ token_address_hex String,
+ chain String,
+ is_blacklisted Bool
+)
+PRIMARY KEY token_address_hex, chain
+SOURCE(Clickhouse(table token_data))
+LIFETIME(MIN 200 MAX 300)
+LAYOUT(COMPLEX_KEY_HASHED_ARRAY());
+
+SELECT block_timestamp
+FROM
+(
+ SELECT
+ block_timestamp,
+ bytes2hex(token_address) AS token_address_hex
+ FROM
+ (
+ SELECT
+ transfer_id,
+ address,
+ value,
+ block_timestamp,
+ token_address,
+ 'zksync' AS chain
+ FROM test
+ )
+ WHERE (address = hex2bytes('0xd387a6e4e84a6c86bd90c158c6028a58cc8ac459')) AND (transfer_id NOT LIKE 'gas%') AND (value > 0) AND (dictGetOrDefault(token_data_map, 'is_blacklisted', (token_address_hex, 'zksync'), true))
+)
+SETTINGS max_threads = 1, short_circuit_function_evaluation = 'enable', allow_experimental_analyzer = 0;
\ No newline at end of file
diff --git a/tests/queries/0_stateless/03094_one_thousand_joins.sql b/tests/queries/0_stateless/03094_one_thousand_joins.sql
index ea159f0e4c0..1f6bd99df7f 100644
--- a/tests/queries/0_stateless/03094_one_thousand_joins.sql
+++ b/tests/queries/0_stateless/03094_one_thousand_joins.sql
@@ -1,6 +1,7 @@
-- Tags: no-fasttest, no-tsan, long
-- (no-tsan because it has a small maximum stack size and the test would fail with TOO_DEEP_RECURSION)
+SET join_algorithm = 'default'; -- for 'full_sorting_merge' the query is 10x slower
SET allow_experimental_analyzer = 1; -- old analyzer returns TOO_DEEP_SUBQUERIES
-- Bug 33446, marked as 'long' because it still runs around 10 sec
diff --git a/tests/queries/0_stateless/03167_base64_url_functions.sql b/tests/queries/0_stateless/03167_base64_url_functions.sql
index 674f1ae498b..6c394ba6c3a 100644
--- a/tests/queries/0_stateless/03167_base64_url_functions.sql
+++ b/tests/queries/0_stateless/03167_base64_url_functions.sql
@@ -2,35 +2,35 @@
-- no-fasttest because aklomp-base64 library is required
-- incorrect number of arguments
-SELECT base64UrlEncode(); -- { serverError NUMBER_OF_ARGUMENTS_DOESNT_MATCH }
-SELECT base64UrlDecode(); -- { serverError NUMBER_OF_ARGUMENTS_DOESNT_MATCH }
-SELECT tryBase64UrlDecode(); -- { serverError NUMBER_OF_ARGUMENTS_DOESNT_MATCH }
-SELECT base64UrlEncode('foo', 'excess argument'); -- { serverError NUMBER_OF_ARGUMENTS_DOESNT_MATCH }
-SELECT base64UrlDecode('foo', 'excess argument'); -- { serverError NUMBER_OF_ARGUMENTS_DOESNT_MATCH }
-SELECT tryBase64UrlDecode('foo', 'excess argument'); -- { serverError NUMBER_OF_ARGUMENTS_DOESNT_MATCH }
+SELECT base64URLEncode(); -- { serverError NUMBER_OF_ARGUMENTS_DOESNT_MATCH }
+SELECT base64URLDecode(); -- { serverError NUMBER_OF_ARGUMENTS_DOESNT_MATCH }
+SELECT tryBase64URLDecode(); -- { serverError NUMBER_OF_ARGUMENTS_DOESNT_MATCH }
+SELECT base64URLEncode('foo', 'excess argument'); -- { serverError NUMBER_OF_ARGUMENTS_DOESNT_MATCH }
+SELECT base64URLDecode('foo', 'excess argument'); -- { serverError NUMBER_OF_ARGUMENTS_DOESNT_MATCH }
+SELECT tryBase64URLDecode('foo', 'excess argument'); -- { serverError NUMBER_OF_ARGUMENTS_DOESNT_MATCH }
-- test with valid inputs
-SELECT 'https://clickhouse.com' AS original, base64UrlEncode(original) AS encoded, base64UrlDecode(encoded), tryBase64UrlDecode(encoded);
-SELECT '12?' AS original, base64UrlEncode(original) AS encoded, base64UrlDecode(encoded), tryBase64UrlDecode(encoded);
-SELECT 'https://www.google.com/search?q=clickhouse+base64+decode&sca_esv=739f8bb380e4c7ed&ei=TfRiZqCDIrmnwPAP2KLRkA8&ved=0ahUKEwjg3ZHitsmGAxW5ExAIHVhRFPIQ4dUDCBA&uact=5&oq=clickhouse+base64+decode' AS original, base64UrlEncode(original) AS encoded, base64UrlDecode(encoded), tryBase64UrlDecode(encoded);
+SELECT 'https://clickhouse.com' AS original, base64URLEncode(original) AS encoded, base64URLDecode(encoded), tryBase64URLDecode(encoded);
+SELECT '12?' AS original, base64URLEncode(original) AS encoded, base64URLDecode(encoded), tryBase64URLDecode(encoded);
+SELECT 'https://www.google.com/search?q=clickhouse+base64+decode&sca_esv=739f8bb380e4c7ed&ei=TfRiZqCDIrmnwPAP2KLRkA8&ved=0ahUKEwjg3ZHitsmGAxW5ExAIHVhRFPIQ4dUDCBA&uact=5&oq=clickhouse+base64+decode' AS original, base64URLEncode(original) AS encoded, base64URLDecode(encoded), tryBase64URLDecode(encoded);
-- encoded value has no padding
-SELECT 'aHR0cHM6Ly9jbGlj' AS encoded, base64UrlDecode(encoded), tryBase64UrlDecode(encoded);
+SELECT 'aHR0cHM6Ly9jbGlj' AS encoded, base64URLDecode(encoded), tryBase64URLDecode(encoded);
-- encoded value has one-byte padding
-SELECT 'aHR0cHM6Ly9jbGlja2g' AS encoded, base64UrlDecode(encoded), tryBase64UrlDecode(encoded);
+SELECT 'aHR0cHM6Ly9jbGlja2g' AS encoded, base64URLDecode(encoded), tryBase64URLDecode(encoded);
-- encoded value has two-bytes padding
-SELECT 'aHR0cHM6Ly9jbGljaw' AS encoded, base64UrlDecode(encoded), tryBase64UrlDecode(encoded);
+SELECT 'aHR0cHM6Ly9jbGljaw' AS encoded, base64URLDecode(encoded), tryBase64URLDecode(encoded);
-- test with invalid inputs
-SELECT base64UrlDecode('https://clickhouse.com'); -- { serverError INCORRECT_DATA }
-SELECT tryBase64UrlDecode('https://clickhouse.com');
-SELECT base64UrlDecode('12?'); -- { serverError INCORRECT_DATA }
-SELECT tryBase64UrlDecode('12?');
-SELECT base64UrlDecode('aHR0cHM6Ly9jbGlja'); -- { serverError INCORRECT_DATA }
-SELECT tryBase64UrlDecode('aHR0cHM6Ly9jbGlja');
+SELECT base64URLDecode('https://clickhouse.com'); -- { serverError INCORRECT_DATA }
+SELECT tryBase64URLDecode('https://clickhouse.com');
+SELECT base64URLDecode('12?'); -- { serverError INCORRECT_DATA }
+SELECT tryBase64URLDecode('12?');
+SELECT base64URLDecode('aHR0cHM6Ly9jbGlja'); -- { serverError INCORRECT_DATA }
+SELECT tryBase64URLDecode('aHR0cHM6Ly9jbGlja');
-- test FixedString argument
-SELECT toFixedString('https://clickhouse.com', 22) AS original, base64UrlEncode(original) AS encoded, base64UrlDecode(encoded), tryBase64UrlDecode(encoded);
+SELECT toFixedString('https://clickhouse.com', 22) AS original, base64URLEncode(original) AS encoded, base64URLDecode(encoded), tryBase64URLDecode(encoded);
diff --git a/tests/queries/0_stateless/03167_parametrized_view_with_cte.reference b/tests/queries/0_stateless/03167_parametrized_view_with_cte.reference
new file mode 100644
index 00000000000..951910bbe74
--- /dev/null
+++ b/tests/queries/0_stateless/03167_parametrized_view_with_cte.reference
@@ -0,0 +1,5 @@
+OK
+123
+123
+123
+123
diff --git a/tests/queries/0_stateless/03167_parametrized_view_with_cte.sql b/tests/queries/0_stateless/03167_parametrized_view_with_cte.sql
new file mode 100644
index 00000000000..1ac5540047a
--- /dev/null
+++ b/tests/queries/0_stateless/03167_parametrized_view_with_cte.sql
@@ -0,0 +1,7 @@
+SET allow_experimental_analyzer=1;
+CREATE OR REPLACE VIEW param_test AS SELECT {test_str:String} as s_result;
+WITH 'OK' AS s SELECT * FROM param_test(test_str=s);
+WITH (SELECT 123) AS s SELECT * FROM param_test(test_str=s);
+WITH (SELECT 100 + 20 + 3) AS s SELECT * FROM param_test(test_str=s);
+WITH (SELECT number FROM numbers(123, 1)) AS s SELECT * FROM param_test(test_str=s);
+WITH CAST(123, 'String') AS s SELECT * FROM param_test(test_str=s);
diff --git a/tests/queries/0_stateless/03168_inconsistent_ast_formatting.reference b/tests/queries/0_stateless/03168_inconsistent_ast_formatting.reference
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/tests/queries/0_stateless/03168_inconsistent_ast_formatting.sql b/tests/queries/0_stateless/03168_inconsistent_ast_formatting.sql
new file mode 100644
index 00000000000..5333ea29ce7
--- /dev/null
+++ b/tests/queries/0_stateless/03168_inconsistent_ast_formatting.sql
@@ -0,0 +1,7 @@
+create table a (x `Null`); -- { clientError SYNTAX_ERROR }
+create table a (x f(`Null`)); -- { clientError SYNTAX_ERROR }
+create table a (x Enum8(f(`Null`, 'World', 2))); -- { clientError SYNTAX_ERROR }
+create table a (`value2` Enum8('Hello' = 1, equals(`Null`, 'World', 2), '!' = 3)); -- { clientError SYNTAX_ERROR }
+
+create table a (x Int8) engine Memory;
+create table b empty as a;
diff --git a/tests/queries/0_stateless/03169_cache_complex_dict_short_circuit_bug.sql b/tests/queries/0_stateless/03169_cache_complex_dict_short_circuit_bug.sql
index 8463d13d251..f91aaf39081 100644
--- a/tests/queries/0_stateless/03169_cache_complex_dict_short_circuit_bug.sql
+++ b/tests/queries/0_stateless/03169_cache_complex_dict_short_circuit_bug.sql
@@ -27,5 +27,5 @@ LAYOUT(COMPLEX_KEY_CACHE(SIZE_IN_CELLS 10));
SELECT dictGetOrDefault('cache_dictionary_complex_key_simple_attributes_short_circuit', 'value_first', (number, concat(toString(number))), toString(materialize('default'))) AS value_first FROM system.numbers LIMIT 20 FORMAT Null;
SELECT dictGetOrDefault('cache_dictionary_complex_key_simple_attributes_short_circuit', 'value_first', (number, concat(toString(number))), toString(materialize('default'))) AS value_first FROM system.numbers LIMIT 20 FORMAT Null;
-DROP TABLE IF EXISTS complex_key_simple_attributes_source_short_circuit_table;
DROP DICTIONARY IF EXISTS cache_dictionary_complex_key_simple_attributes_short_circuit;
+DROP TABLE IF EXISTS complex_key_simple_attributes_source_short_circuit_table;
diff --git a/tests/queries/0_stateless/03173_check_cyclic_dependencies_on_create_and_rename.reference b/tests/queries/0_stateless/03173_check_cyclic_dependencies_on_create_and_rename.reference
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/tests/queries/0_stateless/03173_check_cyclic_dependencies_on_create_and_rename.sql b/tests/queries/0_stateless/03173_check_cyclic_dependencies_on_create_and_rename.sql
new file mode 100644
index 00000000000..0cadd4f5cee
--- /dev/null
+++ b/tests/queries/0_stateless/03173_check_cyclic_dependencies_on_create_and_rename.sql
@@ -0,0 +1,77 @@
+-- Tags: atomic-database
+
+DROP TABLE IF EXISTS test;
+CREATE TABLE test (id UInt64, value String) ENGINE=MergeTree ORDER BY id;
+INSERT INTO test SELECT number, 'str_' || toString(number) FROM numbers(10);
+DROP DICTIONARY IF EXISTS test_dict;
+CREATE DICTIONARY test_dict
+(
+ id UInt64,
+ value String
+)
+PRIMARY KEY id
+SOURCE(CLICKHOUSE(TABLE test))
+LAYOUT(FLAT())
+LIFETIME(MIN 0 MAX 1000);
+DROP TABLE IF EXISTS view_source;
+CREATE TABLE view_source (id UInt64) ENGINE=MergeTree ORDER BY id;
+INSERT INTO view_source SELECT * FROM numbers(5);
+DROP VIEW IF EXISTS view;
+CREATE VIEW view AS SELECT id, dictGet('test_dict', 'value', id) as value FROM view_source;
+
+CREATE OR REPLACE DICTIONARY test_dict
+(
+ id UInt64,
+ value String
+)
+PRIMARY KEY id
+SOURCE(CLICKHOUSE(TABLE view))
+LAYOUT(FLAT())
+LIFETIME(MIN 0 MAX 1000); -- {serverError INFINITE_LOOP}
+
+REPLACE DICTIONARY test_dict
+(
+ id UInt64,
+ value String
+)
+PRIMARY KEY id
+SOURCE(CLICKHOUSE(TABLE view))
+LAYOUT(FLAT())
+LIFETIME(MIN 0 MAX 1000); -- {serverError INFINITE_LOOP}
+
+
+DROP DICTIONARY IF EXISTS test_dict_2;
+CREATE DICTIONARY test_dict_2
+(
+ id UInt64,
+ value String
+)
+PRIMARY KEY id
+SOURCE(CLICKHOUSE(TABLE view))
+LAYOUT(FLAT())
+LIFETIME(MIN 0 MAX 1000);
+
+EXCHANGE DICTIONARIES test_dict AND test_dict_2; -- {serverError INFINITE_LOOP}
+
+DROP DICTIONARY test_dict_2;
+
+CREATE OR REPLACE DICTIONARY test_dict_2
+(
+ id UInt64,
+ value String
+)
+PRIMARY KEY id
+SOURCE(CLICKHOUSE(TABLE view))
+LAYOUT(FLAT())
+LIFETIME(MIN 0 MAX 1000);
+
+EXCHANGE DICTIONARIES test_dict AND test_dict_2; -- {serverError INFINITE_LOOP}
+
+DROP DICTIONARY test_dict;
+RENAME DICTIONARY test_dict_2 to test_dict; -- {serverError INFINITE_LOOP}
+
+DROP DICTIONARY test_dict_2;
+DROP VIEW view;
+DROP TABLE test;
+DROP TABLE view_source;
+
diff --git a/tests/queries/0_stateless/03174_merge_join_bug.reference b/tests/queries/0_stateless/03174_merge_join_bug.reference
new file mode 100644
index 00000000000..af98bcd6397
--- /dev/null
+++ b/tests/queries/0_stateless/03174_merge_join_bug.reference
@@ -0,0 +1,10 @@
+0 0
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+7 7
+8 8
+9 9
diff --git a/tests/queries/0_stateless/03174_merge_join_bug.sql b/tests/queries/0_stateless/03174_merge_join_bug.sql
new file mode 100644
index 00000000000..ab4cb6cd4a9
--- /dev/null
+++ b/tests/queries/0_stateless/03174_merge_join_bug.sql
@@ -0,0 +1,10 @@
+-- Tags: no-random-settings
+
+SET allow_experimental_analyzer=1, join_algorithm = 'full_sorting_merge';
+CREATE TABLE xxxx_yyy (key UInt32, key_b ALIAS key) ENGINE=MergeTree() ORDER BY key SETTINGS ratio_of_defaults_for_sparse_serialization=0.0;
+INSERT INTO xxxx_yyy SELECT number FROM numbers(10);
+
+SELECT *
+FROM xxxx_yyy AS a
+INNER JOIN xxxx_yyy AS b ON a.key = b.key_b
+ORDER BY a.key;
diff --git a/tests/queries/0_stateless/03196_local_memory_limit.reference b/tests/queries/0_stateless/03196_local_memory_limit.reference
new file mode 100644
index 00000000000..f2e22e8aa5b
--- /dev/null
+++ b/tests/queries/0_stateless/03196_local_memory_limit.reference
@@ -0,0 +1 @@
+maximum: 95.37 MiB
diff --git a/tests/queries/0_stateless/03196_local_memory_limit.sh b/tests/queries/0_stateless/03196_local_memory_limit.sh
new file mode 100755
index 00000000000..346b37be006
--- /dev/null
+++ b/tests/queries/0_stateless/03196_local_memory_limit.sh
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+
+CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
+# shellcheck source=../shell_config.sh
+. "$CUR_DIR"/../shell_config.sh
+
+${CLICKHOUSE_LOCAL} --config-file <(echo "100M") --query "SELECT number FROM system.numbers GROUP BY number HAVING count() > 1" 2>&1 | grep -o -P 'maximum: [\d\.]+ MiB'
diff --git a/tests/queries/0_stateless/03197_fix_parse_mysql_iso_date.reference b/tests/queries/0_stateless/03197_fix_parse_mysql_iso_date.reference
new file mode 100644
index 00000000000..bd9ab3be3fa
--- /dev/null
+++ b/tests/queries/0_stateless/03197_fix_parse_mysql_iso_date.reference
@@ -0,0 +1,2 @@
+2024-06-20 00:00:00
+2024-06-20 00:00:00
diff --git a/tests/queries/0_stateless/03197_fix_parse_mysql_iso_date.sql b/tests/queries/0_stateless/03197_fix_parse_mysql_iso_date.sql
new file mode 100644
index 00000000000..e83738f7214
--- /dev/null
+++ b/tests/queries/0_stateless/03197_fix_parse_mysql_iso_date.sql
@@ -0,0 +1,2 @@
+SELECT parseDateTime('2024-06-20', '%F', 'UTC') AS x;
+SELECT parseDateTime('06/20/24', '%D', 'UTC') AS x;
diff --git a/tests/queries/0_stateless/data_json/key_ignore_case.json b/tests/queries/0_stateless/data_json/key_ignore_case.json
new file mode 100644
index 00000000000..ad8f7cb4507
Binary files /dev/null and b/tests/queries/0_stateless/data_json/key_ignore_case.json differ
diff --git a/utils/backup/backup b/utils/backup/backup
new file mode 100755
index 00000000000..6aa9c179033
--- /dev/null
+++ b/utils/backup/backup
@@ -0,0 +1,47 @@
+#!/bin/bash
+
+user="default"
+path="."
+
+usage() {
+ echo
+ echo "A trivial script to upload your files into ClickHouse."
+ echo "You might want to use something like Dropbox instead, but..."
+ echo
+ echo "Usage: $0 --host [--user ] --password "
+ exit 1
+}
+
+while [[ "$#" -gt 0 ]]; do
+ case "$1" in
+ --host)
+ host="$2"
+ shift 2
+ ;;
+ --user)
+ user="$2"
+ shift 2
+ ;;
+ --password)
+ password="$2"
+ shift 2
+ ;;
+ --help)
+ usage
+ ;;
+ *)
+ path="$1"
+ shift 1
+ ;;
+ esac
+done
+
+if [ -z "$host" ] || [ -z "$password" ]; then
+ echo "Error: --host and --password are mandatory."
+ usage
+fi
+
+clickhouse-client --host "$host" --user "$user" --password "$password" --secure --query "CREATE TABLE IF NOT EXISTS default.files (time DEFAULT now(), path String, content String CODEC(ZSTD(6))) ENGINE = MergeTree ORDER BY (path, time)" &&
+find "$path" -type f | clickhouse-local --input-format LineAsString \
+ --max-block-size 1 --min-insert-block-size-rows 0 --min-insert-block-size-bytes '100M' --max-insert-threads 1 \
+ --query "INSERT INTO FUNCTION remoteSecure('$host', default.files, '$user', '$password') (path, content) SELECT line, file(line) FROM table" --progress
diff --git a/utils/check-style/aspell-ignore/en/aspell-dict.txt b/utils/check-style/aspell-ignore/en/aspell-dict.txt
index 550df1395d9..229eccefa48 100644
--- a/utils/check-style/aspell-ignore/en/aspell-dict.txt
+++ b/utils/check-style/aspell-ignore/en/aspell-dict.txt
@@ -575,6 +575,7 @@ MySQLDump
MySQLThreads
NATS
NCHAR
+NDJSON
NEKUDOTAYIM
NEWDATE
NEWDECIMAL
@@ -717,6 +718,8 @@ PlantUML
PointDistKm
PointDistM
PointDistRads
+PostHistory
+PostLink
PostgreSQLConnection
PostgreSQLThreads
Postgres
@@ -1014,8 +1017,8 @@ Updatable
Uppercased
Uptime
Uptrace
-UrlDecode
-UrlEncode
+URLDecode
+URLEncode
UserID
Util
VARCHAR
@@ -2262,6 +2265,7 @@ proleptic
prometheus
proportionsZTest
proto
+protocol
protobuf
protobufsingle
proxied
@@ -2515,6 +2519,7 @@ sqlite
sqrt
src
srcReplicas
+stackoverflow
stacktrace
stacktraces
startsWith
@@ -2853,6 +2858,7 @@ userver
utils
uuid
uuidv
+vCPU
varPop
varPopStable
varSamp
diff --git a/utils/check-style/check-style b/utils/check-style/check-style
index 722dfbcad16..380656cd1ca 100755
--- a/utils/check-style/check-style
+++ b/utils/check-style/check-style
@@ -322,10 +322,14 @@ std_cerr_cout_excludes=(
src/Client/LineReader.cpp
src/Client/QueryFuzzer.cpp
src/Client/Suggest.cpp
+ src/Client/ClientBase.h
+ src/Client/LineReader.h
+ src/Client/ReplxxLineReader.h
src/Bridge/IBridge.cpp
src/Daemon/BaseDaemon.cpp
src/Loggers/Loggers.cpp
src/Common/GWPAsan.cpp
+ src/Common/ProgressIndication.h
)
sources_with_std_cerr_cout=( $(
find $ROOT_PATH/{src,base} -name '*.h' -or -name '*.cpp' | \
diff --git a/utils/keeper-bench/Runner.cpp b/utils/keeper-bench/Runner.cpp
index ed7e09685f0..5ae4c7a0b1c 100644
--- a/utils/keeper-bench/Runner.cpp
+++ b/utils/keeper-bench/Runner.cpp
@@ -1238,9 +1238,13 @@ void Runner::createConnections()
std::shared_ptr Runner::getConnection(const ConnectionInfo & connection_info, size_t connection_info_idx)
{
- Coordination::ZooKeeper::Node node{Poco::Net::SocketAddress{connection_info.host}, static_cast(connection_info_idx), connection_info.secure};
- std::vector nodes;
- nodes.push_back(node);
+ zkutil::ShuffleHost host;
+ host.host = connection_info.host;
+ host.secure = connection_info.secure;
+ host.original_index = static_cast(connection_info_idx);
+ host.address = Poco::Net::SocketAddress{connection_info.host};
+
+ zkutil::ShuffleHosts nodes{host};
zkutil::ZooKeeperArgs args;
args.session_timeout_ms = connection_info.session_timeout_ms;
args.connection_timeout_ms = connection_info.connection_timeout_ms;
diff --git a/utils/zookeeper-cli/CMakeLists.txt b/utils/zookeeper-cli/CMakeLists.txt
index cad7164b775..fd2fa669f40 100644
--- a/utils/zookeeper-cli/CMakeLists.txt
+++ b/utils/zookeeper-cli/CMakeLists.txt
@@ -3,4 +3,6 @@ clickhouse_add_executable(clickhouse-zookeeper-cli
${ClickHouse_SOURCE_DIR}/src/Client/LineReader.cpp)
target_link_libraries(clickhouse-zookeeper-cli PRIVATE
clickhouse_common_zookeeper_no_log
- dbms)
+ dbms
+ clickhouse_functions
+)
diff --git a/utils/zookeeper-dump-tree/CMakeLists.txt b/utils/zookeeper-dump-tree/CMakeLists.txt
index 85e4d18c19f..3f3df65776a 100644
--- a/utils/zookeeper-dump-tree/CMakeLists.txt
+++ b/utils/zookeeper-dump-tree/CMakeLists.txt
@@ -3,4 +3,5 @@ target_link_libraries(zookeeper-dump-tree PRIVATE
clickhouse_common_zookeeper_no_log
clickhouse_common_io
dbms
+ clickhouse_functions
boost::program_options)
diff --git a/utils/zookeeper-remove-by-list/CMakeLists.txt b/utils/zookeeper-remove-by-list/CMakeLists.txt
index 50aaed76110..a4d7dccef65 100644
--- a/utils/zookeeper-remove-by-list/CMakeLists.txt
+++ b/utils/zookeeper-remove-by-list/CMakeLists.txt
@@ -2,4 +2,5 @@ clickhouse_add_executable (zookeeper-remove-by-list main.cpp ${SRCS})
target_link_libraries(zookeeper-remove-by-list PRIVATE
clickhouse_common_zookeeper_no_log
dbms
+ clickhouse_functions
boost::program_options)