Skip to content

Commit 9e84acb

Browse files
committed
roachtest/sqlsmith: avoid using go keyword
Use `cluster.Monitor.Go` to prevent abruptly crashing the nightly run. Release note: None
1 parent fbaa7ff commit 9e84acb

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

pkg/cmd/roachtest/tests/sqlsmith.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,8 @@ WITH into_db = 'defaultdb', unsafe_restore_incompatible_version;
194194
stmt := ""
195195
err := func() error {
196196
done := make(chan error, 1)
197-
go func(context.Context) {
197+
m := c.NewMonitor(ctx, c.Node(1))
198+
m.Go(func(context.Context) error {
198199
// Generate can potentially panic in bad cases, so
199200
// to avoid Go routines from dying we are going
200201
// catch that here, and only pass the error into
@@ -210,7 +211,7 @@ WITH into_db = 'defaultdb', unsafe_restore_incompatible_version;
210211
if stmt == "" {
211212
// If an empty statement is generated, then ignore it.
212213
done <- errors.Newf("Empty statement returned by generate")
213-
return
214+
return nil
214215
}
215216

216217
// TODO(yuzefovich): investigate why using the context with
@@ -225,7 +226,9 @@ WITH into_db = 'defaultdb', unsafe_restore_incompatible_version;
225226
}
226227
}
227228
done <- err
228-
}(ctx)
229+
return nil
230+
})
231+
defer m.Wait()
229232
select {
230233
case <-time.After(timeout * 2):
231234
// SQLSmith generates queries that either perform full table scans of

0 commit comments

Comments
 (0)