From 23ab34ab9099e9bfc2f1fd1a317655f45076fddd Mon Sep 17 00:00:00 2001 From: ti-srebot <66930949+ti-srebot@users.noreply.github.com> Date: Thu, 14 Jul 2022 21:45:06 +0800 Subject: [PATCH] executor: fix index_lookup_hash_join hang when used with limit (#35820) (#36098) 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 62fa460c39111..1ee3aa1f995a8 100644 --- a/executor/index_lookup_hash_join.go +++ b/executor/index_lookup_hash_join.go @@ -500,7 +500,10 @@ func (iw *indexHashJoinInnerWorker) run(ctx context.Context, cancelFunc context. joinResult.err = errors.New("mockIndexHashJoinInnerWorkerErr") }) if joinResult.err != nil { - resultCh <- joinResult + select { + case resultCh <- joinResult: + case <-ctx.Done(): + } return } // When task.keepOuterOrder is TRUE(resultCh != iw.resultCh), the last