Repository navigation
Description
Is there an existing issue for the same bug?
- I have checked the existing issues.
The only exact historical match is #4127, which was closed in 2022 because the old replay flow and the test were considered obsolete. There is no open issue for the current implementation and stack.
Environment
- Branch:
main - Commit:
159742db6672ff5dadb617880b831da026f0a3f4 - Platform: macOS arm64
Summary
TAE can return success from DB.Close() after an append/compact/merge sequence, but the next db.Open() cannot restore the database. Depending on timing, replay either reports Unknown database db or terminates in replayTxnStore.registerPreparedDMLTables with ExpectedEOB.
This was reproduced in three independent processes.
Steps to reproduce
Re-enable the existing TestReplay7 in pkg/vm/engine/tae/db/test/replay_test.go and make the first close explicit:
func TestReplay7(t *testing.T) {
defer testutils.AfterTest(t)()
testutils.EnsureNoLeak(t)
ctx := context.Background()
opts := config.WithQuickScanAndCKPOpts(nil)
tae := testutil.InitTestDB(ctx, ModuleName, t, opts)
schema := catalog.MockSchemaAll(18, 14)
schema.Extra.BlockMaxRows = 10
schema.Extra.ObjectMaxBlocks = 5
bat := catalog.MockBatch(schema, int(schema.Extra.BlockMaxRows*15+1))
defer bat.Close()
testutil.CreateRelationAndAppend(
t, 0, tae, testutil.DefaultTestDB, schema, bat, true,
)
testutil.CompactBlocks(
t, 0, tae, testutil.DefaultTestDB, schema, true,
)
testutil.MergeBlocks(
t, 0, tae, testutil.DefaultTestDB, schema, true,
)
time.Sleep(100 * time.Millisecond)
assert.NoError(t, tae.Close())
tae, err := db.Open(ctx, tae.Dir, opts)
assert.NoError(t, err)
defer tae.Close()
txn, rel := testutil.GetDefaultRelation(t, tae, schema.Name)
testutil.CheckAllColRowsByScan(t, rel, bat.Length(), false)
assert.NoError(t, txn.Commit(context.Background()))
}Run it in independent processes:
for i in 1 2 3; do
go test ./pkg/vm/engine/tae/db/test \
-run '^TestReplay7$' -count=1 -v
doneActual behavior
All three runs failed after DB.Close() had returned nil and db.Open() had started.
Two runs reopened with an empty catalog and then reported:
Replay-Checkpoints ... "max-table-id": 0, "object-count": 0
Unknown database db
One run terminated while replaying WAL:
panic: ExpectedEOB
github.com/matrixorigin/matrixone/pkg/vm/engine/tae/txn/txnimpl.
(*replayTxnStore).registerPreparedDMLTables
Before close, the flush/merge path also recorded ExpectedEOB. Extending the cleanup interval did not eliminate the failure: one run passed and two still failed.
Expected behavior
After a successful DB.Close(), reopening the same directory should restore the database, table, and all 151 committed rows. Replay must not terminate because a committed DML record refers to catalog state omitted by the selected checkpoint.
Impact
A successful shutdown followed by restart can leave committed data inaccessible, or prevent the database from reopening. This is a data availability and recovery correctness issue.
Activity
Ariznawlll commentedon Jul 30, 2026
在最新
main上通过另一条业务负载复现了相同的恢复 panic,补充到本 issue,不再新建重复 issue。测试版本:
0ebba1c0c96bbcf0ff4091236e10df7b97e24a0c平台:macOS arm64
拓扑:单 LOG + 单 TN + 单 CN
触发过程:
SIGINT停止mo-service,进程正常退出。结果:连续重启验证
2/2都在恢复阶段退出,退出码为2,panic 签名完全一致:代码路径与本 issue 描述一致:WAL replay 的 dirty table 记录进入
registerPreparedDMLTables后,db.GetTableEntryByID(record.ID)返回ExpectedEOB,当前代码直接panic(err),导致整个服务无法启动。对照验证:
TestReplay7的构造场景。结论:该恢复正确性问题在
main@0ebba1c0c仍存在,而且可由 Data Branch 重负载后的重启稳定触发,建议继续保持 issue Open。test(tae): restore checkpoint replay coverage (#26415)
jiangxinmeng1 commentedon Aug 19, 2026
fixed by #26415
Ariznawlll commentedon Aug 20, 2026
测试版本
maind7899e703dfaef428f272c2fc0452813c0b8636c原问题验证
执行:
TestReplay7 覆盖 151 行写入、flush、compact、merge、
DB.Close()、重新db.Open()以及 WAL/checkpoint replay。当前 main 连续 3 轮均成功,未出现ExpectedEOB、Unknown database、panic 或数据缺失。Happy Path 覆盖
Unhappy Path 覆盖
白盒验证
TestReplay7是 TAE replay 专项 Go 回归,执行 3/3 通过;该内部生命周期问题不适合转成 MOTR SQL case。回归测试
继续保留
pkg/vm/engine/tae/db/test/replay_test.go中的TestReplay7,不新增 MOTR case。测试证据
Go 输出:
--- PASS: TestReplay7,最终ok github.com/matrixorigin/matrixone/pkg/vm/engine/tae/db/test 4.257s。测试结论
测试通过。
test(tae): restore checkpoint replay coverage (matrixorigin#26415)
test(tae): restore checkpoint replay coverage (matrixorigin#26415)
test(tae): restore checkpoint replay coverage (matrixorigin#26415)