8000 fix(chi): run drop replica on peer host when deleting replica 0 (fixes #2096) by Tyagiquamar · Pull Request #2112 · Altinity/clickhouse-operator · GitHub
[go: up one dir, main page]

Skip to content

fix(chi): run drop replica on peer host when deleting replica 0 (fixes #2096) - #2112

Open
Tyagiquamar wants to merge 1 commit into
Altinity:masterfrom
Tyagiquamar:fix/lost-volume-drop-peer-replica-2096
Open

Tyagiquamar wants to merge 1 commit into
Altinity:masterfrom
Tyagiquamar:fix/lost-volume-drop-peer-replica-2096

Conversation

@Tyagiquamar
@Tyagiquamar Tyagiquamar commented Oct 21, 2026 •
Copy link
Copy Markdown

Summary

Deleting replica 0 runs SYSTEM DROP REPLICA on a peer replica in the same shard, so ZooKeeper metadata is removed even when the replica being deleted cannot serve the statement.

Root cause

The drop always ran on the shard's first host. When that first host was the one being deleted, it was often unavailable or had an empty volume, and the statement never reached a replica that still had the table definitions.

Solution

getHostToRunDropZKReplica picks another host in the shard, and falls back to the first host only when the shard has a single replica.

Test plan

TestGetHostToRunDropZKReplica covers a nil host, a host with no shard, dropping the first replica of a two-replica shard, and the single-replica fallback.

Fixes #2096

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lost-volume recovery drops nothing when the lost host is the shard's first host (provisioner: Operator)

1 participant

0