Skip to content

Commit

Permalink
executor: fix data race in (*HashJoinExec).Close() since `fetchInne…
Browse files Browse the repository at this point in the history
…rAndBuildHashTable` is still running
  • Loading branch information
SunRunAway authored and sre-bot committed Aug 15, 2019
1 parent f866bb4 commit db6c36c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion executor/join.go
Original file line number Diff line number Diff line change
Expand Up @@ -541,8 +541,13 @@ func (e *HashJoinExec) fetchInnerAndBuildHashTable(ctx context.Context) {
err := e.buildHashTableForList(innerResultCh)
if err != nil {
e.innerFinished <- errors.Trace(err)
close(doneCh)
}
// Wait fetchInnerRows be finished.
// 1. if buildHashTableForList fails
// 2. if outerResult.NumRows() == 0, fetchOutChunks will not wait for inner.
for range innerResultCh {
}
close(doneCh)
}

// buildHashTableForList builds hash table from `list`.
Expand Down

0 comments on commit db6c36c

Please sign in to comment.