fixes: deadlock when swap waitForFollowersToCatchUp#788
Merged
mattisonchao merged 12 commits intomainfrom Oct 25, 2025
Merged
Conversation
waitForFollowersToCatchUp
merlimat
reviewed
Oct 25, 2025
| "oxia": "election-fencing-failed-followers", | ||
| "shard": fmt.Sprintf("%d", s.shard), | ||
| }, func() { | ||
| s.keepFencingFailedFollowers(s.shardMetadata.Term, s.shardMetadata.Ensemble, s.shardMetadata.Leader, followers) |
Collaborator
There was a problem hiding this comment.
We are reading the metadata from the go-routine, outside of its mutex. We can make a clone before or acquire the mutex here
| for _, sa := range s.shardMetadata.Ensemble { | ||
| if sa == *s.shardMetadata.Leader { | ||
| group := sync.WaitGroup{} | ||
| defer group.Wait() |
Collaborator
There was a problem hiding this comment.
What's the reason for waiting at the end of the method, if we are not going to return any error?
Member
Author
There was a problem hiding this comment.
It's useless so far. Let me remove it. :)
3142bc3 to
ac44a30
Compare
Member
Author
|
rely on the #790 |
merlimat
approved these changes
Oct 25, 2025
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.
Motivation
fixes: #845
In the current implementation. The shard controller might be stuck in the
swapmethod due towaitForFollowersToCatchUp.The root cause is the swap waiting for
waitForFollowersToCatchUp, but the new follower needs to wait fornewTermAndAddFollowerOpto be fenced and added as a follower.Modification
waitForFollowersToCatchUpoperation out ofshardControllermain loop.