Skip to content

Commit e2f1d38

Browse files
committed
roachtest: deprecate the cluster monitor
Now that we have the global test monitor and goroutine management through task.Tasker, we should direct test writers away from the old monitor. This changes the name of newMonitor to newDeprecated monitor as well as adding a deprecated comment.
1 parent 1b87ee7 commit e2f1d38

File tree

81 files changed

+159
-153
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+159
-153
lines changed

pkg/cmd/roachtest/cluster.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3027,13 +3027,15 @@ func (c *clusterImpl) Extend(ctx context.Context, d time.Duration, l *logger.Log
30273027
return nil
30283028
}
30293029

3030-
// NewMonitor creates a monitor that can watch for unexpected crdb node deaths on m.Wait()
3030+
// NewDeprecatedMonitor creates a monitor that can watch for unexpected crdb node deaths on m.Wait()
30313031
// and provide roachtest safe goroutines.
30323032
//
30333033
// As a general rule, if the user has a workload node, do not monitor it. A
30343034
// monitor's semantics around handling expected node deaths breaks down if it's
30353035
// monitoring a workload node.
3036-
func (c *clusterImpl) NewMonitor(ctx context.Context, opts ...option.Option) cluster.Monitor {
3036+
func (c *clusterImpl) NewDeprecatedMonitor(
3037+
ctx context.Context, opts ...option.Option,
3038+
) cluster.Monitor {
30373039
return newMonitor(ctx, c.t, c, false /* expectExactProcessDeath */, opts...)
30383040
}
30393041

pkg/cmd/roachtest/cluster/cluster_interface.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,11 @@ type Cluster interface {
6666
Stop(ctx context.Context, l *logger.Logger, stopOpts option.StopOpts, opts ...option.Option)
6767
SignalE(ctx context.Context, l *logger.Logger, sig int, opts ...option.Option) error
6868
Signal(ctx context.Context, l *logger.Logger, sig int, opts ...option.Option)
69-
NewMonitor(context.Context, ...option.Option) Monitor
69+
70+
// NewDeprecatedMonitor is deprecated: See #118214
71+
// Instead, use task.Tasker for goroutine management (e.g. test.Go) and test.Monitor
72+
// for monitoring unexpected process deaths (e.g. through the test spec Monitor option)
73+
NewDeprecatedMonitor(context.Context, ...option.Option) Monitor
7074

7175
// Starting virtual clusters.
7276

pkg/cmd/roachtest/clusterstats/mock_cluster_generated_test.go

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/cmd/roachtest/registry/test_spec.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ type TestSpec struct {
191191
Randomized bool
192192

193193
// Monitor specifies whether the test initiates a process monitor. Eventually,
194-
// this should replace all instances of `cluster.NewMonitor`. To make this
194+
// this should replace all instances of `cluster.NewDeprecatedMonitor`. To make this
195195
// transition, tests should be modified to utilize the `test.Monitor` and
196196
// `roachtestutil.Task` interfaces provided with each test.
197197
Monitor bool

pkg/cmd/roachtest/tests/admission_control_disk_bandwidth_overload.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ func registerDiskBandwidthOverload(r registry.Registry) {
9595

9696
// Run foreground kv workload, QoS="regular".
9797
duration := 90 * time.Minute
98-
m := c.NewMonitor(ctx, c.CRDBNodes())
98+
m := c.NewDeprecatedMonitor(ctx, c.CRDBNodes())
9999
m.Go(func(ctx context.Context) error {
100100
t.Status(fmt.Sprintf("starting foreground kv workload thread (<%s)", time.Minute))
101101
dur := " --duration=" + duration.String()

pkg/cmd/roachtest/tests/admission_control_disk_iops_overload.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ func registerDiskIOPSOverload(r registry.Registry) {
9090

9191
// Run foreground kv workload, QoS="regular".
9292
duration := 90 * time.Minute
93-
m := c.NewMonitor(ctx, c.CRDBNodes())
93+
m := c.NewDeprecatedMonitor(ctx, c.CRDBNodes())
9494
m.Go(func(ctx context.Context) error {
9595
t.Status(fmt.Sprintf("starting foreground kv workload thread (<%s)", time.Minute))
9696
dur := " --duration=" + duration.String()

pkg/cmd/roachtest/tests/admission_control_elastic_backup.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ func registerElasticControlForBackups(r registry.Registry) {
8080
t.Status(fmt.Sprintf("during: enabling admission control (<%s)", 30*time.Second))
8181
roachtestutil.SetAdmissionControl(ctx, t, c, true)
8282

83-
m := c.NewMonitor(ctx, c.CRDBNodes())
83+
m := c.NewDeprecatedMonitor(ctx, c.CRDBNodes())
8484
m.Go(func(ctx context.Context) error {
8585
t.Status(fmt.Sprintf("during: creating full backup schedule to run every 20m (<%s)", time.Minute))
8686
bucketPrefix := "gs"

pkg/cmd/roachtest/tests/admission_control_elastic_cdc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ func registerElasticControlForCDC(r registry.Registry) {
105105
stopFeeds(db) // stop stray feeds (from repeated runs against the same cluster for ex.)
106106
defer stopFeeds(db)
107107

108-
m := c.NewMonitor(ctx, c.CRDBNodes())
108+
m := c.NewDeprecatedMonitor(ctx, c.CRDBNodes())
109109
m.Go(func(ctx context.Context) error {
110110
const iters, changefeeds = 5, 10
111111
for i := 0; i < iters; i++ {

pkg/cmd/roachtest/tests/admission_control_elastic_io.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func registerElasticIO(r registry.Registry) {
6969
roachtestutil.SetAdmissionControl(ctx, t, c, true)
7070
duration := 30 * time.Minute
7171
t.Status("running workload")
72-
m := c.NewMonitor(ctx, c.CRDBNodes())
72+
m := c.NewDeprecatedMonitor(ctx, c.CRDBNodes())
7373
labels := map[string]string{
7474
"duration": fmt.Sprintf("%d", duration.Milliseconds()),
7575
"concurrency": "512",

pkg/cmd/roachtest/tests/admission_control_elastic_mixed_version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ func registerElasticWorkloadMixedVersion(r registry.Registry) {
110110
}
111111
runWorkloads := func(ctx2 context.Context) error {
112112
const duration = 5 * time.Minute
113-
m := c.NewMonitor(ctx, c.CRDBNodes())
113+
m := c.NewDeprecatedMonitor(ctx, c.CRDBNodes())
114114
m.Go(func(ctx context.Context) error { return runForeground(ctx, duration) })
115115
m.Go(func(ctx context.Context) error { return runBackground(ctx, duration) })
116116
return m.WaitE()

0 commit comments

Comments
 (0)