Skip to content

Commit 67c83e9

Browse files
authored
Merge pull request vitessio#3920 from jvaidya/fix_reparent_order
During reparent, first stop queries to vttablet, then set the db to RO
2 parents 4f2e0cf + f4a1bf1 commit 67c83e9

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

go/vt/vttablet/tabletmanager/rpc_replication.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -298,13 +298,7 @@ func (agent *ActionAgent) DemoteMaster(ctx context.Context) (string, error) {
298298
}
299299
}()
300300

301-
// Set the server read-only. Note all active connections are not
302-
// affected.
303-
if err := agent.MysqlDaemon.SetReadOnly(true); err != nil {
304-
return "", err
305-
}
306-
307-
// Now disallow queries, to make sure nobody is writing to the
301+
// First, disallow queries, to make sure nobody is writing to the
308302
// database.
309303
tablet := agent.Tablet()
310304
// We don't care if the QueryService state actually changed because we'll
@@ -314,6 +308,12 @@ func (agent *ActionAgent) DemoteMaster(ctx context.Context) (string, error) {
314308
return "", fmt.Errorf("SetServingType(serving=false) failed: %v", err)
315309
}
316310

311+
// Now, set the server read-only. Note all active connections are not
312+
// affected.
313+
if err := agent.MysqlDaemon.SetReadOnly(true); err != nil {
314+
return "", err
315+
}
316+
317317
// If using semi-sync, we need to disable master-side.
318318
if err := agent.fixSemiSync(topodatapb.TabletType_REPLICA); err != nil {
319319
return "", err

0 commit comments

Comments
 (0)