Commit 2b15eec
fix(table): advance ConcatIterator past fully version-pruned first table
Block-level version skipping (SetVersionBounds) can leave a table iterator invalid
after Rewind when every block falls outside the window (seekToFirst/seekToLast set
io.EOF). ConcatIterator.Rewind only positioned on the first table without looping,
so if that table was fully pruned the ConcatIterator — and its MergeIterator level —
looked exhausted and stranded every later table, silently dropping in-window entries
(reachable at L1+ where a level uses a ConcatIterator; e.g. a table with old keys in
early blocks and recent keys in later blocks, scanned with a mid version window).
Add skipInvalidTables(), called from Rewind, mirroring the empty-table loop already
in Next(). No-op when version bounds are disabled. Seek is unaffected: seekFrom does
not version-skip blocks and the binary search guarantees the chosen table holds a key
>= the seek key. Adds TestConcatIteratorSkipsFullyPrunedFirstTable (fails without the fix).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent e4d44cf commit 2b15eec
2 files changed
Lines changed: 56 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
559 | 559 | | |
560 | 560 | | |
561 | 561 | | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
562 | 583 | | |
563 | 584 | | |
564 | 585 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
344 | 344 | | |
345 | 345 | | |
346 | 346 | | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
0 commit comments