sql查询报错无结果

Bug 反馈
查询sql;mysq5.6,执行1500s,返回结果37万行
tidb 5.02集群版本,查询100多秒后,报错无结果,能稳定重现:报错信息如下:

1105 - indexHashJoinInnerWorker.doJoinUnordered failed
时间: 173.643s

日志文件:
[txn_mode=PESSIMISTIC] [err=“indexHashJoinInnerWorker.doJoinUnordered failed
github.com/pingcap/tidb/executor.(*indexHashJoinInnerWorker).doJoinUnordered
\t/home/jen
kins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/executor/index_lookup_hash_join.go:619
github.com/pingcap/tidb/executor.(*indexHashJoinInnerWorker).handleTask
\t/home/jen
kins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/executor/index_lookup_hash_join.go:608
github.com/pingcap/tidb/executor.(*indexHashJoinInnerWorker).run
\t/home/jenkins/ag
ent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/executor/index_lookup_hash_join.go:483
github.com/pingcap/tidb/executor.(*IndexNestedLoopHashJoin).startWorkers.func2
\t/home/jen
kins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/executor/index_lookup_hash_join.go:196
github.com/pingcap/tidb/util.WithRecovery
\t/home/jenkins/agent/workspace/optimizat
ion-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/util/misc.go:95
runtime.goexit
\t/usr/local/go/src/runtime/asm_amd64.s:1357”]
【 Bug 的影响】

【其他背景信息或者截图】
tidb的执行计划:

Projection_77 21111.71 root
└─HashAgg_78 21111.71 root
└─Projection_771 52465.22 root
└─HashJoin_80 52465.22 root
├─IndexJoin_727(Build) 4340.61 root
│ ├─TableReader_762(Build) 4340.53 root
│ │ └─Selection_761 4340.53 cop[tiflash]
│ │ └─TableFullScan_760 4350.00 cop[tiflash] table:y
│ └─IndexReader_726(Probe) 1.00 root
│ └─Selection_725 1.00 cop[tikv]
│ └─IndexRangeScan_724 1.00 cop[tikv] table:x, index:login_idx(phone)
└─HashJoin_136(Probe) 65581.52 root
├─TableReader_720(Build) 211.00 root
│ └─Selection_719 211.00 cop[tikv]
│ └─TableFullScan_718 211.00 cop[tikv] table:e
└─HashJoin_174(Probe) 81976.90 root
├─TableReader_713(Build) 5155.00 root
│ └─TableFullScan_712 5155.00 cop[tiflash] table:t9
└─Projection_176(Probe) 81976.90 root
└─HashJoin_189 81976.90 root
├─TableReader_709(Build) 13488.00 root
│ └─TableFullScan_708 13488.00 cop[tiflash] table:t8
└─HashJoin_200(Probe) 81976.90 root
├─TableReader_705(Build) 13711.00 root
│ └─TableFullScan_704 13711.00 cop[tiflash] table:t7
└─HashJoin_202(Probe) 81976.90 root
├─IndexJoin_634(Build) 0.00 root
│ ├─Projection_645(Build) 0.00 root
│ │ └─IndexJoin_651 0.00 root
│ │ ├─TableReader_682(Build) 0.00 root
│ │ │ └─Selection_681 0.00 cop[tikv]
│ │ │ └─TableFullScan_680 884096.00 cop[tikv] table:c3
│ │ └─IndexLookUp_650(Probe) 0.00 root
│ │ ├─IndexRangeScan_647(Build) 0.00 cop[tikv] table:c1, index:coupon_type_idx(coupontype_id, status)
│ │ └─Selection_649(Probe) 0.00 cop[tikv]
│ │ └─TableRowIDScan_648 0.00 cop[tikv] table:c1
│ └─IndexLookUp_633(Probe) 0.00 root
│ ├─IndexRangeScan_630(Build) 0.00 cop[tikv] table:b, index:order_id(order_id)
│ └─Selection_632(Probe) 0.00 cop[tikv]
│ └─TableRowIDScan_631 0.00 cop[tikv] table:b
└─Projection_204(Probe) 81976.90 root
└─HashJoin_219 81976.90 root
├─HashJoin_226(Build) 81689.50 root
│ ├─HashAgg_337(Build) 16240.44 root
│ │ └─Projection_770 61297.81 root
│ │ └─HashJoin_342 61297.81 root
│ │ ├─IndexJoin_583(Build) 4340.61 root
│ │ │ ├─TableReader_618(Build) 4340.53 root
│ │ │ │ └─Selection_617 4340.53 cop[tiflash]
│ │ │ │ └─TableFullScan_616 4350.00 cop[tiflash] table:y
│ │ │ └─IndexReader_582(Probe) 1.00 root
│ │ │ └─Selection_581 1.00 cop[tikv]
│ │ │ └─IndexRangeScan_580 1.00 cop[tikv] table:x, index:login_idx(phone)
│ │ └─HashJoin_421(Probe) 76622.26 root
│ │ ├─TableReader_576(Build) 211.00 root
│ │ │ └─Selection_575 211.00 cop[tikv]
│ │ │ └─TableFullScan_574 211.00 cop[tikv] table:e
│ │ └─IndexHashJoin_472(Probe) 95777.83 root
│ │ ├─IndexHashJoin_528(Build) 84389.96 root
│ │ │ ├─IndexLookUp_563(Build) 25375.69 root
│ │ │ │ ├─IndexRangeScan_560(Build) 816482.66 cop[tikv] table:k1, index:type_provider_status(order_type, process_status, provider_id)
│ │ │ │ └─Selection_562(Probe) 25375.69 cop[tikv]
│ │ │ │ └─TableRowIDScan_561 816482.66 cop[tikv] table:k1
│ │ │ └─IndexLookUp_525(Probe) 3.33 root
│ │ │ ├─IndexRangeScan_523(Build) 3.33 cop[tikv] table:k2, index:PRIMARY(order_id, wholesale_id, ws_parentid)
│ │ │ └─TableRowIDScan_524(Probe) 3.33 cop[tikv] table:k2
│ │ └─IndexLookUp_469(Probe) 1.00 root
│ │ ├─IndexRangeScan_466(Build) 1.00 cop[tikv] table:k3, index:PRIMARY(order_id, wholesale_id, ws_parentid)
│ │ └─Selection_468(Probe) 1.00 cop[tikv]
│ │ └─TableRowIDScan_467 1.00 cop[tikv] table:k3
│ └─IndexHashJoin_270(Probe) 81689.50 root
│ ├─HashJoin_300(Build) 81689.50 root
│ │ ├─IndexLookUp_330(Build) 81689.50 root
│ │ │ ├─IndexRangeScan_327(Build) 816482.66 cop[tikv] table:t1, index:type_provider_status(order_type, process_status, provider_id)
│ │ │ └─Selection_329(Probe) 81689.50 cop[tikv]
│ │ │ └─TableRowIDScan_328 816482.66 cop[tikv] table:t1
│ │ └─TableReader_334(Probe) 1388646.00 root
│ │ └─TableFullScan_333 1388646.00 cop[tiflash] table:t2
│ └─TableReader_265(Probe) 1.00 root
│ └─TableRangeScan_264 1.00 cop[tikv] table:t3
└─TableReader_629(Probe) 596782.00 root
└─TableFullScan_628 596782.00 cop[tiflash] table:t5

看上去是执行计划走 indexHashJoin 时 panic 了,执行有没有用 prepare 语句,目前 5.0.2 版本已知相关的问题 https://github.com/pingcap/tidb/issues/23897

navicat执行的,无prepare