@@ -85,7 +85,7 @@ func TestClosedTimestampCanServe(t *testing.T) {
8585 // Disable the replicateQueue so that it doesn't interfere with replica
8686 // membership ranges.
8787 clusterArgs .ReplicationMode = base .ReplicationManual
88- tc , db0 , desc := setupClusterForClosedTSTesting (ctx , t , testingTargetDuration , clusterArgs , dbName , tableName )
88+ tc , db0 , desc := setupClusterForClosedTSTesting (ctx , t , testingTargetDuration , 0 , clusterArgs , dbName , tableName )
8989 defer tc .Stopper ().Stop (ctx )
9090
9191 if _ , err := db0 .Exec (`INSERT INTO cttest.kv VALUES(1, $1)` , "foo" ); err != nil {
@@ -156,7 +156,7 @@ func TestClosedTimestampCanServeOnVoterIncoming(t *testing.T) {
156156 clusterArgs .ReplicationMode = base .ReplicationManual
157157 knobs , ltk := makeReplicationTestKnobs ()
158158 clusterArgs .ServerArgs .Knobs = knobs
159- tc , db0 , desc := setupClusterForClosedTSTesting (ctx , t , testingTargetDuration , clusterArgs , dbName , tableName )
159+ tc , db0 , desc := setupClusterForClosedTSTesting (ctx , t , testingTargetDuration , 0 , clusterArgs , dbName , tableName )
160160 defer tc .Stopper ().Stop (ctx )
161161
162162 if _ , err := db0 .Exec (`INSERT INTO cttest.kv VALUES(1, $1)` , "foo" ); err != nil {
@@ -192,7 +192,7 @@ func TestClosedTimestampCanServeThroughoutLeaseTransfer(t *testing.T) {
192192 skip .UnderRace (t )
193193
194194 ctx := context .Background ()
195- tc , db0 , desc := setupClusterForClosedTSTesting (ctx , t , testingTargetDuration , aggressiveResolvedTimestampClusterArgs , "cttest" , "kv" )
195+ tc , db0 , desc := setupClusterForClosedTSTesting (ctx , t , testingTargetDuration , 0 , aggressiveResolvedTimestampClusterArgs , "cttest" , "kv" )
196196 defer tc .Stopper ().Stop (ctx )
197197 repls := replsForRange (ctx , t , tc , desc )
198198
@@ -270,7 +270,7 @@ func TestClosedTimestampCantServeWithConflictingIntent(t *testing.T) {
270270 defer txnwait .TestingOverrideTxnLivenessThreshold (time .Hour )()
271271
272272 ctx := context .Background ()
273- tc , _ , desc := setupClusterForClosedTSTesting (ctx , t , testingTargetDuration , aggressiveResolvedTimestampClusterArgs , "cttest" , "kv" )
273+ tc , _ , desc := setupClusterForClosedTSTesting (ctx , t , testingTargetDuration , 0 , aggressiveResolvedTimestampClusterArgs , "cttest" , "kv" )
274274 defer tc .Stopper ().Stop (ctx )
275275 repls := replsForRange (ctx , t , tc , desc )
276276 ds := tc .Server (0 ).DistSenderI ().(* kvcoord.DistSender )
@@ -377,7 +377,7 @@ func TestClosedTimestampCanServeAfterSplitAndMerges(t *testing.T) {
377377 skip .UnderRace (t )
378378
379379 ctx := context .Background ()
380- tc , db0 , desc := setupClusterForClosedTSTesting (ctx , t , testingTargetDuration , aggressiveResolvedTimestampClusterArgs , "cttest" , "kv" )
380+ tc , db0 , desc := setupClusterForClosedTSTesting (ctx , t , testingTargetDuration , 0 , aggressiveResolvedTimestampClusterArgs , "cttest" , "kv" )
381381 repls := replsForRange (ctx , t , tc , desc )
382382 // Disable the automatic merging.
383383 if _ , err := db0 .Exec ("SET CLUSTER SETTING kv.range_merge.queue_enabled = false" ); err != nil {
@@ -457,7 +457,7 @@ func TestClosedTimestampCantServeBasedOnUncertaintyLimit(t *testing.T) {
457457 ctx := context .Background ()
458458 // Set up the target duration to be very long and rely on lease transfers to
459459 // drive MaxClosed.
460- tc , db0 , desc := setupClusterForClosedTSTesting (ctx , t , testingTargetDuration , aggressiveResolvedTimestampClusterArgs , "cttest" , "kv" )
460+ tc , db0 , desc := setupClusterForClosedTSTesting (ctx , t , testingTargetDuration , 0 , aggressiveResolvedTimestampClusterArgs , "cttest" , "kv" )
461461 defer tc .Stopper ().Stop (ctx )
462462 repls := replsForRange (ctx , t , tc , desc )
463463
@@ -490,7 +490,7 @@ func TestClosedTimestampCanServeForWritingTransaction(t *testing.T) {
490490 skip .UnderRace (t )
491491
492492 ctx := context .Background ()
493- tc , db0 , desc := setupClusterForClosedTSTesting (ctx , t , testingTargetDuration , aggressiveResolvedTimestampClusterArgs , "cttest" , "kv" )
493+ tc , db0 , desc := setupClusterForClosedTSTesting (ctx , t , testingTargetDuration , 0 , aggressiveResolvedTimestampClusterArgs , "cttest" , "kv" )
494494 defer tc .Stopper ().Stop (ctx )
495495 repls := replsForRange (ctx , t , tc , desc )
496496
@@ -537,7 +537,7 @@ func TestClosedTimestampCantServeForNonTransactionalReadRequest(t *testing.T) {
537537 skip .UnderRace (t )
538538
539539 ctx := context .Background ()
540- tc , db0 , desc := setupClusterForClosedTSTesting (ctx , t , testingTargetDuration , aggressiveResolvedTimestampClusterArgs , "cttest" , "kv" )
540+ tc , db0 , desc := setupClusterForClosedTSTesting (ctx , t , testingTargetDuration , 0 , aggressiveResolvedTimestampClusterArgs , "cttest" , "kv" )
541541 defer tc .Stopper ().Stop (ctx )
542542 repls := replsForRange (ctx , t , tc , desc )
543543
@@ -579,7 +579,7 @@ func TestClosedTimestampCantServeForNonTransactionalBatch(t *testing.T) {
579579
580580 testutils .RunTrueAndFalse (t , "tsFromServer" , func (t * testing.T , tsFromServer bool ) {
581581 ctx := context .Background ()
582- tc , db0 , desc := setupClusterForClosedTSTesting (ctx , t , testingTargetDuration , aggressiveResolvedTimestampClusterArgs , "cttest" , "kv" )
582+ tc , db0 , desc := setupClusterForClosedTSTesting (ctx , t , testingTargetDuration , 0 , aggressiveResolvedTimestampClusterArgs , "cttest" , "kv" )
583583 defer tc .Stopper ().Stop (ctx )
584584 repls := replsForRange (ctx , t , tc , desc )
585585
@@ -722,8 +722,7 @@ func TestClosedTimestampFrozenAfterSubsumption(t *testing.T) {
722722 // Set up the closed timestamp timing such that, when we block a merge and
723723 // transfer the RHS lease, the closed timestamp advances over the LHS
724724 // lease but not over the RHS lease.
725- const numNodes = 3
726- tc , _ := setupTestClusterWithDummyRange (t , clusterArgs , "cttest" /* dbName */ , "kv" /* tableName */ , numNodes )
725+ tc , _ , _ := setupClusterForClosedTSTesting (ctx , t , 5 * time .Second , 100 * time .Millisecond , clusterArgs , "cttest" , "kv" )
727726 defer tc .Stopper ().Stop (ctx )
728727 sqlDB := sqlutils .MakeSQLRunner (tc .ServerConn (0 ))
729728 sqlDB .ExecMultiple (t , strings .Split (fmt .Sprintf (`
@@ -1195,19 +1194,22 @@ func aggressiveResolvedTimestampPushKnobs() *kvserver.StoreTestingKnobs {
11951194func setupClusterForClosedTSTesting (
11961195 ctx context.Context ,
11971196 t * testing.T ,
1198- targetDuration time.Duration ,
1197+ targetDuration , sideTransportInterval time.Duration ,
11991198 clusterArgs base.TestClusterArgs ,
12001199 dbName , tableName string ,
12011200) (tc serverutils.TestClusterInterface , db0 * gosql.DB , kvTableDesc roachpb.RangeDescriptor ) {
12021201 const numNodes = 3
1202+ if sideTransportInterval == 0 {
1203+ sideTransportInterval = targetDuration / 4
1204+ }
12031205 tc , desc := setupTestClusterWithDummyRange (t , clusterArgs , dbName , tableName , numNodes )
12041206 sqlRunner := sqlutils .MakeSQLRunner (tc .ServerConn (0 ))
12051207 sqlRunner .ExecMultiple (t , strings .Split (fmt .Sprintf (`
12061208SET CLUSTER SETTING kv.closed_timestamp.target_duration = '%s';
12071209SET CLUSTER SETTING kv.closed_timestamp.side_transport_interval = '%s';
12081210SET CLUSTER SETTING kv.closed_timestamp.follower_reads_enabled = true;
12091211SET CLUSTER SETTING kv.allocator.load_based_rebalancing = 'off';
1210- ` , targetDuration , targetDuration / 4 ),
1212+ ` , targetDuration , sideTransportInterval ),
12111213 ";" )... )
12121214
12131215 // Disable replicate queues to avoid errant lease transfers.
0 commit comments