From 9a226bb36670ad7aaf4336b6c7b94819317dbefd 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 0081993b9fa7..c69d10e6d573 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