Skip to content

Fix PlannedReparentShard unit tests#5274

Merged
enisoc merged 2 commits intovitessio:reparent-refactorfrom
planetscale:ds-fix-prs-unit-tests
Oct 8, 2019
Merged

Fix PlannedReparentShard unit tests#5274
enisoc merged 2 commits intovitessio:reparent-refactorfrom
planetscale:ds-fix-prs-unit-tests

Conversation

@deepthi
Copy link
Copy Markdown
Collaborator

@deepthi deepthi commented Oct 8, 2019

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

@deepthi deepthi requested a review from sougou as a code owner October 8, 2019 03:14
@deepthi deepthi requested a review from enisoc October 8, 2019 03:14
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this unused? I don't see remoteCtx used below either, but just verifying the reason for removal.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it was unused. Not sure when references to it were removed.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@deepthi deepthi force-pushed the ds-fix-prs-unit-tests branch from feae549 to 3c59ff2 Compare October 8, 2019 18:41
Signed-off-by: deepthi <deepthi@planetscale.com>
@enisoc enisoc merged commit 1c7f16c into vitessio:reparent-refactor Oct 8, 2019
@enisoc enisoc deleted the ds-fix-prs-unit-tests branch October 8, 2019 21:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants