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 may block forever #56071

Open
wjhuang2016 opened this issue Sep 13, 2024 · 1 comment
Open

analyze may block forever #56071

wjhuang2016 opened this issue Sep 13, 2024 · 1 comment
Assignees
Labels
severity/moderate sig/planner SIG: Planner type/bug The issue is confirmed as a bug.

Comments

@wjhuang2016
Copy link
Member

wjhuang2016 commented Sep 13, 2024

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reprod

Here is the TiDB's goroutine
bb.txt

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

N/A

3. What did you see instead (Required)

N/A

4. What is your TiDB version? (Required)

master

@wjhuang2016 wjhuang2016 added the type/bug The issue is confirmed as a bug. label Sep 13, 2024
@wjhuang2016
Copy link
Member Author

func (e *AnalyzeExec) handleResultsErrorWithConcurrency(
	buildStatsConcurrency int,
	saveStatsConcurrency int,
	needGlobalStats bool,
	globalStatsMap globalStatsMap,
	resultsCh <-chan *statistics.AnalyzeResults,
) error {
	statsHandle := domain.GetDomain(e.Ctx()).StatsHandle()
	wg := util.NewWaitGroupPool(e.gp)
	saveResultsCh := make(chan *statistics.AnalyzeResults, saveStatsConcurrency)
	errCh := make(chan error, saveStatsConcurrency)
	enableAnalyzeSnapshot := e.Ctx().GetSessionVars().EnableAnalyzeSnapshot
	logutil.BgLogger().Info("start analyze save stats worker", zap.Int("saveStatsConcurrency", saveStatsConcurrency))
	for i := 0; i < saveStatsConcurrency; i++ {
		worker := newAnalyzeSaveStatsWorker(saveResultsCh, errCh, &e.Ctx().GetSessionVars().SQLKiller)
		ctx1 := kv.WithInternalSourceType(context.Background(), kv.InternalTxnStats)
		wg.Run(func() {
			worker.run(ctx1, statsHandle, enableAnalyzeSnapshot)
		})
	}

log:

TiDB 127.0.0.1:4000[analyze.go:417] ["start analyze save stats worker"] [saveStatsConcurrency=0]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/moderate sig/planner SIG: Planner type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants