Skip to content

Commit 489b259

Browse files
committed
executor: AnalyzePartitionConcurrency is not more than number of task
Signed-off-by: Weizhen Wang <[email protected]>
1 parent ff2f8c4 commit 489b259

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

executor/analyze.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ func (e *AnalyzeExec) Next(ctx context.Context, _ *chunk.Chunk) error {
122122
globalStatsMap := make(map[globalStatsKey]globalStatsInfo)
123123
g, _ := errgroup.WithContext(ctx)
124124
g.Go(func() error {
125-
return e.handleResultsError(ctx, concurrency, needGlobalStats, globalStatsMap, resultsCh)
125+
return e.handleResultsError(ctx, concurrency, needGlobalStats, globalStatsMap, resultsCh, len(tasks))
126126
})
127127

128128
for _, task := range tasks {
@@ -353,10 +353,11 @@ func (e *AnalyzeExec) handleResultsError(
353353
needGlobalStats bool,
354354
globalStatsMap globalStatsMap,
355355
resultsCh <-chan *statistics.AnalyzeResults,
356+
taskNum int,
356357
) error {
357358
partitionStatsConcurrency := e.Ctx().GetSessionVars().AnalyzePartitionConcurrency
358359
// the concurrency of handleResultsError cannot be more than partitionStatsConcurrency
359-
partitionStatsConcurrency = min(concurrency, partitionStatsConcurrency)
360+
partitionStatsConcurrency = min(taskNum, partitionStatsConcurrency)
360361
// If partitionStatsConcurrency > 1, we will try to demand extra session from Domain to save Analyze results in concurrency.
361362
// If there is no extra session we can use, we will save analyze results in single-thread.
362363
if partitionStatsConcurrency > 1 {

0 commit comments

Comments
 (0)