[BACKPORT 2026.2][#35212,#35247] YSQL: Always write NOTIFY rows in the statement's transaction (#37444) #38354
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 290 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.339
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #38354"
general
weight: 0.35
arpang
Summary
Outside a transaction block, the rows for
NOTIFYwere written topg_yb_notificationswith single-shard writes, which commit at once.When the statement had already read a table, the notification's cleanup
DELETE ran at that older read time, found the row its own INSERT had
just committed, and raised
Restart read required:notification was sent twice and both rows stayed in
pg_yb_notifications.commits at Sync, outside the retry wrapper, so the statement failed
while its notification was still delivered (#35212).
ybInsertPendingNotifiesToTablenow always writes in the statement'stransaction, so the INSERT/DELETE pair commits with it.
TestPgRegressPgAsyncwaits longer for notifications on sanitizerbuilds: a statement's notifications are queued only once its whole
transaction has been streamed, which for the 1000-notification step
takes over a second there.
Original commit: 85e84ddd75fc8b715d17471e0036eb9499b99a5f / #37444
Test plan
testNotifyAfterTableReadDeliveredOnce. Without the fix it failswith
expected:<[simple, simple_sentinel]> but was:<[simple, simple,; over the extended protocol the statement fails withsimple_sentinel]>
Restart read required.TestPgListenNotifypasses.with COMMIT, DDL event triggers, rollback, read-only and serializable
behave as before;
yb_read_timestill rejects writes.Run on a debug build on macOS arm64.
Merge conflicts
master --> 2026.2
src/postgres/src/backend/commands/async.c:3121— [missing-prerequisite] dropped thepersist_missing_rowargument ofYBCExecuteDelete, which 2026.2 lacks (master added it in c3bbe5de4c0, online schema change part 3); kept this commit's newtrueandYB_TRANSACTIONALarguments.🤖 Generated with Claude Code
---------
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-authored-by: Arpan Agrawal <arpan3495@gmail.com>