Skip to content
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

Fixing backup tests flakiness (#12655) #12736

Merged
merged 1 commit into from
Mar 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 9 additions & 13 deletions go/test/endtoend/backup/vtctlbackup/backup_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,14 @@ type restoreMethod func(t *testing.T, tablet *cluster.Vttablet)
// 13. verify that don't have the data added after the first backup
// 14. remove the backups
func primaryBackup(t *testing.T) {
// Having the VTOrc in this test causes a lot of flakiness. For example when we delete the tablet `replica2` which
// is the current primary and then try to restore from backup the old primary (`primary.Alias`), but before that sometimes the VTOrc
// promotes the `replica1` to primary right after we delete the replica2 (current primary).
// This can result in unexpected behavior. Therefore, disabling the VTOrc in this test to remove flakiness.
localCluster.DisableVTOrcRecoveries(t)
defer func() {
localCluster.EnableVTOrcRecoveries(t)
}()
verifyInitialReplication(t)

output, err := localCluster.VtctlclientProcess.ExecuteCommandWithOutput("Backup", primary.Alias)
Expand Down Expand Up @@ -770,15 +778,9 @@ func terminatedRestore(t *testing.T) {
// Args:
// tablet_type: 'replica' or 'rdonly'.
func vtctlBackup(t *testing.T, tabletType string) {
// Start vtorc before running backups
vtorcProcess := localCluster.NewVTOrcProcess(cluster.VTOrcConfiguration{})
err := vtorcProcess.Setup()
require.NoError(t, err)
localCluster.VTOrcProcesses = append(localCluster.VTOrcProcesses, vtorcProcess)

// StopReplication on replica1. We verify that the replication works fine later in
// verifyInitialReplication. So this will also check that VTOrc is running.
err = localCluster.VtctlclientProcess.ExecuteCommand("StopReplication", replica1.Alias)
err := localCluster.VtctlclientProcess.ExecuteCommand("StopReplication", replica1.Alias)
require.Nil(t, err)

verifyInitialReplication(t)
Expand All @@ -797,12 +799,6 @@ func vtctlBackup(t *testing.T, tabletType string) {
cluster.VerifyRowsInTablet(t, replica2, keyspaceName, 2)

verifyAfterRemovingBackupNoBackupShouldBePresent(t, backups)

// Stop VTOrc
err = localCluster.VTOrcProcesses[0].TearDown()
localCluster.VTOrcProcesses = nil
require.NoError(t, err)

err = replica2.VttabletProcess.TearDown()
require.Nil(t, err)

Expand Down