Skip to content

Commit d7be824

Browse files
committed
save
1 parent 5ead907 commit d7be824

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

db/recsplit/recsplit.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1274,6 +1274,10 @@ func (rs *RecSplit) buildWithWorkers(ctx context.Context) error {
12741274
workerScratches[i] = newWorkerScratch(rs)
12751275
freeScratchCh <- workerScratches[i]
12761276
}
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.
12771281
taskCh := make(chan *recsplitScratch, numWorkers)
12781282
resultCh := make(chan *bucketResult, numWorkers*2)
12791283

0 commit comments

Comments
 (0)