Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
132087: sql: Add SucceedsSoon to TestRaceWithBackfill r=fqazi a=spilchen

We've occasionally seen TestRaceWithBackfill fail with an error like this:
```
pq: scrub-unique: batch timestamp 1727324575.845086785,0 must be after replica GC threshold 1727324575.977490760,0
```

This is likely caused by the test using an excessively aggressive GC TTL setting. To improve the test's stability, I wrapped the scrub-unique operation in a SucceedsSoon block.

Epic: None
Release note: None
Resolves cockroachdb#131401, resolves cockroachdb#130436

Co-authored-by: Matt Spilchen <[email protected]>
  • Loading branch information
craig[bot] and spilchen committed Oct 7, 2024
2 parents 5de85a8 + a423609 commit c864937
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions pkg/sql/schema_changer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -646,14 +646,17 @@ CREATE UNIQUE INDEX vidx ON t.test (v);

ctx := context.Background()

// number of keys == 2 * number of rows; 1 column family and 1 index entry
// for each row.
if err := sqltestutils.CheckTableKeyCount(ctx, kvDB, codec, 2, maxValue); err != nil {
t.Fatal(err)
}
if err := sqlutils.RunScrub(sqlDB, "t", "test"); err != nil {
t.Fatal(err)
}
testutils.SucceedsSoon(t, func() error {
// number of keys == 2 * number of rows; 1 column family and 1 index entry
// for each row.
if err := sqltestutils.CheckTableKeyCount(ctx, kvDB, codec, 2, maxValue); err != nil {
return err
}
if err := sqlutils.RunScrub(sqlDB, "t", "test"); err != nil {
return err
}
return nil
})

// Run some schema changes with operations.

Expand Down

0 comments on commit c864937

Please sign in to comment.