From d60355096a874bfb0e0d2b26d4216efdade2bd2f Mon Sep 17 00:00:00 2001 From: Faizan Qazi Date: Wed, 12 Oct 2022 19:37:37 +0000 Subject: [PATCH] workload/scheamchanger: fix unknown schema retry detection Fixes: #89146 Previously, when we added logic to retry unknown schema errors, the regex used was unfortunately out of sync with the actual error generated. This patch fixes the regex to have the correct string, since those errors were not properly retried. Release note: None --- pkg/workload/schemachange/error_screening.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/workload/schemachange/error_screening.go b/pkg/workload/schemachange/error_screening.go index 4d5ad403700d..e0876e929ed2 100644 --- a/pkg/workload/schemachange/error_screening.go +++ b/pkg/workload/schemachange/error_screening.go @@ -1122,7 +1122,9 @@ SELECT count(*) FROM %s } var ( - regexpUnknownSchemaErr = regexp.MustCompile(`unknown schema \[\d+\]`) + // regexpUnknownSchemaErr matches unknown schema errors with + // a descriptor ID, which will have the form: unknown schema "[123]" + regexpUnknownSchemaErr = regexp.MustCompile(`unknown schema "\[\d+]"`) ) // checkAndAdjustForUnknownSchemaErrors in certain contexts we will attempt to @@ -1135,7 +1137,7 @@ func (og *operationGenerator) checkAndAdjustForUnknownSchemaErrors(err error) er if regexpUnknownSchemaErr.MatchString(pgErr.Message) { og.opGenLog.WriteString(fmt.Sprintf("Rolling back due to unknown schema error %v", err)) - // Force a rollback and log inside the oepration generator. + // Force a rollback and log inside the operation generator. return errors.Mark(err, errRunInTxnRbkSentinel) } }