[#38182] YSQL: Fix duplicate notifications from retried statements #38183
All Vouch review confidence checks passed
Residual risk 0.15 = Change Risk (0.39) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 250 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.331
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #38183"
general
weight: 0.35
arpang
Summary
A query-layer retry kept the discarded attempt's notifications in
pendingNotifies: the restart does not reset PG-side transaction state, so the retried attempt queued its notifications again, and a notification whose payload differed between attempts was delivered twice (#38182).The retry wrapper (
yb_exec_query_wrapper_one_attempt) now takes a mark of the pending notifications when the statement starts and rolls back to it on retry:executeBatch) a retry re-runs only the failing statement, and the notifications queued by earlier statements in the batch must survive.Test plan
testNotifyFromRetriedStatementDeliveredOnce. Without the fix it fails withNotifications: [kept, attempt_..., attempt_..., sentinel] expected:<3> but was:<4>. It runs under REPEATABLE READ: under READ COMMITTED, the default in release builds, the retry rolls back the statement's internal subtransaction, which drops the attempt's notifications, so the test passed without the fix there.testNotifyFromRetriedStatementInReadCommittedBlock: rolling back to the mark keeps the notification queued by the previous statement of a READ COMMITTED block. It passes without the fix too, for the reason above.TestPgListenNotifypasses.Run on a debug build on macOS arm64.
🤖 Generated with Claude Code