|
1 | 1 | ---
|
2 |
| -title: "Can detached parts be dropped?" |
| 2 | +title: "Can detached parts in ClickHouse® be dropped?" |
3 | 3 | linkTitle: "Can detached parts be dropped?"
|
4 | 4 | description: >
|
5 |
| - Can detached parts be dropped? |
| 5 | + Cleaning up detached parts without data loss |
| 6 | +keywords: |
| 7 | + - clickhouse detached parts |
| 8 | + - clickhouse detach |
| 9 | + - clickhouse drop partition |
6 | 10 | ---
|
7 |
| -Here is what different statuses mean: |
| 11 | +ClickHouse® users should monitor for detached parts and act quickly when they appear. Here is what the different statuses of detached parts mean: |
8 | 12 |
|
9 |
| -1. Parts are renamed to 'ignored' if they were found during ATTACH together with other, bigger parts that cover the same blocks of data, i.e. they were already merged into something else. |
10 |
| -2. Parts are renamed to 'broken' if ClickHouse® was not able to load data from the parts. There could be different reasons: some files are lost, checksums are not correct, etc. |
11 |
| -3. Parts are renamed to 'unexpected' if they are present locally, but are not found in ZooKeeper, in case when an insert was not completed properly. The part is detached only if it's old enough (5 minutes), otherwise CH registers this part in ZooKeeper as a new part. |
12 |
| -4. Parts are renamed to 'cloned' if ClickHouse have had some parts on local disk while repairing lost replica so already existed parts being renamed and put in detached directory. Controlled by setting `detach_old_local_parts_when_cloning_replica`. |
| 13 | +1. Parts are renamed to **ignored** if they were found during ATTACH together with other, bigger parts that cover the same blocks of data, i.e. they were already merged into something else. |
| 14 | +2. Parts are renamed to **broken** if ClickHouse was not able to load data from the parts. There could be different reasons: some files are lost, checksums are not correct, etc. |
| 15 | +3. Parts are renamed to **unexpected** if they are present locally, but are not found in ZooKeeper, in case when an insert was not completed properly. The part is detached only if it's old enough (5 minutes), otherwise CH registers this part in ZooKeeper as a new part. |
| 16 | +4. Parts are renamed to **cloned** if ClickHouse has had some parts on local disk while repairing lost replica so already existed parts being renamed and put in detached directory. Controlled by setting `detach_old_local_parts_when_cloning_replica`. |
13 | 17 |
|
14 | 18 | 'Ignored' parts are safe to delete. 'Unexpected' and 'broken' should be investigated, but it might not be an easy thing to do, especially for older parts. If the `system.part_log table` is enabled you can find some information there. Otherwise you will need to look in `clickhouse-server.log` for what happened when the parts were detached.
|
15 | 19 | If there is another way you could confirm that there is no data loss in the affected tables, you could simply delete all detached parts.
|
16 | 20 |
|
17 |
| -It is important to monitor for detached parts and act quickly when they appear. If `clickhouse-server.log` is lost it might be impossible to figure out what happened and why the parts were detached. |
| 21 | +Again, it is important to monitor for detached parts and act quickly when they appear. If `clickhouse-server.log` is lost it might be impossible to figure out what happened and why the parts were detached. |
18 | 22 | You can use `system.asynchronous_metrics` or `system.detached_parts` for monitoring.
|
19 | 23 | ```sql
|
20 | 24 | select metric from system.asynchronous_metrics where metric ilike '%detach%'
|
|
0 commit comments