Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vttablet/tabletmanager: Update the tablet_externally_reparented_timestamp every time the TabletExternallyReparented RPC is called. #3009

Merged
merged 1 commit into from
Jul 25, 2017

Conversation

michael-berlin
Copy link
Contributor

This was always the original intention, but until now we skipped setting the timestamp if the tablet is already the MASTER. See the change in rpc_external_reparent.go.

I've wrote a minimal unit test to verify the new behavior.

Additionally, I had to change the vtgate buffer code because it was dependent on the old behavior to detect a corner case when it should not start to buffer. That's when it saw the end of a reparent before an error due to the same reparent. In order to better test the new code, I had to change the unit tests to use a fake of time.Now().

Copy link
Contributor

@alainjobart alainjobart left a comment

Choose a reason for hiding this comment

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

This change looks good.

I'm also wondering if we should set TER time at this point (to time.Now()): https://github.com/youtube/vitess/blob/master/go/vt/vttablet/tabletmanager/init_tablet.go#L109
so that when the master tablet is restarted, and we realize it's the master, we're good right away, and don't have to wait for another TER. What do you think? (Can be a different PR).

@michael-berlin
Copy link
Contributor Author

Yep, I'll do that change in a separate PR.

vtgate_buffer e2e test is failing with the new code. Looking into it now.

…tamp every time the TabletExternallyReparented RPC is called.

This was always the original intention, but until now we skipped setting the timestamp if the tablet is already the MASTER. See the change in rpc_external_reparent.go.

I've wrote a minimal unit test to verify the new behavior.

Additionally, I had to change the vtgate buffer code because it was dependent on the old behavior to detect a corner case when it should not start to buffer. That's when it saw the end of a reparent *before* an error due to the same reparent. In order to better test the new code, I had to change the unit tests to use a fake of time.Now().

BUG=63883255
@michael-berlin
Copy link
Contributor Author

The failed e2e test covered a problem in the change: if currentMaster is nil, we should not set "lastReparent" and instead wait for the next time when currentMaster != nil and we actually see a change of the master.

I fixed the unit test to cover this case by adding an initial StatsUpdate() call in the TestBuffer method.

Tests are passing now.

@michael-berlin michael-berlin merged commit 87e0a19 into vitessio:master Jul 25, 2017
@michael-berlin michael-berlin deleted the ter_no_skip branch July 25, 2017 23:58
frouioui pushed a commit to planetscale/vitess that referenced this pull request Mar 26, 2024
…oroutine leakage (vitessio#3009)

* cherry pick of 13824

* Fix conflict

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

---------

Signed-off-by: Rohit Nayak <rohit@planetscale.com>
Co-authored-by: Rohit Nayak <rohit@planetscale.com>
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.

3 participants