Skip to content

[Bug]: Misleading errors: RESTORE ... FROM SNAPSHOT gives bare parser error; DATA BRANCH UPDATE/UPDATE conflict reported as 'DELETE and DELETE' #29888

Closed

Description

@MatrixAdventurer

Is there an existing issue for the same bug?

Branch Name

main (docker matrixorigin/matrixone:latest, v4.2.5)

Commit ID

unknown (docker image 4ea73a7022dd)

Other Environment Information

  • Hardware: 1 VM, 8 vCPU Intel Xeon, 15 GB RAM (shared), overlay disk
  • OS: Linux, docker matrixorigin/matrixone:latest (pulled 2026-09-28), single-node, container mem limit 6–7 GB
  • Server: select version() → 8.0.30-MatrixOne-v4.2.5

Actual Behavior

Two error messages in snapshot/branch workflows mislead users:

  1. RESTORE DATABASE ki FROM SNAPSHOT kis; → ERROR 1064 (42000): SQL parser error ... near " snapshot kis". The working form is restore database sys.ki{snapshot="kis"}; restore account sys database ki from snapshot kis also fails with a parser error. The parser error gives no hint of the supported syntax.
  2. A same-row UPDATE/UPDATE conflict on DATA BRANCH MERGE ... WHEN CONFLICT FAIL (and default) reports internal error: conflict: t_dev DELETE and t DELETE on pk(7) with different values — the user ran UPDATEs, not DELETEs.

Expected Behavior

  1. Either accept the intuitive RESTORE DATABASE x FROM SNAPSHOT s form, or return an error that points to the supported syntax.
  2. Conflict message should say UPDATE (or "modified on both sides") and ideally show both values.

Steps to Reproduce

create database ki; use ki; create table t(id int primary key, v varchar(10)); insert into t values(7,'x');
create snapshot kis for database ki;
restore database ki from snapshot kis;              -- ERROR 1064, no hint
restore database sys.ki{snapshot="kis"};            -- works
data branch create table t_dev from t;
update t set v='main' where id=7; update t_dev set v='dev' where id=7;
data branch merge t_dev into t when conflict fail;  -- "... DELETE and t DELETE on pk(7) ..."

Always reproducible. (skip/accept behave correctly: skip keeps 'main', accept takes 'dev'.)

Additional information

Low severity, UX only.

Activity

  1. added
    severity/s0
    ai-easy
    and removed on Oct 12, 2026
  2. gouhongshen commented on Oct 12, 2026

    @gouhongshen
    Contributor

    PR #29958 is trying to fix this issue.

  3. gouhongshen commented on Oct 14, 2026

    @gouhongshen
    Contributor

    PR #29958 has merged and is awaiting manual validation. The issue remains open.

  4. Ariznawlll commented on Oct 22, 2026

    @Ariznawlll
    Collaborator

    测试版本

    • 官方 main 完整 commit:6cbe375b49696021d72778baa292a66287f080bd。
    • 修复:PR #29958,merge commit 5c959556431225711a33d1af5fe9a5b6d4060122;GitHub compare 显示本次 main 相对修复 commit ahead 254、behind 0。
    • 环境:隔离干净工作树,本地嵌入式 1 LogService / 1 TN / 2 CN,真实 MySQL TCP 连接 CN0;macOS arm64。日期:2026-10-22。

    原问题验证

    对同一个专用数据库/快照执行报告中的两种不受支持语法:RESTORE DATABASE ... FROM SNAPSHOT ... 与 RESTORE ACCOUNT sys DATABASE ... FROM SNAPSHOT ...。二者均返回错误,错误文本明确含 FROM SNAPSHOT is not supported、RESTORE DATABASE 和 snapshot= 的正确写法提示;不再只有无方向的 bare parser error。每次错误后查询原表仍是变更后的 after,随后以 RESTORE DATABASE sys.qa_29888{snapshot="qa_29888_s"} 成功恢复为 before。

    同轮创建 branch,对同一主键 id=7 在 base/branch 分别 UPDATE 为 main/dev。默认 MERGE 与 WHEN CONFLICT FAIL 均失败且报文包含 t_dev UPDATE and t UPDATE on pk(7),不再误称 DELETE;失败后 base 仍为 main。完整场景连续 3/3 轮通过。

    Happy Path 覆盖

    正确快照恢复语法实际恢复旧值;冲突 WHEN CONFLICT SKIP 保留 base 的 main,WHEN CONFLICT ACCEPT 将 base 更新为 branch 的 dev。每轮均逐值核对,3/3 通过。

    Unhappy Path 覆盖

    两种错误 RESTORE 语法均有可操作提示且不改变数据;两种失败 MERGE 都没有部分应用或错误改写 base,3/3 通过。专用 snapshot 和数据库在测试末尾删除,失败时亦有清理回退。

    白盒验证

    修复点涉及 RESTORE 语法提示及 DATA BRANCH 冲突类型的输出;本次直接走真实 SQL/MySQL 协议,独立断言错误文本与成功/失败后的表值,并非仅依据开发者评论或字符串单测。

    回归测试

    仓库已存在 test/distributed/cases/snapshot/issue_29888_restore_from_snapshot.sql / .result 及 test/distributed/cases/git4data/branch/merge/merge_issue_29888.sql / .result 配对 BVT,覆盖两种错误语法、正确恢复、UPDATE/UPDATE 冲突及 SKIP/ACCEPT。无需再建重复 MOTR。#29958 的 PR 页面存在 CI Required、Linux/arm64 SCA、Linux/x64 多 CN BVT、Ubuntu/x86 UT 失败记录;未证明这些失败与本 issue 有关,但也不能声称全套 CI 通过。本次仅执行上述本地定向测试,未重跑完整 BVT/集成 CI。

    测试证据

    • 本地命令:GOROOT=/opt/homebrew/Cellar/go/1.26.5/libexec .agents/skills/mo-dev/scripts/mo-cgo-test -p=2 -count=3 -timeout=8m -run '^TestQA29888RestoreHintAndBranchConflict$' ./pkg/tests/issues,退出码 0,ok github.com/matrixorigin/matrixone/pkg/tests/issues。定向 QA 代码仅在隔离工作树,未提交产品仓库。
    • 原报告虽发生在 v4.2.5,但未明确要求该发布线交付;本结论仅适用于上述 main commit,不代表 4.2 发布线。

    测试结论

    测试通过。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

ai-easykind/bugseverity/s0

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions