Skip to content

Commit 2cd752f

Browse files
roachtest: replace kv/splits with splits perturbation test (#170090)
roachtest: replace kv/splits with splits perturbation test
2 parents e11d23c + 9314462 commit 2cd752f

6 files changed

Lines changed: 1244 additions & 134 deletions

File tree

pkg/cmd/roachtest/tests/kv.go

Lines changed: 0 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -767,105 +767,6 @@ func drainWithIpTables(
767767
c.Start(ctx, t.L(), startOpts, install.MakeClusterSettings(), restartNode)
768768
}
769769

770-
func registerKVSplits(r registry.Registry) {
771-
for _, item := range []struct {
772-
quiesce bool
773-
splits int
774-
leases registry.LeaseType
775-
timeout time.Duration
776-
envVars []string
777-
}{
778-
// NB: with 500000 splits, this test sometimes fails since it's pushing
779-
// far past the number of replicas per node we support, at least if the
780-
// ranges start to unquiesce (which can set off a cascade due to resource
781-
// exhaustion).
782-
{true, 200_000, registry.EpochLeases, 140 * time.Minute, nil},
783-
// This version of the test prevents range quiescence to trigger the
784-
// badness described above more reliably for when we wish to improve
785-
// the performance. For now, just verify that 30k unquiesced ranges
786-
// is tenable.
787-
{false, 30_000, registry.EpochLeases, 2 * time.Hour, nil},
788-
// Expiration-based leases prevent quiescence, and are also more expensive
789-
// to keep alive. Again, just verify that 30k ranges is ok.
790-
{false, 30_000, registry.ExpirationLeases, 2 * time.Hour, nil},
791-
// Leader leases without quiescence perform similarly to epoch leases
792-
// without quiescence. Even though epoch leases are set to reach 30k, they
793-
// also reach 60k reliably.
794-
{false, 60_000, registry.LeaderLeases, 2 * time.Hour, nil},
795-
// Leader leases with quiescence don't quite match epoch leases with
796-
// quiescence because in leader leases only the followers ever quiesce.
797-
{true, 80_000, registry.LeaderLeases, 2 * time.Hour, nil},
798-
// With some additional tuning, leader leases can do even better. The extended interval allow
799-
// for more flexibility in extending store liveness support, and prevent support withdrawals at
800-
// higher CPU utilization when goroutine scheduling latency is high.
801-
{
802-
true, 100_000, registry.LeaderLeases, 2 * time.Hour,
803-
[]string{
804-
"COCKROACH_STORE_LIVENESS_SUPPORT_EXPIRY_INTERVAL=1s",
805-
"COCKROACH_STORE_LIVENESS_HEARTBEAT_INTERVAL=3s",
806-
"COCKROACH_STORE_LIVENESS_SUPPORT_DURATION=6s",
807-
},
808-
},
809-
} {
810-
item := item // for use in closure below
811-
name := fmt.Sprintf("kv/splits/nodes=3/quiesce=%t/lease=%s", item.quiesce, item.leases)
812-
if item.envVars != nil {
813-
name += "/tuned"
814-
}
815-
r.Add(registry.TestSpec{
816-
Name: name,
817-
Owner: registry.OwnerKV,
818-
Timeout: item.timeout,
819-
Cluster: r.MakeClusterSpec(
820-
4,
821-
spec.WorkloadNode(),
822-
spec.RandomizeVolumeType(),
823-
spec.RandomlyUseXfs(),
824-
),
825-
// These tests are carefully tuned to succeed up to certain number of
826-
// splits; they are flaky in slower environments.
827-
CompatibleClouds: registry.Clouds(spec.GCE, spec.Local),
828-
Suites: registry.Suites(registry.Nightly),
829-
Leases: item.leases,
830-
Run: func(ctx context.Context, t test.Test, c cluster.Cluster) {
831-
nodes := c.Spec().NodeCount - 1
832-
833-
settings := install.MakeClusterSettings()
834-
// Enable continuous Go execution tracing to aid diagnosis of
835-
// overload-driven failures. See #166402.
836-
settings.ClusterSettings["obs.execution_tracer.interval"] = "10s"
837-
settings.ClusterSettings["obs.execution_tracer.duration"] = "10s"
838-
settings.ClusterSettings["obs.execution_tracer.total_dump_size_limit"] = "10 GiB"
839-
settings.Env = append(settings.Env, "COCKROACH_MEMPROF_INTERVAL=1m", "COCKROACH_DISABLE_QUIESCENCE="+strconv.FormatBool(!item.quiesce))
840-
settings.Env = append(settings.Env, item.envVars...)
841-
if !item.quiesce {
842-
settings.ClusterSettings["kv.raft.store_liveness.quiescence.enabled"] = "false"
843-
}
844-
startOpts := option.NewStartOpts(option.NoBackupSchedule)
845-
startOpts.RoachprodOpts.ExtraArgs = append(startOpts.RoachprodOpts.ExtraArgs, "--cache=256MiB")
846-
c.Start(ctx, t.L(), startOpts, settings, c.CRDBNodes())
847-
848-
t.Status("running workload")
849-
workloadCtx, workloadCancel := context.WithCancel(ctx)
850-
m := c.NewDeprecatedMonitor(workloadCtx, c.CRDBNodes())
851-
m.Go(func(ctx context.Context) error {
852-
defer workloadCancel()
853-
concurrency := roachtestutil.IfLocal(c, "", " --concurrency="+fmt.Sprint(nodes*64))
854-
splits := " --splits=" + roachtestutil.IfLocal(c, "2000", fmt.Sprint(item.splits))
855-
cmd := fmt.Sprintf(
856-
"./cockroach workload run kv --init --max-ops=1"+
857-
concurrency+splits+
858-
" {pgurl%s}",
859-
c.CRDBNodes())
860-
c.Run(ctx, option.WithNodes(c.WorkloadNode()), cmd)
861-
return nil
862-
})
863-
m.Wait()
864-
},
865-
})
866-
}
867-
}
868-
869770
func registerKVScalability(r registry.Registry) {
870771
runScalability := func(ctx context.Context, t test.Test, c cluster.Cluster, percent int) {
871772
nodes := len(c.CRDBNodes())

pkg/cmd/roachtest/tests/perturbation/BUILD.bazel

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ go_library(
1414
"network_partition.go",
1515
"restart_node.go",
1616
"slow_disk.go",
17+
"splits.go",
1718
],
1819
importpath = "github.com/cockroachdb/cockroach/pkg/cmd/roachtest/tests/perturbation",
1920
visibility = ["//visibility:public"],
@@ -23,6 +24,7 @@ go_library(
2324
"//pkg/cmd/roachtest/registry",
2425
"//pkg/cmd/roachtest/roachtestutil",
2526
"//pkg/cmd/roachtest/roachtestutil/artifactsutil",
27+
"//pkg/cmd/roachtest/roachtestutil/task",
2628
"//pkg/cmd/roachtest/spec",
2729
"//pkg/cmd/roachtest/test",
2830
"//pkg/roachprod/install",
@@ -34,6 +36,7 @@ go_library(
3436
"//pkg/workload/cli",
3537
"//pkg/workload/histogram",
3638
"@com_github_cockroachdb_errors//:errors",
39+
"@com_github_lib_pq//:pq",
3740
"@com_github_stretchr_testify//require",
3841
],
3942
)

0 commit comments

Comments
 (0)