Repository navigation
Description
Is there an existing issue for the same bug?
- I have checked the existing issues.
Branch Name
3.0-dev
Commit ID
latest
Other Environment Information
- Hardware parameters: GitHub Actions runner
- OS type: Linux
- Others:
- Observed in PR #23952 BVT
- Failing case: test/distributed/cases/snapshot/sys_restore_to_newnonsys_account.sql
- Log source: mo-service.log from the failed CI runActual Behavior
In BVT, restore account acc01 from snapshot sp07 to account acc02; fails with:
no such table acc_test02.aff01
Relevant executor output from the CI failure:
2026-03-25 07:54:13 ERROR Executor:269 - [/home/runner/_work/matrixone/matrixone/matrixone/test/distributed/cases/snapshot/sys_restore_to_newnonsys_account.sql][row:262][restore account acc01 from snapshot sp07 to account acc02;] was executed failed, con[id=0, user=dump, ***
2026-03-25 07:54:13 ERROR Executor:271 - [EXPECT RESULT]:
null
2026-03-25 07:54:13 ERROR Executor:272 - [ACTUAL RESULT]:
no such table acc_test02.aff01
From mo-service.log, the restore path reports that the target account/database/tables are missing during restore:
30199. Failed to get database acc_test02, error: ExpectedEOB
30200. error: no such table acc_test02.pri01
30201. error: no such table acc_test02.aff01
30244. Failed to get database acc_test02, error: ExpectedEOB
30245. error: Can't drop database 'acc_test02'; database doesn't exist
This suggests that restore-to-new-non-sys-account can leave acc_test02 and its child tables missing or only partially rebuilt.
Expected Behavior
restore account acc01 from snapshot sp07 to account acc02; should succeed, and the restored account acc02 should contain the snapshot contents from sp07, including the objects under acc_test02 such as pri01 and aff01.
Steps to Reproduce
1. Run the snapshot BVT case: `test/distributed/cases/snapshot/sys_restore_to_newnonsys_account.sql`.
2. In that case, create snapshot `sp07` for account `acc01`, make additional changes after the snapshot, then run:
`restore account acc01 from snapshot sp07 to account acc02;`
3. Observe the restore fail at line 262 with:
`no such table acc_test02.aff01`
Relevant SQL fragment:
```sql
drop snapshot if exists sp07;
create snapshot sp07 for account acc01;
-- @session:id=1&user=acc01:test_account&password=111
use test01;
drop table table01;
insert into table02 values(134, 'database');
-- @session
restore account acc01 from snapshot sp07 to account acc02;
### Additional information
Focused log excerpt from `mo-service.log`:
```text
{"level":"ERROR","time":"2026/03/25 07:51:30.467090 +0000","name":"cn-service","caller":"frontend/compiler_context.go:218","msg":"Failed to get database","databaseName":"acc_test02","error":"ExpectedEOB",...}
{"level":"ERROR","time":"2026/03/25 07:51:30.475385 +0000","caller":"disttae/txn_database.go:169","msg":"error: no such table acc_test02.pri01",...}
{"level":"ERROR","time":"2026/03/25 07:51:30.493881 +0000","caller":"disttae/txn_database.go:169","msg":"error: no such table acc_test02.aff01",...}
{"level":"ERROR","time":"2026/03/25 07:51:30.928652 +0000","caller":"compile/ddl.go:136","msg":"error: Can't drop database 'acc_test02'; database doesn't exist",...}
This looks unrelated to the dedupjoin retry fix in PR #23952: the failing logs are in snapshot/account restore code paths (frontend/compiler_context.go, disttae/txn_database.go, compile/ddl.go), and I did not find any checkSnapshotAdvancedDuplicates / ErrTxnNeedRetry traces around the failure window.
Activity
XuPeng-SH commentedon Apr 6, 2026
Root Cause Analysis from Code Tracing
I traced the full code path for the snapshot restore FK table failure. The error "no such table repub02.aff01" (or
acc_test02.aff01) is not an FK ordering issue — it's a catalog cache / transaction workspace visibility issue during clone source resolution.Evidence
From the logs in this issue:
Both
pri01(parent, no FK) andaff01(child with FK) fail. The database itself returnsExpectedEOB. This rules out FK ordering as the cause.Code Path Trace
doRestoreSnapshot()(snapshot.go:528) starts a transaction (begin;)restoreToAccount()(snapshot.go:892) drops ALL databases (dropDb()at line 928), then recreates them from snapshotrestoreTablesWithFk()(snapshot.go:1279)recreateTable()executes clone SQL:create table X clone X {MO_TS = <ts>}TableClone()(ddl.go:3277) callsCreateTable()→ FK validation callsctx.Resolve(parentDb, parentTable, nil)TxnCompilerContext.Resolve()→getRelation()→Database()returnsExpectedEOBWhy ExpectedEOB?
The restore flow drops the database and recreates it within the same transaction:
dropDb()drops the originalrepub02(database ID = X)bh.Exec(createDbSql)recreatesrepub02(database ID = Y, new ID)The clone source
repub02.aff01 {MO_TS = <ts>}tries to resolve the database at the historical timestamp. But:MO_TSDatabase()call incompiler_context.go:354sees the new database but can't resolve historical data through it →ExpectedEOBWhy It's Flaky
This is a race condition between:
Resolve()may read from a stale catalog cache snapshotRelevant Code Locations
snapshot.go:928dropDb()drops databasesnapshot.go:1100snapshot.go:1472ddl.go:3284-3288TableClone()→CreateTable()build_ddl.go:4606ctx.Resolve(parentDb, parentTable)compiler_context.go:354-361Database()→ExpectedEOB→ returns nilcompiler_context.go:375-380Relation()→ErrNoSuchTable→ returns nilPossible Fix Approaches
restoreTablesWithFk()for transientExpectedEOB/ErrNoSuchTableerrors during clonefix: skip checkTableIsMaster during FK table restoration to prevent f…
fix: skip checkTableIsMaster during FK table restoration to prevent f…
fix: skip checkTableIsMaster during FK table restoration to prevent f…
fix: skip checkTableIsMaster during FK table restoration to prevent f…
fix: always skip master check during restore to prevent blocking pare…
LeftHandCold commentedon Apr 27, 2026
补充一组新的复现样本,症状与本 issue 一致,来自 PR #24206 的 BVT:
fix/remote-lock-hung-bind-heartbeat-3.0-dev55a3e6869ecc302aa9bd564cd61afcf061bc8290Matrixone Standlone CI (3.0) / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)test/distributed/cases/snapshot/cluster_level_snapshot_restore_to_nonsys_account.sqlBVT failure details from the job log:
从这次 BVT 看,问题不只是 restore 语句本身报
no such table acc_test02.aff01,restore 结束后目标 account 下多个对象/数据也没有恢复到预期状态:acc_test02.aff01缺失acc_test02.pri01行数多 1acc_test03.table01行数从预期 2 变成 0acc_test03.table02直接不存在acc_test03.table03行数从预期 2 变成 1这说明 cluster-level snapshot restore to non-sys account 仍然可能留下部分对象缺失或数据不一致。
Ariznawlll commentedon Jun 1, 2026
repro:https://github.com/matrixorigin/mo-auto-test/actions/runs/26716013080
gouhongshen commentedon Jun 8, 2026
should be fixed by #24747, #24748, #24749