Update detached-parts KB for recent ClickHouse behavior and safer recipes#162
Update detached-parts KB for recent ClickHouse behavior and safer recipes#162BorisTyshkevich wants to merge 1 commit intomainfrom
Conversation
|
I have read the CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. |
| count() AS parts, | ||
| formatReadableSize(sum(bytes_on_disk)) AS total_bytes, | ||
| min(modification_time) AS oldest, | ||
| max(modification_time) AS newest |
There was a problem hiding this comment.
this query is version specific, as those 3 fields were added later.
| WHERE partition_id IS NULL | ||
| OR min_block_number IS NULL | ||
| OR max_block_number IS NULL | ||
| ORDER BY modification_time DESC |
There was a problem hiding this comment.
what exactly does it 'detect'? Why needed?
| ```sql | ||
| SELECT metric, value | ||
| FROM system.asynchronous_metrics | ||
| WHERE metric IN ('NumberOfDetachedParts', 'NumberOfDetachedByUserParts') |
There was a problem hiding this comment.
this does not add any extra information to above (but can be used on dashboard or for alerting)
| 3. Validate part coverage for "usually safe" reasons (`ignored`, `clone`). | ||
| 4. Drop with `ALTER ... DROP DETACHED ... SETTINGS allow_drop_detached=1`. | ||
|
|
||
| Check replica health first: |
There was a problem hiding this comment.
why writing about that here? it's obvious prerequirement. Like 'you should have your PC on'.
| AND d.reason IN ('ignored', 'clone') | ||
| AND d.min_block_number >= p.min_block_number | ||
| AND d.max_block_number <= p.max_block_number | ||
| ORDER BY d.database, d.table, d.name |
There was a problem hiding this comment.
did someone test it? On different versions?
Code: 46. DB::Exception: Received from localhost:9000. DB::Exception: Unknown function quoteString. Maybe you meant: ['queryString','toString']: While processing database, table, name, reason, concat('ALTER TABLE `', database, '`.`', table, '` DROP DETACHED PART ', quoteString(name), ' SETTINGS allow_drop_detached=1;') AS drop_sql. (UNKNOWN_FUNCTION)
|
|
||
| ### Recovery Recipes | ||
|
|
||
| Attach user-detached parts (`reason = ''`): |
There was a problem hiding this comment.
should it really be 'recovered'? Or it wil lead to data duplication
|
Typical AI slop, makes article worse. |
Closes #161
Summary
This PR updates
content/en/altinity-kb-useful-queries/detached-parts.mdfor correctness with recent ClickHouse versions and adds safer operational guidance.What changed
23.10+as primary behavior (manual detached-part cleanup)22.6-23.9as compatibility note (historical timeout cleanup behavior)system.detached_parts.reason(''vsNULL).ignored|cloneparts,broken-on-start_rename helper).Why
rm -ras default operational path).Notes