Skip to content

Commit

Permalink
executor: reduce the length of channel to avoid OOM (#47540)
Browse files Browse the repository at this point in the history
ref #47275
  • Loading branch information
hawkingrei authored Oct 11, 2023
1 parent aa99c16 commit 68b5788
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion executor/analyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ func (e *AnalyzeExec) Next(ctx context.Context, _ *chunk.Chunk) error {

// Start workers with channel to collect results.
taskCh := make(chan *analyzeTask, concurrency)
resultsCh := make(chan *statistics.AnalyzeResults, len(tasks))
resultChLen := min(concurrency*2, len(tasks))
resultsCh := make(chan *statistics.AnalyzeResults, resultChLen)
for i := 0; i < concurrency; i++ {
e.wg.Run(func() { e.analyzeWorker(taskCh, resultsCh) })
}
Expand Down

0 comments on commit 68b5788

Please sign in to comment.