Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

analyze is killed unexpected #41825

Closed
XuHuaiyu opened this issue Mar 1, 2023 · 0 comments · Fixed by #41826
Closed

analyze is killed unexpected #41825

XuHuaiyu opened this issue Mar 1, 2023 · 0 comments · Fixed by #41826
Labels
affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects the 5.4.x(LTS) versions. affects-6.1 This bug affects the 6.1.x(LTS) versions. affects-6.5 This bug affects the 6.5.x(LTS) versions. severity/major sig/execution SIG execution type/bug The issue is confirmed as a bug.

Comments

@XuHuaiyu
Copy link
Contributor

XuHuaiyu commented Mar 1, 2023

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

If one analyze stmt is killed by the global memory controller, the following analyze stmts on the same connection will be killed immediately.
We can reproduce this problem by modifying the unit test: TestGlobalMemoryControlForAnalyze

diff --git a/executor/analyzetest/analyze_test.go b/executor/analyzetest/analyze_test.go
index 843200fea6..810a3014d1 100644
--- a/executor/analyzetest/analyze_test.go
+++ b/executor/analyzetest/analyze_test.go
@@ -3087,13 +3087,14 @@ func TestGlobalMemoryControlForAnalyze(t *testing.T) {
        sql := "analyze table t with 1.0 samplerate;" // Need about 100MB
        require.NoError(t, failpoint.Enable("github.com/pingcap/tidb/util/memory/ReadMemStats", `return(536870912)`))
        require.NoError(t, failpoint.Enable("github.com/pingcap/tidb/executor/mockAnalyzeMergeWorkerSlowConsume", `return(100)`))
-       defer func() {
-               require.NoError(t, failpoint.Disable("github.com/pingcap/tidb/util/memory/ReadMemStats"))
-               require.NoError(t, failpoint.Disable("github.com/pingcap/tidb/executor/mockAnalyzeMergeWorkerSlowConsume"))
-       }()
        _, err := tk0.Exec(sql)
        require.True(t, strings.Contains(err.Error(), "Out Of Memory Quota!"))
        runtime.GC()
+       require.NoError(t, failpoint.Disable("github.com/pingcap/tidb/util/memory/ReadMemStats"))
+       require.NoError(t, failpoint.Disable("github.com/pingcap/tidb/executor/mockAnalyzeMergeWorkerSlowConsume"))
+
+       _, err = tk0.Exec(sql)
+       require.NoError(t, err)
 }

2. What did you expect to see? (Required)

TestGlobalMemoryControlForAnalyze passed

3. What did you see instead (Required)

TestGlobalMemoryControlForAnalyze failed

4. What is your TiDB version? (Required)

master

@XuHuaiyu XuHuaiyu added the type/bug The issue is confirmed as a bug. label Mar 1, 2023
@XuHuaiyu XuHuaiyu added sig/execution SIG execution affects-6.5 This bug affects the 6.5.x(LTS) versions. severity/major labels Mar 1, 2023
@ti-chi-bot ti-chi-bot added may-affects-4.0 This bug maybe affects 4.0.x versions. may-affects-5.0 This bug maybe affects 5.0.x versions. may-affects-5.1 This bug maybe affects 5.1.x versions. may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 labels Mar 2, 2023
@XuHuaiyu XuHuaiyu removed may-affects-4.0 This bug maybe affects 4.0.x versions. may-affects-5.0 This bug maybe affects 5.0.x versions. may-affects-5.1 This bug maybe affects 5.1.x versions. may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 labels Mar 2, 2023
@ti-chi-bot ti-chi-bot added affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects the 5.4.x(LTS) versions. affects-6.1 This bug affects the 6.1.x(LTS) versions. labels Sep 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects the 5.4.x(LTS) versions. affects-6.1 This bug affects the 6.1.x(LTS) versions. affects-6.5 This bug affects the 6.5.x(LTS) versions. severity/major sig/execution SIG execution type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants