Skip to content

Commit

Permalink
workload/schemachange: address intermittent failures with select stmts
Browse files Browse the repository at this point in the history
Fixes: #91445

Previously, we added logic to detect memory budget, and disk budget
errors but those were only when opening a result set. Unfortunately,
these errors can also be hit when consuming the rows themselves.
To address this, this patch will detect the same errors
and ignore them if detected consuming the result set.

Release note: None
  • Loading branch information
fqazi committed Nov 8, 2022
1 parent d9cc084 commit a66093a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/workload/schemachange/operation_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -3537,6 +3537,16 @@ func (og *operationGenerator) selectStmt(ctx context.Context, tx pgx.Tx) (stmt *
}
}
if err := rows.Err(); err != nil {
pgErr := new(pgconn.PgError)
// For select statements, we can have out of memory or temporary
// space errors at runtime when fetching the result set. So,
// deal with the min here.
if errors.As(err, &pgErr) &&
stmt.potentialExecErrors.contains(pgcode.MakeCode(pgErr.Code)) {
return errors.Mark(errors.Wrap(err, "ROLLBACK; Successfully got expected execution error."),
errRunInTxnRbkSentinel,
)
}
return err
}
return nil
Expand Down

0 comments on commit a66093a

Please sign in to comment.