Repository navigation
Description
Is there an existing issue for the same bug?
- I have checked the existing issues.
Branch Name
main
Commit ID
b24d1b3 (2026-10-16)
Other Environment Information
- Hardware: macOS arm64 (Apple Silicon)
- Topology: single-node standalone
- OS: macOS
Actual Behavior
RESTORE DATABASE <db> {snapshot="<snap>"} silently deletes the publication targeting that database and never recreates it. All subscribers of that publication then break permanently with there is no publication <name>.
Reproduced 3/3 rounds on a fresh standalone instance. In every round:
create publication pubS database spb account acc1;— publication exists, subscriptionspb_subworkscreate snapshot snapS for database spb;- insert a row (post-snapshot mutation)
restore database spb {snapshot="snapS"};— restore itself succeeds (data rolls back correctly)show publications;→ empty, pubS is gone (mo_catalog.mo_pubsrow deleted)- On the subscriber account:
use spb_sub; select ...→ERROR 20101: there is no publication pubS
The subscription database remains as a dangling record (show subscriptions still lists it), so the subscriber has no signal that the source vanished — queries just fail.
Root cause (source-level)
The PITR path does recreate publications after a database restore: pitr.go:1621 calls createPubByPitr(...) (defined at pitr.go:2607), which reads mo_catalog.mo_pubs {MO_TS = ...} and re-runs CREATE PUBLICATION for every publication of the restored database.
The snapshot path has no counterpart: snapshot_restore_with_ts.go (the whole file's function list — restoreToAccountFromTS, restoreDatabaseFromTS, recreateTableFromTS, etc.) contains no publication handling at all. The drop-and-recreate dance during database restore removes the mo_pubs row (the database being restored is dropped first), and nothing rebuilds it.
So the two restore paths disagree: PITR restores publications (that's the intent — see createPubByPitr's log message "create pub after the database is created by pitr"), while snapshot restore destroys them.
Expected Behavior
RESTORE DATABASE ... {snapshot=...} should restore publications targeting the database the same way the PITR path does (recreate mo_pubs rows), keeping the publication and its subscriptions working across the restore. At minimum, dropping the publication should be loud (warn/error), not silent.
Steps to Reproduce
-- sys tenant:
create account acc1 admin_name 'admin' identified by 'admin123';
create database spb; create table spb.t (id int primary key); insert into spb.t values (1),(2);
create publication pubS database spb account acc1;
-- acc1 tenant:
create database spb_sub from sys publication pubS; -- works
-- sys tenant:
create snapshot snapS for database spb;
insert into spb.t values (3);
restore database spb {snapshot="snapS"};
show publications; -- EMPTY: pubS silently deleted
-- acc1 tenant:
use spb_sub; select * from t; -- ERROR 20101: there is no publication pubSAdditional information
- Same intersection family as [Bug]: PITR RESTORE DATABASE fails with strconv.ParseInt error when the database is referenced by a publication (published databases are unrecoverable via PITR) #30607 (PITR restore fails on published DBs via a strconv column mismatch in
createPubByPitr) and [Bug]: CDC must recover or fail explicitly after source-generation changes #30512 (PITR restore kills CDC): the restore × replication-protocol intersection is under-tested. - The upper-stream
snapshot_restore_publication.sqlBVT exists but apparently does not cover "publication targeting a user database + db-level snapshot restore + subscriber still alive".
Activity
XuPeng-SH commentedon Oct 22, 2026
PR #30675 current-head review update — case-sensitive publication replay
XuPeng-SH's formal review of head
45730bd08bd20183f70fe2785dbbcf8844ad917breports a new P1 authorization regression inpkg/frontend/publication_replay.go: withlower_case_table_names=0, restoring a snapshot can lowercase the saved publication table name. If bothPublishedTand a privatepublishedtexist, the restored publication then targets the latter, allowing the subscriber to read a table that was private before restore. If onlyPublishedTexists, replay instead fails becausepublishedtcannot be found. The review requests preserving catalog identifier bytes and adding case-collision plus non-collision regressions.The reviewer reports a real SQL probe showing access denied before restore and subscriber access to the private value afterward; the merge-base controls passed. This is the reviewer's execution evidence, not a test I ran in this turn. It extends the existing RESTORE DATABASE publication issue, so no duplicate issue was opened. Issue remains open and assigned to
matrix-meowpending fix and validation.XuPeng-SH commentedon Oct 22, 2026
QA follow-up for PR #30675 after the synchronize to head
1eadf5008d3e984f50a07c9548d9e32aabad594b:The source-level fix for the previously reported case-sensitive authorization regression is present in this head:
publicationStatementForReplayconstructs the internal CREATE PUBLICATION AST directly from catalog names, rather than reparsing generated SQL with a hard-coded lower-case mode. The current test diff includes case-distinct identifier coverage and real-SQL regression scenarios. This is a static confirmation only; I could not run the Go or MatrixOne service tests in this workspace, and the latest formal review is still on the prior head45730bd08bd20183f70fe2785dbbcf8844ad917b.Please rerun the case-sensitive collision and non-collision restore cases against this exact head and record the results. I am leaving this issue open and its assignee unchanged until exact-head validation is independently confirmed.
XuPeng-SH commentedon Oct 22, 2026
PR #30675 cross-path follow-up — PITR publication replay (rechecked at current head)
Current PR head is
93a72247caacc871efb3dce27cdbcf05798a5761. The earlier finding remains in the current patch:restoreToDatabaseOrTableWithPitrcallscreatePubByPitr(..., nil)inpkg/frontend/pitr.go, even thoughcreatePubByPitrnow acceptsomittedViewsand filters only known unservable views inpublicationInfoForBulkRestore.PITR restores views later through
restoreViewsWithPitr, where an unservable FULLTEXT view can be deliberately skipped and marked unservable. Passingnilmeans an explicit publication selection that includes that omitted view is still replayed unchanged and can fail publication validation / abort PITR restore. Please add a PITR regression for a publication selecting a FULLTEXT view whose index is unavailable at the restore point, and pass the restore's confirmed omitted-view set or reorder replay after those omissions are known. Keep unexpected missing objects fail-closed.This is a source-level recheck of the current patch, not a new local SQL reproduction. The PR body reports local tests on the new head, but this workspace has no MatrixOne checkout/Go toolchain/service, and the visible CI runs are connector E2Es rather than the required restore regression. Issue #30610 remains open and assigned to
daviszhenpending a fix and exact-head validation.XuPeng-SH commentedon Oct 23, 2026
PR #30675 synchronization update — current head
e7e40871c12d8dd092bee8b22a46727b0903edeaThe PR remains open and unmerged. The latest commit changes only the
TestInactiveAfterCannotConnecttest fixture: it makes setup failures fatal, ensures app cleanup, waits with a bounded eventual assertion, and raises the initial successful-connect budget from 100 ms to 10 s. Static inspection indicates this targets the test panic described in the author's report; it does not change publication replay production code.For this exact SHA, GitHub shows Iceberg Connector E2E succeeded and Connector/J Pool Reset E2E is still running; combined status checks are empty. The latest formal approval I found is for older head
1180cd9361046a1b7cd52560d4e0a7c0c7cba28a; no fresh review is recorded one7e4087. The author reports that two other failures on prior head93a7224were cleanup/cluster-startup incidents and that their local macOS reruns passed. Those are author-reported results, not independent validation here.I did not run MatrixOne tests locally because this workspace has no MatrixOne checkout or Go toolchain. Issue remains open and assigned to
daviszhen; no issue duplication, status change, or reassignment. Next step is to inspect the final exact-head CI (including UT/BVT/SCA) and obtain a fresh review before testing/transfer.fix(frontend): replay publications after snapshot database restore (#…
XuPeng-SH commentedon Oct 24, 2026
Local current-main QA for merged PR #30675 (9693f11), run 2026-10-24:
test/distributed/cases/snapshot/database_restore_publication.sqlthrough separate real MySQL-protocol sessions on an isolated local CN and compared each result with its committed.result: 26/26 SELECT result sets matched, zero mismatches. This includes the reported database-snapshot restore with a live subscriber, subscriber reads after restore, repeated database restore, table-only restore, FK/view ordering, external-FK preservation of the live publication/comment, quoted identifiers and table selection, empty account grants, and zero-table publication state.go test ./pkg/frontend -short -tags=matrixone_testpublication/snapshot tests passed (30 top-level PASS markers, package runtime 0.494s), including catalog identifier/case-mode handling, replay ownership boundaries, known-unservable-view filtering, and error propagation.This confirms the reported snapshot database-restore failure in the scoped local run. It is single-node and does not include live PITR, a
lower_case_table_names=0case-collision matrix, or full Compose acceptance. Those boundaries remain for tester confirmation; the issue should stay open until that follow-up.XuPeng-SH commentedon Oct 24, 2026
Supplemental local current-main QA for merged PR #30675, run 2026-10-24. The 13 Go files changed by merge SHA
9693f11c84a23f5020394170ef16bf6e61ba5f7amatch the tested service source6f773c556d4f3177f5373eb193cd576e080b662f; upstream main was pinned at463803dfbbaed941501e231ba216c0a69e6c73c9. The reused service binary SHA-256 is51489b59a60310e79eddcf1182c582685b2c60f800f35a0a625eb5359469349b.On a second owned single-node service with a fresh
/tmpdata root and unique ports, I enabledlower_case_table_names=0and used real MySQL-protocol SQL. The fixture created separatePublishedTand privatepublishedttables with distinct values, then published onlyPublishedT. After snapshot database restore, the publication catalog still listed exactlyPublishedT; the published and private control tables each returned their pre-snapshot row, and the subscriber listed onlyPublishedTand read the expected public row. The same case-distinct fixture was restored through live database PITR: the publication retained exact table selection, both source tables returned their pre-anchor rows, and the subscriber read the expected published row. All 11 assertions passed; cleanup readback found zero fixture publications and accounts. Logs and fixture are kept locally in the QA workspace.Setup note: account creation after switching the fresh service to mode 0 returned error 1146 for
information_schema.CHARACTER_SETS; I preserved that attempt and pre-provisioned the local subscriber while mode was 1, then verified both new sys and subscriber sessions were mode 0 before the challenge. I have not classified that separate setup interaction as a #30675 result.This supplements the prior 26/26 committed snapshot result-set checks and focused Go tests. It is still scoped single-node evidence: no multi-CN/Compose run, no PITR FULLTEXT/unservable-view omission challenge, and no three-round repeat. It does not claim full acceptance. The issue remains open and assigned to
daviszhen; I made no assignee change.Ariznawlll commentedon Nov 30, 2026
当前 main 复验:snapshot 通过,但 PITR 边界仍有确定反例,保持 OPEN
测试版本
c255da6778fac39bc53b5b9defaab3b6f945e4d6。2eaddeaa961297dcb8df498c6abe47610ed16e1eca5ad35edb287538570f7ba0。SELECT git_version()核对完整 SHA。1. Snapshot publication 健康控制:3 个 root tests × 3 轮,9/9 PASS
执行当前源码的:
TestSnapshotDatabasePublicationReplayBoundariesTestSnapshotEmptyPublicationTablesRestoreTestSnapshotPublicationSkipsExternalTables覆盖真实 subscriber、重复 RESTORE、FK/view、quoted identifier、显式/空表集合、空授权、大小写碰撞、external table,以及删除 FULLTEXT 索引后成为 unservable 的 view。无 FAIL、SKIP。
日志 SHA256:
6ba295b566b8fe53e6c004cb7ffea9e99b319778f346105a0306ac4fe9e5059e。2. PITR + publication + unservable FULLTEXT view:3/3 均失败
每轮使用独立账号、数据库、publication、subscription 和 PITR,执行以下真实 SQL 流程:
base_t上建立 FULLTEXT,创建依赖MATCH ... AGAINST的v_ft,发布base_t,v_ft。base_t和v_ft,确认恢复前链路健康。v_ft成为恢复时必须省略的 unservable view。RESTORE DATABASE ... FROM PITR ...。因此尚未进入后续 publication/subscriber 正确性断言,不能记为通过,也不能用 snapshot 的 9/9 代替该路径。
三轮日志 SHA256:
46309d9f341eec50037d95bb19fb81e871f8ece9ad2e575ea2ec4624c3c4115b7d89f9da1a04f86ec8edcb6437cf0a0a55b7b2759f00618d356b6dd7534270222fd847745effba8848b990005961cb547f280c1d53bb55bd5048e5aea30f9f7d探针 SHA256:
d424886b068ffb057c24454caa3024125a4c1d3e6250cff7cbe62e45499d56fd。3. 源码对应关系与结论
当前
pkg/frontend/pitr.go的数据库 PITR publication 重放仍调用createPubByPitr(..., nil),没有像 snapshot 路径那样传入应省略的 unservable-view 集合。这与本轮v_ft not exists反例一致,但这里以真实运行结果为准,不仅凭源码推断。本轮确认:原 Issue 的 snapshot 修复在当前 main 的定向矩阵通过;相邻且此前明确保留的 PITR FULLTEXT/unservable-view 缺口仍可稳定触发。 因此 Issue 继续保持 OPEN。失败探针未推送为“已通过”的 MOTR 回归;启动阶段的端口竞态/连接基础设施失败也未混入三轮产品结果。
Ariznawlll commentedon Nov 30, 2026
原 snapshot publication 场景验收通过;PITR 反例已拆分
c255da6778fac39bc53b5b9defaab3b6f945e4d6,双 CN 均通过git_version()核对。TestSnapshotDatabasePublicationReplayBoundaries、TestSnapshotEmptyPublicationTablesRestore、TestSnapshotPublicationSkipsExternalTables各 3 轮,合计 9/9 PASS。af80c193fe338365a5cf6d2ff6603e24d5548a7b。远端新 head CI 以实际回执为准,不提前宣称全绿。数据库 PITR 在省略 FULLTEXT view 后重放 publication 时的
20101: table 'v_ft' not exists已另提 #33510:#33510 。三轮真实失败和最小复现均保留在新 Bug,没有写成 PASS golden,也不由 snapshot 结果推断 PITR 已修复。因此关闭本 Issue 的原 snapshot publication 范围;#33510 继续保持 OPEN。