Open wjhuang2016 opened 6 days ago
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]
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