File tree Expand file tree Collapse file tree 4 files changed +18
-10
lines changed Expand file tree Collapse file tree 4 files changed +18
-10
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ import (
1313)
1414
1515const (
16- defaultMaxNetworkRTT = 150 * time .Millisecond
16+ DefaultMaxNetworkRTT = 150 * time .Millisecond
1717)
1818
1919// computeLeadTimeForGlobalReads calculates how far ahead of the current time a
@@ -118,7 +118,7 @@ func TargetForPolicy(
118118 targetOffsetTime = leadTargetOverride
119119 break
120120 }
121- targetOffsetTime = computeLeadTimeForGlobalReads (defaultMaxNetworkRTT ,
121+ targetOffsetTime = computeLeadTimeForGlobalReads (DefaultMaxNetworkRTT ,
122122 maxClockOffset , sideTransportCloseInterval )
123123 default :
124124 panic ("unexpected RangeClosedTimestampPolicy" )
Original file line number Diff line number Diff line change @@ -2737,6 +2737,21 @@ func (r *Replica) GetMutexForTesting() *ReplicaMutex {
27372737 return & r .mu .ReplicaMutex
27382738}
27392739
2740+ // TODO(wenyihu6): rename the *ForTesting functions to be Testing* (see
2741+ // #144119 for more details).
2742+
2743+ // SetCachedClosedTimestampPolicyForTesting sets the closed timestamp policy on r
2744+ // to be the given policy. It is a test-only helper method.
2745+ func (r * Replica ) SetCachedClosedTimestampPolicyForTesting (policy ctpb.RangeClosedTimestampPolicy ) {
2746+ r .cachedClosedTimestampPolicy .Store (int32 (policy ))
2747+ }
2748+
2749+ // GetCachedClosedTimestampPolicyForTesting returns the closed timestamp policy on r.
2750+ // It is a test-only helper method.
2751+ func (r * Replica ) GetCachedClosedTimestampPolicyForTesting () ctpb.RangeClosedTimestampPolicy {
2752+ return ctpb .RangeClosedTimestampPolicy (r .cachedClosedTimestampPolicy .Load ())
2753+ }
2754+
27402755// maybeEnqueueProblemRange will enqueue the replica for processing into the
27412756// replicate queue iff:
27422757//
Original file line number Diff line number Diff line change @@ -16,7 +16,6 @@ import (
1616 "github.com/cockroachdb/cockroach/pkg/kv"
1717 "github.com/cockroachdb/cockroach/pkg/kv/kvpb"
1818 "github.com/cockroachdb/cockroach/pkg/kv/kvserver/batcheval"
19- "github.com/cockroachdb/cockroach/pkg/kv/kvserver/closedts/ctpb"
2019 "github.com/cockroachdb/cockroach/pkg/kv/kvserver/concurrency/lock"
2120 "github.com/cockroachdb/cockroach/pkg/roachpb"
2221 "github.com/cockroachdb/cockroach/pkg/testutils"
@@ -31,12 +30,6 @@ import (
3130 "golang.org/x/sync/errgroup"
3231)
3332
34- // TestingSetCachedClosedTimestampPolicy sets the closed timestamp policy on r
35- // to be the given policy. It is a test-only helper method.
36- func (r * Replica ) TestingSetCachedClosedTimestampPolicy (policy ctpb.RangeClosedTimestampPolicy ) {
37- r .cachedClosedTimestampPolicy .Store (int32 (policy ))
38- }
39-
4033func TestSideTransportClosed (t * testing.T ) {
4134 defer leaktest .AfterTest (t )()
4235 defer log .Scope (t ).Close (t )
Original file line number Diff line number Diff line change @@ -1095,7 +1095,7 @@ func TestClosedTimestampPolicyRefreshIntervalOnLeaseTransfers(t *testing.T) {
10951095 })
10961096
10971097 // Force repl2 policy to be LAG_BY_CLUSTER_SETTING.
1098- repl2 .TestingSetCachedClosedTimestampPolicy (ctpb .LAG_BY_CLUSTER_SETTING )
1098+ repl2 .SetCachedClosedTimestampPolicyForTesting (ctpb .LAG_BY_CLUSTER_SETTING )
10991099 require .Equal (t , roachpb .LAG_BY_CLUSTER_SETTING , repl2 .GetRangeInfo (ctx ).ClosedTimestampPolicy )
11001100
11011101 // Ensure that transferring the lease to repl2 does trigger a lease refresh.
You can’t perform that action at this time.
0 commit comments