Repository navigation
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Reviewing PR #213 at level 3, head 3267f6e, base 5ea51a4. Verdict: request changes. Two blocking defects, five Moderate issues, and the PR's CI is currently red because of one of its own new tests. Every finding below was reproduced by an independent falsifier at both the head and base commits, in scratch worktrees. Wherever a real producer existed (slot-directory permission change, TCP reset), it was used; the remaining injections fire at the real failure site. The evidence for both Critical findings was re-run a second time. PR metadata. The title follows the repo's conventional-commit style. The PR is still a draft. The description puts numbers in bold and doesn't name Critical1. A transient fsync failure during a recycle leaves the sender unable to publish, permanently
How it happens:
Who sees it: the standalone Trigger: a slow fsync that ends in EIO/ENOSPC while a recycle is being claimed. The window is narrow, but it widens on degrading storage, where failing fsyncs are slow and the claim waits up to 30 s for exactly that sync. The default Suggested fix: a non-terminal store error seen after parking must not strand the session. Either:
2. Every pooled Arrow flush pays an extra full validation pass while recycling is armed but cannot run
Code path: Measurements (8 columns: 3 Utf8 symbol columns, 1 dictionary symbol column, 4 others):
How long the armed state lasts:
Durable-ACK mode, where "drained" means durably acknowledged, is the obvious real-world case of long ACK latency. That case was not executed separately. Classification: in-diff. Suggested fix: take the drained/live snapshot first. Validate only when a recycle is pending, or when the snapshot shows a claim will be attempted (drained, live, no open deferred group). For example, pass the validation as a callback that Moderate3. A recoverable recycle failure leaves the standalone sender in a misleading parked state
Symptoms, each executed:
Note that base already latches Suggested fix:
4. macOS: a server reset during the manual-mode bounded wait fails the flush
Code path:
The reset can arrive during the wait or just before the flush while the arm is aging. Linux was not tested and probably accepts the Suggested fix: when the transport has already disconnected or scheduled a reconnect, treat a timeout-restore failure as part of that disconnect, not as an API error. 5. A terminal background sender keeps its server connection open until it is dropped
Code: Suggested fix: park the core only when a recycle claim requested the stop. On any other exit, drop it, as base did. 6. Reset backpressure returns
|
…ling it The recycle drain deadline can expire between the driver's time check and the socket call. `apply_io_deadline` then returned a TimedOut error for a read or write it never attempted; the WebSocket reader reported that as a disconnect, and the next progress call reconnected and replayed. An expired deadline now bounds the call with the smallest positive socket timeout, so an idle non-blocking read stays idle and a small write still goes out, while a stalled write remains bounded. Found by stressing the bounded-wait recycle test under CPU load, where it reproduced the CI failure signature with no ACK race in play. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…faults Review round 1 of the symbol dictionary recycling PR found that a recoverable fault while a recycle had parked its worker could strand or mislabel a working sender. Fix each case at the class level, in both progress modes and for standalone and pooled senders: - A claim that finds the store terminal after parking drops the parked session so its connection closes at once; a claim that finds a periodic-sync durability latch after parking hands the session back to a restarted worker (new traffic gate, ordinary reconnect with dictionary catch-up), since only a worker retries that sync. A worker spawn failure while un-parking marks the session terminal. - The worker parks its session only when a recycle claim asked it to stop; a terminal or closing exit drops it, so a terminal sender releases its server connection before it is dropped. - Chunk/Arrow input validation runs only when a recycle is about to be claimed or resumed. An armed policy whose claim cannot succeed (undrained queue, link down, open deferred group) no longer validates every flush. - `Sender::must_close()` follows the publication lifecycle for QWP/WebSocket; a recoverable `SocketError` (back-pressure timeout, durability latch, storage fault during recycling) no longer retires the sender. - Close with a drained reset that a storage fault interrupted abandons the reset inside the queue (topology reservation released, borrowed spare or budget returned) and runs the ordinary drained close, releasing the slot at close. The queue's own `close` keeps refusing while a resumable reset is pending. Manual `drive_once` resumes a parked recycle and always drives orphan drainers. - Reset back-pressure at the drained boundary runs trim-only maintenance (never the cadence sync) until the reset can reserve its segment or the append deadline passes, sleeping out a deferred trim barrier rather than polling, then reports it as the same `SocketError` an append timeout does. - A failed socket-timeout restore on a peer-reset socket during the bounded wait joins the reconnect instead of failing the flush (macOS/BSD return EINVAL there). Tests: the bounded-wait test withholds ACKs through the mock instead of racing a timer; new coverage for every path above, including a mock fault that resets the connection after a frame and a hook that latches a durability failure at the parked claim. Docs for `must_close` updated in Rust, FFI and the C header. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Summary
Long-lived QWP/WebSocket store-and-forward senders retain symbol dictionaries as new values arrive, eventually reaching the dictionary limits even after older frames are acknowledged. This change lets those senders recycle a drained dictionary at a safe public flush boundary and start a fresh wire session while preserving the live sender's frame sequence numbers, slot ownership, progress observers, and cumulative accounting.
Recycling is enabled by default. It is armed after a successful publication reaches the configured threshold and current hysteresis floor, then runs before encoding the next eligible nonempty publication. It cannot split a public publication or an open deferred-commit group, discard unresolved frames, or release and reacquire the live slot lock.
Behavior and API
symbol_dict_resetonon,offsymbol_dict_reset_threshold1000001..=1000000symbol_dict_reset_max_wait_millis20000..=9223372036854reset_symbol_dictionary()advisory methods on standalone and pooled sender APIs. Requests coalesce and schedule a future safe reset; they do not themselves flush, wait, connect, or guarantee completion. Disabled recycling is a no-op, while closed/terminal senders retain their existing errors.Sender::must_close()(andline_sender_must_close) follows the publication lifecycle for QWP/WebSocket: a server rejection or protocol violation retires the sender, while recoverableSocketErrors (a back-pressure timeout, a periodic-sync durability latch, a storage fault during recycling) do not. This also removes the pre-existing latch after an append timeout.Implementation and scope
SocketErroran append timeout produces. A deferred trim barrier is slept out until its retry time instead of polled, and a budget with no acknowledged segment left to trim fails at once (defensive: the capacity validation makes it unreachable).closekeeps refusing while a resumable reset is pending. Manualdrive_once(andwait, which drives) resumes a parked recycle and always drives orphan drainers. A failed socket-timeout restore on a peer-reset socket during the bounded wait joins the reconnect instead of failing the flush (macOS/BSD return EINVAL there). A worker-thread spawn failure while un-parking marks the session terminal, as a worker panic does.QuestDb::flush_polars_dataframe, remains excluded; no C manual-reset ABI is added.Validation
Vs QuestDB masterCI job (TestVsQuestDBMaster) andenterprise-e2e-c-client.almost-all-features,arrow,polarson Rust 1.91.1: 2,710 passed, 0 failed, 27 ignored.2bffcfd4): 710 passed, 421 expected skips. Named churn/restart/bounce tests assert observed resets and complete row-to-symbol mappings. Enterprise validation covers actual demote/promote barriers, Rust/C/C++ row senders, and Chunk/Arrow/Polars automatic, disabled, and advisory modes with durable ACKs.Review round 1
All seven findings of the first review and its adjacent base finding are addressed. Where the fix differs from the reviewer's suggestion:
same == 1) with no ACK in play, which exposed a wire-level defect behind it: when the drain deadline expired between the driver's time check and the socket read, the socket helper returned a "deadline expired" error for a read it never attempted, the reader reported that as a disconnect, and the next progress call reconnected and replayed. An expired deadline now bounds the call with the smallest positive timeout instead of failing it (ws/nosigpipe.rs), with a unit test for the idle-read and small-write cases.must_closelatched after an append timeout): fixed by the same change as finding 3 instead of being filed separately, since the fix is one line class and both symptoms share it.Independent delta review of this round (fresh agent, diff only): two gaps and one new defect it found are fixed above (slot lock held until drop; a thread-spawn failure during un-park re-stranding the session; the reset loop polling the append deadline at 50 µs). Not taken: a pooled-level test that
validate_chunk/validate_arrow_batchare skipped while armed-but-blocked. The skip is decided inPublicationRecycle::before_publication, which is unit-tested with a counting callback; the pooled sites only forward their validator closures, and the skip is not observable there without instrumentation because the encode path validates the same input.Findings not taken from the review itself: none.
Draft status and remaining validation limits
5ea51a47show unresolved throughput declines: symbol validation/descriptor append 7.16%, f64 append 4.66%, and S1 below-threshold row wall throughput 8.19% with substantial variance. Source/disassembly inspection did not identify additional hot-path work; this is not a general no-regression result. The validation change from review finding 2 removes the per-flush validation pass while a recycle is armed but blocked; it has not been re-measured.f017fda5; later commits name the cold maintenance phases, strengthen close tests, clarify documentation and apply the review fixes. Measurements were not rerun on them. High-cardinality connection observations cover the whole warmup/measurement invocation, not exact per-pass recycle cadence.🤖 Generated with Claude Code