Skip to content

Commit

Permalink
restore a code about retryable error (#19618)
Browse files Browse the repository at this point in the history
  • Loading branch information
m-schen authored Oct 26, 2024
1 parent 42e7dcf commit 2dd2876
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions pkg/sql/compile/compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -496,14 +496,22 @@ func (c *Compile) runOnce() (err error) {
for i := 0; i < cap(errC); i++ {
e := <-errC

// if any error happens,
// just cancel this function and throw it.
// cancel this query if the first error occurs.
if e != nil && errToThrowOut == nil {
errToThrowOut = e

// cancel query.
_, queryCancel := process.GetQueryCtxFromProc(c.proc)
queryCancel()
// cancel all scope tree.
for j := range c.scopes {
if c.scopes[j].Proc != nil {
c.scopes[j].Proc.Cancel()
}
}
}

// if any error already return is retryable, we should throw this one
// to make sure query will retry.
if e != nil && c.isRetryErr(e) {
errToThrowOut = e
}
}
close(errC)
Expand Down

0 comments on commit 2dd2876

Please sign in to comment.