Commit 509b372
Cut three redundant walks out of recovery and the flush path
C9. The full-dict-fallback discard re-folded the whole recovered ring
even when the dictionary it discarded was EMPTY -- and that is the
ordinary client-upgrade path, not the rare one the comment described.
Every frame the shipped client ever wrote passes confirmedMaxId = -1, so
deltaStart is 0 and maxDeltaStart is 0; such a slot has no .symbol-dict,
so recovery creates a fresh empty one. All three discard conditions hold
on the first restart after upgrading, for every non-empty slot, and the
first fold was already keyed to that size-0 baseline -- so the re-fold
recomputed a bit-identical result over the entire backlog, with a
byte-at-a-time varint decode over full-dict frames that carry the whole
dictionary, inside build(). It now runs only when the discarded
dictionary held entries, which is the only case that can desynchronise
the fold from the baseline its consumers derive.
C11. PersistedSymbolDict.openExisting walked the file twice: once to
CRC every chunk and total the surviving entry bytes, then again --
re-decoding both header varints of every chunk -- purely to copy into an
exact-sized allocation. The entry region is by construction a subset of
the file, so the file length bounds it for free: one pass now validates
and copies together into a length-sized buffer, then shrinks to the exact
size. The trusted prefix is unchanged.
The same pass gained an entryBytes <= 0 guard. Every entry costs at least
its own length varint, so a positive entryCount inside a zero-byte region
is self-contradictory -- but the CRC only proves the bytes are what was
written, never that the header triple is consistent, so the scan accepted
such a chunk and left decodeLoadedSymbols to discover it later, as a
throw two layers up rather than a trimmed prefix.
C12. Each pass of the flush path re-walked tableBuffers.keys() and
re-probed the hash map per table: three probes per table on a plain
flush, five on a split, on the producer's thread. The non-empty tables
are now collected once into two reusable lists and every pass indexes
them directly -- which also removes the bodyIdx bookkeeping that had to
stay aligned with splitFrameBodyBytes by hand.
Regression tests, each verified to fail with its fix reverted:
testEmptyDictionaryDiscardDoesNotReFoldTheBacklog (expected:<1> but
was:<2>) with testPopulatedDictionaryDiscardStillReFolds as its
counterpart, and
testChunkClaimingEntriesInAZeroByteRegionEndsTheTrustedPrefix
(expected:<0> but was:<1>). Observing C9 needed a new engine-level
recoveryFoldCount: recoveryFramesVisited() cannot see a second fold
because the re-fold replaces the analysis instance.
C12 has no new test. Its behaviour is unchanged by construction and its
real risk -- index alignment across the collected lists and
splitFrameBodyBytes -- is already exercised by the two split tests that
drive two distinct tables (testSplitBatchShipsDeltaOnFirstFrameOnly,
testOversizedTableSplitStrandsNothing).
Full client suite: 2696 tests green.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 3f98352 commit 509b372
5 files changed
Lines changed: 237 additions & 91 deletions
File tree
- core/src
- main/java/io/questdb/client/cutlass/qwp/client
- sf/cursor
- test/java/io/questdb/client/test/cutlass/qwp/client/sf/cursor
Lines changed: 40 additions & 58 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
175 | 175 | | |
176 | 176 | | |
177 | 177 | | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
178 | 186 | | |
179 | 187 | | |
180 | 188 | | |
| |||
3214 | 3222 | | |
3215 | 3223 | | |
3216 | 3224 | | |
3217 | | - | |
3218 | | - | |
| 3225 | + | |
| 3226 | + | |
| 3227 | + | |
| 3228 | + | |
| 3229 | + | |
| 3230 | + | |
| 3231 | + | |
| 3232 | + | |
3219 | 3233 | | |
3220 | 3234 | | |
3221 | 3235 | | |
3222 | 3236 | | |
3223 | 3237 | | |
3224 | 3238 | | |
3225 | 3239 | | |
3226 | | - | |
| 3240 | + | |
| 3241 | + | |
3227 | 3242 | | |
3228 | 3243 | | |
3229 | | - | |
| 3244 | + | |
3230 | 3245 | | |
3231 | 3246 | | |
3232 | 3247 | | |
| |||
3552 | 3567 | | |
3553 | 3568 | | |
3554 | 3569 | | |
3555 | | - | |
| 3570 | + | |
3556 | 3571 | | |
3557 | 3572 | | |
3558 | 3573 | | |
| |||
3584 | 3599 | | |
3585 | 3600 | | |
3586 | 3601 | | |
3587 | | - | |
3588 | | - | |
3589 | | - | |
3590 | | - | |
3591 | | - | |
3592 | | - | |
3593 | | - | |
3594 | | - | |
3595 | | - | |
| 3602 | + | |
| 3603 | + | |
3596 | 3604 | | |
3597 | 3605 | | |
3598 | 3606 | | |
3599 | | - | |
| 3607 | + | |
3600 | 3608 | | |
3601 | 3609 | | |
3602 | 3610 | | |
| |||
3618 | 3626 | | |
3619 | 3627 | | |
3620 | 3628 | | |
3621 | | - | |
| 3629 | + | |
3622 | 3630 | | |
3623 | 3631 | | |
3624 | 3632 | | |
| |||
3640 | 3648 | | |
3641 | 3649 | | |
3642 | 3650 | | |
3643 | | - | |
| 3651 | + | |
3644 | 3652 | | |
3645 | 3653 | | |
3646 | 3654 | | |
| |||
3671 | 3679 | | |
3672 | 3680 | | |
3673 | 3681 | | |
3674 | | - | |
3675 | 3682 | | |
3676 | 3683 | | |
3677 | 3684 | | |
| |||
3695 | 3702 | | |
3696 | 3703 | | |
3697 | 3704 | | |
3698 | | - | |
| 3705 | + | |
3699 | 3706 | | |
3700 | | - | |
3701 | | - | |
3702 | | - | |
3703 | | - | |
3704 | | - | |
3705 | | - | |
3706 | | - | |
3707 | | - | |
3708 | | - | |
3709 | | - | |
3710 | | - | |
| 3707 | + | |
| 3708 | + | |
3711 | 3709 | | |
3712 | | - | |
3713 | | - | |
| 3710 | + | |
3714 | 3711 | | |
3715 | 3712 | | |
3716 | 3713 | | |
| |||
3737 | 3734 | | |
3738 | 3735 | | |
3739 | 3736 | | |
3740 | | - | |
3741 | | - | |
3742 | 3737 | | |
3743 | | - | |
3744 | | - | |
3745 | | - | |
3746 | | - | |
3747 | | - | |
3748 | | - | |
3749 | | - | |
3750 | | - | |
3751 | | - | |
| 3738 | + | |
| 3739 | + | |
3752 | 3740 | | |
3753 | | - | |
3754 | | - | |
| 3741 | + | |
3755 | 3742 | | |
3756 | 3743 | | |
3757 | | - | |
| 3744 | + | |
3758 | 3745 | | |
3759 | 3746 | | |
3760 | 3747 | | |
| |||
3800 | 3787 | | |
3801 | 3788 | | |
3802 | 3789 | | |
3803 | | - | |
| 3790 | + | |
3804 | 3791 | | |
3805 | 3792 | | |
3806 | | - | |
3807 | | - | |
3808 | | - | |
3809 | | - | |
3810 | | - | |
3811 | | - | |
3812 | | - | |
3813 | | - | |
3814 | | - | |
3815 | | - | |
3816 | | - | |
| 3793 | + | |
| 3794 | + | |
| 3795 | + | |
3817 | 3796 | | |
| 3797 | + | |
| 3798 | + | |
| 3799 | + | |
3818 | 3800 | | |
3819 | 3801 | | |
3820 | 3802 | | |
| |||
Lines changed: 31 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
111 | 115 | | |
112 | 116 | | |
113 | 117 | | |
| |||
348 | 352 | | |
349 | 353 | | |
350 | 354 | | |
| 355 | + | |
351 | 356 | | |
352 | 357 | | |
353 | 358 | | |
| |||
401 | 406 | | |
402 | 407 | | |
403 | 408 | | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
404 | 422 | | |
405 | 423 | | |
406 | 424 | | |
| |||
427 | 445 | | |
428 | 446 | | |
429 | 447 | | |
430 | | - | |
431 | | - | |
432 | | - | |
433 | | - | |
434 | | - | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
435 | 456 | | |
436 | 457 | | |
437 | 458 | | |
| |||
809 | 830 | | |
810 | 831 | | |
811 | 832 | | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
812 | 838 | | |
813 | 839 | | |
814 | 840 | | |
| |||
Lines changed: 37 additions & 28 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
670 | 670 | | |
671 | 671 | | |
672 | 672 | | |
| 673 | + | |
673 | 674 | | |
674 | 675 | | |
675 | 676 | | |
| |||
692 | 693 | | |
693 | 694 | | |
694 | 695 | | |
695 | | - | |
696 | | - | |
697 | | - | |
698 | | - | |
699 | | - | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
700 | 706 | | |
701 | | - | |
702 | | - | |
703 | | - | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
704 | 715 | | |
705 | 716 | | |
706 | 717 | | |
| |||
729 | 740 | | |
730 | 741 | | |
731 | 742 | | |
732 | | - | |
| 743 | + | |
| 744 | + | |
733 | 745 | | |
734 | 746 | | |
735 | 747 | | |
| |||
743 | 755 | | |
744 | 756 | | |
745 | 757 | | |
746 | | - | |
747 | | - | |
748 | | - | |
749 | | - | |
750 | | - | |
751 | | - | |
752 | | - | |
753 | | - | |
754 | | - | |
755 | | - | |
756 | | - | |
757 | | - | |
758 | | - | |
759 | | - | |
760 | | - | |
761 | | - | |
762 | | - | |
763 | | - | |
764 | | - | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
765 | 767 | | |
766 | 768 | | |
767 | 769 | | |
| |||
788 | 790 | | |
789 | 791 | | |
790 | 792 | | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
791 | 799 | | |
792 | 800 | | |
793 | 801 | | |
794 | 802 | | |
| 803 | + | |
795 | 804 | | |
796 | 805 | | |
797 | 806 | | |
| |||
0 commit comments