Skip to content

Commit

Permalink
cherry pick pingcap#24257 to release-5.0
Browse files Browse the repository at this point in the history
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
  • Loading branch information
guo-shaoge authored and ti-srebot committed Apr 28, 2021
1 parent 1145e34 commit cc80524
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion executor/parallel_apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,14 @@ func (e *ParallelNestedLoopApplyExec) Next(ctx context.Context, req *chunk.Chunk
// Close implements the Executor interface.
func (e *ParallelNestedLoopApplyExec) Close() error {
e.memTracker = nil
err := e.outerExec.Close()
if atomic.LoadUint32(&e.started) == 1 {
close(e.exit)
e.notifyWg.Wait()
e.started = 0
}
// Wait all workers to finish before Close() is called.
// Otherwise we may got data race.
err := e.outerExec.Close()

if e.runtimeStats != nil {
runtimeStats := newJoinRuntimeStats()
Expand Down

0 comments on commit cc80524

Please sign in to comment.