Repository navigation
Description
Consolidated tracking scope: mo-dump view dependency false positives and bounded ordering
Original reproductions and discussions remain available in the source issues below. Administrative consolidation is not a claim that a defect is fixed. Each input family and execution path retains independent acceptance.
Included reports
- #30672 — [Bug]: mo-dump hangs forever (100% CPU in adjustViewOrder) when view DDL text false-matches another view's name — substring dependency graph builds fake cycles with no guard; truncated dump still replays DROP DATABASE
Acceptance checklist
- Retain string-literal, projection/derived-column alias and comment collisions as independent false-dependency regressions; they must not create graph edges or an infinite loop.
- Verify real one-way/cross-schema dependencies retain correct order and genuine cycles or unresolvable dependencies return a bounded diagnostic.
- Keep partial-output handling explicit: a failed or interrupted export is not a valid backup, even if it already emitted DROP DATABASE.
- Reuse merged fix: prevent false view dependencies and cyclic dump hangs mo_dump#53 (fix: prevent false view dependencies and cyclic dump hangs mo_dump#53) and revalidate the linked report against the fixed tool. Its merge is not fresh runtime evidence for this consolidation.
从 matrixorigin/mo_dump#48 迁入主库跟踪。以下保留原问题的复现、验证和白盒证据;修复范围是独立的 mo_dump 工具,与 MatrixOne 主库联动验收。
Description
两个互不依赖的合法 VIEW,只要各自的 SQL 字符串字面量包含另一个 VIEW 名称,mo-dump 的视图排序会把它们误判成循环依赖并进入无进展的无限循环。导出不返回、不写 MODUMP SUCCESS,输出文件仅有数据库头部;整库逻辑备份因此无法完成。
Environment
- MatrixOne
main:75ff736835c3d00d40dc00a0a1d3b11129388e5b,本地隔离 LOG/TN/CN,frontend127.0.0.1:26011。 mo_dumpmain:324c33dbdc7075cd5d7beaafd1e15c76709dd442,macOS arm64,Go 1.26.5make build。- 日期:2026-10-19。
Steps to reproduce
CREATE DATABASE d;
CREATE VIEW d.va AS SELECT 'vb' AS marker;
CREATE VIEW d.vb AS SELECT 'va' AS marker;
SELECT * FROM d.va; -- vb
SELECT * FROM d.vb; -- vagtimeout -k 1s 3s ./mo-dump -u root -h 127.0.0.1 -P 26011 -db d > d.sql实际两条 VIEW 都是常量查询,没有表/VIEW 引用,也没有依赖环。
Actual behavior
mo-dump 3 秒内始终不返回,被 gtimeout 终止,退出码 124。在三个完全独立新库中重复为 3/3。每份输出文件只有 188 字节的 SET foreign_key_checks 和 DROP/CREATE/USE DATABASE 头部,没有 CREATE VIEW 或成功标记。进程终止后 MO SQL 连接仍可正常查询这两条 VIEW;没有遗留 mo-dump 进程。
Expected behavior
没有真实依赖的视图应当有限时间内导出并可恢复;即使存在真实循环或无法确定依赖,也应返回明确错误而不是无限循环。
Stability and controls
- 复现:独立数据库
exp_modump_view_a/b/c各 1/1,合计 3/3,均超时退出124。 - 正常对照:
dep1 AS SELECT 1 AS x、dep2 AS SELECT x+1 AS y FROM dep1有真实单向依赖;导出 9 ms 返回 0,输出正确的dep1→dep2顺序及MODUMP SUCCESS,重新导入后SELECT * FROM dep2返回2。 - 失败原子性:导出操作没有修改源库;三个源库的 VIEW 可继续查询;不完整输出文件不能用于恢复,调用方需要检查进程退出状态。
Code analysis
cmd/mo-dump/main.go 的 adjustViewOrder 用 strings.Count(createTable[i], tables[j].Name) > 0 推断视图依赖,不区分对象引用和字符串字面量,因此上述两个定义被各计入一条伪依赖。随后 for order < len(viewName) 只在 viewCount[i]==0 时推进 order,但没有“本轮没有进展”的退出条件;两个计数都非零时永久循环。这是代码和 3/3 黑盒结果一致的根因。
Evidence
- 三份本地截断输出:
/private/tmp/mo-explore-run-20261019/modump_view_a.sql、modump_view_b.sql、modump_view_c.sql,各 188 字节。 SHOW CREATE VIEW明确给出CREATE VIEW ... va AS SELECT 'vb' ...与... vb AS SELECT 'va' ...;常规查询分别返回vb和va。- 已搜索本仓库 open/closed issues;现有 Fix MIN: avx512 version of VPCMPEQQ has changed behavior #43–Make use of as many SIMD registers as possible #45 分别是生成列与 CSV 数据损坏,不涉及视图排序或挂起。
Regression coverage
建议加入真实 VIEW 依赖、无依赖但字符串包含对方名称、注释/列别名包含对方名称、跨 schema 引用、无法解析依赖和非法循环边界。排序循环需要明确无进展检测;集成测试应设置进程超时并验证导出文件可导入。
主库关联
原始问题:matrixorigin/mo_dump#48。相关代码位于独立仓库;此处作为主库统一追踪入口,修复后需要跨仓库验证导出、恢复及数据一致性。
Activity
slyunnn commentedon Oct 26, 2026
Regression and extended verification for #30555 (2026-10-26)
Verification Environment
main:4769417cdce5531c9771644eca49f1e71d8f654c—fix(plan): preserve replayable defaults and dump fingerprints (#31067). The running binary was rebuilt from this commit, restarted, and checked withgit_version()at all endpoints.2 CN / 1 TN / 1 Log service / Proxy. MySQL text-protocol connections succeeded through Proxy6001, CN116001, and CN216002; the original dump and restore were executed separately through each endpoint.mo-dumplatestmain:82760a085cf4a9dedfab66008cfc6b2f7cc1ebae, locally rebuilt. Associated fix: mo_dump PR #53, merge commitf33f68e554e2d8fb41c8746414e4b12bdc3c1e33. It replaces string-count-based ordering with parsed relation dependencies and bounded ordering/error handling.What Was Covered
vacontains string literal'vb';vbcontains'va'.mo-dumpcompleted within20seconds without a false dependency cycle through Proxy, CN1, and CN2.8exported views were present, the dump reportedMODUMP SUCCESS, and restore plus subsequent queries succeeded at all3endpoints. Restore sent each SQL statement separately; a whole-file multi-statement packet was not used.3endpoints.3endpoints.mo-dumpGo tests: genuine self/cross-database cycles produce a bounded error; dependency failures propagate without a false successful view section. Fullgo test -count=1 ./...passed on the tested tool commit.Findings
The original hang did not reproduce with the fixed
mo-dump: string literals and aliases no longer create false view-dependency edges. Export, ordered replay, and query checks passed on all three SQL routes. The initial attempt to send the entire dump as one client packet was incompatible with this restore path; replaying individual statements succeeded and is the evidence reported above.Large-data regression required: No. This defect concerns view-definition dependency parsing and no-progress ordering, not row count, batch/block, spill, concurrency, or data volume. The minimal two-view collision and real dependency/cycle boundaries exercise the relevant behavior without unrelated scale cost.
MOTR / BVT Coverage
No duplicate SQL-only MOTR case was added: a MOTR
.testcannot directly validate themo-dumpcommand's dependency graph, timeout, and partial-output behavior. The owning tool's full Go test suite passed, and the live export/restore scenarios above provided command-level evidence. No new MOTR commit or daily/weekly PR change was made for this issue.Final Conclusion
Fixed for the original #30555 false-dependency hang on the tested MatrixOne and
mo-dumprevisions. The issue remains open for maintainer acceptance; this verification does not claim whole-file multi-statement restore, live cyclic-view creation, or forced-interruption coverage.