Repository navigation
Description
Consolidated tracking scope
Full-database export must distinguish user objects that need backup from internal catalog relations that should not be exported as ordinary tables. The reports exercise separate relkind paths in cmd/mo-dump: a user sequence currently aborts -db <database>, while -db all on a clean tenant sends built-in catalog relations into the ordinary-table dispatcher. Consolidation tracks completeness of the documented whole-database export modes; it does not claim these object types have one implementation or one fix.
Acceptance criteria
-
mo-dump -db <database>exports a user sequence definition and its current allocation state together with dependent tables and data, and the restored sequence continues without reusing consumed values. -
mo-dump -db allin a clean tenant skips or specially handles built-in catalog relations while exporting every user database successfully. - Test both modes on fresh tenants and confirm exit status, completion marker, restored user objects, and absence of partially successful output. Unsupported user objects must fail clearly rather than produce a false success marker.
Included report
- #30601 — clean-tenant
-db allfails on built-in catalog relation kinds; original report and discussion remain on that issue.
Original canonical report (preserved verbatim)
问题
数据库中只要包含合法的 sequence,mo-dump -db <db> 就无法导出整库,报 not supported: table: seq table type: S。因此连同库的普通表及其数据也无法备份。-csv 和 -no-data 同样失败。
环境
- MatrixOne
main:75ff736835c3d00d40dc00a0a1d3b11129388e5b matrixorigin/mo_dumpmain:324c33dbdc7075cd5d7beaafd1e15c76709dd442- 本地单节点隔离实例,MySQL 协议;
@@version为8.0.30-MatrixOne-v1.3.0(该字符串不代表源码 SHA)
最小复现
CREATE DATABASE dump_seq_repro;
USE dump_seq_repro;
CREATE SEQUENCE seq INCREMENT BY 5 START WITH 10;
CREATE TABLE t (id BIGINT PRIMARY KEY DEFAULT nextval('seq'), note VARCHAR(32));
INSERT INTO t(note) VALUES ('a'),('b');
SELECT * FROM t ORDER BY id;
-- (10, 'a'), (15, 'b')mo-dump -u root -h 127.0.0.1 -P <port> -db dump_seq_repro > dump.sql
# exit 1: modump error: not supported: table: seq table type: S完整失败输出是已写入 DROP DATABASE IF EXISTS / CREATE DATABASE / USE 的非完整 SQL 前缀;不能用作备份。-csv、-no-data 也返回相同错误。
预期与影响
整库导出应包含可恢复的 sequence 定义和状态、依赖它的表及数据;至少不应留下看似可用的部分备份。当前任何包含 sequence 的数据库都无法使用 mo-dump 整库备份。mo_dump README 将未指定 -tbl 的 -db 描述为整库导出,未列出 sequence 限制。
复现与对照
- 三个全新数据库分别执行上面的 sequence + 默认值表,整库导出均相同失败:3/3。
- 对照:同库
-tbl t导出成功,含(10,'a'),(15,'b');另一组 UUID、ENUM/SET、YEAR、BIT、TIMESTAMP、VECTOR 以及数值/时间/JSON 的普通表 CSV 导出、恢复和逐列比对均通过。 - 导出失败后源表仍有 2 行(id 10、15),sequence 目录项仍存在;没有观察到源库被修改。
代码定位
cmd/mo-dump/main.go:getTables 从 mo_catalog.mo_tables 取 relkind,包含 sequence 的 S;dump 的对象类型分支只处理普通表、外表和视图,其他类型直接返回 not supported。当前仓库搜索不到 sequence 导出处理代码或回归测试。
回归建议
补整库 SQL/CSV/-no-data 下 sequence 与 DEFAULT nextval 的导出恢复;核对已调用、未调用、ALTER 后 sequence 的下一值,及失败时输出文件不可被误用。此轮未修改仓库或提交 PR。
Activity
Ariznawlll commentedon Oct 20, 2026
Independent confirmation + escaping-path characterization
Reproduced 3/3 on main (commit b24d1b3): any database containing a CREATE SEQUENCE fails whole-db dump with
modump error: not supported: table: <seq_name> table type: S, exit code 1, and the output file contains only the 97-byte preamble (SET foreign_key_checks / DROP DATABASE / CREATE DATABASE / USE) — i.e. the DROP DATABASE statement is emitted. Danger detail worth noting: if a user (or a cron script ignoring exit codes) pipes this dump file into a target instance, it will drop the target database and recreate it empty — amplifying a backup failure into potential data loss on restore.Control: same database without the sequence dumps fine (285 bytes, full).
-tbl <table>filtering does bypass the failure, but requires the user to know a-priori which objects are sequences — not viable for automated whole-db backup pipelines.Suggested fix priorities: (a) emit sequence DDL (
CREATE SEQUENCE) in the dump instead of treating it as an unsupported table type, or at minimum (b) skip-with-warning and complete the rest of the dump, and (c) do not emitDROP DATABASEin a file that never got to dump anything.[-][Bug]: mo-dump fails whole-database backup when database contains a sequence[/-][+][Bug]: mo-dump full-database export must handle user sequences and built-in catalog relations[/+]slyunnn commentedon Oct 29, 2026
Regression and extended verification for #30577 (2026-10-29)
Verification Environment
7597f979e7904cf37ff077c94ffad191367d4d89—fix(plan): compare SET columns by their member values (#31633). Newly built macOS/arm64 CPU runtime; build identity and endpointgit_version()matched7597f979e7.4090716fda03097e56e98221c05382a9c11d8528—Merge pull request #71 from matrixorigin/fix/astra-meow-30596. Newly built Go1.26.4CLI, identified by its build log and embedded commit flag.2 CN / 1 TN / 1 Log service / 1 Proxy. Proxy127.0.0.1:6001, CN1127.0.0.1:16001, CN2127.0.0.1:16002were all connected and used for actual export/restore scenarios, not merely health checks.What Was Covered
START WITH 10 INCREMENT BY 5and dependent table restored both consumed rows, with IDs10and15. The next generated row used20, not a reused value.-no-datarestored empty dependent tables and the sequence definition; the next value correctly restarted at10. Sequence DDL preceded dependent table DDL.-db allclearly, with nonzero status and empty stdout. After creating two user databases,-db allexported/restored both, skipped platform catalog databases, preserved rows and continued the sequence at102after source allocation of100with increment2.SETVALsemantics, concurrent source writes, injected corrupt sequence backing rows, and stdout-channel failure during final publication.Findings
The original sequence dispatcher failure and ordinary-tenant system-catalog
-db allfailure did not reproduce.Associated fix: mo_dump#68, commit
1fe1d16fe9f47467b395c8c50c44b2bb765ed074—fix: dump user sequences and skip system databases for -db all.Qualified
NEXTVAL('db.seq')is separately tracked by MatrixOne #31452; restoration here used the dump script'sUSEplus local sequence-name contract. No duplicate issue was opened.MOTR / BVT Coverage
The tested mo_dump revision passed its full existing Go suite with
make test, including maintained sequence/publication tests. Real CLI checks additionally verified dump contents, exit status, restoration and next-value behavior at each endpoint. No duplicate MOTR case or PR was added; a SQL-only test cannot prove mo-dump output ordering, publication or restoration completeness. No MatrixOne tracked source/configuration changes were made.Final Conclusion
Fixed on the tested main versions for user-sequence whole-database export and ordinary-tenant
-db allcatalog handling.Large-data regression is not required: object dispatch, definition ordering and allocation-state replay are exercised by the smallest distinguishing sequence/table fixtures, not by increasing unrelated row counts.
Issue status remains unchanged for maintainer acceptance.