diff --git a/pkg/cmd/roachtest/registry/test_spec.go b/pkg/cmd/roachtest/registry/test_spec.go index a06ef44f92f1..98feded22697 100644 --- a/pkg/cmd/roachtest/registry/test_spec.go +++ b/pkg/cmd/roachtest/registry/test_spec.go @@ -224,6 +224,8 @@ func (l LeaseType) String() string { return "epoch" case ExpirationLeases: return "expiration" + case LeaderLeases: + return "leader" case MetamorphicLeases: return "metamorphic" default: @@ -238,8 +240,11 @@ const ( EpochLeases // ExpirationLeases uses expiration leases for all ranges. ExpirationLeases + // LeaderLeases uses leader leases where possible. + LeaderLeases // MetamorphicLeases randomly chooses epoch or expiration - // leases (across the entire cluster) + // leases (across the entire cluster). + // TODO(nvanbenschoten): add leader leases to this mix. MetamorphicLeases ) diff --git a/pkg/cmd/roachtest/test_runner.go b/pkg/cmd/roachtest/test_runner.go index f05b3acbe6f2..da14016903f2 100644 --- a/pkg/cmd/roachtest/test_runner.go +++ b/pkg/cmd/roachtest/test_runner.go @@ -903,8 +903,12 @@ func (r *testRunner) runWorker( case registry.DefaultLeases: case registry.EpochLeases: c.clusterSettings["kv.expiration_leases_only.enabled"] = "false" + c.clusterSettings["kv.raft.leader_fortification.fraction_enabled"] = "0.0" case registry.ExpirationLeases: c.clusterSettings["kv.expiration_leases_only.enabled"] = "true" + case registry.LeaderLeases: + c.clusterSettings["kv.expiration_leases_only.enabled"] = "false" + c.clusterSettings["kv.raft.leader_fortification.fraction_enabled"] = "1.0" case registry.MetamorphicLeases: enabled := prng.Float64() < 0.5 c.status(fmt.Sprintf("metamorphically setting kv.expiration_leases_only.enabled = %t", diff --git a/pkg/cmd/roachtest/tests/failover.go b/pkg/cmd/roachtest/tests/failover.go index 91cc4d74d1dd..3db946f714bf 100644 --- a/pkg/cmd/roachtest/tests/failover.go +++ b/pkg/cmd/roachtest/tests/failover.go @@ -59,10 +59,20 @@ var rangeLeaseRenewalDuration = func() time.Duration { // requests are successful with nominal latencies. See also: // https://github.com/cockroachdb/cockroach/issues/103654 func registerFailover(r registry.Registry) { - for _, leases := range []registry.LeaseType{registry.EpochLeases, registry.ExpirationLeases} { + leaseTypes := []registry.LeaseType{registry.EpochLeases, registry.ExpirationLeases, registry.LeaderLeases} + for _, leases := range leaseTypes { var leasesStr string - if leases == registry.ExpirationLeases { + switch leases { + case registry.EpochLeases: + // TODO(nvanbenschoten): when leader leases become the default, we should + // change this to "/lease=epoch" and change leader leases to "". + leasesStr = "" + case registry.ExpirationLeases: leasesStr = "/lease=expiration" + case registry.LeaderLeases: + leasesStr = "/lease=leader" + default: + panic(errors.AssertionFailedf("unknown lease type: %v", leases)) } for _, readOnly := range []bool{false, true} { diff --git a/pkg/cmd/roachtest/tests/tpcc.go b/pkg/cmd/roachtest/tests/tpcc.go index 6361501e38f3..5705321cd756 100644 --- a/pkg/cmd/roachtest/tests/tpcc.go +++ b/pkg/cmd/roachtest/tests/tpcc.go @@ -1280,7 +1280,8 @@ type tpccBenchSpec struct { // Encryption-At-Rest / EAR). EncryptionEnabled bool // ExpirationLeases enables use of expiration-based leases. - ExpirationLeases bool + ExpirationLeases bool + // TODO(nvanbenschoten): add a leader lease variant. EnableDefaultScheduledBackup bool // SharedProcessMT, if true, indicates that the cluster should run in // shared-process mode of multi-tenancy.