From 742f361af5f879066bbe4f1a6c8349d3a81e1dea Mon Sep 17 00:00:00 2001 From: ti-srebot <66930949+ti-srebot@users.noreply.github.com> Date: Thu, 14 Jul 2022 18:51:07 +0800 Subject: [PATCH] executor: fix index_lookup_hash_join hang when used with limit (#35820) (#36101) close pingcap/tidb#35638 --- executor/index_lookup_hash_join.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/executor/index_lookup_hash_join.go b/executor/index_lookup_hash_join.go index 65ec964ed2d55..9c16d1958493f 100644 --- a/executor/index_lookup_hash_join.go +++ b/executor/index_lookup_hash_join.go @@ -627,7 +627,10 @@ func (iw *indexHashJoinInnerWorker) handleTask(ctx context.Context, task *indexH if task.keepOuterOrder { if err != nil { joinResult.err = err - resultCh <- joinResult + select { + case <-ctx.Done(): + case resultCh <- joinResult: + } } close(resultCh) }