Repository navigation
Description
Description
Multiple independent Window-function query shapes in the Jinpan AP workload reach the configured 7200-second limit on the dev multi-CN environment. This issue intentionally excludes q1004_adv_window_frame_running, which is already tracked in #26066.
Environment
- Workflow: https://github.com/matrixorigin/mo-nightly-regression/actions/runs/33482459227
- Workflow branch:
codex/mo-ap-regression-dev-assets - Deployment: cn-dev
freetier-01, multi-CN, OSS-loadedjinpan_001dataset - SQL limit:
--sql-timeout 7200 - Date: 2026-09-01 to 2026-09-04
Reproduction
Run the Advanced Join phase against the jinpan_001 dataset. The following Window-function cases each ran for the full 7200 seconds and were then terminated by the runner:
q1045_adv_window_frame_runningq1127_adv_window_frame_runningq1143_adv_inventory_ratio_winq1225_adv_inventory_ratio_winq1250_adv_window_frame_runningq1348_adv_inventory_ratio_winq1430_adv_inventory_ratio_winq1824_adv_window_frame_runningq1922_adv_inventory_ratio_winq1947_adv_window_frame_running
Actual behavior
Each listed query exceeded two hours of execution time. The runner emitted:
Execution timeout after 7200s; skips remaining SQL in the current file and continues with the next file...
The completed Advanced Join shards contain repeated occurrences of this signature. No CN OOMKilled, exit 137, Go panic, or fatal error was found in the corresponding investigation windows.
Expected behavior
Window queries over this AP dataset should complete within a bounded, operationally acceptable duration. A broad set of Window query shapes repeatedly consuming the entire two-hour test budget is a performance defect, even though the runner can cancel and continue.
Scope and related issues
q1004_adv_window_frame_runningis tracked by [Bug]: Window over large fact table under UNION ALL + outer LIMIT not short-circuited (jinpan join_adv q1004) #26066.- This issue covers the remaining standard Window aggregate/order-by shapes.
- RANGE-frame cases are tracked separately in [Bug]: Dev AP q1811 exceeds configured 7200s SQL timeout without cancellation #28007.
- CN draining / connection loss is tracked separately in [Bug]: CN 垂直扩容迁移破坏在途分布式 Pipeline #27776.
Evidence
- Advanced shard 1: https://github.com/matrixorigin/mo-nightly-regression/actions/runs/33482459227/job/99890422491
- Advanced shard 2: https://github.com/matrixorigin/mo-nightly-regression/actions/runs/33482459227/job/99890422678
- Case sources:
tools/mo-regression-test/cases/jinpan_001/join_adv/
Regression coverage
After a fix, add a bounded Jinpan/big-data performance regression for representative window_frame_running and inventory_ratio_win cases, with recorded execution duration and no two-hour timeout.
Activity
aptend commentedon Sep 7, 2026
Latest main code-path update (2026-09-07)
Reviewed against
main@bcd5ed833b5400fe95f322e4028adb2bde3de0a4. The reported run used the diverged 4.2 dev build4f62825d3; current main contains Window changes that were absent from that execution path.Relevant merged changes:
ROWS ... UNBOUNDED PRECEDING ... CURRENT ROWSUM/AVG frames with retained running state.The ten reported cases split into two repeated SQL shapes:
q1045/q1127/q1250/q1824/q1947 ... window_frame_runningThese use cumulative SUM plus
ROWS 2 PRECEDING ... CURRENT ROWAVG. Both frames match current-main fast paths. Aggregate frame work changes from repeated-prefix/window refill toward O(N); sorting and repartitioning remain. These cases should be materially different from the old dev run.q1143/q1225/q1348/q1430/q1922 ... inventory_ratio_winThese use
SUM(...) OVER (PARTITION BY werks)plus RANK. RANK is covered by the newer direct path, but the full-partition SUM is not. It still reaches the generic evaluator, which refills the complete partition for every requested output row; full consumption remains O(sum(partition_size^2)). A full-partition aggregate fast path is still needed.This is static code-path evidence. Before closing or splitting the issue, replay one representative of each shape on the same
jinpan_001data with latest main and recordEXPLAIN ANALYZE, elapsed time, and profile. The running-ROWS representative should no longer be dominated by repeated aggregate Fill; the inventory-ratio representative remains the expected unresolved control.Ariznawlll commentedon Oct 28, 2026
结论
q1143、q1225 本轮均在 1800 秒超时,测试不通过。 累计 ROWS 优化有实际生效证据,但普通整分区 SUM 仍走重复 Fill 的泛型路径,未被现有快速路径覆盖。已转回 @aptend。
关键证据
main@861a2c4cb68961d8b6b01f18e0aa6ac52a3a505f,TKE 部署复用镜像commit-861a2c4;未补取运行二进制完整 SHA。fix(window): stream split window results #26913、fix(window): evaluate cumulative sum frames linearly #27006、fix: optimize bounded rows window sum #27385、perf(window): optimize bounded RANGE aggregates #27940、perf: add cost-based hash partition for windows #27972、feat: enable cost-based window hash partitioning #28608 均在指定 SHA 的祖先链上。Window -> processAggregateFuncRange -> sumAvgDecExec.Fill -> Decimal256.Add256。q1143 协调 CNnightly-regression-dis-tp-cn-f2g85,15:00–15:05 UTC 的 Window 子树占 88.67%,末段仍为 88.51%;q1225 的nightly-regression-dis-tp-cn-vtcl4,16:25–16:30 占 91.88%,末段仍为 91.79%。占比为对应 CN 采样窗口内的 CPU 比例。SUM(...) OVER (PARTITION BY werks)是普通整分区 SUM,不符合累计 ROWS、有限滑动 ROWS/RANGE 的快速路径条件。当前实现对每个输出行重新 Fill 完整分区;分批输出及 LIMIT 500/2000 没有消除重复聚合。processCumulativeAggregateFuncRange,证明累计优化路径实际执行。不同 SQL 不作为严格 A/B 加速比。context canceled并回滚;不等于全部远端资源已同步清理。Pyroscope:process_cpu:cpu:nanoseconds:cpu:nanoseconds,service_name=mo-ap-regression-commit-861a2c4-20261027-40469797177/main,pod 与窗口如上。待解决点
Ariznawlll commentedon Oct 28, 2026
结论
测试不通过。补充核对原 run 的其余五条超时查询后,q1020、q1061、q1102、q1184、q1266 与此前 q1143、q1225 具有相同的主要瓶颈:普通整分区 DECIMAL SUM 没有按分区计算一次并复用,仍逐输出行重复 Fill 分区。 七条均达到本轮 1800 秒客户端预算,归入本 issue 的同一优化/回归集合;无需将五个包装变体再拆成五个独立原因。q1021 的主要热点是 OR-EXISTS 的 LoopJoin 条件扫描,属于 #28110,机制不同。
现有证据支持“同一主要瓶颈”,并不排除 UNION、排序、JOIN 放大或物化的附加成本。本结论来自原运行日志、逐条 CPU profile、原 SQL 和指定源码交叉核对,不是新重测通过/失败的结论,也不是完整 EXPLAIN 的替代品。
关键证据
运行与版本
mo-ap-regression-commit-861a2c4-20261027-40469797177。861a2c4cb68961d8b6b01f18e0aa6ac52a3a505f;资产 SHA:3b53e658b0029b4f5c6615017fb48419b7743be8。commit-861a2c4镜像标签;相关修复 PR fix(window): stream split window results #26913、fix(window): evaluate cumulative sum frames linearly #27006、fix: optimize bounded rows window sum #27385、perf(window): optimize bounded RANGE aggregates #27940、perf: add cost-based hash partition for windows #27972、feat: enable cost-based window hash partitioning #28608 及 UNION ALL 相关 fix(compile): schedule union all branches lazily #27009 的 merge commit 均已纳入指定 main SHA 的祖先。原运行二进制的完整 SHA 未独立补取,不能把配置/检出 SHA 等同于已核验运行二进制完整 SHA。七条原 SQL 的核心相同,差异在包装与 LIMIT
逐条从固定资产读取 SQL,去掉空白差异后,字段、四表 JOIN/ON、WHERE 的核心 SELECT 完全一致,核心 SHA256:
fa1b25b9b6eead857cc0e23d83e9b9ceaf04ac0269e6bb9b16525b0e92418494。q1020 包含相同核心两份,其余各一份。共同查询dwd_dcp.dwd_s4_ztmm019 z,INNER JOINdwd_s4_t001w w,LEFT JOINdwd_s4_makt mk/dwd_s4_mara ma,过滤z.zsl > 0。关键表达式:以下时间均为 2026 年北京时间;每条仅对应原 run 中的一次执行。失败没有有效完成耗时,1800 秒表示实测触发的客户端超时预算。
逐条 profile,而非只根据 SQL 形状推测同因
Pyroscope datasource
pyroscope,profile typeprocess_cpu:cpu:nanoseconds:cpu:nanoseconds;selector:以下是各协调 CN 在指定窗口的 CPU 样本子树并集,嵌套帧不重复累加;占比不是整条 SQL wall time 比例。
七条均能看到同一热点链:
q1143/q1225 的末段采样仍分别有 88.51% / 91.79% 落在该窗口聚合子树。新增五条采样窗口没有 LoopJoin.Call CPU 样本;这只说明这些窗口的主要热点不同于 q1021,不能据此断言物理计划完全没有 LoopJoin。
源码适用范围解释了“包含修复,仍然慢”
固定版本的 窗口分派及 Fill 循环 显示:累计路径要求符合条件的 ROWS 且结束于 CURRENT ROW,滑动 ROWS/RANGE 各有有限边界等守卫;现有整分区一次计算分支只接受部分 ordered-set 函数,不包含这里的普通 SUM。于是该表达式进入按输出行 j、帧内行 k 重复 Fill 的通用路径。有限输出仍可能产生 K×P 成本;完整消费可达 sum(P²)。
#26913 的分批懒输出和 HASH 分区选择不等于普通整分区 SUM 的结果复用;本版本 批大小 为 8192,外层 LIMIT 也不保证将首批窗口内部工作裁成该 LIMIT。q1020 的 UNION ALL 修复不能消除分支内部已有的窗口聚合瓶颈;本次没有完整计划,不额外断言分支调度方式或 HASH 是否实际选中。
运行中的正面对照:同轮 running ROWS 的 q1045 / q1127 / q1250 分别完成于 312534.15 / 311131.94 / 312326.19 ms;q1045 的 CPU profile 直接出现
processCumulativeAggregateFuncRange。这说明累计优化路径确有执行证据,不能简单归因于“修复代码全没生效”;不同 SQL 不构成严格 A/B 加速比。超时后的取消响应
01a17d42-531d-79aa-b3a7-b9987c8c254201a17d84-93d3-7a85-81e8-033633e9c4e401a17daf-bad3-745f-b544-90d3efa4de2501a17dd6-b01a-7742-b4e9-398de4c1168801a17dfe-1c5f-7d99-9fa2-03e995b3261301a17e25-3dc5-761f-bfc1-36b1e1df5aa701a17e4c-5f26-7ef0-99bf-4a53c795743a这些主 statement 有界响应取消,本轮没有观察到它们超时后继续长期不退出;这不能证明所有远端 pipeline/资源同步清理完毕。执行慢和取消不响应需要分开判断。
待解决点
定向任务进度补充:首个 focused run40635348515 的 CN 完整 VCS SHA、Pod Ready、Proxy 三次探针均通过,但在导入 runner 的 Python cryptography/CFFI 依赖时失败,尚未执行 plan/业务 SQL。已仅修复测试客户端依赖隔离后复用同环境触发上述 run40635601332;产品与资产版本未变,最终 SQL 状态以该 run 的实际 case 证据为准。
Ariznawlll commentedon Oct 28, 2026
结论
测试不通过。本轮定向重测已结束,q1143、q1225原SQL均再次1800秒超时,q1225不再是结果未决。 两条在同一协调CN、相同关键统计估计下仍走通用整分区SUM,CPU热点分别为 92.18% / 92.25%;同session重放前计划与初始计划逐行一致,主要瓶颈仍是普通整分区DECIMAL SUM的重复Fill。两条取消后的客户端连接级退出检查均通过。
关键证据
本轮 focused run40635601332 / job122641727266 的 attempt1 已结束:重放步骤真实失败,job于北京时间 2026-10-28 14:34:55 收尾。失败原因是目标原SQL超时,不是plan/table_stats或客户端依赖失败。复用原namespace
mo-ap-regression-commit-861a2c4-20261028-40624634916,test_phase=focused, skip_load=true,没有重建或重新load。861a2c4cb68961d8b6b01f18e0aa6ac52a3a505f;三个CN实际Govcs.revision均完整匹配,full_sha_verified=true。旧run运行二进制核验限制不追溯改变。05c69be7886efa6efb5136c395aa40b7dc5e7eb3;原SQL资产:3b53e658b0029b4f5c6615017fb48419b7743be8。runtime.json、execution/summary.json、每条original.sql、plan.jsonl、各表*.stats.jsonl、result.status.json和summary。以下精确耗时来自实际case文件,不是workflow步骤总耗时。原SQL和实际重算SHA256:
5d026db2747b1213877737b0fd6fc4198afb4c2ac92d04dce8148d50aecfbb6a。b801b90f467e1072f20dafe6cf3ca4deef73fa06cdec5c8119b740ea0f266433。同session计划已对齐,初始统计差异不是这两条分别超时的必要条件
两条执行session都落在CN
nightly-regression-dis-tp-cn-s86d5(node34616636-3462-3639-6336-633131353262)。session分别为01a18100-49c8-7568-8dac-04aa74162a47、01a1811b-caf3-7716-a493-f69623e31296。各自完整EXPLAIN与初始计划逐行完全相同(40/41行):本次真实CPU profile确认了通用聚合路径
Pyroscope datasource
pyroscope;profile typeprocess_cpu:cpu:nanoseconds:cpu:nanoseconds;先确认ProfileTypes/Series有数据,selector:百分比为该CN对应窗口的CPU样本子树并集,嵌套帧不重复累加,不是整条SQL墙钟时间占比。
两条实际仍在此路径;旧run窗口主热点为88.67%/91.88%,新旧主机制一致,不当作严格A/B加速比。本版 window分派/Fill循环 的普通整分区SUM不属于已覆盖的累计/有限滑动快路径。本次采样没有LoopJoin CPU样本,不等于计划中完全无此算子。
取消和退出确认已补齐
01a18100-4bc4-7dab-a41f-1aef2b8d6a0301a1811b-cb1d-73dd-801e-4e147cf550ccLoki为精确namespace窗口UTC06:02–06:04附近、06:33–06:36。客户端超时关闭自有连接,随后只读SHOW FULL PROCESSLIST检查对应conn_id;两条均
client_query_exit_confirmed=true, abort_remaining=false,按脚本语义连接已消失或Sleep,没有KILL。本轮未见这两个主statement长期不响应取消;这不证明所有远端pipeline/资源同步清理完毕。timeout rows=0不是成功空结果。q1143 同session重放前完整 EXPLAIN VERBOSE(与初始计划逐行一致)
q1225 同session重放前完整 EXPLAIN VERBOSE(与初始计划逐行一致)
待解决点
perf: reuse full-partition windows and hash mixed EXISTS (#31585)
aptend commentedon Oct 29, 2026
Jinpan AP verification update after #31585 (merged as
6d9f7127118de74a6831785ded85563d31b140a6):q1143_adv_inventory_ratio_wincompleted in 51.63 s and returned 2,000 rows in the optimized replay. It timed out after 1,800 s in the earlier run.2f114269a109aecb622c15be6bfd8814b3f76686; the merged revision has not yet been replayed on Jinpan. Each result is from a single execution on a different commit/environment, so this is not a controlled speedup measurement.The issue remains open pending a merged-revision replay, result comparison, and coverage of the other affected query shapes.
Ariznawlll commentedon Nov 3, 2026
结论
测试通过。本次覆盖原 issue 的 10 条窗口 SQL 的大数据执行和本地真实数据抽样正确性对照;全量大数据未逐行与 MySQL 比对。
关键证据
main@650a4bb3a4666f22ddfd19d60783d17cb8d47675,3 CN / 1 TN,10 条原 SQL 均完成。q1045/q1127/q1250/q1824/q1947分别耗时 335.60/302.74/335.22/303.01/329.77 秒;q1143/q1225/q1348/q1430/q1922分别耗时 50.59/49.98/49.29/51.64/50.07 秒。这是各一次执行及行数验证,不是全量 golden。main@d61a7206c16b30baa4efc525eb6067c4364035aa(本机二进制,非官方发布镜像)与 MySQL 8.0.45;逐表输入一致,10 条原 SQL 连续 3 轮全行一致。为消除窗口并列顺序不确定性,原始 ACDOCA 样本按窗口排序键保留一行,最终 9 行;本地窗口 SQL 分别返回 2 或 30 行。此前真实大数据 ACDOCA 约 1.05 亿行、库存约 1180 万行;本地抽样不能替代大数据全量对照。待解决点