Skip to content

Commit 0aee1bb

Browse files
committed
kv: deflake TestTxnCoordSenderRetries
Fixes cockroachdb#107847. This commit deflakes `TestTxnCoordSenderRetries`, which was observed to fail if a load-based split was performed at key "ab". A split at this key had the effect of turning the "write too old in staging commit" subtest into something closer to "multi-range batch commit with write too old (err on first range)", where the transaction record and write-write conflict were on different ranges. This commit deflakes the test by disabling load-based splits. While diagnosing the issue, I found two easy ways to reproduce the failure which demonstrate that load-based splitting was the source of the flakiness: - manually split at key "ab" - sleep for 10ms between each subtest, giving load-based splitting more time With load-based splitting disabled, the test passes under race+stress even with the 10ms pauses. Release note: None
1 parent 886515f commit 0aee1bb

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

pkg/kv/kvclient/kvcoord/dist_sender_server_test.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2012,6 +2012,11 @@ func TestTxnCoordSenderRetries(t *testing.T) {
20122012
return nil
20132013
}
20142014

2015+
// Disable load-based splitting to avoid unexpected range splits. The test
2016+
// operates between keys "a" and "z" and expects a single split point at "b".
2017+
// See the call to setupMultipleRanges below.
2018+
storeKnobs.DisableLoadBasedSplitting = true
2019+
20152020
var refreshSpansCondenseFilter atomic.Value
20162021
s := serverutils.StartServerOnly(t,
20172022
base.TestServerArgs{Knobs: base.TestingKnobs{
@@ -3181,10 +3186,10 @@ func TestTxnCoordSenderRetries(t *testing.T) {
31813186
// This test is like the previous one in that the commit batch succeeds at
31823187
// an updated timestamp, but this time the EndTxn puts the
31833188
// transaction in the STAGING state instead of COMMITTED because there had
3184-
// been previous write in a different batch. Like above, the commit is
3189+
// been a previous write in a different batch. Like above, the commit is
31853190
// successful since there are no refresh spans (the request will succeed
31863191
// after a server-side refresh).
3187-
name: "write too old in staging commit",
3192+
name: "write too old with put in staging commit",
31883193
beforeTxnStart: func(ctx context.Context, db *kv.DB) error {
31893194
return db.Put(ctx, "a", "orig")
31903195
},

0 commit comments

Comments
 (0)