Repository navigation
Labels
kind/bugSomething isn't workingseverity/s0Active / top priority for current sprint. Owner has committed to working on it now.
Milestone
Description
Description
mo-dump 无法导出 MatrixOne 合法的带标点表名:表名含单引号时,-tbl 的 catalog 过滤 SQL 语法错误;表名含反引号时,单表和整库导出都在 SHOW CREATE TABLE 语法错误。整库只因存在这样一张普通表便无法完成逻辑备份。问题发生在导出阶段,与 #30554–#30559 的导入或类型问题不同。
Environment
- MatrixOne
maincommit:75ff736835c3d00d40dc00a0a1d3b11129388e5b;隔离 LOG/TN/CN,SQL frontend127.0.0.1:26011,SELECT @@version为8.0.30-MatrixOne-v1.3.0。 mo_dumpmaincommit:324c33dbdc7075cd5d7beaafd1e15c76709dd442,本地构建的 macOS arm64 二进制。- 日期:2026-10-19。
Steps to reproduce
在独立测试库 d 中执行:
CREATE TABLE d.plain(id INT PRIMARY KEY, v VARCHAR(20));
INSERT INTO d.plain VALUES(1,'plain');
CREATE TABLE d.`a'b`(id INT PRIMARY KEY, v VARCHAR(20));
INSERT INTO d.`a'b` VALUES(2,'apostrophe');
CREATE TABLE d.`a``b`(id INT PRIMARY KEY, v VARCHAR(20));
INSERT INTO d.`a``b` VALUES(3,'backtick');三张表均创建、写入和读取成功。之后分别运行:
./mo-dump -u root -h 127.0.0.1 -P 26011 -db d > full.sql
./mo-dump -u root -h 127.0.0.1 -P 26011 -db d -tbl "a'b" > apostrophe.sql
./mo-dump -u root -h 127.0.0.1 -P 26011 -db d -tbl 'a`b' > backtick.sql
./mo-dump -u root -h 127.0.0.1 -P 26011 -db d -tbl plain > plain.sqlActual behavior
- 前三条命令均退出
1,报 MatrixOneERROR 1064。-tbl "a'b"错误位置为b');含反引号的单表及整库导出错误位置为 `b``。 - 整库输出只有约 206 字节的
SET foreign_key_checks和DROP/CREATE/USE DATABASE头部,没有数据和成功标记,不能作为可恢复备份。 -tbl plain退出0,输出完整 DDL、数据和MODUMP SUCCESS。
Expected behavior
合法普通表的导出应正确引用/转义对象名。整库导出不应仅因存在带标点的合法表名而失败;单表导出和导入后应保留表名与行值。
Stability and controls
- 使用三个独立新库
exp_modump_ident_1019_a/b/c,每库相同三张表;整库失败3/3,单引号表-tbl失败3/3,反引号表-tbl失败3/3。 - 正常对照:
plain单表导出成功,并导入另一新库后读到(1,'plain')。 - 失败后源库三张表仍在,三行分别为
(1,'plain')、(2,'apostrophe')、(3,'backtick'),连接可继续查询;没有发现源数据修改或进程崩溃。
Code analysis
cmd/mo-dump/main.go的getTables直接把tbl.Name拼入单引号 SQL (relname in ('...')),没有转义单引号。getCreateTable直接把数据库名和表名拼入反引号标识符show create table \db`.`tbl``,没有对名字中的反引号进行双写。dumpData在输出数据库 DROP/CREATE/USE 头部后才逐表读取 DDL,因此此类失败留下看似可用但不完整的输出文件;程序正确地退出非零且未打印成功标记。
Evidence
- 本地复现输入:
/private/tmp/mo-explore-run-20261019/modump_identifiers_setup.sql;结果文件:modump_ident_{a,b,c}_{full,plain,apostrophe,backtick}_rc.{sql,err};恢复核对:modump_identifiers_check.sql。 - 已检索 MatrixOne 和 mo_dump 仓库的 open/closed issue,以及
mysql-compatibility-contract/README.md,未见此导出缺陷的既有条款。[Bug]: SHOW INDEX and SHOW COLUMNS fail for quoted table or indexed-column names #30549 是 MO 本身的 SHOW INDEX/COLUMNS,[Bug]: COPY ALTER fails on table names containing an embedded backtick #30550 是 COPY ALTER 内部 DROP;本问题是独立工具的 catalog/SHOW CREATE 查询路径。
Regression coverage
建议 mo_dump 集成测试覆盖普通/单引号/反引号表名的整库与 -tbl 导出→导入→精确行值核对,并增加错误退出时不得把半截文件当作成功备份的断言。
Metadata
Metadata
Assignees
Labels
kind/bugSomething isn't workingseverity/s0Active / top priority for current sprint. Owner has committed to working on it now.
Activity
slyunnn commentedon Oct 26, 2026
Regression and extended verification for #30560 (2026-10-26)
Verification Environment
main:b466f4ae9b74813a4ff93eaf43a6c81e6cbb8b0b—fix: acknowledge ISCP drain before executor runtime starts (#31167). The binary was rebuilt and restarted;git_version()returnedb466f4aon all tested routes.mo-dumpmain:d9d6375512620f12ff371b8602cc1d10d6f6caa0, locally rebuilt. Associated fix: identifier quoting from mo_dump PR #56 was integrated into merged PR #53, merge commitf33f68e554e2d8fb41c8746414e4b12bdc3c1e33; implementation commit17b7f37488ef72127c2f2d96f600e08899c0e074(fix: quote dump object names throughout export and restore). PR Add bag difference #56 itself closed without a separate merge.2 CN / 1 TN / 1 Log service / Proxy. Setup, export, nativemysql 9.7.1restore, catalog checks, and value queries ran independently over MySQL text-protocol routes Proxy6001, CN116001, and CN216002.What Was Covered
plain, apostrophe tablea'b, and backtick tablea`bwere created, populated, and queried before export on all3routes.0withMODUMP SUCCESS; native-client restore into an empty target returned0and preserved every table name and its exact row value on all3routes.-tblexport forplain,a'b, anda`breturned0withMODUMP SUCCESS; each table-only script restored into a pre-created, explicitly selected database and preserved its exact row on all3routes.a'`b(both punctuation characters) passed both selected-table and full-database export/restore.-tbl "a'b_missing"exited1, reported that the table does not exist, emitted noMODUMP SUCCESS, and left the existing source table queryable on all3routes.CREATE DATABASEis its existing contract; the restore client was given a target database explicitly.Findings
The original
1064failures from unescaped apostrophes/backticks no longer reproduce. All15positive endpoint/export combinations restored with exact catalog names and rows, and all3missing-name negative checks returned a non-success status without altering source data.Large-data regression required: No. The defect is catalog-string and SQL-identifier quoting, independent of row count, block/batch size, spill, or network scale. One row per named table and a combined-quote boundary reach the relevant parser paths.
MOTR / BVT Coverage
The owning
mo-dumprepository contains focused identifier/catalog error tests; its fullgo test -count=1 ./...suite passed on the tested revision. The live CLI/native-client checks above provide end-to-end confirmation. No duplicate SQL-only MOTR case, issue commit, or weekly PR change was made because the behavior under test is the tool's emitted SQL and exit status.Final Conclusion
Fixed for #30560 on the tested MatrixOne and
mo-dumprevisions. Full and selected-table exports now preserve the reported punctuation-bearing ordinary table names and data.