-
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
Conversation
executor/join.go
Outdated
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 comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we only need to check e.finished
in the granularity of Chunk
?
@@ -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) { |
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.
@@ -533,6 +536,9 @@ 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 comment
The 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 next
function of the child.
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.
LGTM
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.
LGTM
/run-all-tests |
What problem does this PR solve?
Break fetchInnerAndBuildHashTable if error happened during fetchOuterAndProbeHashTable.
What is changed and how it works?
Before this PR, if any error happens during fetchOuterAndProbeHashTable,
fetchInnerAndBuildHashTable will continue running, this will cause some
unexpected situations such as DataRace which would may by closing HashJoinExec
while fetchOuterAndProbeHashTable is still running.
This PR checks HashJoinExec.finished evecy time in the loop of
fetchInnerAndBuildHashTable to exists in time if any error happens.
Check List
Tests
Code changes
Side effects
Related changes