diff --git a/pkg/kv/kvserver/client_lease_test.go b/pkg/kv/kvserver/client_lease_test.go index b168f531eb5e..a527c4f05077 100644 --- a/pkg/kv/kvserver/client_lease_test.go +++ b/pkg/kv/kvserver/client_lease_test.go @@ -936,6 +936,12 @@ 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) for i := 0; i < numNodes; i++ { serverArgs[i] = base.TestServerArgs{ Locality: localities[i], diff --git a/pkg/kv/kvserver/replica_range_lease.go b/pkg/kv/kvserver/replica_range_lease.go index 9fdcfd84183b..3672c6d56e50 100644 --- a/pkg/kv/kvserver/replica_range_lease.go +++ b/pkg/kv/kvserver/replica_range_lease.go @@ -68,7 +68,7 @@ import ( "go.etcd.io/etcd/raft/v3" ) -var transferExpirationLeasesFirstEnabled = settings.RegisterBoolSetting( +var TransferExpirationLeasesFirstEnabled = settings.RegisterBoolSetting( settings.SystemOnly, "kv.transfer_expiration_leases_first.enabled", "controls whether we transfer expiration-based leases that are later upgraded to epoch-based ones", @@ -259,7 +259,7 @@ func (p *pendingLeaseRequest) InitOrJoinRequest( if p.repl.requiresExpiringLeaseRLocked() || (transfer && - transferExpirationLeasesFirstEnabled.Get(&p.repl.store.ClusterSettings().SV) && + TransferExpirationLeasesFirstEnabled.Get(&p.repl.store.ClusterSettings().SV) && p.repl.store.ClusterSettings().Version.IsActive(ctx, clusterversion.EnableLeaseUpgrade)) { // In addition to ranges that unconditionally require expiration-based // leases (node liveness and earlier), we also use them during lease