Fix PlannedReparentShard unit tests#5274
Merged
enisoc merged 2 commits intovitessio:reparent-refactorfrom Oct 8, 2019
Merged
Conversation
enisoc
reviewed
Oct 8, 2019
go/vt/wrangler/reparent.go
Outdated
Member
There was a problem hiding this comment.
Was this unused? I don't see remoteCtx used below either, but just verifying the reason for removal.
Collaborator
Author
There was a problem hiding this comment.
Yes, it was unused. Not sure when references to it were removed.
Collaborator
Author
There was a problem hiding this comment.
It turns out that when code was moved around in #5226, it led to us calling PromoteSlave with an already used context, effectively reducing the timeout to some indeterminate value, and also partly undoing the changes in #4850. However, this is all still on the feature branch, so no harm done. I have added the necessary lines of code to get it back to the way it is supposed to be.
We should not explicitly call SetMaster on the old master because PromoteSlaveWhenCaughtUp sets newMaster's tablet type to MASTER, which leads ShardSync to update the Shard record, which notifies the oldMaster's ShardSync, which calls SetMaster Signed-off-by: deepthi <deepthi@planetscale.com>
feae549 to
3c59ff2
Compare
Signed-off-by: deepthi <deepthi@planetscale.com>
enisoc
approved these changes
Oct 8, 2019
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.
The expected result needed to be updated (because we now call SetMaster twice) + a tiny fix in SetMaster.
I went ahead and removed the block of code in PRS that was updating the shard's MasterAlias, even though with it in place, PRS still works as expected. IOW, ShardSync is working idempotently, as desired.
It also seems like SetMaster already works idempotently as well, at least in the unit tests.
Nice work @enisoc!
Signed-off-by: deepthi deepthi@planetscale.com