Skip to content

Commit

Permalink
*: fix data race in the EnableAnalyzeSnapshot (#55596) (#55734)
Browse files Browse the repository at this point in the history
close #55469
  • Loading branch information
ti-chi-bot authored Sep 23, 2024
1 parent 4b69818 commit a2bb8ad
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/executor/analyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -460,11 +460,12 @@ func (e *AnalyzeExec) handleResultsErrorWithConcurrency(ctx context.Context, sta
var wg util.WaitGroupWrapper
saveResultsCh := make(chan *statistics.AnalyzeResults, partitionStatsConcurrency)
errCh := make(chan error, partitionStatsConcurrency)
enableAnalyzeSnapshot := e.Ctx().GetSessionVars().EnableAnalyzeSnapshot
for i := 0; i < partitionStatsConcurrency; i++ {
worker := newAnalyzeSaveStatsWorker(saveResultsCh, subSctxs[i], errCh, &e.Ctx().GetSessionVars().Killed)
ctx1 := kv.WithInternalSourceType(context.Background(), kv.InternalTxnStats)
wg.Run(func() {
worker.run(ctx1, e.Ctx().GetSessionVars().EnableAnalyzeSnapshot)
worker.run(ctx1, enableAnalyzeSnapshot)
})
}
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 = 50,
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 a2bb8ad

Please sign in to comment.