Repository navigation
Description
Description
In the 4.2-dev distributed stability environment, a bounded recent-history query on system.statement_info intermittently exceeds the client's 30-second read timeout during concurrent long-running workloads. This issue tracks the 4.2-dev observation and does not claim that resource contention, a particular query operator, or an engine defect has been isolated as the sole cause.
Environment
- Branch:
4.2-dev; image:commit-1b6023b(short tag, full commit SHA not independently verified). - Topology: 2 CN, 1 DN, 3 LogService and 1 Proxy; existing stability workload.
- Namespace:
mo-stb-4-2-dev-28f1f02-r36999135328-a1. - Existing stability run: https://github.com/matrixorigin/mo-nightly-regression/actions/runs/36999135328
- Investigation: 2026-11-05, timestamps Beijing time (UTC+8).
Steps to reproduce
Observed workload, not yet an isolated deterministic reproducer:
- Run the existing
statement_inforead-only soak alongside the stability workload. - Repeatedly query a bounded five-minute historical window, ordered by request time and statement ID, using a 30-second client read timeout:
SELECT statement_id, request_at, duration, status, aggr_count
FROM system.statement_info
WHERE request_at >= '2026-11-05 01:44:24.202605'
AND request_at < '2026-11-05 01:49:24.202605'
ORDER BY request_at DESC, statement_id DESC
LIMIT 100;The SQL timestamps are the literal values recorded by the server, not a claim that they are Beijing time.
Actual behavior
- At 09:51:54 the client recorded MySQL error 2013 (read timeout); the matching CN recorded
context canceledat 09:51:55 for statement ID01a1a967-5659-7b94-9de5-b11ce5325749. This is consistent with the client timeout followed by cancellation; cancellation itself is not proof of why execution was slow. - For successful
recentqueries logged from approximately 09:25 to 10:25: 190 observations, median 0.56 s, p95 18.032 s, max 27.923 s. This distribution excludes timed-out queries. Eight error events (2013) were also observed in this window, but the script does not record the failing query case or worker on each query event, so not all eight can be attributed torecent. - A separately captured ordinary
EXPLAINon the current environment for the same query shape showsTable Scan → Sort → Limit 100 → Project, with time-range block filters. This is a plan for the query shape, not anEXPLAIN ANALYZEof the failed execution.
Expected behavior
Recent-history queries with a bounded time window and limit should return promptly under a stated supported workload; investigate the observed tail latency and provide a reproducible resource/latency envelope.
Stability and controls
- Repeated timeouts observed in one loaded 4.2-dev long-running environment; no independent 3/3 isolated reproduction or latest-main validation.
- Successful queries from the same workload are observed; no comparable low-load or same-data baseline has been run.
- At 09:51:54, the two CNs used approximately 13.86/14 and 12.66/14 cores on a 5-minute average; the first CN had about 93% of CFS periods throttled. High concurrent load is a plausible contributor and has not been excluded.
EXPLAIN ANALYZEwas not run because it executes the query and could interfere with the existing test. No per-operator timing or actual scan count has been established.
Evidence
- Runner soak log:
/data1/stability-test/36999135328_a1_28f1f02/statement-info-test/statement-info.log, matching server statement ID above. - IDC Loki: namespace above, CN
stability-regression-dis-tp-cn-mhn9h, Nov 5 09:49–09:54 Beijing time. The failed query was logged at 09:51:55. - IDC Prometheus: same namespace, CN CPU and CFS throttling 5-minute rates at 09:51:54.
- IDC Pyroscope CPU profile: same CN, 09:51:20–09:52:00 Beijing time. A TableScan/Top/column-copy stack accounts for approximately 35% of the entire CN aggregate CPU sample, not necessarily this SQL alone.
Code analysis
The captured ordinary plan confirms a time-filtered scan and top/sort path. The reason for the tail latency, actual scanned data, impact of concurrent workload and whether this is a product regression remain unverified.
Regression coverage
After diagnosis, add a bounded statement_info recent-history performance check with realistic data volume, documented concurrent load, low-load control, server-side operator profiling and repeatable latency thresholds; do not weaken or stop existing stability workloads to pass it.
Related
- [Bug]: cn-dev system.statement_info marker/time-window diagnostics time out #28900 reports time-bounded marker/text queries timing out in cn-dev; SQL shapes and environments differ, and a common cause or duplicate has not been proven.
- [Performance]: system.statement_info empty-result query scans 418M rows on v4.1.3 #26960 tracks a historical empty-result
statement_infoscan issue. - [Bug]: multi-CN percentile cancellation connector cleanup times out #29492 / fix: distinguish durable pipeline termination from queue delivery #29549 concern connector terminal-cleanup warning semantics. Some warnings occurred near this incident, but no causal link to this query timeout has been established.
Activity
fix(readutil): detach ordered scan zonemaps from object metadata
fix(disttae): detach local ordered-scan zonemaps from metadata
fix(sql): enable leading-key pruning for distributed Top-K scans (#32261
XuPeng-SH commentedon Nov 6, 2026
合并范围记录:main 适配 #32261 已于 2026-11-06 11:38:37 UTC 合入,merge
5aa9884f27d7fdd71030c9b6d42c545e1460c3b2,最终 PR head2fe41d68d1b55a148def93c7dcecba6d0d9ade4b。该子范围可在包含此提交的 main 构建上验证:多键 Top-K 首键动态 block pruning、remote Top tag/scan ordering 传递、reader-owned block ordering 与 threshold,保留完整 comparator、相等首键候选以及 NULL/类型/映射保守回退;JSON/geometry 首键不启用该剪枝。本 issue 继续由 @ck89119 跟进原 4.2-dev 性能事件。当前原分支 PR #32242(head
b36f024a3601d7627fd4b05f81daa50378160be7)仍 open/unmerged;两个 PR 都写 Related to #32219,并明确未复现原 30 秒超时、未确立唯一原因或保证生产延迟改善。已合 main 的扫描优化不能代替本 issue 要求的原分支诊断、并发负载/低负载对照及可重复资源和延迟范围,因此本轮不改派整项,也不关闭。现有验证证据:作者报告 1/2 CN BVT 各两轮 92/92、受控扫描 1/16 与 4/16 blocks、相等首键保留全部候选、包级及 race 回归;approved review/13 个成功 CI contexts 绑定旧 head
ab8674a87e76,Mergify 报告最终合并门禁CI Required成功。不能把旧 head 全部测试改称最终 head 重跑,也不能把合并当作独立 #32324 的根因或修复证明。本轮为远端记录/可用补丁核对,没有执行本地或集群测试。后续记录请区分 main 剪枝功能/正确性验证与原 4.2-dev 生产样式 tail-latency 结论;现有 #32242 的合并状态及原事件跟进分别更新即可,无新增自动 backport 要求。
fix(plan): keep spatial Top-K keys off zonemap ordering
fix(sql): enable leading-key pruning for distributed Top-K scans (#32242
Ariznawlll commentedon Nov 10, 2026
结论
按用户确认,基于当前观察窗口未复现,先关闭本问题;这不代表已确认根治,后续若再次出现可重新打开。
关键证据
4.2-dev 稳定性环境运行 commit-e4f70a7268d46ea4ec45f87dceaf5b0e3f3d91d8,包含相关优化 #32242。2026-11-09 21:47 至 2026-11-10 12:30(北京时间)的现有长跑日志中,recent 查询成功 3379 次,p50 0.218 秒、p95 2.322 秒、最大 7.526 秒,该窗口没有记录客户端错误。
待解决点
这不是同数据量、同并发负载的独立对照或对原始超时的确定性复现;原问题唯一原因尚未确认,相关优化不能作为根治证明。