@@ -57,6 +57,7 @@ import (
57
57
"github.com/pingcap/tidb/pkg/parser/ast"
58
58
"github.com/pingcap/tidb/pkg/parser/model"
59
59
"github.com/pingcap/tidb/pkg/parser/mysql"
60
+ "github.com/pingcap/tidb/pkg/parser/terror"
60
61
plannercore "github.com/pingcap/tidb/pkg/planner/core"
61
62
plannerutil "github.com/pingcap/tidb/pkg/planner/util"
62
63
"github.com/pingcap/tidb/pkg/sessionctx"
@@ -4500,11 +4501,20 @@ func (builder *dataReaderBuilder) buildProjectionForIndexJoin(
4500
4501
canReorderHandles bool ,
4501
4502
memTracker * memory.Tracker ,
4502
4503
interruptSignal * atomic.Value ,
4503
- ) (exec.Executor , error ) {
4504
- childExec , err := builder .buildExecutorForIndexJoinInternal (ctx , v .Children ()[0 ], lookUpContents , indexRanges , keyOff2IdxOff , cwc , canReorderHandles , memTracker , interruptSignal )
4504
+ ) (executor exec.Executor , err error ) {
4505
+ var childExec exec.Executor
4506
+ childExec , err = builder .buildExecutorForIndexJoinInternal (ctx , v .Children ()[0 ], lookUpContents , indexRanges , keyOff2IdxOff , cwc , canReorderHandles , memTracker , interruptSignal )
4505
4507
if err != nil {
4506
4508
return nil , err
4507
4509
}
4510
+ defer func () {
4511
+ if r := recover (); r != nil {
4512
+ err = util .GetRecoverError (r )
4513
+ }
4514
+ if err != nil {
4515
+ terror .Log (exec .Close (childExec ))
4516
+ }
4517
+ }()
4508
4518
4509
4519
e := & ProjectionExec {
4510
4520
BaseExecutor : exec .NewBaseExecutor (builder .ctx , v .Schema (), v .ID (), childExec ),
@@ -4519,9 +4529,16 @@ func (builder *dataReaderBuilder) buildProjectionForIndexJoin(
4519
4529
if int64 (v .StatsCount ()) < int64 (builder .ctx .GetSessionVars ().MaxChunkSize ) {
4520
4530
e .numWorkers = 0
4521
4531
}
4532
+ failpoint .Inject ("buildProjectionForIndexJoinPanic" , func (val failpoint.Value ) {
4533
+ if v , ok := val .(bool ); ok && v {
4534
+ panic ("buildProjectionForIndexJoinPanic" )
4535
+ }
4536
+ })
4522
4537
err = e .open (ctx )
4523
-
4524
- return e , err
4538
+ if err != nil {
4539
+ return nil , err
4540
+ }
4541
+ return e , nil
4525
4542
}
4526
4543
4527
4544
// buildRangesForIndexJoin builds kv ranges for index join when the inner plan is index scan plan.
0 commit comments