Repository navigation
Description
Description
A LogService client can return an RPC error from GetLatestLsn or GetRequiredLsn when its established connection points to one isolated store, even though the other two voters remain healthy and can serve the query. Both operations are read-only, but the managed client resets the connection and returns the error without trying a healthy address. This is distinct from the Read and GetTruncatedLsn retry paths in PR #32149.
Environment
- Three LogService voters and three HAKeeper voters on the isolated
10.222.1.51test host; independent network namespacesmofpn0-2, subnet198.18.53.0/24. - Binary built from PR fix(logservice): harden reads, proposals, snapshots, truncation, and HAKeeper restart #32149 head
790bca99211ad431e9ea62429cc4c955956b9ef2. ItsGetLatestLsnandGetRequiredLsnimplementations matchupstream/main65b721e1b93c6b9e05db2063b220e0c35916b335. - Direct client uses
logservice.NewClientwith all three service addresses and a 70-second caller deadline. No TN/CN process was started.
Controlled reproduction
- Create one client and successfully call the selected query. Pause that same process before its next call.
- Use
ss -tnpto identify its established RPC peer. Disable only that store's host veth, leaving the other two voters mutually reachable. - Release the next call while the established connection is blackholed. Restore the veth after the observation.
| Operation | Established peer isolated | First value | Second call result |
|---|---|---|---|
GetLatestLsn |
node2 198.18.53.12:58821 |
233 | rpc timeout after 1.001 s of the second call |
GetRequiredLsn |
node1 198.18.53.11:58811 |
0 | TCP read i/o timeout after 10.301 s of the second call |
During the node2 isolation, a fresh client restricted to healthy node0 and node1 returned latest=234 err=<nil>. During node1 isolation, a fresh client restricted to healthy node0 and node2 returned latest=238 err=<nil>. The initial queries succeeded before isolation, and both fault scripts restored the links afterward.
In pkg/logservice/client.go, managedClient.GetLatestLsn and managedClient.GetRequiredLsn reset the client after any error, but only loop when isRetryableError sees shard-not-found. The MORPC timeout is returned directly. A read-only query should retry on an isolated connection while its caller deadline is still live; the retry must preserve the requested result and avoid retrying a permanent application error.
Evidence
Raw logs, probe binary, and fault scripts: /home/mo/jxm/verify-pr32149-20261106/{latest,required}{,-fault}.log and query-probe on the test host. The same test root contains the cluster configuration and node logs. This direct-client test establishes the API failure; it does not claim a measured TN/CN impact.
Activity
Fix LogService required LSN and WAL recovery across failover (#32330)
XuPeng-SH commentedon Nov 10, 2026
QA 交接:修复 PR #32330 已于 2026-11-10 12:26:03 UTC 合入 main,merge SHA
39e470bad8262405906ada3b38d5da40647184f9(最终 headb837dd5d2d5ba8015b64aa037cde13b00621a7bf)。本项转交 QA,不代表验收通过。GetLatestLsn/GetRequiredLsn 使用有界尝试并在 caller 仍有效时切换连接重试;重点复测当前连接 voter 黑洞、健康多数派读回、短 deadline、取消与永久应用错误,保留返回值语义。
已核对本 issue 完整讨论及 PR 最终相关源码、全部 review/回复:旧快照 revision、ownership loss 重启、生产工厂取消、leader-state RPC deadline、read-only TruncateWAL 五项旧问题均已有修复及后续评审确认,没有当前适用的已验证反例或未完开发 follow-up 阻止本项转测。
实际证据与限制:作者报告 logservice、datasync、tnservice、TAE db、logservicedriver、wal owning suites 及定向 ownership/cancellation race 通过;远端合并队列记录 CI Required 成功。以上为作者/远端证据,本轮未本地执行、未读取测试主机原始日志,不能替代最终 merge SHA 的真实三 voter 故障、完整 TN/CN SQL 或长稳验收。请按本项原场景复测并记录版本、注入边界、时延及恢复结果。旧格式已物理截断且无认证 checkpoint 边界的 #32240 仍单独保留研发;不因本次转测自动要求 4.2 backport。
Ariznawlll commentedon Nov 11, 2026
测试版本
官方 main
553e16f52b02d59e9ecc5e3c8862f2603e661f48;本地与 Linux CI 均使用独立三进程、三副本 LogService,直接调用 LogService client。原问题验证
客户端配置三个地址并确认已有连接;分别隔离其连接的 leader 或 follower 的响应,其余两票保持可用。
GetLatestLsn、GetRequiredLsn均在 caller deadline 内切换并成功,最新 main Linux CI 两种角色约 10.1 秒返回。实际注入是代理丢弃已有连接的响应,不是物理交换机断网。Happy Path 覆盖
故障前正常写入并查询;故障后查询成功,latest 不小于已确认 LSN,已确认记录可从三个副本读回。
Unhappy Path 覆盖
leader/follower 两种故障各重复 3 次的本地三进程矩阵通过;短 deadline 和主动取消对照通过。永久应用错误测试验证错误只调用一次、及时返回,随后正常读取仍可用。
白盒验证
最新 main
TestManagedLSNOperationsLeaveIsolatedEstablishedConnection以-race -count=3通过;永久错误定向测试同样以 race 重复 3 次通过。回归测试
已加入 MOTR PR #1926 的每日三副本故障回归,PR 尚未合入。
测试证据
Linux CI 三副本任务 基于同一 main SHA 通过,两个 API 的 leader/follower 注入均记录
all_voters_read=pass。最新提交的 Linux 三副本 CI 也已通过。测试结论
测试通过。此结论针对 LogService client API,不等同于完整 TN/CN SQL 或长稳验收。