From a87d86ef9c5ff367e83fd561948aeead6f34c8e2 Mon Sep 17 00:00:00 2001 From: Dirkjan Bussink Date: Wed, 1 May 2024 21:50:16 +0200 Subject: [PATCH] endtoend: Remove usage of deprecated terminology Now that we don't run these tests anymore against old MySQL 5.7 releases we can update the terminology used. Signed-off-by: Dirkjan Bussink --- .../reparent/emergencyreparent/ers_test.go | 6 +++--- .../reparent/plannedreparent/reparent_test.go | 14 ++++++------- go/test/endtoend/reparent/utils/utils.go | 4 ++-- .../buffer/reparent/failover_buffer_test.go | 8 ++++---- go/test/endtoend/tabletgateway/vtgate_test.go | 8 ++++---- .../tabletmanager/tablet_health_test.go | 2 +- go/test/endtoend/tabletmanager/tablet_test.go | 6 +++--- .../testdata/config/init_testserver_db.sql | 2 +- go/test/endtoend/vtorc/general/vtorc_test.go | 20 +++++++++---------- .../vtorc/readtopologyinstance/main_test.go | 4 ++-- go/test/endtoend/vtorc/utils/utils.go | 8 ++++---- 11 files changed, 41 insertions(+), 41 deletions(-) diff --git a/go/test/endtoend/reparent/emergencyreparent/ers_test.go b/go/test/endtoend/reparent/emergencyreparent/ers_test.go index 95942b5f16b..0eaac97a4f2 100644 --- a/go/test/endtoend/reparent/emergencyreparent/ers_test.go +++ b/go/test/endtoend/reparent/emergencyreparent/ers_test.go @@ -357,12 +357,12 @@ func TestNoReplicationStatusAndIOThreadStopped(t *testing.T) { tablets := clusterInstance.Keyspaces[0].Shards[0].Vttablets utils.ConfirmReplication(t, tablets[0], []*cluster.Vttablet{tablets[1], tablets[2], tablets[3]}) - err := clusterInstance.VtctldClientProcess.ExecuteCommand("ExecuteFetchAsDBA", tablets[1].Alias, `STOP SLAVE`) + err := clusterInstance.VtctldClientProcess.ExecuteCommand("ExecuteFetchAsDBA", tablets[1].Alias, `STOP REPLICA`) require.NoError(t, err) - err = clusterInstance.VtctldClientProcess.ExecuteCommand("ExecuteFetchAsDBA", tablets[1].Alias, `RESET SLAVE ALL`) + err = clusterInstance.VtctldClientProcess.ExecuteCommand("ExecuteFetchAsDBA", tablets[1].Alias, `RESET REPLICA ALL`) require.NoError(t, err) // - err = clusterInstance.VtctldClientProcess.ExecuteCommand("ExecuteFetchAsDBA", tablets[3].Alias, `STOP SLAVE IO_THREAD;`) + err = clusterInstance.VtctldClientProcess.ExecuteCommand("ExecuteFetchAsDBA", tablets[3].Alias, `STOP REPLICA IO_THREAD;`) require.NoError(t, err) // Run an additional command in the current primary which will only be acked by tablets[2] and be in its relay log. insertedVal := utils.ConfirmReplication(t, tablets[0], nil) diff --git a/go/test/endtoend/reparent/plannedreparent/reparent_test.go b/go/test/endtoend/reparent/plannedreparent/reparent_test.go index de10e9921c1..d9d6cb06b79 100644 --- a/go/test/endtoend/reparent/plannedreparent/reparent_test.go +++ b/go/test/endtoend/reparent/plannedreparent/reparent_test.go @@ -96,7 +96,7 @@ func TestPRSWithDrainedLaggingTablet(t *testing.T) { utils.ConfirmReplication(t, tablets[0], []*cluster.Vttablet{tablets[1], tablets[2], tablets[3]}) // make tablets[1 lag from the other tablets by setting the delay to a large number - utils.RunSQLs(context.Background(), t, []string{`stop slave`, `CHANGE MASTER TO MASTER_DELAY = 1999`, `start slave;`}, tablets[1]) + utils.RunSQLs(context.Background(), t, []string{`stop replica`, `CHANGE REPLICATION SOURCE TO SOURCE_DELAY = 1999`, `start replica;`}, tablets[1]) // insert another row in tablets[1 utils.ConfirmReplication(t, tablets[0], []*cluster.Vttablet{tablets[2], tablets[3]}) @@ -224,7 +224,7 @@ func reparentFromOutside(t *testing.T, clusterInstance *cluster.LocalProcessClus } // commands to convert a replica to be writable - promoteReplicaCommands := []string{"STOP SLAVE", "RESET SLAVE ALL", "SET GLOBAL read_only = OFF"} + promoteReplicaCommands := []string{"STOP REPLICA", "RESET REPLICA ALL", "SET GLOBAL read_only = OFF"} utils.RunSQLs(ctx, t, promoteReplicaCommands, tablets[1]) // Get primary position @@ -233,9 +233,9 @@ func reparentFromOutside(t *testing.T, clusterInstance *cluster.LocalProcessClus // tablets[0] will now be a replica of tablets[1 changeReplicationSourceCommands := []string{ "RESET MASTER", - "RESET SLAVE", + "RESET REPLICA", fmt.Sprintf("SET GLOBAL gtid_purged = '%s'", gtID), - fmt.Sprintf("CHANGE MASTER TO MASTER_HOST='%s', MASTER_PORT=%d, MASTER_USER='vt_repl', MASTER_AUTO_POSITION = 1", utils.Hostname, tablets[1].MySQLPort), + fmt.Sprintf("CHANGE REPLICATION SOURCE TO SOURCE_HOST='%s', SOURCE_PORT=%d, SOURCE_USER='vt_repl', SOURCE_AUTO_POSITION = 1", utils.Hostname, tablets[1].MySQLPort), } utils.RunSQLs(ctx, t, changeReplicationSourceCommands, tablets[0]) @@ -244,11 +244,11 @@ func reparentFromOutside(t *testing.T, clusterInstance *cluster.LocalProcessClus // tablets[2 will be a replica of tablets[1 changeReplicationSourceCommands = []string{ - "STOP SLAVE", + "STOP REPLICA", "RESET MASTER", fmt.Sprintf("SET GLOBAL gtid_purged = '%s'", gtID), - fmt.Sprintf("CHANGE MASTER TO MASTER_HOST='%s', MASTER_PORT=%d, MASTER_USER='vt_repl', MASTER_AUTO_POSITION = 1", utils.Hostname, tablets[1].MySQLPort), - "START SLAVE", + fmt.Sprintf("CHANGE REPLICATION SOURCE TO SOURCE_HOST='%s', SOURCE_PORT=%d, SOURCE_USER='vt_repl', SOURCE_AUTO_POSITION = 1", utils.Hostname, tablets[1].MySQLPort), + "START REPLICA", } utils.RunSQLs(ctx, t, changeReplicationSourceCommands, tablets[2]) diff --git a/go/test/endtoend/reparent/utils/utils.go b/go/test/endtoend/reparent/utils/utils.go index 39f29c789d7..5038352d721 100644 --- a/go/test/endtoend/reparent/utils/utils.go +++ b/go/test/endtoend/reparent/utils/utils.go @@ -610,7 +610,7 @@ func WaitForReplicationToStart(t *testing.T, clusterInstance *cluster.LocalProce // CheckReplicaStatus checks the replication status and asserts that the replication is stopped func CheckReplicaStatus(ctx context.Context, t *testing.T, tablet *cluster.Vttablet) { - qr := RunSQL(ctx, t, "show slave status", tablet) + qr := RunSQL(ctx, t, "show replica status", tablet) IOThreadRunning := fmt.Sprintf("%v", qr.Rows[0][10]) SQLThreadRunning := fmt.Sprintf("%v", qr.Rows[0][10]) assert.Equal(t, IOThreadRunning, "VARCHAR(\"No\")") @@ -765,7 +765,7 @@ func SetReplicationSourceFailed(tablet *cluster.Vttablet, prsOut string) bool { // CheckReplicationStatus checks that the replication for sql and io threads is setup as expected func CheckReplicationStatus(ctx context.Context, t *testing.T, tablet *cluster.Vttablet, sqlThreadRunning bool, ioThreadRunning bool) { - res := RunSQL(ctx, t, "show slave status", tablet) + res := RunSQL(ctx, t, "show replica status", tablet) if ioThreadRunning { require.Equal(t, "Yes", res.Rows[0][10].ToString()) } else { diff --git a/go/test/endtoend/tabletgateway/buffer/reparent/failover_buffer_test.go b/go/test/endtoend/tabletgateway/buffer/reparent/failover_buffer_test.go index 486dc3ef9e5..7bb139438f8 100644 --- a/go/test/endtoend/tabletgateway/buffer/reparent/failover_buffer_test.go +++ b/go/test/endtoend/tabletgateway/buffer/reparent/failover_buffer_test.go @@ -31,7 +31,7 @@ import ( var ( demoteQueries = []string{"SET GLOBAL read_only = ON", "FLUSH TABLES WITH READ LOCK", "UNLOCK TABLES"} - promoteQueries = []string{"STOP SLAVE", "RESET SLAVE ALL", "SET GLOBAL read_only = OFF"} + promoteQueries = []string{"STOP REPLICA", "RESET REPLICA ALL", "SET GLOBAL read_only = OFF"} hostname = "localhost" ) @@ -73,11 +73,11 @@ func failoverExternalReparenting(t *testing.T, clusterInstance *cluster.LocalPro // Use 'localhost' as hostname because Travis CI worker hostnames // are too long for MySQL replication. changeSourceCommands := []string{ - "STOP SLAVE", + "STOP REPLICA", "RESET MASTER", fmt.Sprintf("SET GLOBAL gtid_purged = '%s'", gtID), - fmt.Sprintf("CHANGE MASTER TO MASTER_HOST='%s', MASTER_PORT=%d, MASTER_USER='vt_repl', MASTER_AUTO_POSITION = 1", "localhost", newPrimary.MySQLPort), - "START SLAVE", + fmt.Sprintf("CHANGE REPLICATION SOURCE TO SOURCE_HOST='%s', SOURCE_PORT=%d, SOURCE_USER='vt_repl', SOURCE_AUTO_POSITION = 1", "localhost", newPrimary.MySQLPort), + "START REPLICA", } err = oldPrimary.VttabletProcess.QueryTabletMultiple(changeSourceCommands, keyspaceUnshardedName, true) require.NoError(t, err) diff --git a/go/test/endtoend/tabletgateway/vtgate_test.go b/go/test/endtoend/tabletgateway/vtgate_test.go index a48a22f2cb0..1f4f8758e16 100644 --- a/go/test/endtoend/tabletgateway/vtgate_test.go +++ b/go/test/endtoend/tabletgateway/vtgate_test.go @@ -80,16 +80,16 @@ func TestVtgateReplicationStatusCheck(t *testing.T) { } }() // Stop replication on the non-PRIMARY tablets. - _, err = clusterInstance.VtctldClientProcess.ExecuteCommandWithOutput("ExecuteFetchAsDBA", clusterInstance.Keyspaces[0].Shards[0].Replica().Alias, "stop slave") + _, err = clusterInstance.VtctldClientProcess.ExecuteCommandWithOutput("ExecuteFetchAsDBA", clusterInstance.Keyspaces[0].Shards[0].Replica().Alias, "stop replica") require.NoError(t, err) - _, err = clusterInstance.VtctldClientProcess.ExecuteCommandWithOutput("ExecuteMultiFetchAsDBA", clusterInstance.Keyspaces[0].Shards[0].Rdonly().Alias, "stop slave") + _, err = clusterInstance.VtctldClientProcess.ExecuteCommandWithOutput("ExecuteMultiFetchAsDBA", clusterInstance.Keyspaces[0].Shards[0].Rdonly().Alias, "stop replica") require.NoError(t, err) // Restart replication afterward as the cluster is re-used. defer func() { - _, err = clusterInstance.VtctldClientProcess.ExecuteCommandWithOutput("ExecuteFetchAsDBA", clusterInstance.Keyspaces[0].Shards[0].Replica().Alias, "start slave") + _, err = clusterInstance.VtctldClientProcess.ExecuteCommandWithOutput("ExecuteFetchAsDBA", clusterInstance.Keyspaces[0].Shards[0].Replica().Alias, "start replica") require.NoError(t, err) // Testing ExecuteMultiFetchAsDBA by running multiple commands in a single call: - _, err = clusterInstance.VtctldClientProcess.ExecuteCommandWithOutput("ExecuteMultiFetchAsDBA", clusterInstance.Keyspaces[0].Shards[0].Rdonly().Alias, "start slave sql_thread; start slave io_thread;") + _, err = clusterInstance.VtctldClientProcess.ExecuteCommandWithOutput("ExecuteMultiFetchAsDBA", clusterInstance.Keyspaces[0].Shards[0].Rdonly().Alias, "start replica sql_thread; start replica io_thread;") require.NoError(t, err) }() time.Sleep(2 * time.Second) // Build up some replication lag diff --git a/go/test/endtoend/tabletmanager/tablet_health_test.go b/go/test/endtoend/tabletmanager/tablet_health_test.go index c8eb43b682f..bf3747fde29 100644 --- a/go/test/endtoend/tabletmanager/tablet_health_test.go +++ b/go/test/endtoend/tabletmanager/tablet_health_test.go @@ -119,7 +119,7 @@ func TestHealthCheck(t *testing.T) { // Make sure the primary is still primary checkTabletType(t, primaryTablet.Alias, "PRIMARY") - utils.Exec(t, conn, "stop slave") + utils.Exec(t, conn, "stop replica") // stop replication, make sure we don't go unhealthy. err = clusterInstance.VtctldClientProcess.ExecuteCommand("StopReplication", rTablet.Alias) diff --git a/go/test/endtoend/tabletmanager/tablet_test.go b/go/test/endtoend/tabletmanager/tablet_test.go index 830502268d1..398610d82de 100644 --- a/go/test/endtoend/tabletmanager/tablet_test.go +++ b/go/test/endtoend/tabletmanager/tablet_test.go @@ -82,11 +82,11 @@ func TestResetReplicationParameters(t *testing.T) { require.NoError(t, err) // Set a replication source on the tablet and start replication - err = tablet.VttabletProcess.QueryTabletMultiple([]string{"stop slave", "change master to master_host = 'localhost', master_port = 123", "start slave"}, keyspaceName, false) + err = tablet.VttabletProcess.QueryTabletMultiple([]string{"stop replica", "change replication source to source_host = 'localhost', source_port = 123", "start replica"}, keyspaceName, false) require.NoError(t, err) // Check the replica status. - res, err := tablet.VttabletProcess.QueryTablet("show slave status", keyspaceName, false) + res, err := tablet.VttabletProcess.QueryTablet("show replica status", keyspaceName, false) require.NoError(t, err) // This is expected to return 1 row result require.Len(t, res.Rows, 1) @@ -96,7 +96,7 @@ func TestResetReplicationParameters(t *testing.T) { require.NoError(t, err) // Recheck the replica status and this time is should be empty - res, err = tablet.VttabletProcess.QueryTablet("show slave status", keyspaceName, false) + res, err = tablet.VttabletProcess.QueryTablet("show replica status", keyspaceName, false) require.NoError(t, err) require.Len(t, res.Rows, 0) } diff --git a/go/test/endtoend/vreplication/testdata/config/init_testserver_db.sql b/go/test/endtoend/vreplication/testdata/config/init_testserver_db.sql index 2be570ca152..89998b856b5 100644 --- a/go/test/endtoend/vreplication/testdata/config/init_testserver_db.sql +++ b/go/test/endtoend/vreplication/testdata/config/init_testserver_db.sql @@ -79,7 +79,7 @@ GRANT SELECT, PROCESS, SUPER, REPLICATION CLIENT, RELOAD GRANT SELECT, UPDATE, DELETE, DROP ON performance_schema.* TO 'vt_monitoring'@'localhost'; -RESET SLAVE ALL; +RESET REPLICA ALL; RESET MASTER; # custom sql is used to add custom scripts like creating users/passwords. We use it in our tests diff --git a/go/test/endtoend/vtorc/general/vtorc_test.go b/go/test/endtoend/vtorc/general/vtorc_test.go index 1adc091be59..8ff66fad59c 100644 --- a/go/test/endtoend/vtorc/general/vtorc_test.go +++ b/go/test/endtoend/vtorc/general/vtorc_test.go @@ -172,7 +172,7 @@ func TestVTOrcRepairs(t *testing.T) { utils.WaitForSuccessfulRecoveryCount(t, vtOrcProcess, logic.FixReplicaRecoveryName, 2) // Stop just the IO thread on the replica - _, err = utils.RunSQL(t, "STOP SLAVE IO_THREAD", replica, "") + _, err = utils.RunSQL(t, "STOP REPLICA IO_THREAD", replica, "") require.NoError(t, err) // check replication is setup correctly @@ -180,7 +180,7 @@ func TestVTOrcRepairs(t *testing.T) { utils.WaitForSuccessfulRecoveryCount(t, vtOrcProcess, logic.FixReplicaRecoveryName, 3) // Stop just the SQL thread on the replica - _, err = utils.RunSQL(t, "STOP SLAVE SQL_THREAD", replica, "") + _, err = utils.RunSQL(t, "STOP REPLICA SQL_THREAD", replica, "") require.NoError(t, err) // check replication is setup correctly @@ -191,10 +191,10 @@ func TestVTOrcRepairs(t *testing.T) { t.Run("ReplicationFromOtherReplica", func(t *testing.T) { // point replica at otherReplica changeReplicationSourceCommands := []string{ - "STOP SLAVE", - "RESET SLAVE ALL", - fmt.Sprintf("CHANGE MASTER TO MASTER_HOST='%s', MASTER_PORT=%d, MASTER_USER='vt_repl', MASTER_AUTO_POSITION = 1", utils.Hostname, otherReplica.MySQLPort), - "START SLAVE", + "STOP REPLICA", + "RESET REPLICA ALL", + fmt.Sprintf("CHANGE REPLICATION SOURCE TO SOURCE_HOST='%s', SOURCE_PORT=%d, SOURCE_USER='vt_repl', SOURCE_AUTO_POSITION = 1", utils.Hostname, otherReplica.MySQLPort), + "START REPLICA", } err := utils.RunSQLs(t, changeReplicationSourceCommands, replica, "") require.NoError(t, err) @@ -210,10 +210,10 @@ func TestVTOrcRepairs(t *testing.T) { t.Run("CircularReplication", func(t *testing.T) { // change the replication source on the primary changeReplicationSourceCommands := []string{ - "STOP SLAVE", - "RESET SLAVE ALL", - fmt.Sprintf("CHANGE MASTER TO MASTER_HOST='%s', MASTER_PORT=%d, MASTER_USER='vt_repl', MASTER_AUTO_POSITION = 1", replica.VttabletProcess.TabletHostname, replica.MySQLPort), - "START SLAVE", + "STOP REPLICA", + "RESET REPLICA ALL", + fmt.Sprintf("CHANGE REPLICATION SOURCE TO SOURCE_HOST='%s', SOURCE_PORT=%d, SOURCE_USER='vt_repl', SOURCE_AUTO_POSITION = 1", replica.VttabletProcess.TabletHostname, replica.MySQLPort), + "START REPLICA", } err := utils.RunSQLs(t, changeReplicationSourceCommands, curPrimary, "") require.NoError(t, err) diff --git a/go/test/endtoend/vtorc/readtopologyinstance/main_test.go b/go/test/endtoend/vtorc/readtopologyinstance/main_test.go index 78e4f4dfcda..fd7454365bd 100644 --- a/go/test/endtoend/vtorc/readtopologyinstance/main_test.go +++ b/go/test/endtoend/vtorc/readtopologyinstance/main_test.go @@ -108,11 +108,11 @@ func TestReadTopologyInstanceBufferable(t *testing.T) { // After this we restart the replication and enable the recoveries again. err = logic.DisableRecovery() require.NoError(t, err) - err = utils.RunSQLs(t, []string{`STOP SLAVE;`, + err = utils.RunSQLs(t, []string{`STOP REPLICA;`, `SET GTID_NEXT="12345678-1234-1234-1234-123456789012:1";`, `BEGIN;`, `COMMIT;`, `SET GTID_NEXT="AUTOMATIC";`, - `START SLAVE;`, + `START REPLICA;`, }, replica, "") require.NoError(t, err) err = logic.EnableRecovery() diff --git a/go/test/endtoend/vtorc/utils/utils.go b/go/test/endtoend/vtorc/utils/utils.go index 056276594d8..834efb41457 100644 --- a/go/test/endtoend/vtorc/utils/utils.go +++ b/go/test/endtoend/vtorc/utils/utils.go @@ -327,7 +327,7 @@ func cleanAndStartVttablet(t *testing.T, clusterInfo *VTOrcClusterInfo, vttablet _, err = RunSQL(t, "DROP DATABASE IF EXISTS _vt", vttablet, "") require.NoError(t, err) // stop the replication - _, err = RunSQL(t, "STOP SLAVE", vttablet, "") + _, err = RunSQL(t, "STOP REPLICA", vttablet, "") require.NoError(t, err) // reset the binlog _, err = RunSQL(t, "RESET MASTER", vttablet, "") @@ -502,7 +502,7 @@ func WaitForReplicationToStop(t *testing.T, vttablet *cluster.Vttablet) error { case <-timeout: return fmt.Errorf("timedout: waiting for primary to stop replication") default: - res, err := RunSQL(t, "SHOW SLAVE STATUS", vttablet, "") + res, err := RunSQL(t, "SHOW REPLICA STATUS", vttablet, "") if err != nil { return err } @@ -699,7 +699,7 @@ func CheckSourcePort(t *testing.T, replica *cluster.Vttablet, source *cluster.Vt t.Fatal("timedout waiting for correct primary to be setup") return default: - res, err := RunSQL(t, "SHOW SLAVE STATUS", replica, "") + res, err := RunSQL(t, "SHOW REPLICA STATUS", replica, "") require.NoError(t, err) if len(res.Rows) != 1 { @@ -708,7 +708,7 @@ func CheckSourcePort(t *testing.T, replica *cluster.Vttablet, source *cluster.Vt } for idx, field := range res.Fields { - if strings.EqualFold(field.Name, "MASTER_PORT") || strings.EqualFold(field.Name, "SOURCE_PORT") { + if strings.EqualFold(field.Name, "SOURCE_PORT") { port, err := res.Rows[0][idx].ToInt64() require.NoError(t, err) if port == int64(source.MySQLPort) {