Repository navigation
Keep discarded cached Parses out of the pending queue - #135
Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 2 commits intoDec 2, 2026
Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 2 commits into
gh-worker-dd-mergequeue-cf854d[bot] merged 2 commits into
Conversation
Exercise pending-statement confirmation across savepoint recovery and bind the new statement after commit so discarded pending entries cannot mask a lost definition. Signed-off-by: Perfloop Agent <[email protected]>
An earlier buffered error makes PostgreSQL ignore a cached Parse until Sync. Do not queue or forward that Parse: in a transaction held across savepoint recovery it would consume the next valid ParseComplete. Signed-off-by: Perfloop Agent <[email protected]>
|
Hi, I'm Tomás, I build Perfloop. I approved this contribution and will handle review feedback here. @jhinds, this builds on the cached- If you'd like anything in this patch changed, just let me know and I'll update it. |
Collaborator
|
@tsenart thanks for the contribution! let me run the tests |
jhinds
approved these changes
Dec 2, 2026
gh-worker-dd-mergequeue-cf854d
Bot
merged commit Dec 2, 2026
9bfb6ba
into
DataDog:main
16 checks passed
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 does this PR do?
An extended-query pipeline can lose a valid prepared statement after an error and rollback to a savepoint: a Bind of
s_otherafter COMMIT fails with SQLSTATE26000. This change prevents a discarded, backend-cachedParsefrom consuming the next valid statement's confirmation.Motivation
With
SELECT 1already cached, a failing message followed byParse(s_reuse, SELECT 1)andSyncleavess_reusepending. AfterROLLBACK TO SAVEPOINT, parsings_otherasSELECT 2incorrectly confirmss_reuseinstead. A Bind inside the transaction can still finds_otherin the pending queue; COMMIT clears that queue and exposes the missing confirmation.Move the cached-path return outside the success-only branch: discarded Parses are neither queued nor forwarded, while successful cache hits still produce
ParseComplete. The next confirmation then belongs tos_other. This covers named statements with automatic caching off or on, and automatically cached unnamed statements.How did you test it?
Focused session Go tests passed on Go 1.26.0 and Go 1.27.4 with race detection. The regression in
pkg/session/discarded_parse_pending_queue_test.gofails without the fix and passes with it across all 12 cache-mode and earlier-error combinations. Scoped CONTRIBUTING checks pass.test/integration/discarded_parse_test.gonow binds after COMMIT and compiles with race detection. PostgreSQL-backed integration execution remains unvalidated and is left to target CI.AI assistance
Implemented with Perfloop.
Case and evidence
Made by Perfloop. Human sponsor: Tomás Senart.