From 8cf76862cd54d45d476d2b16b2652f86b69a72fe Mon Sep 17 00:00:00 2001 From: Manan Gupta Date: Mon, 13 Nov 2023 11:33:22 +0530 Subject: [PATCH 1/3] feat: fix TestReparentWithDownReplica Signed-off-by: Manan Gupta --- .../reparent/plannedreparent/reparent_test.go | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/go/test/endtoend/reparent/plannedreparent/reparent_test.go b/go/test/endtoend/reparent/plannedreparent/reparent_test.go index 59734bce57a..7da46262949 100644 --- a/go/test/endtoend/reparent/plannedreparent/reparent_test.go +++ b/go/test/endtoend/reparent/plannedreparent/reparent_test.go @@ -275,17 +275,24 @@ func TestReparentWithDownReplica(t *testing.T) { // Perform a graceful reparent operation. It will fail as one tablet is down. out, err := utils.Prs(t, clusterInstance, tablets[1]) require.Error(t, err) - assert.True(t, utils.SetReplicationSourceFailed(tablets[2], out)) - - // insert data into the new primary, check the connected replica work - insertVal := utils.ConfirmReplication(t, tablets[1], []*cluster.Vttablet{tablets[0], tablets[3]}) + var insertVal int + // Assert that PRS failed + if clusterInstance.VtctlMajorVersion <= 17 { + assert.True(t, utils.SetReplicationSourceFailed(tablets[2], out)) + // insert data into the new primary, check the connected replica work + insertVal = utils.ConfirmReplication(t, tablets[1], []*cluster.Vttablet{tablets[0], tablets[3]}) + } else { + assert.Contains(t, out, fmt.Sprintf("TabletManager.PrimaryStatus on %s error", tablets[2].Alias)) + // insert data into the old primary, check the connected replica works. The primary tablet shouldn't have changed. + insertVal = utils.ConfirmReplication(t, tablets[0], []*cluster.Vttablet{tablets[1], tablets[3]}) + } // restart mysql on the old replica, should still be connecting to the old primary tablets[2].MysqlctlProcess.InitMysql = false err = tablets[2].MysqlctlProcess.Start() require.NoError(t, err) - // Use the same PlannedReparentShard command to fix up the tablet. + // Use the same PlannedReparentShard command to promote the new primary. _, err = utils.Prs(t, clusterInstance, tablets[1]) require.NoError(t, err) From da7ab649dfa1f23aaf7cc62d05b71de6f9aa9ed3 Mon Sep 17 00:00:00 2001 From: Manan Gupta Date: Mon, 13 Nov 2023 11:34:30 +0530 Subject: [PATCH 2/3] feat: fix TestReparentReplicaOffline Signed-off-by: Manan Gupta --- .../reparent/plannedreparent/reparent_test.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/go/test/endtoend/reparent/plannedreparent/reparent_test.go b/go/test/endtoend/reparent/plannedreparent/reparent_test.go index 7da46262949..00d1546d6fb 100644 --- a/go/test/endtoend/reparent/plannedreparent/reparent_test.go +++ b/go/test/endtoend/reparent/plannedreparent/reparent_test.go @@ -123,9 +123,16 @@ func TestReparentReplicaOffline(t *testing.T) { // Perform a graceful reparent operation. out, err := utils.PrsWithTimeout(t, clusterInstance, tablets[1], false, "", "31s") require.Error(t, err) - assert.True(t, utils.SetReplicationSourceFailed(tablets[3], out)) - utils.CheckPrimaryTablet(t, clusterInstance, tablets[1]) + // Assert that PRS failed + if clusterInstance.VtctlMajorVersion <= 17 { + assert.True(t, utils.SetReplicationSourceFailed(tablets[3], out)) + utils.CheckPrimaryTablet(t, clusterInstance, tablets[1]) + } else { + assert.Contains(t, out, "rpc error: code = DeadlineExceeded desc") + utils.CheckPrimaryTablet(t, clusterInstance, tablets[0]) + } + } func TestReparentAvoid(t *testing.T) { From 52d43098f8613c0c202547b86aeac37d4aeb3a40 Mon Sep 17 00:00:00 2001 From: Manan Gupta Date: Mon, 13 Nov 2023 11:36:00 +0530 Subject: [PATCH 3/3] feat: fix TestReparentAvoid Signed-off-by: Manan Gupta --- go/test/endtoend/reparent/plannedreparent/reparent_test.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/go/test/endtoend/reparent/plannedreparent/reparent_test.go b/go/test/endtoend/reparent/plannedreparent/reparent_test.go index 00d1546d6fb..7a0b16f5890 100644 --- a/go/test/endtoend/reparent/plannedreparent/reparent_test.go +++ b/go/test/endtoend/reparent/plannedreparent/reparent_test.go @@ -162,7 +162,11 @@ func TestReparentAvoid(t *testing.T) { utils.StopTablet(t, tablets[0], true) out, err := utils.PrsAvoid(t, clusterInstance, tablets[1]) require.Error(t, err) - assert.Contains(t, out, "cannot find a tablet to reparent to in the same cell as the current primary") + if clusterInstance.VtctlMajorVersion <= 17 { + assert.Contains(t, out, "cannot find a tablet to reparent to in the same cell as the current primary") + } else { + assert.Contains(t, out, "rpc error: code = DeadlineExceeded desc = latest balancer error") + } utils.ValidateTopology(t, clusterInstance, false) utils.CheckPrimaryTablet(t, clusterInstance, tablets[1]) }