diff --git a/pkg/kv/kvserver/client_lease_test.go b/pkg/kv/kvserver/client_lease_test.go index 7de20b692274..eb8c8b6c4479 100644 --- a/pkg/kv/kvserver/client_lease_test.go +++ b/pkg/kv/kvserver/client_lease_test.go @@ -950,6 +950,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], diff --git a/pkg/kv/kvserver/replica_range_lease.go b/pkg/kv/kvserver/replica_range_lease.go index 95ddc3f91529..dfed63081aea 100644 --- a/pkg/kv/kvserver/replica_range_lease.go +++ b/pkg/kv/kvserver/replica_range_lease.go @@ -71,7 +71,7 @@ import ( "github.com/cockroachdb/redact" ) -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", @@ -281,7 +281,7 @@ func (p *pendingLeaseRequest) InitOrJoinRequest( if p.repl.shouldUseExpirationLeaseRLocked() || (transfer && - transferExpirationLeasesFirstEnabled.Get(&p.repl.store.ClusterSettings().SV) && + TransferExpirationLeasesFirstEnabled.Get(&p.repl.store.ClusterSettings().SV) && p.repl.store.ClusterSettings().Version.IsActive(ctx, clusterversion.TODODelete_V22_2EnableLeaseUpgrade)) { // In addition to ranges that should be using expiration-based leases // (typically the meta and liveness ranges), we also use them during lease