Skip to content

Commit

Permalink
changefeedccl: deflake TestChangefeedSchemaChangeBackfillCheckpoint
Browse files Browse the repository at this point in the history
Previously, this test failed because of the maximum allowed checkpoint frequency being
too low (every 10ms). This test fails consistently when the frequency lower (ex. every 500ms)
and fails very, very rarely when the frequency is 10ms. To fix these rare flakes,
this change sets the frequency to once every nanosecond, which is the higest possible
frequency value since setting 0 will disable checkpointing.

The reason the test fails with a large frequency is as follows: The test waits to observe
a checkpoint during a schema change backfill. Because the changefeed is running normally
before the schema change and backfill occurs, it is regularly checkpointing the highwater.
Thus, it's possible for the changefeed to checkpoint the highwater, then complete the entire
backfill without checkpointing within 10ms. No checkpoints will be written during the backfill
in that scenario because 10ms have not passed since the last checkpoint. In this scenario, the
test fails to see a checkpoint written during the backfill and times out.

Fixes: cockroachdb#110876
Release note: None
Epic: None
jayshrivastava committed Sep 19, 2023
1 parent 66cd84c commit 1295da9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/ccl/changefeedccl/changefeed_test.go
Original file line number Diff line number Diff line change
@@ -2217,9 +2217,11 @@ func TestChangefeedSchemaChangeBackfillCheckpoint(t *testing.T) {
// Pause job and setup overrides to force a checkpoint
require.NoError(t, jobFeed.Pause())

// Checkpoint progress frequently, and set the checkpoint size limit.
// Ensure that checkpoints happen every time by setting a large checkpoint size.
// Because setting 0 for the FrontierCheckpointFrequency disables checkpointing,
// setting 1 nanosecond is the smallest possible value.
changefeedbase.FrontierCheckpointFrequency.Override(
context.Background(), &s.Server.ClusterSettings().SV, 10*time.Millisecond)
context.Background(), &s.Server.ClusterSettings().SV, 1*time.Nanosecond)
changefeedbase.FrontierCheckpointMaxBytes.Override(
context.Background(), &s.Server.ClusterSettings().SV, maxCheckpointSize)

0 comments on commit 1295da9

Please sign in to comment.