[#36083] YSQL: Make every LISTEN wait for the notifications poller to start #38212
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.42) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.42 · 339 lines diff across 4 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.349
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #38212"
general
weight: 0.35
arpang
Summary
Problem. The first LISTEN on a node starts the notifications poller, and it does so after releasing
NotifyQueueLock. Meanwhile, other LISTENs can join:1. LISTEN A finds no listeners on the node, registers, and starts creating the slot and the poller.
2. LISTEN B arrives, sees A registered, and commits without waiting.
3. A fails before the poller is up (cancel, slot creation error, poller init failure).
B is now registered with no poller. It gets no notifications and no error. Every later LISTEN on the node joins B and is in the same state, until all of them leave.
Fix. Every LISTEN now waits until the poller reports that it initialized, and fails if it didn't. If A leaves before the poller reports,
ybCleanupListenStatemarks the startup failed and stops the poller, so B fails instead of waiting forever. Every way A can leave (abort, FATAL, crash) goes through that function. Once the failed LISTENs have left, the next LISTEN starts a fresh poller.Alternative rejected. Reusing
has_runtime_errorwould let B's LISTEN commit and then drop its connection with FATAL, instead of failing the LISTEN.Follow-ups.
Test plan
New tests: the first LISTEN on a node is delayed in poller init, a second LISTEN joins, then the first fails. The joining LISTEN must fail too, and a later LISTEN must get a working poller. The tests wait until the joining LISTEN shows the
BgWorkerStartupwait event, so they always exercise the join.TestPgListenNotify#testListenJoiningCancelledFirstListenFails: the first LISTEN is cancelled. Fails without the fix (the joining LISTEN succeeds).TestPgListenNotify#testListenJoiningFailedPollerInitFails: the poller fails to initialize.Run on a macOS debug build:
🤖 Generated with Claude Code