From aa716488013eb021549761d9617a5a2e64a56dd7 Mon Sep 17 00:00:00 2001 From: Nathan VanBenschoten Date: Wed, 1 Sep 2021 22:36:06 -0400 Subject: [PATCH] kv: deflake TestPriorityRatchetOnAbortOrPush Fixes #68584. The test was flaky for the reasons described in #68584. There doesn't appear to be an easy way to fix this behavior, and it's not clear how valuable doing so even is given how little we rely on transaction priorities anymore, so the commit just deflakes the test by rejecting them. Release justification: deflaking a test. --- pkg/kv/kvclient/kvcoord/txn_test.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pkg/kv/kvclient/kvcoord/txn_test.go b/pkg/kv/kvclient/kvcoord/txn_test.go index 8a286075f9ba..9a33a94302e8 100644 --- a/pkg/kv/kvclient/kvcoord/txn_test.go +++ b/pkg/kv/kvclient/kvcoord/txn_test.go @@ -202,7 +202,17 @@ func TestLostUpdate(t *testing.T) { func TestPriorityRatchetOnAbortOrPush(t *testing.T) { defer leaktest.AfterTest(t)() defer log.Scope(t).Close(t) - s := createTestDB(t) + s := createTestDBWithKnobs(t, &kvserver.StoreTestingKnobs{ + TestingRequestFilter: func(_ context.Context, ba roachpb.BatchRequest) *roachpb.Error { + // Reject transaction heartbeats, which can make the test flaky when they + // detect an aborted transaction before the Get operation does. See #68584 + // for an explanation. + if ba.IsSingleHeartbeatTxnRequest() { + return roachpb.NewErrorf("rejected") + } + return nil + }, + }) defer s.Stop() pushByReading := func(key roachpb.Key) {