Repository navigation
Description
Description
A TN WAL driver starting ReplayForWrite can fail after 3 minutes while two of the three LogService voters remain responsive. Its first GetTruncatedLsn uses a pooled RPC connection to one unresponsive follower. The managed client changes addresses only after the RPC returns an error; the driver's first-attempt deadline is its entire 3-minute retry budget. When that deadline expires, the driver stops instead of trying another already available replica, so WAL replay returns context deadline exceeded before reading any records.
This is an observed WAL driver startup failure, not an end-to-end TN/SQL outage claim. TAE's replay/promotion path uses this driver and propagates replay errors, making TN recovery a credible impact. A real TN process was not started in this test.
Environment
- MatrixOne source baseline
upstream/mainatd61a7206c16b30baa4efc525eb6067c4364035aa; probe/report commitf77bb91fd7. - Dedicated three-voter LogService cluster on
10.222.1.51; data shard 1, RPC addresses127.0.0.1:58201,:58211,:58221; default 5-minute store expiration. - Test uses TN's
wal.NewLogserviceHandleandStoreImpl.Replay(ReplayForWrite), the reallogservice.NewClientwith all three service addresses, and defaultClientMaxCount=100/ driverMaxTimeout=3m. The probe's outer replay context is 6 minutes so it does not cause the 3-minute failure.
Stable reproduction
On a fresh dedicated cluster with the checked-in WAL probe and chaos-client, run the reproducer using a unique tag. It starts the WAL process, waits until its 100 client connections have been created, queries the current data-shard leader, SIGSTOPs one ordinary replica, and releases ReplayForWrite. It retries connection-selection attempts until the replay call is stalled, then keeps only that one replica paused through the driver's default deadline. A safety task and finally resume the node.
python3 test/logservice-chaos/tn_driver_probe/reproduce_replay_tail.py \
--root /home/mo/jxm/logservice-tnwal-lifecycle-20261105 \
--probe /home/mo/jxm/tn-wal-probe-lifecycle \
--tag replay-tail-newWhile replay is stalled, query GetTruncatedLsn directly through each of the other two addresses. In both fault runs those requests immediately returned 3612; their shard status also showed a leader and all three configured voters. A healthy control replay after node recovery completed in 229.536 ms.
| Run | Paused ordinary replica | First GetTruncatedLsn |
ReplayForWrite |
|---|---|---|---|
replay-tail-1 |
node0 | context deadline exceeded after 3m0.000644s, retry-times=1 |
Exit 2; zero WAL records read/applied. |
replay-tail-9 |
node2 | context deadline exceeded after 3m0.000224s, retry-times=1 |
Exit 2; zero WAL records read/applied. |
Code path and expected behavior
logservicedriver/replayer.go:initReadWatermarkscallsgetTruncatedPSNFromBackendbefore any replay reads.logservicedriver/truncate.go:getTruncatedPSNFromBackendobtains one pooled client. EachGetTruncatedLsnattempt usesd.config.MaxTimeout(default 3 minutes); after the first failure it checks whether elapsed time already exceeds that same budget, and returns the error without trying another client.pkg/logservice/client.gocreates data RPC clients withWithBackendReadTimeout(0)and resets a managed client's connection only after the request returns an error. A TCP connection to a stopped/unresponsive replica can therefore consume the whole driver budget.- TAE
db.ReplayWalinvokesWal.Replay;ReplayCtl.StopForWritepropagates replay failure to promotion. The test proves failure at the WAL boundary; TN process and SQL effects remain unmeasured.
With two responsive voters and a readable truncate watermark, replay should switch to a reachable replica within a bounded failover window and continue. Any timeout/failover change must preserve WAL read consistency and avoid treating an uncertain write outcome as a definite failure.
Related #32133 and #32148 cover 60-second Append/Read tails from stale RPC connections. This issue records a distinct 3-minute replay initialization failure caused by the GetTruncatedLsn retry budget.
Full report. Raw logs are retained on 51 under /home/mo/jxm/logservice-tnwal-lifecycle-20261105/replay-tail-{1,9}.log and replay-tail-control.log. All three test nodes were stopped after the experiment.
Activity
jiangxinmeng1 commentedon Nov 5, 2026
同一旧连接失效机制还影响 checkpoint 后台物理
Truncate:在默认 100-client TN WAL driver 上,checkpoint intent ACK 已返回,后台新建的 LogService 客户端连接到普通副本 node2。暂停 node2,另外两票保持可读,直接查询截断位点立即返回旧值 PSN 3612。首次截断尝试的默认 3 分钟 context 到期后,第二次才换地址成功;Wal-Truncate-Execute总耗时 3m0.529s,物理位点随后推进到 PSN 6923。期间测试进程已经输出写入完成摘要,但正常Close一直等待后台截断。测试屏障放在第一次 RPC 发送前,计入首次尝试的 context 时间;没有将 3 分钟归因于 RPC 本身的全部耗时。这不是新的回放失败,也未测量事务提交延迟;它是两票可用时相同长超时机制在物理清理路径的表现。记录与探针:jiangxinmeng1@081adbc931 ,原始日志在 51 的
/home/mo/jxm/logservice-tnwal-lifecycle-20261105/truncate-tail-a.log。jiangxinmeng1 commentedon Nov 5, 2026
补充真实 TN WAL driver 入口(
wal.NewLogserviceHandle、默认 100 client、三地址)的网络故障复现:先建立客户端池,再把一个普通副本的专用 RPC 端口用iptables OUTPUT DROP黑洞,另两票始终存活且直接GetTruncatedLsn/GetLatestLsn成功。两次命中旧连接的
ReplayForWrite都在首次GetTruncatedLsn等待约 152.15 秒后收到 TCPi/o timeout,重连并成功回放;完整耗时 152.154 / 152.119 秒。健康对照耗时 280.795 毫秒。两次回放的 10 条保留 WAL 记录与对照逐条一致。与此前SIGSTOP单副本后约 180 秒直接回放失败不同,网络 DROP 最终成功,但两者都显示两票可用时故障检测长尾。报告及安全清理的复现脚本:https://github.com/jiangxinmeng1/matrixone/blob/7914370688/docs/design/logservice_three_node_failure_test.md ,https://github.com/jiangxinmeng1/matrixone/blob/7914370688/test/logservice-chaos/tn_driver_probe/reproduce_replay_network.py 。原始日志在 51 的
/home/mo/jxm/logservice-tnwal-lifecycle-20261105/replay-net-4.log、replay-net2-2.log、replay-net-control.log。测试节点与网络规则均已清理。fix(logservice): harden reads, proposals, snapshots, truncation, and …
XuPeng-SH commentedon Nov 6, 2026
QA 交接:#32149 已于 2026-11-06 07:40:26 UTC 合入 main,merge
ee5e93bcefd4f04bcda6b8e5002eef96038396d3,最终 headf83150eb8ffb17a3d91a3fbf6865e5a0d0b9ec2e。将本 issue 的 replay 初始化截断水位读取修复转交 @Ariznawlll 验证,不代表验收通过,也不把所有 WAL 路径一并标为已修复。修复范围:
GetTruncatedLsn单次 7 秒 child deadline,响应黑洞或连接错误后 reset,在 caller 有效时重连重试;getTruncatedPSNFromBackend获取 client 后使用一个总 MaxTimeout budget,并让重试/backoff 响应取消。空池clientPool.Get()仍不识别 context;不改变 Append/Truncate 写语义。已完整读正文与 2 条评论、PR 最终 diff 和讨论。旧构建的 SIGSTOP 约 180 秒失败、网络 DROP 约 152 秒后恢复、10 条 WAL 数据一致均是修复前证据,不是新版本失败。作者报告真实 LogService client+response-dropping proxy 的水位恢复及短 caller 截止、mock transient retry/取消测试,以及 logservice/WAL normal/race、focused repeats、vet 通过。最新本地验证及 approved review 绑定旧 head
790bca9921;Mergify 报告合并门禁CI Required成功。本轮没有本地或集群实测,三 voter 网络场景尚未在合并版本重跑。QA 建议:建立默认 100-client 池后,对命中的普通副本分别 SIGSTOP/网络黑洞,保持另外两票可读,验证 replay 初始化换地址恢复、总预算/短 caller 取消、保留 LSN/payload 与健康对照一致;另测随机重连、健康慢请求及空池边界。7 秒不是完整 TN/SQL 或所有 blocked-send 的硬时限。
范围边界:现有评论中的 checkpoint 物理 Truncate / Close 长尾不作为本次 replay 初始化修复的通过结论。#32329 跟踪后台 Truncate 不响应 shutdown 的取消链,#32322 跟踪 replay Read 外层取消,均未被本 PR 修复,继续保留研发;#32133 的 Dragonboat proposal transport 也不包含。本次转测不关闭这些独立问题。
Ariznawlll commentedon Nov 10, 2026
结论
测试通过。验收范围是 #32149 修复的 WAL replay 初始化读取截断位点:单个 LogService 副本无响应时,在另外两个副本可用的前提下重连并继续回放。此结论不扩展到完整 TN 重启、SQL 可用性或其他 WAL 写入/截断路径。
关键证据
11d2e1ef7e1b3ed3a20e6d7f29f912e55118db5b上编译同一版本的 MO 和真实 WAL driver;隔离环境启动 3 个 LogService voter,使用默认 100-client 连接池。健康对照回放成功。待解决点
空连接池
Get()仍不响应 context,属于本次修复明确排除的边界,不能将本次通过理解为其已修复。物理 Truncate/Close、replay Read 的取消链及端到端 TN/SQL 故障恢复不在本次验收范围;相关问题继续分别跟踪。