From a66093ac18830e998140e394c806d02f027060e2 Mon Sep 17 00:00:00 2001 From: Faizan Qazi Date: Mon, 7 Nov 2022 22:27:50 +0000 Subject: [PATCH] workload/schemachange: address intermittent failures with select stmts 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 --- pkg/workload/schemachange/operation_generator.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkg/workload/schemachange/operation_generator.go b/pkg/workload/schemachange/operation_generator.go index fa289f012a81..1e70f7f7af16 100644 --- a/pkg/workload/schemachange/operation_generator.go +++ b/pkg/workload/schemachange/operation_generator.go @@ -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