Repository navigation
Finish transaction rotations before planned reconnects - #807
Conversation
|
🤖 Automated first-pass review — a human maintainer's review is still required before merge. Thanks for this. I went through the fix, the tests and the docs. Finishing the rotation and measuring from that boundary seems like the right compatible option from #673. Non-transaction
The synthetic peer test is a good fit here. It checks the actual commands on the wire and committed vs. discarded writes, not just reported counts. The description says it fails on the pre-fix code, which is the bar we want for a fix like this (PR#364 is an earlier example in this repo). Also, the description says independent review and the new-head CI are still pending. The core fix looks solid. I'd mainly like an answer on the processed/generated base before this merges. (Would file this as a comment, not a formal block.) |
|
The generated/processed baseline uses the standalone transaction invariant at a drained pipeline: generated work either received a final reply (processed), remains in flight, or was dropped and removed from generated by disconnect(). Transactions do not enter the retry/replay queues, and skipped commands never increment generated. Thus generated and processed are equal at this boundary, including after the unplanned-loss controls; the lower-than-base guard protects the unsigned subtraction rather than documenting an expected drift. Taking the base from generated would be equivalent under this invariant. The next interval starts from the actual drained boundary. The post-generation check is necessary in the committed interval-1 lost-MULTI case. I built a narrow mutant removing only that check: it exits 1 after one processed MULTI with “client(s) stopped before reaching their stop condition.” The final head passes. The acknowledged MULTI reaches the interval, the dropped SET is uncounted, and skipping EXEC reaches the boundary without creating a request or a future response callback. The repeated disconnect/connect action preserves the existing nontransaction scheduling path; factoring that short action is reasonable cleanup but is not needed for the counter/boundary behavior. The documentation wording will be checked in the maintainer review; current help/manpage describe the behavior directly. Validation now includes the 20 process configurations under ASan/LSan, 17 unit programs, 8 actual RLTest tests (including the existing nontransaction reconnect/drop regression), and real Redis/proxy controls. DISCARD deliberately remains 9 SET acknowledgements with zero SET executions; a request budget ending inside a rotation remains the separate tail limitation. Refs #673 leaves the original accounting-contract acceptance explicit; this PR does not claim execution-based statistics or automatic closure of the whole issue. |
…ransaction-reconnect-20261023
|
bugbot run Please review current integration head29215fe5d1d15ab13b6b7ecb80b9842e78fae63a. It combines the unchanged transaction reconnect fix with merged weighted latency, WAIT totals, bounded logging and eight-shard coverage changes. Clean17/17 units and12/12 focused runtime functions pass; full CI and independent rechecks remain pending. The automatic check skipped the unchanged PR patch. |
|
Following the 17:43:21 review update:
The duplicate connection block and first-command scan can be refactored separately; this retains the existing non-transaction path and directly tested boundary lookup. The rate-limited probe is retained with the review evidence; a committed combination test remains useful follow-up coverage. All final-head review and CI gates remain mandatory; merge will be squash only. |
…ransaction-reconnect-20261023
|
bugbot run Please review integration head cafd747. The automatic Cursor check skipped an unchanged patch; a fresh run is requested for this head. Following the 19:11:54 Claude update: the processed baseline is intentional. At a drained standalone transaction boundary, generated and processed coincide. Disconnect uncounts dropped workload requests, and lost-MULTI skipping advances the rotation without generating another request. The earlier independent GDB control observed equality at all 24 planned reconnect boundaries, including the natural rate-timer/lost-block case. The integration preserves those production and regression-test blobs exactly; it does not relabel that earlier runtime probe as a new execution. The less-than guard protects unsigned subtraction defensively. The duplicate reconnect block and first-command lookup remain localized to preserve the established non-transaction path; no new hot-path performance claim is made. The README wording describes the remaining partial request-budget limitation, which is still open as #647. The peer's error list is checked only after shutdown/server_close/join; it is a diagnostic append list rather than the multi-field transaction counters protected by the lock. I have left those nonblocking refactors/wording nits out of this integration. Fresh validation: clean 17/17 units, 15/15 authenticated focused runtime tests, and all 832 tests assigned exactly once across two sanitizer shards. Commands, source identity and results. Seven focused reviews and full new-head CI remain mandatory. |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit cafd747. Configure here.
Problem
Planned
--reconnect-intervalreconnects can discard acknowledged writes inside MULTI. On current master, 27 requests with MULTI/SET/EXEC and interval 8 report 10 SET replies while Redis executes only 7, at pipelines 1 and 8. The last rotation completes, so those missing writes come from earlier planned disconnects, independently of the request-budget tail in #647.Root cause
The planned reconnect interval can fall inside a transaction command rotation, closing the connection after QUEUED acknowledgements but before EXEC.
Fix
With
--transaction, finish the current weighted command rotation, drain its replies, then reconnect. Measure the next interval from that actual boundary: MULTI/SET/EXEC with interval 8 reconnects after 9 commands. Generation and reconnect scheduling share the same boundary check, including WATCH prefixes and command ratios. A second check after generation handles the lost-MULTI skip reaching a boundary without another response callback. Nontransaction interval behavior and the #634 unplanned-loss protection remain unchanged.Counts/latencies still describe replies: a SET inside MULTI records its QUEUED acknowledgement. This does not reinterpret historical samples as executed-command statistics. README/help/manpage explain that unplanned loss, DISCARD or aborted EXEC can retain acknowledgements for unexecuted work, and that request/time limits still apply normally. Together with the merged #634 unplanned-loss protection, this resolves #673 using its explicitly offered compatibility option: document acknowledgement-based accounting and prevent planned reconnects from cutting a transaction. The separate request-budget tail remains tracked in #647.
Tests
The final integration head
29215fenormally merges master through #814, including the eight-shard coverage capacity fix and #810 bounded stderr logging. Clean build passes all17 unit programs;12 actual RLTest functions pass in46seconds on private authenticated Redis, covering transaction reconnect, connection-kill recovery, logging and weighted latency. All823 discovered tests are assigned exactly once across eight nonempty shards. The transaction implementation and committed regression blobs are unchanged from reviewed1100e75. New-head CI and seven focused rechecks remain required; the earlier coverage timeout is not waived.Affected versions
Transaction support first appeared in 2.4.0 (
f7f8983, #390). The original issue affects 2.4.0 through 2.5.2; history derives the older tags, while the issue independently tested 2.5.2. #634 fixed continuing a lost block, but its planned-drop residual is reproduced here on master6818fe3. This PR does not claim fresh executions of every release.Fixes #673.
🤖 Generated with Claude Code
Note
Medium Risk
Changes when standalone connections reconnect under
--transactionand--reconnect-interval, which can affect benchmark fidelity and connection churn; non-transaction interval behavior is intended to stay the same.Overview
With
--transaction, planned--reconnect-intervalno longer disconnects mid–command rotation (e.g. after MULTI/QUEUED but before EXEC). The client waits until at least N requests have been generated since the last planned reconnect, then finishes the current weighted--commandrotation, drains replies, and reconnects at the next rotation boundary (including WATCH prefixes and command ratios). The next interval is measured from that actual boundary, not a raw request modulus.hold_pipelineand a newprepare_transaction_reconnect/reconnect_transaction_intervalpath inshard_connectionshare the same boundary logic; the old per-response modulus reconnect is skipped when--transactionis set. Unplanned reconnect and lost-MULTI skip behavior is unchanged; stats still count QUEUED acks inside MULTI, not executed commands.README,
--help, and the manpage document transaction rotations vs planned reconnects. A new RLTest module exercises full wire rotations, weighted commands, pipelining, and unplanned loss.Reviewed by Cursor Bugbot for commit cafd747. Bugbot is set up for automated code reviews on this repo. Configure here.