Skip to content

Commit

Permalink
changefeedccl: deflake TestAlterChangefeedAddTargetsDuringBackfill
Browse files Browse the repository at this point in the history
Note this commit is similar to 1295da9, but
applies to a different test.

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#110796
Release note: None
Epic: None

 Please enter a valid issue or epic reference:
  • Loading branch information
jayshrivastava committed Sep 19, 2023
1 parent 7f3407b commit 9d6c38c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/ccl/changefeedccl/alter_changefeed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1023,9 +1023,11 @@ func TestAlterChangefeedAddTargetsDuringSchemaChangeError(t *testing.T) {
require.NoError(t, jobFeed.Pause())

var maxCheckpointSize int64 = 100 << 20
// 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)

Expand Down

0 comments on commit 9d6c38c

Please sign in to comment.