Skip to content

Commit 80b8bf8

Browse files
committed
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: cockroachdb#105101 Epic: none Release note: None
1 parent 1382b26 commit 80b8bf8

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pkg/kv/kvserver/client_lease_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -947,6 +947,13 @@ func TestLeasePreferencesDuringOutage(t *testing.T) {
947947
locality("us", "mi"),
948948
locality("us", "mi"),
949949
}
950+
// Disable expiration based lease transfers. It is possible that a (pseudo)
951+
// dead node acquires the lease and we are forced to wait out the expiration
952+
// timer, if this were not set.
953+
settings := cluster.MakeTestingClusterSettings()
954+
sv := &settings.SV
955+
kvserver.TransferExpirationLeasesFirstEnabled.Override(ctx, sv, false)
956+
kvserver.ExpirationLeasesOnly.Override(ctx, sv, false)
950957
for i := 0; i < numNodes; i++ {
951958
serverArgs[i] = base.TestServerArgs{
952959
Locality: localities[i],

0 commit comments

Comments
 (0)