Repository navigation
fix(chi): run drop replica on peer host when deleting replica 0 (fixes #2096) - #2112
Open
Tyagiquamar wants to merge 1 commit into
Open
Tyagiquamar wants to merge 1 commit into
Tyagiquamar wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Deleting replica 0 runs
SYSTEM DROP REPLICAon 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
getHostToRunDropZKReplicapicks another host in the shard, and falls back to the first host only when the shard has a single replica.Test plan
TestGetHostToRunDropZKReplicacovers a nil host, a host with no shard, dropping the first replica of a two-replica shard, and the single-replica fallback.Fixes #2096