Commit ff53e1f
Rebuild the dictionary from the frames still on disk
A slot whose symbol dictionary was damaged was being condemned as
unreplayable while every symbol it needed was sitting on disk. The
sender told the user to resend data that had never been lost, and after
the previous commit it set the slot aside instead.
Three things kept the rebuild from ever running.
setCursorEngine gated the producer's seed on deltaDictEnabled. That flag
is false exactly when the slot's dictionary failed to open -- fd
exhaustion, a read-only remount, ENOSPC -- which is precisely when the
frames on disk are the only surviving copy of the symbols. The rebuild
was dead code for the very case it was written for.
collectReplaySymbolsAbove walked from ackedFsn+1, so it skipped the
acked frames. But an acked frame is not trimmed the instant it is
acked: trim unlinks whole SEALED segments. The frames that registered
the early ids are almost always still there, and they are exactly the
ids the replay set's deltas start above. It walks every frame on disk
now, and a slot whose registering frames really HAVE been trimmed still
reports the gap, because then nothing holds them.
And the send loop's mirror seeded only from the dictionary file, never
from the frames -- so even with the other two fixed, the loop would
still condemn (deltaStart > sentDictCount) a slot the producer had just
seeded successfully. The mirror is the loop's model of what the SERVER
holds and it is what the catch-up ships, so it now seeds from the same
two sources in the same order, and the two land on the same number by
construction. Only when a surviving frame actually depends on ids it
does not carry: at maxSymbolDeltaStart == 0 every frame re-registers
from id 0 as it replays, so a full-dict slot stays catch-up-free.
The recovery tests now assert the strong form -- the fresh server's
reconstructed dictionary must come back COMPLETE and in order, which
can only happen if the catch-up carried the ids the acked frames still
hold. A null-padded or shifted dictionary fails there, which is the
corruption the old guard condemned these slots to avoid. It never had
to.
The quarantine now covers only what is genuinely unrecoverable: the
registering frames trimmed away and the dictionary torn, so nothing
anywhere holds those ids.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent aeb92b5 commit ff53e1f
4 files changed
Lines changed: 216 additions & 244 deletions
File tree
- core/src
- main/java/io/questdb/client/cutlass/qwp/client
- sf/cursor
- test/java/io/questdb/client/test/cutlass/qwp/client
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2258 | 2258 | | |
2259 | 2259 | | |
2260 | 2260 | | |
2261 | | - | |
| 2261 | + | |
| 2262 | + | |
| 2263 | + | |
| 2264 | + | |
| 2265 | + | |
2262 | 2266 | | |
2263 | 2267 | | |
2264 | 2268 | | |
| |||
Lines changed: 35 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
111 | 119 | | |
112 | 120 | | |
113 | 121 | | |
| |||
380 | 388 | | |
381 | 389 | | |
382 | 390 | | |
383 | | - | |
384 | | - | |
385 | | - | |
| 391 | + | |
386 | 392 | | |
387 | 393 | | |
388 | 394 | | |
389 | 395 | | |
390 | | - | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
391 | 400 | | |
392 | 401 | | |
393 | 402 | | |
| |||
715 | 724 | | |
716 | 725 | | |
717 | 726 | | |
718 | | - | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
719 | 735 | | |
720 | 736 | | |
721 | 737 | | |
| |||
842 | 858 | | |
843 | 859 | | |
844 | 860 | | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
845 | 875 | | |
846 | 876 | | |
847 | 877 | | |
| |||
Lines changed: 38 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
| 47 | + | |
46 | 48 | | |
47 | 49 | | |
48 | 50 | | |
| |||
699 | 701 | | |
700 | 702 | | |
701 | 703 | | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
702 | 723 | | |
703 | 724 | | |
704 | 725 | | |
| |||
2268 | 2289 | | |
2269 | 2290 | | |
2270 | 2291 | | |
| 2292 | + | |
| 2293 | + | |
| 2294 | + | |
| 2295 | + | |
| 2296 | + | |
| 2297 | + | |
| 2298 | + | |
| 2299 | + | |
| 2300 | + | |
| 2301 | + | |
| 2302 | + | |
| 2303 | + | |
| 2304 | + | |
| 2305 | + | |
| 2306 | + | |
| 2307 | + | |
| 2308 | + | |
2271 | 2309 | | |
2272 | 2310 | | |
2273 | 2311 | | |
| |||
0 commit comments