Skip to content

Commit 1fb0eac

Browse files
committed
catalog/lease: fix flake for TestTableCreationPushesTxnsInRecentPast
Previously, TestTableCreationPushesTxnsInRecentPast could flake because we attempted to increase the uncertainty interval error by adding a delay on KV RPC calls to make the uncertainty interval larger. This would work based on the observed timestamp having a variance between nodes. This wasn't effective, and we could still have intermittent failures, because the variance was not large enough. To address this, this patch will increase the maximum offset on the HLC clock itself, which is used as the base value for computing the uncertainty interval (see computeIntervalForTxn). With this change, we expect a more deterministic reproduction of the txn getting pushed because of the uncertainty interval. Fixes: #114366 Release note: None
1 parent f71ed12 commit 1fb0eac

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

pkg/sql/catalog/lease/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ go_test(
8888
"//pkg/jobs/jobspb",
8989
"//pkg/keys",
9090
"//pkg/kv",
91-
"//pkg/kv/kvclient/kvcoord",
9291
"//pkg/kv/kvpb",
9392
"//pkg/kv/kvserver",
9493
"//pkg/kv/kvserver/kvserverbase",

pkg/sql/catalog/lease/lease_test.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import (
2828
"github.com/cockroachdb/cockroach/pkg/jobs/jobspb"
2929
"github.com/cockroachdb/cockroach/pkg/keys"
3030
"github.com/cockroachdb/cockroach/pkg/kv"
31-
"github.com/cockroachdb/cockroach/pkg/kv/kvclient/kvcoord"
3231
"github.com/cockroachdb/cockroach/pkg/kv/kvpb"
3332
"github.com/cockroachdb/cockroach/pkg/kv/kvserver"
3433
"github.com/cockroachdb/cockroach/pkg/kv/kvserver/kvserverbase"
@@ -2028,12 +2027,8 @@ func TestTableCreationPushesTxnsInRecentPast(t *testing.T) {
20282027
tc := serverutils.StartCluster(t, 3, base.TestClusterArgs{
20292028
ServerArgs: base.TestServerArgs{
20302029
Knobs: base.TestingKnobs{
2031-
KVClient: &kvcoord.ClientTestingKnobs{
2032-
// Intentionally add latency so that the uncertainty
2033-
// limit is higher to reduce the risk of this test flaking.
2034-
LatencyFunc: func(id roachpb.NodeID) (time.Duration, bool) {
2035-
return time.Millisecond * 100, true
2036-
},
2030+
Store: &kvserver.StoreTestingKnobs{
2031+
MaxOffset: time.Second,
20372032
},
20382033
},
20392034
DefaultTestTenant: base.TestDoesNotWorkWithSecondaryTenantsButWeDontKnowWhyYet(109385),

0 commit comments

Comments
 (0)