First commit

This commit is contained in:
Olga Revyakina 2021-04-04 21:27:00 +03:00
parent bcd1bf88c4
commit b980120042
4 changed files with 80 additions and 4 deletions

View File

@ -2844,4 +2844,15 @@ Sets the interval in seconds after which periodically refreshed [live view](../.
Default value: `60`.
## check_query_single_value_result {#check_query_single_value_result}
For `MergeTree` family engines defines the level of detail for the [CHECK TABLE](../../sql-reference/statements/check-table.md#checking-mergetree-tables) query result.
Possible values:
- 0 — the `CHECK TABLE` query shows a check status for every individual data part of a table.
- 1 — the `CHECK TABLE` query shows the general table check status.
Default value: `0`.
[Original article](https://clickhouse.tech/docs/en/operations/settings/settings/) <!-- hide -->

View File

@ -30,9 +30,36 @@ Performed over the tables with another table engines causes an exception.
Engines from the `*Log` family dont provide automatic data recovery on failure. Use the `CHECK TABLE` query to track data loss in a timely manner.
For `MergeTree` family engines, the `CHECK TABLE` query shows a check status for every individual data part of a table on the local server.
## Checking the MergeTree Family Tables {#checking-mergetree-tables}
**If the data is corrupted**
For `MergeTree` family engines, if [check_query_single_value_result](../../operations/settings/settings.md#check_query_single_value_result) = 0, the `CHECK TABLE` query shows a check status for every individual data part of a table on the local server.
```sql
SET check_query_single_value_result = 0;
CHECK TABLE test_table;
```
```text
┌─part_path─┬─is_passed─┬─message─┐
│ all_1_4_1 │ 1 │ │
│ all_1_4_2 │ 1 │ │
└───────────┴───────────┴─────────┘
```
If `check_query_single_value_result` = 0, the `CHECK TABLE` query shows the general table check status.
```sql
SET check_query_single_value_result = 1;
CHECK TABLE test_table;
```
```text
┌─result─┐
│ 1 │
└────────┘
```
## If the Data Is Corrupted {#if-data-is-corrupted}
If the table is corrupted, you can copy the non-corrupted data to another table. To do this:

View File

@ -2746,4 +2746,15 @@ SELECT * FROM test2;
Значение по умолчанию: `60`.
## check_query_single_value_result {#check_query_single_value_result}
Для таблиц семейства `MergeTree` определяет уровень детализации результата для запросов [CHECK TABLE](../../sql-reference/statements/check-table.md#checking-mergetree-tables).
Возможные значения:
- 0 — запрос `CHECK TABLE` возвращает статус каждого куска данных таблицы.
- 1 — запрос `CHECK TABLE` возвращает статус таблицы в целом.
Значение по умолчанию: `0`.
[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/settings/settings/) <!--hide-->

View File

@ -29,9 +29,36 @@ CHECK TABLE [db.]name
В движках `*Log` не предусмотрено автоматическое восстановление данных после сбоя. Используйте запрос `CHECK TABLE`, чтобы своевременно выявлять повреждение данных.
Для движков из семейства `MergeTree` запрос `CHECK TABLE` показывает статус проверки для каждого отдельного куска данных таблицы на локальном сервере.
## Проверка таблиц семейства MergeTree {#checking-mergetree-tables}
**Что делать, если данные повреждены**
Для таблиц семейства `MergeTree` если [check_query_single_value_result](../../operations/settings/settings.md#check_query_single_value_result) = 0, запрос `CHECK TABLE` возвращает статус каждого куска данных таблицы на локальном сервере.
```sql
SET check_query_single_value_result = 0;
CHECK TABLE test_table;
```
```text
┌─part_path─┬─is_passed─┬─message─┐
│ all_1_4_1 │ 1 │ │
│ all_1_4_2 │ 1 │ │
└───────────┴───────────┴─────────┘
```
Если `check_query_single_value_result` = 0, запрос `CHECK TABLE` возвращает статус таблицы в целом.
```sql
SET check_query_single_value_result = 1;
CHECK TABLE test_table;
```
```text
┌─result─┐
│ 1 │
└────────┘
```
## Что делать, если данные повреждены {#if-data-is-corrupted}
В этом случае можно скопировать оставшиеся неповрежденные данные в другую таблицу. Для этого: