Skip to content

Commit 2e1146f

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

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
@@ -42,6 +42,9 @@ import (
4242
"github.com/pingcap/tidb/util/memory"
4343
)
4444

45+
// IsChildCloseCalledForTest is used for test
46+
var IsChildCloseCalledForTest = false
47+
4548
var (
4649
_ Executor = &HashJoinExec{}
4750
_ Executor = &NestedLoopApplyExec{}
@@ -148,7 +151,11 @@ type hashjoinWorkerResult struct {
148151
}
149152

150153
// Close implements the Executor Close interface.
154+
<<<<<<< HEAD:executor/join.go
151155
func (e *HashJoinExec) Close() error {
156+
=======
157+
func (e *HashJoinV1Exec) Close() (err error) {
158+
>>>>>>> af367b8a5ae (executor: replace `Call` with `CallWithRecover` in the close of hash join v1 (#61868)):pkg/executor/join/hash_join_v1.go
152159
if e.closeCh != nil {
153160
close(e.closeCh)
154161
}
@@ -171,9 +178,19 @@ func (e *HashJoinExec) Close() error {
171178
close(e.probeWorkers[i].joinChkResourceCh)
172179
channel.Clear(e.probeWorkers[i].joinChkResourceCh)
173180
}
181+
<<<<<<< HEAD:executor/join.go
174182
e.probeSideTupleFetcher.probeChkResourceCh = nil
175183
terror.Call(e.rowContainer.Close)
176184
e.hashJoinCtx.sessCtx.GetSessionVars().MemTracker.UnbindActionFromHardLimit(e.rowContainer.ActionSpill())
185+
=======
186+
e.ProbeSideTupleFetcher.probeChkResourceCh = nil
187+
util.WithRecovery(func() { err = e.RowContainer.Close() }, func(r any) {
188+
if r != nil {
189+
err = errors.Errorf("%v", r)
190+
}
191+
})
192+
e.HashJoinCtxV1.SessCtx.GetSessionVars().MemTracker.UnbindActionFromHardLimit(e.RowContainer.ActionSpill())
193+
>>>>>>> af367b8a5ae (executor: replace `Call` with `CallWithRecover` in the close of hash join v1 (#61868)):pkg/executor/join/hash_join_v1.go
177194
e.waiterWg.Wait()
178195
}
179196
e.outerMatchedStatus = e.outerMatchedStatus[:0]
@@ -193,7 +210,16 @@ func (e *HashJoinExec) Close() error {
193210
if e.stats != nil {
194211
defer e.ctx.GetSessionVars().StmtCtx.RuntimeStatsColl.RegisterStats(e.id, e.stats)
195212
}
213+
<<<<<<< HEAD:executor/join.go
196214
err := e.baseExecutor.Close()
215+
=======
216+
217+
IsChildCloseCalledForTest = true
218+
childErr := e.BaseExecutor.Close()
219+
if childErr != nil {
220+
return childErr
221+
}
222+
>>>>>>> af367b8a5ae (executor: replace `Call` with `CallWithRecover` in the close of hash join v1 (#61868)):pkg/executor/join/hash_join_v1.go
197223
return err
198224
}
199225

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)