Repository navigation
feat: drop and restore replica keeper metadata during horizontal scaling - #415
GrigoryPervakov wants to merge 1 commit into
Conversation
|
Workflow [PR], commit [3b48c09] Summary: ✅ Code ReviewResult: What changed: This PR extends horizontal scaling cleanup to remove table-level Keeper registrations, restores retained-volume replicas before admitting traffic, and adds readiness/status reporting for pending restoration. It also updates ClickHouse query handling and adds integration and end-to-end coverage for replica rejoin scenarios. No new inline findings. The existing unresolved concern about missing Keeper paths causing the batched Investigation: 6/13 rounds, 24 tool calls. |
AI review gate — AI review passedClean review from: Cursor Bugbot. |
48509e4 to
3b48c09
Compare
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 3b48c09. Configure here.
AI review gate — auto-approved
History (latest 5 heads, newest first)
|
Why
On scale-down, the operator dropped only the Replicated database entry of the removed replica, so its table registrations leaked into Keeper. A replica recreated on a fresh volume then failed the database recovery on REPLICA_ALREADY_EXISTS forever, while it was reported in sync and admitted to client traffic without tables. A replica recreated with its old volume stayed read-only because its registrations were gone.
What
SYSTEM DROP DATABASE REPLICA ... FROM SHARD ... WITH TABLES) through a same-shard peer. Removed shards still drop only the database entries.SYSTEM RESTORE DATABASE REPLICAandSYSTEM RESTORE REPLICA. Objects dropped from the cluster meanwhile are skipped and logged, restoring them would recreate them.ReplicaRestorePendingonSchemaInSyncuntil then.conn.Select, match ClickHouse errors by ch-go codes.Note
High Risk
Changes core schema sync, traffic admission, and Keeper metadata lifecycle during scaling—mistakes could strand replicas read-only, leak registrations, or admit traffic before replication is safe.
Overview
Extends scale-down cleanup so removed replicas are deregistered from Replicated databases and their ReplicatedMergeTree tables (
SYSTEM DROP DATABASE REPLICA ... WITH TABLESvia a shard peer), allowing replica names to be reused on scale-up instead of leaving stale Keeper entries.On scale-up, joining replicas with a retained volume are re-registered through
SYSTEM RESTORE DATABASE REPLICA/SYSTEM RESTORE REPLICA, with cleanup of leaked table registrations from prior incarnations before database creation. Client traffic stays gated until restore completes;SchemaInSynccan reportReplicaRestorePendinguntil then.Refactors ClickHouse command I/O toward
conn.Selectand ch-go error codes, adds a peer filter so maintenance runs on initialized replicas, and expands integration/e2e coverage for rejoin after scale-down with and without disk.Reviewed by Cursor Bugbot for commit 3b48c09. Bugbot is set up for automated code reviews on this repo. Configure here.
Workflow [PR]