Skip to content

Commit 86c5569

Browse files
committed
roachtest: deflake mixed-version backup/restore roachtest
As part of the 25.4 migration, all descriptors are rewritten to use the new serialization format. If this occurs during a restore, the restore will fail due to version mismatches. This test deflakes our mixed-version backup-restore roachtests to rerun the restore if it encounters that error. Fixes: #154611 Fixes: #154850 Release note: None
1 parent 588e5f6 commit 86c5569

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

pkg/cmd/roachtest/tests/mixed_version_backup.go

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1327,9 +1327,27 @@ func (d *BackupRestoreTestDriver) runRestore(
13271327
if err := d.testUtils.QueryRow(ctx, rng, restoreStmt).Scan(&jobID); err != nil {
13281328
return nil, "", fmt.Errorf("backup %s: error in restore statement: %w", bc.name, err)
13291329
}
1330-
if err := d.testUtils.waitForJobSuccess(ctx, l, rng, jobID, internalSystemJobs); err != nil {
1331-
return nil, "", err
1330+
if jobErr := d.testUtils.waitForJobSuccess(ctx, l, rng, jobID, internalSystemJobs); jobErr != nil {
1331+
if !strings.Contains(jobErr.Error(), "version mismatch for descriptor") {
1332+
return nil, "", jobErr
1333+
}
1334+
// In the 25.4 upgrade, all descriptors are rewritten in the migration to use
1335+
// the new serialization format. If this upgrade occurs in the middle of the
1336+
// restore, we may encounter a version mismatch error. As a short-term fix for
1337+
// this test flake, we retry the restore if we encounter this error.
1338+
// TODO (kev-cao): Remove after 25.4 migrations are no longer run or if
1339+
// another solution for accounting for the descriptor upgrades is found.
1340+
l.Printf(
1341+
"encountered version mismatch error due to mixed-version upgrade, retrying restore: %w", jobErr,
1342+
)
1343+
if err := d.testUtils.QueryRow(ctx, rng, restoreStmt).Scan(&jobID); err != nil {
1344+
return nil, "", fmt.Errorf("backup %s: error in restore statement: %w", bc.name, err)
1345+
}
1346+
if jobErr = d.testUtils.waitForJobSuccess(ctx, l, rng, jobID, internalSystemJobs); jobErr != nil {
1347+
return nil, "", jobErr
1348+
}
13321349
}
1350+
13331351
return restoredTables, restoreDB, nil
13341352
}
13351353

0 commit comments

Comments
 (0)