From e15a080104afc968d041b5894e2260bb3385a29a Mon Sep 17 00:00:00 2001 From: George Date: Wed, 17 Feb 2021 00:36:18 +0300 Subject: [PATCH 01/16] First draft --- docs/en/operations/settings/settings.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/en/operations/settings/settings.md b/docs/en/operations/settings/settings.md index 963f9fa18bd..3e7694380cb 100644 --- a/docs/en/operations/settings/settings.md +++ b/docs/en/operations/settings/settings.md @@ -1872,6 +1872,18 @@ Possible values: Default value: `0`. +## insert_shard_id {#insert_shard_id} + +Enables insertion of data into specific shards from [Distributed](../../engines/table-engines/special/distributed.md#distributed) tables. + +This setting allows to insert data into specific shard from distributed table without perceiving local tables. + +Possible values: + +- Any number from `0` (disabled) to `shards_number` of corresponding [Distributed](../../engines/table-engines/special/distributed.md#distributed) table. + +Defauld value: `0` + ## use_compact_format_in_distributed_parts_names {#use_compact_format_in_distributed_parts_names} Uses compact format for storing blocks for async (`insert_distributed_sync`) INSERT into tables with `Distributed` engine. From 701fd2c54ef5d66a85f70ef1c0c77bc6f6a4f098 Mon Sep 17 00:00:00 2001 From: George Date: Wed, 10 Mar 2021 13:10:16 +0300 Subject: [PATCH 02/16] Small update --- docs/en/operations/settings/settings.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/en/operations/settings/settings.md b/docs/en/operations/settings/settings.md index 3e7694380cb..3601e471285 100644 --- a/docs/en/operations/settings/settings.md +++ b/docs/en/operations/settings/settings.md @@ -1874,15 +1874,16 @@ Default value: `0`. ## insert_shard_id {#insert_shard_id} -Enables insertion of data into specific shards from [Distributed](../../engines/table-engines/special/distributed.md#distributed) tables. +Enables insertion of data into specific shards of [Distributed](../../engines/table-engines/special/distributed.md#distributed) tables. -This setting allows to insert data into specific shard from distributed table without perceiving local tables. +This setting allows to synchronously insert data into specific shard from distributed table without perceiving local tables. Possible values: -- Any number from `0` (disabled) to `shards_number` of corresponding [Distributed](../../engines/table-engines/special/distributed.md#distributed) table. +- 0 — Disabled. +- Any number from `1` to `shards_number` of corresponding [Distributed](../../engines/table-engines/special/distributed.md#distributed) table. -Defauld value: `0` +Defauld value: `0`. ## use_compact_format_in_distributed_parts_names {#use_compact_format_in_distributed_parts_names} From 8cc0de8c4c29708f6b15ac0f17d0f1590f12f1cd Mon Sep 17 00:00:00 2001 From: George Date: Sat, 13 Mar 2021 15:41:47 +0300 Subject: [PATCH 03/16] Updated description --- docs/en/operations/settings/settings.md | 43 +++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/docs/en/operations/settings/settings.md b/docs/en/operations/settings/settings.md index 9d8178f680a..6f7db4f2a23 100644 --- a/docs/en/operations/settings/settings.md +++ b/docs/en/operations/settings/settings.md @@ -1874,17 +1874,54 @@ Default value: `0`. ## insert_shard_id {#insert_shard_id} -Enables insertion of data into specific shards of [Distributed](../../engines/table-engines/special/distributed.md#distributed) tables. +Enables synchronous insertion of data into specific shards of [Distributed](../../engines/table-engines/special/distributed.md#distributed) tables. -This setting allows to synchronously insert data into specific shard from distributed table without perceiving local tables. +If `insert_shard_id` isn't specified or the value is incorrect, the server will throw an exception. + +You can check server config or use this query to get the number of shard on `requested_cluster`. + +``` sql +SELECT uniq(shard_num) FROM system.clusters WHERE cluster='requested_cluster'; +``` Possible values: - 0 — Disabled. -- Any number from `1` to `shards_number` of corresponding [Distributed](../../engines/table-engines/special/distributed.md#distributed) table. +- Any number from `1` to `shards_num` of corresponding [Distributed](../../engines/table-engines/special/distributed.md#distributed) table. Defauld value: `0`. +**Example** + +Query: + +```sql +CREATE TABLE x AS system.numbers ENGINE = MergeTree ORDER BY number; + +CREATE TABLE x_dist AS x ENGINE = Distributed('test_cluster_two_shards_localhost', currentDatabase(), x); + +INSERT INTO x_dist SELECT * FROM numbers(5) SETTINGS insert_shard_id = 1; + +SELECT * FROM x_dist ORDER BY number ASC; +``` + +Result: + +``` text +┌─number─┐ +│ 0 │ +│ 0 │ +│ 1 │ +│ 1 │ +│ 2 │ +│ 2 │ +│ 3 │ +│ 3 │ +│ 4 │ +│ 4 │ +└────────┘ +``` + ## use_compact_format_in_distributed_parts_names {#use_compact_format_in_distributed_parts_names} Uses compact format for storing blocks for async (`insert_distributed_sync`) INSERT into tables with `Distributed` engine. From f7159874aada147001932b305d502775626784ef Mon Sep 17 00:00:00 2001 From: gyuton <40863448+gyuton@users.noreply.github.com> Date: Thu, 18 Mar 2021 00:51:07 +0300 Subject: [PATCH 04/16] Update docs/en/operations/settings/settings.md Co-authored-by: Anna <42538400+adevyatova@users.noreply.github.com> --- docs/en/operations/settings/settings.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/operations/settings/settings.md b/docs/en/operations/settings/settings.md index 6f7db4f2a23..aeaf2a2de07 100644 --- a/docs/en/operations/settings/settings.md +++ b/docs/en/operations/settings/settings.md @@ -1881,7 +1881,7 @@ If `insert_shard_id` isn't specified or the value is incorrect, the server will You can check server config or use this query to get the number of shard on `requested_cluster`. ``` sql -SELECT uniq(shard_num) FROM system.clusters WHERE cluster='requested_cluster'; +SELECT uniq(shard_num) FROM system.clusters WHERE cluster = 'requested_cluster'; ``` Possible values: From aab83c1d79fb7b3d5adf2a05274155ea695fc4d3 Mon Sep 17 00:00:00 2001 From: George Date: Thu, 18 Mar 2021 02:00:45 +0300 Subject: [PATCH 05/16] Added translation --- docs/en/operations/settings/settings.md | 2 +- docs/ru/operations/settings/settings.md | 51 +++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 1 deletion(-) diff --git a/docs/en/operations/settings/settings.md b/docs/en/operations/settings/settings.md index aeaf2a2de07..a1218dfe0bc 100644 --- a/docs/en/operations/settings/settings.md +++ b/docs/en/operations/settings/settings.md @@ -1878,7 +1878,7 @@ Enables synchronous insertion of data into specific shards of [Distributed](../. If `insert_shard_id` isn't specified or the value is incorrect, the server will throw an exception. -You can check server config or use this query to get the number of shard on `requested_cluster`. +To get the number of shards on `requested_cluster`, you can check server config or use this query: ``` sql SELECT uniq(shard_num) FROM system.clusters WHERE cluster = 'requested_cluster'; diff --git a/docs/ru/operations/settings/settings.md b/docs/ru/operations/settings/settings.md index f8f587c8a36..38c46b74a40 100644 --- a/docs/ru/operations/settings/settings.md +++ b/docs/ru/operations/settings/settings.md @@ -1744,6 +1744,57 @@ ClickHouse генерирует исключение - [Движок Distributed](../../engines/table-engines/special/distributed.md#distributed) - [Управление распределёнными таблицами](../../sql-reference/statements/system.md#query-language-system-distributed) + +## insert_shard_id {#insert_shard_id} + +Включает синхронную запись данных в указанный шард [Distributed](../../engines/table-engines/special/distributed.md#distributed) таблицы. + +Если значение настройки `insert_shard_id` не указано или указано неверно, сервер выдаст ошибку. + +Чтобы узнать количество шардов на кластере `requested_cluster`, можно проверить конфигурацию сервера или использовать этот запрос: + +``` sql +SELECT uniq(shard_num) FROM system.clusters WHERE cluster = 'requested_cluster'; +``` + +Возможные значения: + +- 0 — выключено. +- Любое число от `1` до `shards_num` соответствующей [Distributed](../../engines/table-engines/special/distributed.md#distributed) таблицы. + +Значение по-умолчанию: `0`. + +**Пример** + +Запрос: + +```sql +CREATE TABLE x AS system.numbers ENGINE = MergeTree ORDER BY number; + +CREATE TABLE x_dist AS x ENGINE = Distributed('test_cluster_two_shards_localhost', currentDatabase(), x); + +INSERT INTO x_dist SELECT * FROM numbers(5) SETTINGS insert_shard_id = 1; + +SELECT * FROM x_dist ORDER BY number ASC; +``` + +Результат: + +``` text +┌─number─┐ +│ 0 │ +│ 0 │ +│ 1 │ +│ 1 │ +│ 2 │ +│ 2 │ +│ 3 │ +│ 3 │ +│ 4 │ +│ 4 │ +└────────┘ +``` + ## validate_polygons {#validate_polygons} Включает или отключает генерирование исключения в функции [pointInPolygon](../../sql-reference/functions/geo/index.md#pointinpolygon), если многоугольник самопересекающийся или самокасающийся. From 2c88b0bd911f0dbf9c022c9cdb1c7d229ca4de2a Mon Sep 17 00:00:00 2001 From: George Date: Thu, 18 Mar 2021 02:03:27 +0300 Subject: [PATCH 06/16] Small fixes --- docs/en/operations/settings/settings.md | 2 +- docs/ru/operations/settings/settings.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/en/operations/settings/settings.md b/docs/en/operations/settings/settings.md index a1218dfe0bc..4bf3290498c 100644 --- a/docs/en/operations/settings/settings.md +++ b/docs/en/operations/settings/settings.md @@ -1874,7 +1874,7 @@ Default value: `0`. ## insert_shard_id {#insert_shard_id} -Enables synchronous insertion of data into specific shards of [Distributed](../../engines/table-engines/special/distributed.md#distributed) tables. +Enables or disables synchronous data insertion into specific shards of [Distributed](../../engines/table-engines/special/distributed.md#distributed) tables. If `insert_shard_id` isn't specified or the value is incorrect, the server will throw an exception. diff --git a/docs/ru/operations/settings/settings.md b/docs/ru/operations/settings/settings.md index 38c46b74a40..87acfd755ab 100644 --- a/docs/ru/operations/settings/settings.md +++ b/docs/ru/operations/settings/settings.md @@ -1747,7 +1747,7 @@ ClickHouse генерирует исключение ## insert_shard_id {#insert_shard_id} -Включает синхронную запись данных в указанный шард [Distributed](../../engines/table-engines/special/distributed.md#distributed) таблицы. +Включает или отключает режим синхронного добавления данных в указанный шард [Distributed](../../engines/table-engines/special/distributed.md#distributed) таблицы. Если значение настройки `insert_shard_id` не указано или указано неверно, сервер выдаст ошибку. From 61820d15346ccb8aeda923da5b803e6dfdf297d8 Mon Sep 17 00:00:00 2001 From: gyuton <40863448+gyuton@users.noreply.github.com> Date: Fri, 19 Mar 2021 16:25:48 +0300 Subject: [PATCH 07/16] Update docs/ru/operations/settings/settings.md Co-authored-by: Anna <42538400+adevyatova@users.noreply.github.com> --- docs/ru/operations/settings/settings.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/ru/operations/settings/settings.md b/docs/ru/operations/settings/settings.md index 87acfd755ab..b9b1a712288 100644 --- a/docs/ru/operations/settings/settings.md +++ b/docs/ru/operations/settings/settings.md @@ -1751,7 +1751,7 @@ ClickHouse генерирует исключение Если значение настройки `insert_shard_id` не указано или указано неверно, сервер выдаст ошибку. -Чтобы узнать количество шардов на кластере `requested_cluster`, можно проверить конфигурацию сервера или использовать этот запрос: +Узнать количество шардов `shard_num` на кластере `requested_cluster` можно из конфигурации сервера, либо используя запрос: ``` sql SELECT uniq(shard_num) FROM system.clusters WHERE cluster = 'requested_cluster'; From c51109d46e2320beba4826c640ea7ec8828d2fb2 Mon Sep 17 00:00:00 2001 From: gyuton <40863448+gyuton@users.noreply.github.com> Date: Fri, 19 Mar 2021 16:25:55 +0300 Subject: [PATCH 08/16] Update docs/ru/operations/settings/settings.md Co-authored-by: Anna <42538400+adevyatova@users.noreply.github.com> --- docs/ru/operations/settings/settings.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/ru/operations/settings/settings.md b/docs/ru/operations/settings/settings.md index b9b1a712288..0ac61a823e8 100644 --- a/docs/ru/operations/settings/settings.md +++ b/docs/ru/operations/settings/settings.md @@ -1762,7 +1762,7 @@ SELECT uniq(shard_num) FROM system.clusters WHERE cluster = 'requested_cluster'; - 0 — выключено. - Любое число от `1` до `shards_num` соответствующей [Distributed](../../engines/table-engines/special/distributed.md#distributed) таблицы. -Значение по-умолчанию: `0`. +Значение по умолчанию: `0`. **Пример** From 8f1f9415f985ded160e3364c9821fc8dbc27f737 Mon Sep 17 00:00:00 2001 From: gyuton <40863448+gyuton@users.noreply.github.com> Date: Fri, 19 Mar 2021 16:28:46 +0300 Subject: [PATCH 09/16] Update settings.md --- docs/en/operations/settings/settings.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/docs/en/operations/settings/settings.md b/docs/en/operations/settings/settings.md index 4bf3290498c..a0be136db13 100644 --- a/docs/en/operations/settings/settings.md +++ b/docs/en/operations/settings/settings.md @@ -1897,11 +1897,8 @@ Query: ```sql CREATE TABLE x AS system.numbers ENGINE = MergeTree ORDER BY number; - CREATE TABLE x_dist AS x ENGINE = Distributed('test_cluster_two_shards_localhost', currentDatabase(), x); - INSERT INTO x_dist SELECT * FROM numbers(5) SETTINGS insert_shard_id = 1; - SELECT * FROM x_dist ORDER BY number ASC; ``` From 28525747290bad7a31ee10e1f50c8ccf2fecd377 Mon Sep 17 00:00:00 2001 From: gyuton <40863448+gyuton@users.noreply.github.com> Date: Fri, 19 Mar 2021 16:29:16 +0300 Subject: [PATCH 10/16] Update settings.md --- docs/ru/operations/settings/settings.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/docs/ru/operations/settings/settings.md b/docs/ru/operations/settings/settings.md index 0ac61a823e8..1830cc10ffd 100644 --- a/docs/ru/operations/settings/settings.md +++ b/docs/ru/operations/settings/settings.md @@ -1770,11 +1770,8 @@ SELECT uniq(shard_num) FROM system.clusters WHERE cluster = 'requested_cluster'; ```sql CREATE TABLE x AS system.numbers ENGINE = MergeTree ORDER BY number; - CREATE TABLE x_dist AS x ENGINE = Distributed('test_cluster_two_shards_localhost', currentDatabase(), x); - INSERT INTO x_dist SELECT * FROM numbers(5) SETTINGS insert_shard_id = 1; - SELECT * FROM x_dist ORDER BY number ASC; ``` From 3be9d798ce2ef835990f31530e41a64f4cc62ed1 Mon Sep 17 00:00:00 2001 From: gyuton <40863448+gyuton@users.noreply.github.com> Date: Tue, 23 Mar 2021 12:22:38 +0300 Subject: [PATCH 11/16] Update docs/en/operations/settings/settings.md Co-authored-by: Kruglov Pavel <48961922+Avogar@users.noreply.github.com> --- docs/en/operations/settings/settings.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/operations/settings/settings.md b/docs/en/operations/settings/settings.md index a0be136db13..fe9f1567e42 100644 --- a/docs/en/operations/settings/settings.md +++ b/docs/en/operations/settings/settings.md @@ -1889,7 +1889,7 @@ Possible values: - 0 — Disabled. - Any number from `1` to `shards_num` of corresponding [Distributed](../../engines/table-engines/special/distributed.md#distributed) table. -Defauld value: `0`. +Default value: `0`. **Example** From 52c5608a05de72a01fd1e675939ab5dcfbb4e487 Mon Sep 17 00:00:00 2001 From: gyuton <40863448+gyuton@users.noreply.github.com> Date: Tue, 23 Mar 2021 12:23:52 +0300 Subject: [PATCH 12/16] Update settings.md --- docs/en/operations/settings/settings.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/operations/settings/settings.md b/docs/en/operations/settings/settings.md index fe9f1567e42..cda2a142681 100644 --- a/docs/en/operations/settings/settings.md +++ b/docs/en/operations/settings/settings.md @@ -1876,7 +1876,7 @@ Default value: `0`. Enables or disables synchronous data insertion into specific shards of [Distributed](../../engines/table-engines/special/distributed.md#distributed) tables. -If `insert_shard_id` isn't specified or the value is incorrect, the server will throw an exception. +If `insert_shard_id` value is incorrect, the server will throw an exception. To get the number of shards on `requested_cluster`, you can check server config or use this query: From 42c573e719cf39ab677baf2e575949d068e430b1 Mon Sep 17 00:00:00 2001 From: gyuton <40863448+gyuton@users.noreply.github.com> Date: Tue, 23 Mar 2021 12:24:46 +0300 Subject: [PATCH 13/16] Update settings.md --- docs/ru/operations/settings/settings.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/ru/operations/settings/settings.md b/docs/ru/operations/settings/settings.md index 1830cc10ffd..a0d7e5c133c 100644 --- a/docs/ru/operations/settings/settings.md +++ b/docs/ru/operations/settings/settings.md @@ -1749,7 +1749,7 @@ ClickHouse генерирует исключение Включает или отключает режим синхронного добавления данных в указанный шард [Distributed](../../engines/table-engines/special/distributed.md#distributed) таблицы. -Если значение настройки `insert_shard_id` не указано или указано неверно, сервер выдаст ошибку. +Если значение настройки `insert_shard_id` указано неверно, сервер выдаст ошибку. Узнать количество шардов `shard_num` на кластере `requested_cluster` можно из конфигурации сервера, либо используя запрос: From 601eb40d89619fa7c45a6002ec9153d2f22e97ac Mon Sep 17 00:00:00 2001 From: gyuton <40863448+gyuton@users.noreply.github.com> Date: Tue, 23 Mar 2021 13:01:57 +0300 Subject: [PATCH 14/16] Update settings.md --- docs/en/operations/settings/settings.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/operations/settings/settings.md b/docs/en/operations/settings/settings.md index cda2a142681..aec2076b4d1 100644 --- a/docs/en/operations/settings/settings.md +++ b/docs/en/operations/settings/settings.md @@ -1874,7 +1874,7 @@ Default value: `0`. ## insert_shard_id {#insert_shard_id} -Enables or disables synchronous data insertion into specific shards of [Distributed](../../engines/table-engines/special/distributed.md#distributed) tables. +If not `0`, specifies the shard of [Distributed](../../engines/table-engines/special/distributed.md#distributed) table into which the data will be inserted synchronously. If `insert_shard_id` value is incorrect, the server will throw an exception. From b30cbd4237ef781cd2dd9d30791739897a73be46 Mon Sep 17 00:00:00 2001 From: gyuton <40863448+gyuton@users.noreply.github.com> Date: Tue, 23 Mar 2021 13:04:51 +0300 Subject: [PATCH 15/16] Update settings.md --- docs/ru/operations/settings/settings.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/ru/operations/settings/settings.md b/docs/ru/operations/settings/settings.md index a0d7e5c133c..9dd12c2a7f5 100644 --- a/docs/ru/operations/settings/settings.md +++ b/docs/ru/operations/settings/settings.md @@ -1747,7 +1747,7 @@ ClickHouse генерирует исключение ## insert_shard_id {#insert_shard_id} -Включает или отключает режим синхронного добавления данных в указанный шард [Distributed](../../engines/table-engines/special/distributed.md#distributed) таблицы. +Если не `0`, указывает, в какой шард [Distributed](../../engines/table-engines/special/distributed.md#distributed) таблицы данные будут добавлены синхронно. Если значение настройки `insert_shard_id` указано неверно, сервер выдаст ошибку. From aa0e35f26433798f84a311c0f4704a0dde6db18b Mon Sep 17 00:00:00 2001 From: gyuton <40863448+gyuton@users.noreply.github.com> Date: Tue, 23 Mar 2021 13:08:07 +0300 Subject: [PATCH 16/16] Update docs/ru/operations/settings/settings.md Co-authored-by: Kruglov Pavel <48961922+Avogar@users.noreply.github.com> --- docs/ru/operations/settings/settings.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/ru/operations/settings/settings.md b/docs/ru/operations/settings/settings.md index 9dd12c2a7f5..d6f6dc27a1c 100644 --- a/docs/ru/operations/settings/settings.md +++ b/docs/ru/operations/settings/settings.md @@ -1747,7 +1747,7 @@ ClickHouse генерирует исключение ## insert_shard_id {#insert_shard_id} -Если не `0`, указывает, в какой шард [Distributed](../../engines/table-engines/special/distributed.md#distributed) таблицы данные будут добавлены синхронно. +Если не `0`, указывает, в какой шард [Distributed](../../engines/table-engines/special/distributed.md#distributed) таблицы данные будут вставлены синхронно. Если значение настройки `insert_shard_id` указано неверно, сервер выдаст ошибку.