-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
executor: break innerTable fetcher is error happend during fetching outer table #7554
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -264,6 +264,9 @@ func (e *HashJoinExec) fetchInnerRows(ctx context.Context) (err error) { | |
e.innerResult.GetMemTracker().AttachTo(e.memTracker) | ||
e.innerResult.GetMemTracker().SetLabel("innerResult") | ||
for { | ||
if e.finished.Load().(bool) { | ||
return nil | ||
} | ||
chk := e.children[e.innerIdx].newChunk() | ||
err = e.innerExec.Next(ctx, chk) | ||
if err != nil || chk.NumRows() == 0 { | ||
|
@@ -533,8 +536,14 @@ func (e *HashJoinExec) buildHashTableForList() error { | |
valBuf = make([]byte, 8) | ||
) | ||
for i := 0; i < e.innerResult.NumChunks(); i++ { | ||
if e.finished.Load().(bool) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this check can be removed, because we only need to guarantee not calling the |
||
return nil | ||
} | ||
chk := e.innerResult.GetChunk(i) | ||
for j := 0; j < chk.NumRows(); j++ { | ||
if e.finished.Load().(bool) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This check may slow down the hash table building performance. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe we only need to check |
||
return nil | ||
} | ||
hasNull, keyBuf, err = e.getJoinKeyFromChkRow(false, chk.GetRow(j), keyBuf) | ||
if err != nil { | ||
return errors.Trace(err) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the outer table error happened after this and before
Next
, there is still race.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need a wait group or mutex to block the
close
operation on child until this goroutine finishes.