Commit f104abb
Fix race condition in nextInsertBatch() causing off-by-1 doc count
has_next_create() and next() were separate non-atomic operations, allowing
two threads to both pass the boundary check at create_e and produce one
extra document beyond the intended range.
Fix: atomically claim the index with getAndIncrement() first, then break
if the claimed index is out of bounds — eliminating the check-then-act gap.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 94ef7e5 commit f104abb
1 file changed
Lines changed: 16 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
464 | 464 | | |
465 | 465 | | |
466 | 466 | | |
467 | | - | |
468 | | - | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
469 | 483 | | |
470 | 484 | | |
471 | 485 | | |
| |||
0 commit comments