-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
do not demote a new primary after backup completion #12856
Changes from all commits
94b9586
af9444b
5b59d05
289fb7a
1a119a9
60b1d0d
c9917cc
9a7ca0c
90ea238
ffe41c4
d5bc717
2bb78e5
180f629
db4c441
a0bf584
9ec0e1d
45ff059
3802300
2e55a26
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -489,20 +489,7 @@ func (s *VtctldServer) backupTablet(ctx context.Context, tablet *topodatapb.Tabl | |
logger.Errorf("failed to send stream response %+v: %v", resp, err) | ||
} | ||
case io.EOF: | ||
// Do not do anything for primary tablets and when active reparenting is disabled | ||
if mysqlctl.DisableActiveReparents || tablet.Type == topodatapb.TabletType_PRIMARY { | ||
return nil | ||
} | ||
|
||
// Otherwise we find the correct primary tablet and set the replication source, | ||
// since the primary could have changed while we executed the backup which can | ||
// also affect whether we want to send semi sync acks or not. | ||
tabletInfo, err := s.ts.GetTablet(ctx, tablet.Alias) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
return reparentutil.SetReplicationSource(ctx, s.ts, s.tmc, tabletInfo.Tablet) | ||
return nil | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. a question here: if there is a reparent operation and some other replica is promoted to primary, will this replica still point to the correct new primary? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, can we add a test for that as well, if it does not exist already? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It will, as I have ported this exact logic to rpc_backup, with the addition of checking to not demote yourself if you're the primary |
||
default: | ||
return err | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The way I see it there can be a race condition. The current implementation assumed both
Backup
andPlannedReparentShard
are heavyweight enough (read: runtimes are long enough in both), that if we call them roughly concurrently, that means they'll execute concurrently to some extent.But it does not enforce the situation where the backup has started, and then the reparent began. It could be the other way around.
I don't have a good suggestion here and I don't see a clean solution. But still its worth pointing out this test could either become flaky, or not always test what it's meant to test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I thought the same thing, but the test as it stands now will not be flaky, but it won't test the correct thing everytime either. When we introduce some bug, then the test would become flaky.
I thought of ways to make the test better, but other than inserting a million records to lengthen the backup process, I don't know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, I spent an extraordinary amount of time trying to find ways to make this be more accurate, but nothing reasonable came to mind ):