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. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 48509e4. Configure here.
AI review gate — Cursor Bugbot found issues
Unresolved findings (1): What to do:
Re-run the gate with “Re-run jobs” after an approval or a finished review. A push re-runs it automatically. |
48509e4 to
3b48c09
Compare

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 reconciliation around scale-up/down, Keeper metadata DDL, and when replicas receive client traffic—mis-steps could affect replication consistency or block scaling until manual Keeper cleanup.
Overview
Fixes horizontal scaling so Keeper metadata for removed replicas is cleaned up at both database and table level, and joining replicas can re-register instead of wedging on stale znodes or serving traffic half-ready.
Scale-down now drops removed replicas via
SYSTEM DROP DATABASE REPLICA ... FROM SHARD ... WITH TABLESon a same-shard peer (removed shards still drop database entries only). Scale-up / rejoin proactively drops leaked table registrations, thenRestoreReplicarunsSYSTEM RESTORE DATABASE REPLICA/SYSTEM RESTORE REPLICAafter database sync, skipping objects dropped from the cluster while the replica was away.Client traffic admission now requires restore to succeed (not just database sync), and
SchemaInSynccan reportReplicaRestorePendinguntil Keeper re-registration and schema catch-up finish. Docs and conditions text reflect this.Implementation also switches many commander queries to
conn.Select, promotesch-gofor error codes, adds Keeper introspection helpers, and extends integration/e2e tests for rejoin with and without retained PVC data.Reviewed by Cursor Bugbot for commit 3b48c09. Bugbot is set up for automated code reviews on this repo. Configure here.
Workflow [PR]