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
restore account may fail during DropDatabase FK cleanup when FK-related tables were already deleted in the same txn #24008
restore account ... {snapshot=...} can intermittently fail during snapshot restore. A representative failure looks like:
restore account acc01{snapshot="sp10"}
no such table acc_test02.aff01
After that, the restore does not fully converge to the snapshot state.
Root cause
The failure path is in restoreToAccountFromTS() -> DropDatabase -> removeFkeysRelationships().
During restore, FK-related tables may already be deleted earlier in the same restore transaction. Later FK cleanup still revisits them through three lookup surfaces:
database.Relation(...) on names returned by Relations()
parent lookup via GetRelationById(fkey.ForeignTbl)
child lookup via GetRelationById(childId)
Those surfaces can legitimately return:
ErrNoSuchTable
ErrInternal with can not find table by id ... Deleted in txn
These are expected same-transaction missing-table states, but they can still abort restore if treated as fatal.
Expected behavior
FK cleanup during DropDatabase should skip these same-transaction missing-table cases and continue restore, while still surfacing unrelated errors.
Fix direction
Unify the three FK-cleanup lookup paths behind a narrow helper that only tolerates:
moerr.ErrNoSuchTable
moerr.ErrInternal containing can not find table by id
CGO_CFLAGS='-I/home/xupeng/matrixone/thirdparties/install/include' \
CGO_LDFLAGS='-L/home/xupeng/matrixone/thirdparties/install/lib' \
LD_LIBRARY_PATH='/home/xupeng/matrixone/thirdparties/install/lib' \
go test ./pkg/sql/compile -count=1
Activity
fix: tolerate same-txn missing tables during FK cleanup
fix: handle missing child table in DropTable FK cleanup (#24132)
fix: handle missing child table in DropTable FK cleanup (matrixorigin…