Skip to content

Commit d8c5160

Browse files
Fix initialization code to also stop replication to prevent crash (vitessio#12534) (vitessio#12692)
* feat: fix initialization code to also stop replication * feat: fix tests expectations * feat: fix wrangler tests --------- Signed-off-by: Manan Gupta <manan@planetscale.com>
1 parent f56e64a commit d8c5160

File tree

12 files changed

+83
-37
lines changed

12 files changed

+83
-37
lines changed

go/test/endtoend/reparent/newfeaturetest/reparent_test.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,3 +169,16 @@ func rowNumberFromPosition(pos string) int {
169169
rowNum, _ := strconv.Atoi(rowNumStr)
170170
return rowNum
171171
}
172+
173+
// TestTabletRestart tests that a running tablet can be restarted and everything is still fine
174+
func TestTabletRestart(t *testing.T) {
175+
defer cluster.PanicHandler(t)
176+
clusterInstance := utils.SetupReparentCluster(t, "semi_sync")
177+
defer utils.TeardownCluster(clusterInstance)
178+
tablets := clusterInstance.Keyspaces[0].Shards[0].Vttablets
179+
180+
utils.StopTablet(t, tablets[1], false)
181+
tablets[1].VttabletProcess.ServingStatus = "SERVING"
182+
err := tablets[1].VttabletProcess.Setup()
183+
require.NoError(t, err)
184+
}

go/vt/vtctl/grpcvtctldserver/endtoend/init_shard_primary_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ func TestInitShardPrimary(t *testing.T) {
6363

6464
tablet2.FakeMysqlDaemon.ExpectedExecuteSuperQueryList = []string{
6565
// These come from tablet startup
66+
"STOP SLAVE",
6667
"RESET SLAVE ALL",
6768
"FAKE SET MASTER",
6869
"START SLAVE",
@@ -76,6 +77,7 @@ func TestInitShardPrimary(t *testing.T) {
7677
tablet2.FakeMysqlDaemon.SetReplicationSourceInputs = append(tablet2.FakeMysqlDaemon.SetReplicationSourceInputs, fmt.Sprintf("%v:%v", tablet1.Tablet.Hostname, tablet1.Tablet.MysqlPort))
7778

7879
tablet3.FakeMysqlDaemon.ExpectedExecuteSuperQueryList = []string{
80+
"STOP SLAVE",
7981
"RESET SLAVE ALL",
8082
"FAKE SET MASTER",
8183
"START SLAVE",

go/vt/vttablet/tabletmanager/tm_init.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,7 @@ func (tm *TabletManager) initializeReplication(ctx context.Context, tabletType t
919919
log.Warningf("primary tablet in the shard record doesn't have mysql hostname specified. probably because that tablet shutdown.")
920920
return nil, nil
921921
}
922-
if err := tm.MysqlDaemon.SetReplicationSource(ctx, currentPrimary.Tablet.MysqlHostname, int(currentPrimary.Tablet.MysqlPort), false /* stopReplicationBefore */, true /* startReplicationAfter */); err != nil {
922+
if err := tm.MysqlDaemon.SetReplicationSource(ctx, currentPrimary.Tablet.MysqlHostname, int(currentPrimary.Tablet.MysqlPort), true /* stopReplicationBefore */, true /* startReplicationAfter */); err != nil {
923923
return nil, vterrors.Wrap(err, "MysqlDaemon.SetReplicationSource failed")
924924
}
925925

go/vt/vttablet/tabletmanager/tm_init_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,7 @@ func TestCheckPrimaryShip(t *testing.T) {
382382
fakeMysql := tm.MysqlDaemon.(*fakemysqldaemon.FakeMysqlDaemon)
383383
fakeMysql.SetReplicationSourceInputs = append(fakeMysql.SetReplicationSourceInputs, fmt.Sprintf("%v:%v", otherTablet.MysqlHostname, otherTablet.MysqlPort))
384384
fakeMysql.ExpectedExecuteSuperQueryList = []string{
385+
"STOP SLAVE",
385386
"RESET SLAVE ALL",
386387
"FAKE SET MASTER",
387388
"START SLAVE",

go/vt/wrangler/testlib/backup_test.go

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,8 @@ func testBackupRestore(t *testing.T, cDetails *compressionDetails) error {
182182
},
183183
}
184184
sourceTablet.FakeMysqlDaemon.ExpectedExecuteSuperQueryList = []string{
185-
// These 3 statements come from tablet startup
185+
// These 4 statements come from tablet startup
186+
"STOP SLAVE",
186187
"RESET SLAVE ALL",
187188
"FAKE SET MASTER",
188189
"START SLAVE",
@@ -231,13 +232,15 @@ func testBackupRestore(t *testing.T, cDetails *compressionDetails) error {
231232
},
232233
}
233234
destTablet.FakeMysqlDaemon.ExpectedExecuteSuperQueryList = []string{
234-
// These 3 statements come from tablet startup
235+
// These 4 statements come from tablet startup
236+
"STOP SLAVE",
235237
"RESET SLAVE ALL",
236238
"FAKE SET MASTER",
237239
"START SLAVE",
238240
"STOP SLAVE",
239241
"RESET SLAVE ALL",
240242
"FAKE SET SLAVE POSITION",
243+
"STOP SLAVE",
241244
"RESET SLAVE ALL",
242245
"FAKE SET MASTER",
243246
"START SLAVE",
@@ -419,7 +422,8 @@ func TestBackupRestoreLagged(t *testing.T) {
419422
}
420423
sourceTablet.FakeMysqlDaemon.SetReplicationSourceInputs = []string{fmt.Sprintf("%s:%d", primary.Tablet.MysqlHostname, primary.Tablet.MysqlPort)}
421424
sourceTablet.FakeMysqlDaemon.ExpectedExecuteSuperQueryList = []string{
422-
// These 3 statements come from tablet startup
425+
// These 4 statements come from tablet startup
426+
"STOP SLAVE",
423427
"RESET SLAVE ALL",
424428
"FAKE SET MASTER",
425429
"START SLAVE",
@@ -489,13 +493,15 @@ func TestBackupRestoreLagged(t *testing.T) {
489493
},
490494
}
491495
destTablet.FakeMysqlDaemon.ExpectedExecuteSuperQueryList = []string{
492-
// These 3 statements come from tablet startup
496+
// These 4 statements come from tablet startup
497+
"STOP SLAVE",
493498
"RESET SLAVE ALL",
494499
"FAKE SET MASTER",
495500
"START SLAVE",
496501
"STOP SLAVE",
497502
"RESET SLAVE ALL",
498503
"FAKE SET SLAVE POSITION",
504+
"STOP SLAVE",
499505
"RESET SLAVE ALL",
500506
"FAKE SET MASTER",
501507
"START SLAVE",
@@ -642,7 +648,8 @@ func TestRestoreUnreachablePrimary(t *testing.T) {
642648
}
643649
sourceTablet.FakeMysqlDaemon.SetReplicationSourceInputs = []string{fmt.Sprintf("%s:%d", primary.Tablet.MysqlHostname, primary.Tablet.MysqlPort)}
644650
sourceTablet.FakeMysqlDaemon.ExpectedExecuteSuperQueryList = []string{
645-
// These 3 statements come from tablet startup
651+
// These 4 statements come from tablet startup
652+
"STOP SLAVE",
646653
"RESET SLAVE ALL",
647654
"FAKE SET MASTER",
648655
"START SLAVE",
@@ -684,13 +691,15 @@ func TestRestoreUnreachablePrimary(t *testing.T) {
684691
},
685692
}
686693
destTablet.FakeMysqlDaemon.ExpectedExecuteSuperQueryList = []string{
687-
// These 3 statements come from tablet startup
694+
// These 4 statements come from tablet startup
695+
"STOP SLAVE",
688696
"RESET SLAVE ALL",
689697
"FAKE SET MASTER",
690698
"START SLAVE",
691699
"STOP SLAVE",
692700
"RESET SLAVE ALL",
693701
"FAKE SET SLAVE POSITION",
702+
"STOP SLAVE",
694703
"RESET SLAVE ALL",
695704
"FAKE SET MASTER",
696705
"START SLAVE",

go/vt/wrangler/testlib/copy_schema_shard_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,13 @@ limitations under the License.
1717
package testlib
1818

1919
import (
20+
"context"
2021
"fmt"
2122
"testing"
2223
"time"
2324

2425
"vitess.io/vitess/go/vt/discovery"
2526

26-
"context"
27-
2827
"vitess.io/vitess/go/mysql/fakesqldb"
2928
"vitess.io/vitess/go/sqltypes"
3029
"vitess.io/vitess/go/vt/logutil"
@@ -74,7 +73,8 @@ func copySchema(t *testing.T, useShardAsSource bool) {
7473
sourceRdonly := NewFakeTablet(t, wr, "cell1", 1,
7574
topodatapb.TabletType_RDONLY, sourceRdonlyDb, TabletKeyspaceShard(t, "ks", "-80"))
7675
sourceRdonly.FakeMysqlDaemon.ExpectedExecuteSuperQueryList = []string{
77-
// These 3 statements come from tablet startup
76+
// These 4 statements come from tablet startup
77+
"STOP SLAVE",
7878
"RESET SLAVE ALL",
7979
"FAKE SET MASTER",
8080
"START SLAVE",

go/vt/wrangler/testlib/emergency_reparent_shard_test.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@ func TestEmergencyReparentShard(t *testing.T) {
137137
goodReplica1.FakeMysqlDaemon.WaitPrimaryPositions = append(goodReplica1.FakeMysqlDaemon.WaitPrimaryPositions, goodReplica1.FakeMysqlDaemon.CurrentSourceFilePosition)
138138
goodReplica1.FakeMysqlDaemon.SetReplicationSourceInputs = append(goodReplica1.FakeMysqlDaemon.SetReplicationSourceInputs, topoproto.MysqlAddr(newPrimary.Tablet), topoproto.MysqlAddr(oldPrimary.Tablet))
139139
goodReplica1.FakeMysqlDaemon.ExpectedExecuteSuperQueryList = []string{
140-
// These 3 statements come from tablet startup
140+
// These 4 statements come from tablet startup
141+
"STOP SLAVE",
141142
"RESET SLAVE ALL",
142143
"FAKE SET MASTER",
143144
"START SLAVE",
@@ -169,7 +170,8 @@ func TestEmergencyReparentShard(t *testing.T) {
169170
goodReplica2.FakeMysqlDaemon.WaitPrimaryPositions = append(goodReplica2.FakeMysqlDaemon.WaitPrimaryPositions, goodReplica2.FakeMysqlDaemon.CurrentSourceFilePosition)
170171
goodReplica2.FakeMysqlDaemon.SetReplicationSourceInputs = append(goodReplica2.FakeMysqlDaemon.SetReplicationSourceInputs, topoproto.MysqlAddr(newPrimary.Tablet), topoproto.MysqlAddr(oldPrimary.Tablet))
171172
goodReplica2.FakeMysqlDaemon.ExpectedExecuteSuperQueryList = []string{
172-
// These 3 statements come from tablet startup
173+
// These 4 statements come from tablet startup
174+
"STOP SLAVE",
173175
"RESET SLAVE ALL",
174176
"FAKE SET MASTER",
175177
"START SLAVE",
@@ -271,7 +273,8 @@ func TestEmergencyReparentShardPrimaryElectNotBest(t *testing.T) {
271273
moreAdvancedReplica.FakeMysqlDaemon.WaitPrimaryPositions = append(moreAdvancedReplica.FakeMysqlDaemon.WaitPrimaryPositions, moreAdvancedReplica.FakeMysqlDaemon.CurrentSourceFilePosition)
272274
newPrimary.FakeMysqlDaemon.WaitPrimaryPositions = append(newPrimary.FakeMysqlDaemon.WaitPrimaryPositions, moreAdvancedReplica.FakeMysqlDaemon.CurrentPrimaryPosition)
273275
moreAdvancedReplica.FakeMysqlDaemon.ExpectedExecuteSuperQueryList = []string{
274-
// These 3 statements come from tablet startup
276+
// These 4 statements come from tablet startup
277+
"STOP SLAVE",
275278
"RESET SLAVE ALL",
276279
"FAKE SET MASTER",
277280
"START SLAVE",

go/vt/wrangler/testlib/external_reparent_test.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,13 @@ limitations under the License.
1717
package testlib
1818

1919
import (
20+
"context"
2021
"flag"
2122
"testing"
2223
"time"
2324

2425
"vitess.io/vitess/go/vt/discovery"
2526

26-
"context"
27-
2827
"github.com/stretchr/testify/assert"
2928

3029
"vitess.io/vitess/go/vt/logutil"
@@ -263,7 +262,8 @@ func TestTabletExternallyReparentedWithDifferentMysqlPort(t *testing.T) {
263262
// TabletActionReplicaWasRestarted and point to the new mysql port
264263
goodReplica.FakeMysqlDaemon.SetReplicationSourceInputs = append(goodReplica.FakeMysqlDaemon.SetReplicationSourceInputs, topoproto.MysqlAddr(oldPrimary.Tablet))
265264
goodReplica.FakeMysqlDaemon.ExpectedExecuteSuperQueryList = []string{
266-
// These 3 statements come from tablet startup
265+
// These 4 statements come from tablet startup
266+
"STOP SLAVE",
267267
"RESET SLAVE ALL",
268268
"FAKE SET MASTER",
269269
"START SLAVE",
@@ -352,7 +352,8 @@ func TestTabletExternallyReparentedContinueOnUnexpectedPrimary(t *testing.T) {
352352
// TabletActionReplicaWasRestarted and point to a bad host
353353
goodReplica.FakeMysqlDaemon.SetReplicationSourceInputs = append(goodReplica.FakeMysqlDaemon.SetReplicationSourceInputs, topoproto.MysqlAddr(oldPrimary.Tablet))
354354
goodReplica.FakeMysqlDaemon.ExpectedExecuteSuperQueryList = []string{
355-
// These 3 statements come from tablet startup
355+
// These 4 statements come from tablet startup
356+
"STOP SLAVE",
356357
"RESET SLAVE ALL",
357358
"FAKE SET MASTER",
358359
"START SLAVE",
@@ -437,7 +438,8 @@ func TestTabletExternallyReparentedRerun(t *testing.T) {
437438
// On the good replica, we will respond to
438439
// TabletActionReplicaWasRestarted.
439440
goodReplica.FakeMysqlDaemon.ExpectedExecuteSuperQueryList = []string{
440-
// These 3 statements come from tablet startup
441+
// These 4 statements come from tablet startup
442+
"STOP SLAVE",
441443
"RESET SLAVE ALL",
442444
"FAKE SET MASTER",
443445
"START SLAVE",

go/vt/wrangler/testlib/permissions_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,14 @@ limitations under the License.
1717
package testlib
1818

1919
import (
20+
"context"
2021
"strings"
2122
"testing"
2223
"time"
2324

2425
"vitess.io/vitess/go/vt/discovery"
2526
"vitess.io/vitess/go/vt/topo/topoproto"
2627

27-
"context"
28-
2928
"vitess.io/vitess/go/sqltypes"
3029
"vitess.io/vitess/go/vt/logutil"
3130
"vitess.io/vitess/go/vt/topo"
@@ -564,7 +563,8 @@ func TestPermissions(t *testing.T) {
564563
}
565564
replica.FakeMysqlDaemon.SetReplicationSourceInputs = append(replica.FakeMysqlDaemon.SetReplicationSourceInputs, topoproto.MysqlAddr(primary.Tablet))
566565
replica.FakeMysqlDaemon.ExpectedExecuteSuperQueryList = []string{
567-
// These 3 statements come from tablet startup
566+
// These 4 statements come from tablet startup
567+
"STOP SLAVE",
568568
"RESET SLAVE ALL",
569569
"FAKE SET MASTER",
570570
"START SLAVE",

go/vt/wrangler/testlib/planned_reparent_shard_test.go

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ func TestPlannedReparentShardNoPrimaryProvided(t *testing.T) {
117117
goodReplica1.FakeMysqlDaemon.Replicating = true
118118
goodReplica1.FakeMysqlDaemon.SetReplicationSourceInputs = append(goodReplica1.FakeMysqlDaemon.SetReplicationSourceInputs, topoproto.MysqlAddr(newPrimary.Tablet), topoproto.MysqlAddr(oldPrimary.Tablet))
119119
goodReplica1.FakeMysqlDaemon.ExpectedExecuteSuperQueryList = []string{
120-
// These 3 statements come from tablet startup
120+
// These 4 statements come from tablet startup
121+
"STOP SLAVE",
121122
"RESET SLAVE ALL",
122123
"FAKE SET MASTER",
123124
"START SLAVE",
@@ -236,7 +237,8 @@ func TestPlannedReparentShardNoError(t *testing.T) {
236237
goodReplica1.FakeMysqlDaemon.Replicating = true
237238
goodReplica1.FakeMysqlDaemon.SetReplicationSourceInputs = append(goodReplica1.FakeMysqlDaemon.SetReplicationSourceInputs, topoproto.MysqlAddr(newPrimary.Tablet), topoproto.MysqlAddr(oldPrimary.Tablet))
238239
goodReplica1.FakeMysqlDaemon.ExpectedExecuteSuperQueryList = []string{
239-
// These 3 statements come from tablet startup
240+
// These 4 statements come from tablet startup
241+
"STOP SLAVE",
240242
"RESET SLAVE ALL",
241243
"FAKE SET MASTER",
242244
"START SLAVE",
@@ -252,7 +254,8 @@ func TestPlannedReparentShardNoError(t *testing.T) {
252254
goodReplica2.FakeMysqlDaemon.ReadOnly = true
253255
goodReplica2.FakeMysqlDaemon.SetReplicationSourceInputs = append(goodReplica2.FakeMysqlDaemon.SetReplicationSourceInputs, topoproto.MysqlAddr(newPrimary.Tablet), topoproto.MysqlAddr(oldPrimary.Tablet))
254256
goodReplica2.FakeMysqlDaemon.ExpectedExecuteSuperQueryList = []string{
255-
// These 3 statements come from tablet startup
257+
// These 4 statements come from tablet startup
258+
"STOP SLAVE",
256259
"RESET SLAVE ALL",
257260
"FAKE SET MASTER",
258261
"START SLAVE",
@@ -460,7 +463,8 @@ func TestPlannedReparentShardWaitForPositionFail(t *testing.T) {
460463
goodReplica1.FakeMysqlDaemon.Replicating = true
461464
goodReplica1.FakeMysqlDaemon.SetReplicationSourceInputs = append(goodReplica1.FakeMysqlDaemon.SetReplicationSourceInputs, topoproto.MysqlAddr(newPrimary.Tablet), topoproto.MysqlAddr(oldPrimary.Tablet))
462465
goodReplica1.FakeMysqlDaemon.ExpectedExecuteSuperQueryList = []string{
463-
// These 3 statements come from tablet startup
466+
// These 4 statements come from tablet startup
467+
"STOP SLAVE",
464468
"RESET SLAVE ALL",
465469
"FAKE SET MASTER",
466470
"START SLAVE",
@@ -476,7 +480,8 @@ func TestPlannedReparentShardWaitForPositionFail(t *testing.T) {
476480
goodReplica2.FakeMysqlDaemon.ReadOnly = true
477481
goodReplica2.FakeMysqlDaemon.SetReplicationSourceInputs = append(goodReplica2.FakeMysqlDaemon.SetReplicationSourceInputs, topoproto.MysqlAddr(newPrimary.Tablet), topoproto.MysqlAddr(oldPrimary.Tablet))
478482
goodReplica2.FakeMysqlDaemon.ExpectedExecuteSuperQueryList = []string{
479-
// These 3 statements come from tablet startup
483+
// These 4 statements come from tablet startup
484+
"STOP SLAVE",
480485
"RESET SLAVE ALL",
481486
"FAKE SET MASTER",
482487
"START SLAVE",
@@ -573,7 +578,8 @@ func TestPlannedReparentShardWaitForPositionTimeout(t *testing.T) {
573578
goodReplica1.FakeMysqlDaemon.Replicating = true
574579
goodReplica1.FakeMysqlDaemon.SetReplicationSourceInputs = append(goodReplica1.FakeMysqlDaemon.SetReplicationSourceInputs, topoproto.MysqlAddr(newPrimary.Tablet), topoproto.MysqlAddr(oldPrimary.Tablet))
575580
goodReplica1.FakeMysqlDaemon.ExpectedExecuteSuperQueryList = []string{
576-
// These 3 statements come from tablet startup
581+
// These 4 statements come from tablet startup
582+
"STOP SLAVE",
577583
"RESET SLAVE ALL",
578584
"FAKE SET MASTER",
579585
"START SLAVE",
@@ -589,7 +595,8 @@ func TestPlannedReparentShardWaitForPositionTimeout(t *testing.T) {
589595
goodReplica2.FakeMysqlDaemon.ReadOnly = true
590596
goodReplica2.FakeMysqlDaemon.SetReplicationSourceInputs = append(goodReplica2.FakeMysqlDaemon.SetReplicationSourceInputs, topoproto.MysqlAddr(newPrimary.Tablet), topoproto.MysqlAddr(oldPrimary.Tablet))
591597
goodReplica2.FakeMysqlDaemon.ExpectedExecuteSuperQueryList = []string{
592-
// These 3 statements come from tablet startup
598+
// These 4 statements come from tablet startup
599+
"STOP SLAVE",
593600
"RESET SLAVE ALL",
594601
"FAKE SET MASTER",
595602
"START SLAVE",
@@ -654,7 +661,8 @@ func TestPlannedReparentShardRelayLogError(t *testing.T) {
654661
goodReplica1.FakeMysqlDaemon.Replicating = true
655662
goodReplica1.FakeMysqlDaemon.SetReplicationSourceInputs = append(goodReplica1.FakeMysqlDaemon.SetReplicationSourceInputs, topoproto.MysqlAddr(primary.Tablet))
656663
goodReplica1.FakeMysqlDaemon.ExpectedExecuteSuperQueryList = []string{
657-
// These 3 statements come from tablet startup
664+
// These 4 statements come from tablet startup
665+
"STOP SLAVE",
658666
"RESET SLAVE ALL",
659667
"FAKE SET MASTER",
660668
"START SLAVE",
@@ -739,7 +747,8 @@ func TestPlannedReparentShardRelayLogErrorStartReplication(t *testing.T) {
739747
goodReplica1.FakeMysqlDaemon.CurrentSourcePort = int(primary.Tablet.MysqlPort)
740748
goodReplica1.FakeMysqlDaemon.ExpectedExecuteSuperQueryList = []string{
741749
// simulate error that will trigger a call to RestartReplication
742-
// These 3 statements come from tablet startup
750+
// These 4 statements come from tablet startup
751+
"STOP SLAVE",
743752
"RESET SLAVE ALL",
744753
"FAKE SET MASTER",
745754
"START SLAVE",
@@ -852,7 +861,8 @@ func TestPlannedReparentShardPromoteReplicaFail(t *testing.T) {
852861
goodReplica1.FakeMysqlDaemon.Replicating = true
853862
goodReplica1.FakeMysqlDaemon.SetReplicationSourceInputs = append(goodReplica1.FakeMysqlDaemon.SetReplicationSourceInputs, topoproto.MysqlAddr(newPrimary.Tablet), topoproto.MysqlAddr(oldPrimary.Tablet))
854863
goodReplica1.FakeMysqlDaemon.ExpectedExecuteSuperQueryList = []string{
855-
// These 3 statements come from tablet startup
864+
// These 4 statements come from tablet startup
865+
"STOP SLAVE",
856866
"RESET SLAVE ALL",
857867
"FAKE SET MASTER",
858868
"START SLAVE",
@@ -868,7 +878,8 @@ func TestPlannedReparentShardPromoteReplicaFail(t *testing.T) {
868878
goodReplica2.FakeMysqlDaemon.ReadOnly = true
869879
goodReplica2.FakeMysqlDaemon.SetReplicationSourceInputs = append(goodReplica2.FakeMysqlDaemon.SetReplicationSourceInputs, topoproto.MysqlAddr(newPrimary.Tablet), topoproto.MysqlAddr(oldPrimary.Tablet))
870880
goodReplica2.FakeMysqlDaemon.ExpectedExecuteSuperQueryList = []string{
871-
// These 3 statements come from tablet startup
881+
// These 4 statements come from tablet startup
882+
"STOP SLAVE",
872883
"RESET SLAVE ALL",
873884
"FAKE SET MASTER",
874885
"START SLAVE",
@@ -973,7 +984,8 @@ func TestPlannedReparentShardSamePrimary(t *testing.T) {
973984
goodReplica1.FakeMysqlDaemon.Replicating = true
974985
goodReplica1.FakeMysqlDaemon.SetReplicationSourceInputs = append(goodReplica1.FakeMysqlDaemon.SetReplicationSourceInputs, topoproto.MysqlAddr(oldPrimary.Tablet))
975986
goodReplica1.FakeMysqlDaemon.ExpectedExecuteSuperQueryList = []string{
976-
// These 3 statements come from tablet startup
987+
// These 4 statements come from tablet startup
988+
"STOP SLAVE",
977989
"RESET SLAVE ALL",
978990
"FAKE SET MASTER",
979991
"START SLAVE",
@@ -989,7 +1001,8 @@ func TestPlannedReparentShardSamePrimary(t *testing.T) {
9891001
goodReplica2.FakeMysqlDaemon.ReadOnly = true
9901002
goodReplica2.FakeMysqlDaemon.SetReplicationSourceInputs = append(goodReplica2.FakeMysqlDaemon.SetReplicationSourceInputs, topoproto.MysqlAddr(oldPrimary.Tablet))
9911003
goodReplica2.FakeMysqlDaemon.ExpectedExecuteSuperQueryList = []string{
992-
// These 3 statements come from tablet startup
1004+
// These 4 statements come from tablet startup
1005+
"STOP SLAVE",
9931006
"RESET SLAVE ALL",
9941007
"FAKE SET MASTER",
9951008
"START SLAVE",

0 commit comments

Comments
 (0)