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+
4659const numFullBackups = 3
4760
4861type 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