Skip to content

Commit

Permalink
executor: reduce the length of channel to avoid OOM
Browse files Browse the repository at this point in the history
Signed-off-by: Weizhen Wang <[email protected]>
  • Loading branch information
hawkingrei committed Oct 11, 2023
1 parent ec2731b commit c16fd69
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 @@ -112,7 +112,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 c16fd69

Please sign in to comment.