Skip to content

Commit

Permalink
This is an automated cherry-pick of pingcap#55596
Browse files Browse the repository at this point in the history
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
  • Loading branch information
hawkingrei committed Sep 23, 2024
1 parent 4b69818 commit f3e360c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
20 changes: 20 additions & 0 deletions pkg/executor/analyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,7 @@ func (e *AnalyzeExec) handleResultsError(
return err
}

<<<<<<< HEAD
func (e *AnalyzeExec) handleResultsErrorWithConcurrency(ctx context.Context, statsConcurrency int, needGlobalStats bool,
subSctxs []sessionctx.Context,
globalStatsMap globalStatsMap, resultsCh <-chan *statistics.AnalyzeResults) error {
Expand All @@ -465,6 +466,25 @@ func (e *AnalyzeExec) handleResultsErrorWithConcurrency(ctx context.Context, sta
ctx1 := kv.WithInternalSourceType(context.Background(), kv.InternalTxnStats)
wg.Run(func() {
worker.run(ctx1, e.Ctx().GetSessionVars().EnableAnalyzeSnapshot)
=======
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
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)
>>>>>>> b02581a7a47 (*: fix data race in the EnableAnalyzeSnapshot (#55596))
})
}
tableIDs := map[int64]struct{}{}
Expand Down
5 changes: 5 additions & 0 deletions pkg/executor/test/analyzetest/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ go_test(
"main_test.go",
],
flaky = True,
<<<<<<< HEAD
shard_count = 50,
=======
race = "on",
shard_count = 49,
>>>>>>> b02581a7a47 (*: fix data race in the EnableAnalyzeSnapshot (#55596))
deps = [
"//pkg/config",
"//pkg/domain",
Expand Down
1 change: 1 addition & 0 deletions pkg/executor/test/analyzetest/memorycontrol/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ go_test(
"memory_control_test.go",
],
flaky = True,
race = "on",
shard_count = 5,
deps = [
"//pkg/config",
Expand Down

0 comments on commit f3e360c

Please sign in to comment.