Skip to content

Commit 8f1140b

Browse files
xzhangxian1008ti-chi-bot
authored andcommitted
This is an automated cherry-pick of #61868
Signed-off-by: ti-chi-bot <[email protected]>
1 parent 2ec3e3e commit 8f1140b

File tree

4 files changed

+882
-0
lines changed

4 files changed

+882
-0
lines changed

executor/hash_table.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"unsafe"
2424

2525
"github.com/pingcap/errors"
26+
<<<<<<< HEAD:executor/hash_table.go
2627
"github.com/pingcap/tidb/sessionctx"
2728
"github.com/pingcap/tidb/sessionctx/stmtctx"
2829
"github.com/pingcap/tidb/types"
@@ -33,6 +34,18 @@ import (
3334
"github.com/pingcap/tidb/util/execdetails"
3435
"github.com/pingcap/tidb/util/hack"
3536
"github.com/pingcap/tidb/util/memory"
37+
=======
38+
"github.com/pingcap/failpoint"
39+
"github.com/pingcap/tidb/pkg/sessionctx"
40+
"github.com/pingcap/tidb/pkg/sessionctx/stmtctx"
41+
"github.com/pingcap/tidb/pkg/types"
42+
"github.com/pingcap/tidb/pkg/util/bitmap"
43+
"github.com/pingcap/tidb/pkg/util/chunk"
44+
"github.com/pingcap/tidb/pkg/util/codec"
45+
"github.com/pingcap/tidb/pkg/util/disk"
46+
"github.com/pingcap/tidb/pkg/util/hack"
47+
"github.com/pingcap/tidb/pkg/util/memory"
48+
>>>>>>> af367b8a5ae (executor: replace `Call` with `CallWithRecover` in the close of hash join v1 (#61868)):pkg/executor/join/hash_table_v1.go
3649
)
3750

3851
// hashContext keeps the needed hash context of a db table in hash join.
@@ -501,6 +514,8 @@ func (c *hashRowContainer) Len() uint64 {
501514
}
502515

503516
func (c *hashRowContainer) Close() error {
517+
failpoint.Inject("issue60923", nil)
518+
504519
defer c.memTracker.Detach()
505520
c.chkBuf = nil
506521
return c.rowContainer.Close()

executor/join.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ import (
4141
"github.com/pingcap/tidb/util/memory"
4242
)
4343

44+
// IsChildCloseCalledForTest is used for test
45+
var IsChildCloseCalledForTest = false
46+
4447
var (
4548
_ Executor = &HashJoinExec{}
4649
_ Executor = &NestedLoopApplyExec{}
@@ -147,7 +150,11 @@ type hashjoinWorkerResult struct {
147150
}
148151

149152
// Close implements the Executor Close interface.
153+
<<<<<<< HEAD:executor/join.go
150154
func (e *HashJoinExec) Close() error {
155+
=======
156+
func (e *HashJoinV1Exec) Close() (err error) {
157+
>>>>>>> af367b8a5ae (executor: replace `Call` with `CallWithRecover` in the close of hash join v1 (#61868)):pkg/executor/join/hash_join_v1.go
151158
if e.closeCh != nil {
152159
close(e.closeCh)
153160
}
@@ -170,9 +177,19 @@ func (e *HashJoinExec) Close() error {
170177
close(e.probeWorkers[i].joinChkResourceCh)
171178
channel.Clear(e.probeWorkers[i].joinChkResourceCh)
172179
}
180+
<<<<<<< HEAD:executor/join.go
173181
e.probeSideTupleFetcher.probeChkResourceCh = nil
174182
terror.Call(e.rowContainer.Close)
175183
e.hashJoinCtx.sessCtx.GetSessionVars().MemTracker.UnbindActionFromHardLimit(e.rowContainer.ActionSpill())
184+
=======
185+
e.ProbeSideTupleFetcher.probeChkResourceCh = nil
186+
util.WithRecovery(func() { err = e.RowContainer.Close() }, func(r any) {
187+
if r != nil {
188+
err = errors.Errorf("%v", r)
189+
}
190+
})
191+
e.HashJoinCtxV1.SessCtx.GetSessionVars().MemTracker.UnbindActionFromHardLimit(e.RowContainer.ActionSpill())
192+
>>>>>>> af367b8a5ae (executor: replace `Call` with `CallWithRecover` in the close of hash join v1 (#61868)):pkg/executor/join/hash_join_v1.go
176193
e.waiterWg.Wait()
177194
}
178195
e.outerMatchedStatus = e.outerMatchedStatus[:0]
@@ -192,7 +209,16 @@ func (e *HashJoinExec) Close() error {
192209
if e.stats != nil {
193210
defer e.ctx.GetSessionVars().StmtCtx.RuntimeStatsColl.RegisterStats(e.id, e.stats)
194211
}
212+
<<<<<<< HEAD:executor/join.go
195213
err := e.baseExecutor.Close()
214+
=======
215+
216+
IsChildCloseCalledForTest = true
217+
childErr := e.BaseExecutor.Close()
218+
if childErr != nil {
219+
return childErr
220+
}
221+
>>>>>>> af367b8a5ae (executor: replace `Call` with `CallWithRecover` in the close of hash join v1 (#61868)):pkg/executor/join/hash_join_v1.go
196222
return err
197223
}
198224

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
load("@io_bazel_rules_go//go:def.bzl", "go_test")
2+
3+
go_test(
4+
name = "issuetest_test",
5+
timeout = "short",
6+
srcs = [
7+
"executor_issue_test.go",
8+
"main_test.go",
9+
],
10+
flaky = True,
11+
shard_count = 25,
12+
deps = [
13+
"//pkg/autoid_service",
14+
"//pkg/config",
15+
"//pkg/executor",
16+
"//pkg/executor/join",
17+
"//pkg/kv",
18+
"//pkg/meta/autoid",
19+
"//pkg/parser/auth",
20+
"//pkg/parser/charset",
21+
"//pkg/parser/mysql",
22+
"//pkg/session/types",
23+
"//pkg/testkit",
24+
"//pkg/testkit/testfailpoint",
25+
"//pkg/util",
26+
"//pkg/util/dbterror/exeerrors",
27+
"//pkg/util/memory",
28+
"@com_github_pingcap_failpoint//:failpoint",
29+
"@com_github_stretchr_testify//require",
30+
"@com_github_tikv_client_go_v2//tikv",
31+
"@org_uber_go_goleak//:goleak",
32+
],
33+
)

0 commit comments

Comments
 (0)