From 80b8bf88b78ce993bcae0b171c42d8755e0e6c04 Mon Sep 17 00:00:00 2001 From: Austen McClernon Date: Mon, 7 Aug 2023 21:41:58 +0000 Subject: [PATCH] kvserver: deflake lease preferences during outage Previously, it was possible for a soon to be dead replica, to acquire the range lease in the `TestLeasePreferencesDuringOutage` test. The acquired lease would be expiration based, disallowing the intended leaseholder from acquiring the lease. This patch disables expiration based lease transfers, deflaking the test. Resolves: #105101 Epic: none Release note: None --- pkg/kv/kvserver/client_lease_test.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/kv/kvserver/client_lease_test.go b/pkg/kv/kvserver/client_lease_test.go index 01134c494eb8..35ce53d70084 100644 --- a/pkg/kv/kvserver/client_lease_test.go +++ b/pkg/kv/kvserver/client_lease_test.go @@ -947,6 +947,13 @@ func TestLeasePreferencesDuringOutage(t *testing.T) { locality("us", "mi"), locality("us", "mi"), } + // Disable expiration based lease transfers. It is possible that a (pseudo) + // dead node acquires the lease and we are forced to wait out the expiration + // timer, if this were not set. + settings := cluster.MakeTestingClusterSettings() + sv := &settings.SV + kvserver.TransferExpirationLeasesFirstEnabled.Override(ctx, sv, false) + kvserver.ExpirationLeasesOnly.Override(ctx, sv, false) for i := 0; i < numNodes; i++ { serverArgs[i] = base.TestServerArgs{ Locality: localities[i],