[BACKPORT 2026.1][#34371,#34668] DocDB: Fail yb_thin_client connections over to another tserver when theirs stops answering (#34374, #34684) #34678
All Vouch review confidence checks passed
Residual risk 0.20 = Change Risk (0.46) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.46 · 477 lines diff across 5 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.369
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #34678"
general
weight: 0.35
arpang
Summary
yb_thin_client pinned each connection to one tserver: connection i used
address i, and a session dropped on a network error was reopened on the same
tserver. A pool that fits on one connection, such as 1 read + 1 write session,
sent everything to the first address. When that tserver stopped answering,
every retry went back to it, and writes stalled until it returned, even though
the rest of the cluster held quorum. Client creation also failed if any
session's tserver was unreachable, so recreating the client could not escape
either.
one it uses. Each session records the tserver it was opened on, since
session ids are local to a tserver.
answers alone), moves the connection to the next tserver. A Perform or
OpenTable timeout does not: the tserver may be alive and waiting on a tablet
leader or the master.
its next use. A paged scan pinned to it gets YBTHIN_READ_RESTART without a
reopen.
ybthin_table_open after any failed RPC. At create, the connection follows
the tserver its session opened on. On the call path a reopen still tries
one tserver, so it takes at most one RPC timeout; a caller also waits out
any reopen of its session already in progress.
call went out.
sessions (after one failed reopen, a connection's other sessions wait for
the next round), and checks for shutdown between sessions.
No new flags, and no defaults change. With a single configured address,
nothing moves.
Test fix from #34684
Also includes #34684, which fixes a race in the failover tests:
PagedScanAcrossAFrozenTserverfailed 2 of 20 times on ASAN.ExternalDaemon::Pause()sends SIGSTOP and returns before the tserver'sthreads have stopped, so a tserver the test meant to freeze could still
answer the next RPC. A
Freeze()helper now pauses the tserver and waits,via
waitid(WSTOPPED | WNOHANG | WNOWAIT), until the whole process hasstopped. All three failover tests use it. Test-only change.
Backport notes
Two clean cherry-picks, in separate commits.
before the original commit, so the patch is the same as the original.
merged to master yet. The test file matches #34684's version exactly. If
#34684 changes before it merges, this backport needs the same change.
Original commits:
Upgrade/Rollback safety
Client-side only: no wire-format, RPC, or C ABI change. The tserver needs no change.
Test plan
./build-support/lint.sh --rev origin/2026.1: 0 errors, 0 warnings.yb_thin_client-itest, including the failover tests added by theoriginal change:
- PgThinClientFailoverTest.OneConnectionPoolMovesOffAStoppedTserver
- PgThinClientFailoverTest.CreateSkipsAnUnreachableTserver
- PgThinClientExternalFailoverTest.WritesMoveOffAFrozenTserver
- PgThinClientExternalFailoverTest.PagedScanAcrossAFrozenTserver and
PageInFlightWhenItsTserverDies, which #34684 deflakes
<!-- Reviewable:start -->
This change is <img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>
<!-- Reviewable:end -->