Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release-24.3: roachtest: add failover variants with leader leases #133369

Merged
merged 1 commit into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion pkg/cmd/roachtest/registry/test_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,8 @@ func (l LeaseType) String() string {
return "epoch"
case ExpirationLeases:
return "expiration"
case LeaderLeases:
return "leader"
case MetamorphicLeases:
return "metamorphic"
default:
Expand All @@ -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
)

Expand Down
4 changes: 4 additions & 0 deletions pkg/cmd/roachtest/test_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
14 changes: 12 additions & 2 deletions pkg/cmd/roachtest/tests/failover.go
Original file line number Diff line number Diff line change
Expand Up @@ -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} {
Expand Down
3 changes: 2 additions & 1 deletion pkg/cmd/roachtest/tests/tpcc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down