@@ -2810,7 +2810,8 @@ func TestChangefeedLaggingSpanCheckpointing(t *testing.T) {
2810
2810
2811
2811
var jobID jobspb.JobID
2812
2812
sqlDB .QueryRow (t ,
2813
- `CREATE CHANGEFEED FOR foo INTO 'null://' WITH resolved='50ms', no_initial_scan, cursor=$1` , tsStr ,
2813
+ `CREATE CHANGEFEED FOR foo INTO 'null://'
2814
+ WITH resolved='50ms', min_checkpoint_frequency='50ms', no_initial_scan, cursor=$1` , tsStr ,
2814
2815
).Scan (& jobID )
2815
2816
2816
2817
// Helper to read job progress
@@ -2952,7 +2953,8 @@ func TestChangefeedSchemaChangeBackfillCheckpoint(t *testing.T) {
2952
2953
}
2953
2954
2954
2955
// Setup changefeed job details, avoid relying on initial scan functionality
2955
- baseFeed := feed (t , f , `CREATE CHANGEFEED FOR foo WITH resolved='100ms', min_checkpoint_frequency='100ms', no_initial_scan` )
2956
+ baseFeed := feed (t , f , `CREATE CHANGEFEED FOR foo
2957
+ WITH resolved='100ms', min_checkpoint_frequency='1ns', no_initial_scan` )
2956
2958
jobFeed := baseFeed .(cdctest.EnterpriseTestFeed )
2957
2959
jobRegistry := s .Server .JobRegistry ().(* jobs.Registry )
2958
2960
@@ -9124,22 +9126,21 @@ func TestChangefeedBackfillCheckpoint(t *testing.T) {
9124
9126
9125
9127
// Emit resolved events for majority of spans. Be extra paranoid and ensure that
9126
9128
// we have at least 1 span for which we don't emit resolved timestamp (to force checkpointing).
9127
- haveGaps := false
9129
+ // We however also need to ensure there's at least one span that isn't filtered out.
9130
+ var allowedOne , haveGaps bool
9128
9131
knobs .FilterSpanWithMutation = func (r * jobspb.ResolvedSpan ) (bool , error ) {
9129
9132
if r .Span .Equal (tableSpan ) {
9130
- // Do not emit resolved events for the entire table span.
9131
- // We "simulate" large table by splitting single table span into many parts, so
9132
- // we want to resolve those sub-spans instead of the entire table span.
9133
- // However, we have to emit something -- otherwise the entire changefeed
9134
- // machine would not work.
9135
- r .Span .EndKey = tableSpan .Key .Next ()
9133
+ return true , nil
9134
+ }
9135
+ if ! allowedOne {
9136
+ allowedOne = true
9136
9137
return false , nil
9137
9138
}
9138
- if haveGaps {
9139
- return rnd .Intn (10 ) > 7 , nil
9139
+ if ! haveGaps {
9140
+ haveGaps = true
9141
+ return true , nil
9140
9142
}
9141
- haveGaps = true
9142
- return true , nil
9143
+ return rnd .Intn (10 ) > 7 , nil
9143
9144
}
9144
9145
9145
9146
// Checkpoint progress frequently, and set the checkpoint size limit.
@@ -9149,7 +9150,8 @@ func TestChangefeedBackfillCheckpoint(t *testing.T) {
9149
9150
context .Background (), & s .Server .ClusterSettings ().SV , maxCheckpointSize )
9150
9151
9151
9152
registry := s .Server .JobRegistry ().(* jobs.Registry )
9152
- foo := feed (t , f , `CREATE CHANGEFEED FOR foo WITH resolved='100ms'` )
9153
+ foo := feed (t , f , `CREATE CHANGEFEED FOR foo
9154
+ WITH resolved='100ms', min_checkpoint_frequency='1ns'` )
9153
9155
// Some test feeds (kafka) are not buffered, so we have to consume messages.
9154
9156
var shouldDrain int32 = 1
9155
9157
g := ctxgroup .WithContext (context .Background ())
@@ -12009,7 +12011,8 @@ func TestChangefeedProtectedTimestampUpdate(t *testing.T) {
12009
12011
require .Equal (t , int64 (0 ), managePTSCount )
12010
12012
require .Equal (t , int64 (0 ), managePTSErrorCount )
12011
12013
12012
- createStmt := `CREATE CHANGEFEED FOR foo WITH resolved='10ms', no_initial_scan`
12014
+ createStmt := `CREATE CHANGEFEED FOR foo
12015
+ WITH resolved='10ms', min_checkpoint_frequency='10ms', no_initial_scan`
12013
12016
testFeed := feed (t , f , createStmt )
12014
12017
defer closeFeed (t , testFeed )
12015
12018
@@ -12122,7 +12125,8 @@ func TestChangefeedProtectedTimestampUpdateError(t *testing.T) {
12122
12125
return errors .New ("test error" )
12123
12126
}
12124
12127
12125
- createStmt := `CREATE CHANGEFEED FOR foo WITH resolved='10ms', no_initial_scan`
12128
+ createStmt := `CREATE CHANGEFEED FOR foo
12129
+ WITH resolved='10ms', min_checkpoint_frequency='10ms', no_initial_scan`
12126
12130
testFeed := feed (t , f , createStmt )
12127
12131
defer closeFeed (t , testFeed )
12128
12132
0 commit comments