Commit de8ba19
Add async progress callback, fast-close opt-out, and test coverage
Pair the existing SenderError async dispatch with a SenderProgressHandler
sibling so users can react to ack-watermark advances off the I/O thread.
SenderProgressDispatcher mirrors SenderErrorDispatcher: bounded inbox,
lazy-started daemon, volatile handler swap. Watermarks are monotonic, so
a full inbox evicts the oldest entry rather than the newest -- drops
compress, they don't lose information. CursorWebSocketSendLoop dispatches
on every advance the engine actually accepts; CursorSendEngine.acknowledge
and SegmentRing.acknowledge now return a boolean to give the loop a
no-cost way to skip dispatch on idempotent re-acks.
Make the close() drain genuinely opt-out. close_flush_timeout_millis<=0
now skips both drainOnClose AND the pre-drain checkError(). Previously
checkError ran unconditionally, so a HALT-policy rejection always escaped
through close() even when the user explicitly asked for a fast close.
Users opting out are expected to observe outcomes via the async progress
or error callback instead, which is exactly the surface this change adds.
setProgressHandler and setErrorHandler are post-connect-effective: they
forward to the live dispatcher's volatile handler field so builders,
tests, and reconfigurable apps can install a new handler without tearing
down the dispatcher thread. Drop the unused 1-arg
SenderProgressDispatcher constructor and the dead capacity field; the
LinkedBlockingDeque enforces its own bound, so the field had no readers.
Cover the public surface with focused unit tests:
- CursorSendEngineTest gains coverage for wasRecoveredFromDisk(),
sealedSegments(), sealedSegmentsSnapshot(), and segmentSizeBytes().
Snapshot tests assert empty-buffer, sized-fit, and undersize-buffer
paths; recovery tests cover memory-mode, fresh-disk, and reopen.
- CursorWebSocketSendLoopDurableAckTest gains coverage for
getTotalDurableAcks() and getTotalDurableTrimAdvances(), including
the on-enqueue drain path that bumps trim advances even when the
durable-ack frame itself ran against an empty queue.
- SegmentRingTest gains coverage for maxBytesPerSegment(), including
the openExisting recovery path which forwards the configured value.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 5ae7149 commit de8ba19
11 files changed
Lines changed: 1380 additions & 519 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: 76 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
0 commit comments