We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5ead907 commit d7be824Copy full SHA for d7be824
db/recsplit/recsplit.go
@@ -1274,6 +1274,10 @@ func (rs *RecSplit) buildWithWorkers(ctx context.Context) error {
1274
workerScratches[i] = newWorkerScratch(rs)
1275
freeScratchCh <- workerScratches[i]
1276
}
1277
+ // taskCh capacity matches the scratch pool size: the same N scratch objects circulate
1278
+ // as both pool items and task payloads, so taskCh can never hold more than N items.
1279
+ // To allow double-buffering (producer assembles bucket N+1 while workers process N),
1280
+ // increase both freeScratchCh and taskCh to numWorkers*2.
1281
taskCh := make(chan *recsplitScratch, numWorkers)
1282
resultCh := make(chan *bucketResult, numWorkers*2)
1283
0 commit comments