You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Misleading errors: RESTORE ... FROM SNAPSHOT gives bare parser error; DATA BRANCH UPDATE/UPDATE conflict reported as 'DELETE and DELETE' #29888
Two error messages in snapshot/branch workflows mislead users:
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.
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
Either accept the intuitive RESTORE DATABASE x FROM SNAPSHOT s form, or return an error that points to the supported syntax.
Conflict message should say UPDATE (or "modified on both sides") and ideally show both values.
Steps to Reproduce
createdatabaseki; use ki; create table t(id intprimary 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) ..."
Activity
gouhongshen commentedon Oct 12, 2026
PR #29958 is trying to fix this issue.
Clarify snapshot restore and branch merge diagnostics (#29958)
gouhongshen commentedon Oct 14, 2026
PR #29958 has merged and is awaiting manual validation. The issue remains open.
Ariznawlll commentedon Oct 22, 2026
测试版本
main完整 commit:6cbe375b49696021d72778baa292a66287f080bd。5c959556431225711a33d1af5fe9a5b6d4060122;GitHub compare 显示本次 main 相对修复 commit ahead 254、behind 0。原问题验证
对同一个专用数据库/快照执行报告中的两种不受支持语法:
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 代码仅在隔离工作树,未提交产品仓库。maincommit,不代表 4.2 发布线。测试结论
测试通过。