Commit 52a9473
Speed up recovery lookups and the per-symbol varint decode
C14. findSegmentContaining walked the sealed list linearly, on the
reconnect path, under the ring monitor -- with the list bounded only by
the documented ~16K-segment ceiling, and its sibling nextSealedAfter
doing the identical predicate in log N right beside it. The list is
sorted by baseSeq with disjoint ranges, so the same binary search
applies. A comparison probe makes it observable, and the test asserts
the counter is non-zero BEFORE asserting the bound: the counter exists
only in the binary search, so a bound-only assertion would pass for free
against a reverted linear scan -- the trap the sibling perf assertions
in this file already fall into.
C15. seedGlobalDictionaryFromPersisted poured the recovered symbols into
a default-capacity (64) dictionary, rehashing the map ~log2(n/64) times,
each pass O(current size). recoveredMaxSymbolId + 1 bounds the seed, so
the dictionary is now pre-sized before the pour. The field is no longer
final; nothing retains a reference -- the encoder and the persisted
dictionary both take it per call -- and the swap happens during
construction, before the producer or the I/O thread exist.
C16. ensureAppendMap rounded the window START down to a 4 MiB boundary
while sizing it to the record's END, so a chunk straddling that boundary
produced a window spanning both: 8 MiB mapped and re-allocated, whose
lower half covers bytes already written and never touched again. Steady
state then advanced 4 MiB per remap while always mapping 8. mmap only
requires a page-aligned offset, so the window is now page-aligned.
C17. readVarintAt returned its end position through an instance field --
a store per call, and this runs once per SYMBOL: per frame in
accumulateSentDict and once per mirror entry in sendDictCatchUp. It now
packs (value << 3) | bytes into the return, the shape
RecoveredFrameAnalysis.readVarint already uses.
That also closes a guard that could not guard. The field version returned
0 with varintEnd == p when p >= limit, so a caller computing
p = varintEnd + len got p == limit and its `p > limit` bail-out could not
fire at an exact boundary; a frame declaring more entries than it carries
would walk zero-length pseudo-entries and advance sentDictCount past
bytes the mirror does not hold. A -1 return makes truncation detectable
and every bail-out now fires.
C13 is RETRACTED, not fixed. The review claimed trySendOne's in-place
orphan-tail re-anchor was dead after a catch-up, so every retirement on a
dictionary-bearing slot cost a reconnect. The dead-arm half is right; the
cost claim is not. Both connection setup sites -- swapClient and
positionCursorForStart -- call tryRetireOrphanTail before any send, so
that arm is reached only when frames below the tail still needed acks,
which means they were sent on this connection and a recycle was always
the correct path. Proven: a test written for the fix passed with the fix
reverted. The code is restored; only the comment, which claimed the wire
mapping is untouched "because no wire sequence has been consumed" (false
once a catch-up has run), is corrected. The test is kept under a name
describing what it does pin -- that adding a catch-up leaves the
start()-time retirement intact -- and says so.
Full client suite: 2697 tests green.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 509b372 commit 52a9473
6 files changed
Lines changed: 180 additions & 36 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: 14 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
158 | | - | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
159 | 163 | | |
160 | 164 | | |
161 | 165 | | |
| |||
4080 | 4084 | | |
4081 | 4085 | | |
4082 | 4086 | | |
| 4087 | + | |
| 4088 | + | |
| 4089 | + | |
| 4090 | + | |
| 4091 | + | |
| 4092 | + | |
| 4093 | + | |
| 4094 | + | |
| 4095 | + | |
4083 | 4096 | | |
4084 | 4097 | | |
4085 | 4098 | | |
| |||
Lines changed: 60 additions & 32 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
346 | 346 | | |
347 | 347 | | |
348 | 348 | | |
349 | | - | |
350 | | - | |
351 | 349 | | |
352 | 350 | | |
353 | 351 | | |
| |||
2416 | 2414 | | |
2417 | 2415 | | |
2418 | 2416 | | |
2419 | | - | |
| 2417 | + | |
| 2418 | + | |
| 2419 | + | |
| 2420 | + | |
2420 | 2421 | | |
2421 | 2422 | | |
2422 | 2423 | | |
| |||
2453 | 2454 | | |
2454 | 2455 | | |
2455 | 2456 | | |
2456 | | - | |
2457 | | - | |
| 2457 | + | |
| 2458 | + | |
| 2459 | + | |
| 2460 | + | |
| 2461 | + | |
| 2462 | + | |
2458 | 2463 | | |
2459 | 2464 | | |
2460 | 2465 | | |
| |||
2486 | 2491 | | |
2487 | 2492 | | |
2488 | 2493 | | |
2489 | | - | |
2490 | | - | |
2491 | | - | |
| 2494 | + | |
| 2495 | + | |
2492 | 2496 | | |
2493 | 2497 | | |
| 2498 | + | |
| 2499 | + | |
| 2500 | + | |
| 2501 | + | |
2494 | 2502 | | |
2495 | 2503 | | |
2496 | 2504 | | |
2497 | 2505 | | |
2498 | 2506 | | |
2499 | 2507 | | |
2500 | | - | |
2501 | | - | |
2502 | | - | |
| 2508 | + | |
| 2509 | + | |
2503 | 2510 | | |
2504 | 2511 | | |
2505 | 2512 | | |
2506 | 2513 | | |
| 2514 | + | |
| 2515 | + | |
| 2516 | + | |
| 2517 | + | |
2507 | 2518 | | |
2508 | 2519 | | |
2509 | 2520 | | |
| |||
2569 | 2580 | | |
2570 | 2581 | | |
2571 | 2582 | | |
2572 | | - | |
| 2583 | + | |
| 2584 | + | |
| 2585 | + | |
| 2586 | + | |
| 2587 | + | |
| 2588 | + | |
| 2589 | + | |
| 2590 | + | |
| 2591 | + | |
| 2592 | + | |
| 2593 | + | |
| 2594 | + | |
| 2595 | + | |
| 2596 | + | |
| 2597 | + | |
2573 | 2598 | | |
2574 | 2599 | | |
2575 | | - | |
2576 | | - | |
2577 | | - | |
| 2600 | + | |
| 2601 | + | |
| 2602 | + | |
2578 | 2603 | | |
| 2604 | + | |
2579 | 2605 | | |
2580 | | - | |
| 2606 | + | |
2581 | 2607 | | |
2582 | 2608 | | |
2583 | | - | |
2584 | | - | |
2585 | | - | |
2586 | | - | |
2587 | | - | |
2588 | | - | |
2589 | | - | |
2590 | | - | |
2591 | 2609 | | |
2592 | | - | |
2593 | | - | |
| 2610 | + | |
2594 | 2611 | | |
2595 | 2612 | | |
2596 | 2613 | | |
| |||
2649 | 2666 | | |
2650 | 2667 | | |
2651 | 2668 | | |
2652 | | - | |
2653 | | - | |
2654 | | - | |
| 2669 | + | |
| 2670 | + | |
| 2671 | + | |
| 2672 | + | |
| 2673 | + | |
2655 | 2674 | | |
2656 | 2675 | | |
2657 | 2676 | | |
| |||
3023 | 3042 | | |
3024 | 3043 | | |
3025 | 3044 | | |
3026 | | - | |
3027 | | - | |
3028 | | - | |
| 3045 | + | |
| 3046 | + | |
| 3047 | + | |
| 3048 | + | |
| 3049 | + | |
| 3050 | + | |
| 3051 | + | |
| 3052 | + | |
| 3053 | + | |
| 3054 | + | |
| 3055 | + | |
| 3056 | + | |
3029 | 3057 | | |
3030 | 3058 | | |
3031 | 3059 | | |
| |||
Lines changed: 8 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
933 | 933 | | |
934 | 934 | | |
935 | 935 | | |
936 | | - | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
937 | 944 | | |
938 | 945 | | |
939 | 946 | | |
| |||
Lines changed: 28 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| 93 | + | |
93 | 94 | | |
94 | 95 | | |
95 | 96 | | |
| |||
608 | 609 | | |
609 | 610 | | |
610 | 611 | | |
611 | | - | |
612 | | - | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
613 | 634 | | |
614 | 635 | | |
615 | 636 | | |
| |||
841 | 862 | | |
842 | 863 | | |
843 | 864 | | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
844 | 870 | | |
845 | 871 | | |
846 | 872 | | |
| |||
Lines changed: 51 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
187 | 238 | | |
188 | 239 | | |
189 | 240 | | |
| |||
Lines changed: 19 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
462 | 462 | | |
463 | 463 | | |
464 | 464 | | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
465 | 484 | | |
466 | 485 | | |
467 | 486 | | |
| |||
0 commit comments