From f17a6cd46fb3baed9fb328d0a827342ab8a97b7a Mon Sep 17 00:00:00 2001 From: Yahor Yuzefovich Date: Mon, 15 Aug 2022 10:48:55 -0700 Subject: [PATCH] colexecerror: do not annotate the context canceled error This commit makes it so that the context canceled error doesn't get annotated with an assertion failure when it doesn't have a valid PG code. This makes sure that the sentry issues don't get filed for the context canceled errors - they are expected to occur. Release note: None --- pkg/sql/colexecerror/error.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/sql/colexecerror/error.go b/pkg/sql/colexecerror/error.go index 5658b16112ad..1034a00e743d 100644 --- a/pkg/sql/colexecerror/error.go +++ b/pkg/sql/colexecerror/error.go @@ -75,10 +75,11 @@ func CatchVectorizedRuntimeError(operation func()) (retErr error) { annotateErrorWithoutCode := true var nie *notInternalError - if errors.As(err, &nie) { - // A notInternalError was not caused by the vectorized engine and - // represents an error that we don't want to annotate in case it - // doesn't have a valid PG code. + if errors.Is(err, context.Canceled) || errors.As(err, &nie) { + // We don't want to annotate the context cancellation and + // notInternalError errors in case they don't have a valid PG code + // so that the sentry report is not sent (errors with failed + // assertions get sentry reports). annotateErrorWithoutCode = false } if code := pgerror.GetPGCode(err); annotateErrorWithoutCode && code == pgcode.Uncategorized {