v.23.10Improvement

ClickHouse Enhances ReplicatedMergeTree Startup by Restoring Closest Ancestor Parts

During ReplicatedMergeTree tables startup clickhouse server checks set of parts for unexpected parts (exists locally, but not in zookeeper). All unexpected parts move to detached directory and instead of them server tries to restore some ancestor (covered) parts. Now server tries to restore closest ancestors instead of random covered parts. #55645 (alesapin).
Improved handling of unexpected parts during ReplicatedMergeTree table startup by restoring the closest ancestor parts instead of random covered parts.

Why it matters

When ReplicatedMergeTree tables start, the server checks for unexpected parts (parts present locally but missing in ZooKeeper). Previously, the server detached these unexpected parts and attempted to restore some random covered ancestor parts, which could lead to inefficiencies or slower recovery. This feature enhances data consistency and startup reliability by ensuring that the server restores the closest ancestor parts, optimizing the recovery process.

How to use it

This improvement is applied automatically during the startup of ReplicatedMergeTree tables. Users do not need to enable or configure anything manually to benefit from this change.