Skip to content

Commit aa35135

Browse files
authored
Merge pull request #158359 from msbutler/backport24.3-158289
release-24.3: roachtest: route more schema change workload flakes to foundations
2 parents ca3452b + 98a56bb commit aa35135

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

pkg/cmd/roachtest/tests/backup_restore_roundtrip.go

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,19 @@ var (
4343
}
4444
)
4545

46+
func handleSchemaChangeWorkloadError(err error) error {
47+
// If the UNEXPECTED ERROR detail appears, the workload likely flaked.
48+
// Otherwise, the workload could have failed due to other reasons like a node
49+
// crash.
50+
if err != nil {
51+
flattenedErr := errors.FlattenDetails(err)
52+
if strings.Contains(flattenedErr, "UNEXPECTED ERROR") || strings.Contains(flattenedErr, "UNEXPECTED COMMIT ERROR") {
53+
return registry.ErrorWithOwner(registry.OwnerSQLFoundations, errors.Wrapf(err, "schema change workload failed"))
54+
}
55+
}
56+
return err
57+
}
58+
4659
const numFullBackups = 3
4760

4861
type roundTripSpecs struct {
@@ -251,18 +264,9 @@ func startBackgroundWorkloads(
251264
return nil, err
252265
}
253266

254-
handleChemaChangeError := func(err error) error {
255-
// If the UNEXPECTED ERROR detail appears, the workload likely flaked.
256-
// Otherwise, the workload could have failed due to other reasons like a node
257-
// crash.
258-
if err != nil && strings.Contains(errors.FlattenDetails(err), "UNEXPECTED ERROR") {
259-
return registry.ErrorWithOwner(registry.OwnerSQLFoundations, errors.Wrapf(err, "schema change workload failed"))
260-
}
261-
return err
262-
}
263267
err = c.RunE(ctx, option.WithNodes(workloadNode), scInit.String())
264268
if err != nil {
265-
return nil, handleChemaChangeError(err)
269+
return nil, handleSchemaChangeWorkloadError(err)
266270
}
267271

268272
run := func() (func(), error) {
@@ -279,7 +283,7 @@ func startBackgroundWorkloads(
279283
})
280284
stopSC := workloadWithCancel(m, func(ctx context.Context) error {
281285
if err := c.RunE(ctx, option.WithNodes(workloadNode), scRun.String()); err != nil {
282-
return handleChemaChangeError(err)
286+
return handleSchemaChangeWorkloadError(err)
283287
}
284288
return nil
285289
})

0 commit comments

Comments
 (0)