Skip to content

Commit

Permalink
backupccl: deflake TestCleanupIntentsDuringBackupPerformanceRegression
Browse files Browse the repository at this point in the history
The test was counting batches of pushes for the entire duration of the
test, not just the back itself. This patch resets the counters to do a
more targeted assertion.

Fixes: cockroachdb#112812

Release note: None
  • Loading branch information
miraradeva committed Oct 24, 2023
1 parent 3e32c60 commit 7147c1f
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions pkg/ccl/backupccl/backup_intents_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,14 @@ func TestCleanupIntentsDuringBackupPerformanceRegression(t *testing.T) {
}
}

// Reset the counters to avoid counting pushes and intent resolutions not
// part of the backup.
numIntentResolveBatches.Store(0)
numPushBatches.Store(0)

_, err = sqlDb.Exec("backup table foo to 'userfile:///test.foo'")
require.NoError(t, err, "Failed to run backup")

if !abort {
for _, tx := range transactions {
require.NoError(t, tx.Commit())
}
}

// We expect each group of 10 intents to take 2 intent resolution batches:
// - One intent gets discovered and added to the lock table, which forces the
// abandoned txn to be pushed and added to the txnStatusCache.
Expand All @@ -120,5 +119,12 @@ func TestCleanupIntentsDuringBackupPerformanceRegression(t *testing.T) {
// Each of the 1,000 transactions is expected to get pushed once, but in an
// actual run of the test we might see more pushes (e.g. of other transactions).
require.GreaterOrEqual(t, 1100, int(numPushBatches.Load()))

if !abort {
for _, tx := range transactions {
// Ensure the long-running transactions can commit.
require.NoError(t, tx.Commit())
}
}
})
}

0 comments on commit 7147c1f

Please sign in to comment.