Skip to content

Commit

Permalink
Merge pull request #95151 from ajwerner/ajwerner/clean-up-error-repor…
Browse files Browse the repository at this point in the history
…ting

sql/schemachanger: downgrade log warning when statement is not supported
  • Loading branch information
ajwerner authored Jan 12, 2023
2 parents bd3e876 + fa48836 commit 53f29d4
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions pkg/sql/schemachanger/scerrors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,21 @@ func (el EventLogger) HandlePanicAndLogError(ctx context.Context, err *error) {
if errors.Is(*err, context.Canceled) {
return
}
if *err == nil {
// We use a depth of 2 because this function is generally called with defer;
// using a depth of 1 would show that the caller was runtime/panic.go.
const depth = 2
switch {
case *err == nil:
if log.ExpensiveLogEnabled(ctx, 2) {
log.InfofDepth(ctx, 1, "done %s in %s", el.msg, redact.Safe(timeutil.Since(el.start)))
log.InfofDepth(ctx, depth, "done %s in %s", el.msg, redact.Safe(timeutil.Since(el.start)))
}
return
}
log.WarningfDepth(ctx, 1, "failed %s with error: %v", el.msg, *err)
if errors.HasAssertionFailure(*err) {
case HasNotImplemented(*err):
log.InfofDepth(ctx, depth, "failed %s with error: %v", el.msg, *err)
case errors.HasAssertionFailure(*err):
*err = errors.Wrapf(*err, "%s", el.msg)
fallthrough
default:
log.WarningfDepth(ctx, depth, "failed %s with error: %v", el.msg, *err)
}
}

Expand Down

0 comments on commit 53f29d4

Please sign in to comment.