[#38556,#38733] YSQL: Restart the notifications poller on errors instead of terminating listeners #38903
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 · 343 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 #38903"
general
weight: 0.35
arpang
Summary
Problem. The notifications poller reads
pg_yb_notificationsthrough the virtual WAL. The virtual WAL retries only a few known tablet errors itself (kRetryableErrorPatterns: not leader, tablet not running, ...) and passes everything else up, because walsender's client is expected to reconnect and resume. The poller instead treated every such error as fatal and terminated all listeners on the node, even for transient ones like aTimedOutRPC during a leader move. Listeners lost notifications until they reconnected. Separately, a poller that failed to restart didn't tell its listeners, which stayed connected but silently received no new notifications (#38733).Fix. The poller now recovers the way a walsender client does: it exits and the postmaster restarts it from the slot's restart LSN. This is safe because it acks only after writing to the queue, and listeners skip replayed entries (#30947). Listeners see a delay instead of a disconnect.
Listeners are still terminated when restarting can't help:
yb_notifications_poller_no_progress_timeout_mswhen an error hits. Progress means acking a transaction, or an empty read between transactions. A poller stuck replaying a failing transaction makes none, so it gets terminated; a healthy poller keeps making it, so its transient errors never add up.Known limits. A transaction that takes longer than the timeout to stream and then hits an error terminates the listeners. Also, a LISTEN issued while the poller is restarting can receive notifications from transactions that committed shortly before it, as it can whenever the poller lags; restarts make that lag longer.
Closes #38556, closes #38733.
Test plan
./yb_build.sh release --java-test 'org.yb.pgsql.TestPgListenNotify#<test>', release on macOS arm64:All passed locally before the switch to the no-progress timeout; the current head is covered by CI only, and
testLaterErrorAfterProgressRestartsPollerhas not run locally.testPollerRestartsAfterTransientError,testLaterErrorAfterProgressRestartsPoller,testRestartedPollerRecoversFromInitFailure,testRestartedPollerInitFailureTerminatesListenerstestPollerErrorHoldingQueueLock,testCdcRuntimeErrorBlocksNewListenertestCdcRuntimeErrorTerminatesListeners(real stream expiry),testPollerRestartDoesNotRedeliverNotifications,testListenJoiningFailedPollerInitFails🤖 Generated with Claude Code