Skip to content

Commit

Permalink
This is an automated cherry-pick of #55596
Browse files Browse the repository at this point in the history
Signed-off-by: ti-chi-bot <[email protected]>
  • Loading branch information
hawkingrei authored and ti-chi-bot committed Aug 29, 2024
1 parent 49219b2 commit 515bcb4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pkg/executor/analyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -459,13 +459,24 @@ func (e *AnalyzeExec) handleResultsErrorWithConcurrency(ctx context.Context, sta
partitionStatsConcurrency := len(subSctxs)

wg := util.NewWaitGroupPool(e.gp)
<<<<<<< HEAD
saveResultsCh := make(chan *statistics.AnalyzeResults, partitionStatsConcurrency)
errCh := make(chan error, partitionStatsConcurrency)
for i := 0; i < partitionStatsConcurrency; i++ {
worker := newAnalyzeSaveStatsWorker(saveResultsCh, subSctxs[i], errCh, &e.Ctx().GetSessionVars().SQLKiller)
ctx1 := kv.WithInternalSourceType(context.Background(), kv.InternalTxnStats)
wg.Run(func() {
worker.run(ctx1, e.Ctx().GetSessionVars().EnableAnalyzeSnapshot)
=======
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
1 change: 1 addition & 0 deletions pkg/executor/test/analyzetest/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ go_test(
"main_test.go",
],
flaky = True,
race = "on",
shard_count = 49,
deps = [
"//pkg/config",
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 515bcb4

Please sign in to comment.