Skip to content

Commit

Permalink
sql: handle panic in InternalExecutor.exec()
Browse files Browse the repository at this point in the history
Previously defered error augmentation in internal executor expectec
either resultset or error being populated and didn't handle panic
down the stack correctly.
This was giving slightly misleading error messages.
This change adds a case where panic is propagated correctly if both
error and resultset are nil.

Release note: None
  • Loading branch information
aliher1911 committed Jan 6, 2022
1 parent 260144b commit 69ba2a9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/sql/internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -662,15 +662,15 @@ func (ie *InternalExecutor) execInternal(
//
// TODO(knz): track the callers and check whether opName could be turned
// into a type safe for reporting.
if retErr != nil {
if !errIsRetriable(retErr) {
if retErr != nil || r == nil {
// Both retErr and r can be nil in case of panic.
if retErr != nil && !errIsRetriable(retErr) {
retErr = errors.Wrapf(retErr, "%s", opName)
}
stmtBuf.Close()
wg.Wait()
sp.Finish()
} else {
// r must be non-nil here.
r.errCallback = func(err error) error {
if err != nil && !errIsRetriable(err) {
err = errors.Wrapf(err, "%s", opName)
Expand Down

0 comments on commit 69ba2a9

Please sign in to comment.