fix(db): bound reader statements after acquire (#3651) - #3681
Open
NanoRisk6 wants to merge 1 commit into
Open
Conversation
Routed reads already cap acquire at 150ms, but once a reader connection is held every subsequent statement was unbounded. A replica blackhole mid-transaction hung the request indefinitely because writer-fallback never ran. Arm statement_timeout (2s) and idle_in_transaction_session_timeout (5s) via after_connect on the lazy reader pool so mid-flight hangs fail closed back to the writer. Signed-off-by: NanoRisk6 <aidashtherapy@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Problem This Solves
Once a routed read acquires a reader connection, no statement timeout bounded subsequent queries. A replica that goes dark mid-transaction (LB failover, SG change, standby promotion) hung the request indefinitely — writer fallback only runs on acquire/proof errors. Fixes #3651 (activation gate for #3268).
Why This Change Was Made
Acquire is already capped at 150ms. Issue recommends
after_connectonconnect_read_pool(same pattern as the writer floor guard) with:statement_timeout = 2s— bounds every statement on the held snapshotidle_in_transaction_session_timeout = 5s— bounds idle-between-statementsReader-side only; writer pool timeouts remain out of scope.
User Impact
Evidence