Skip to content

[Bug]: DROP PUBLICATION leaves subscriber DB as a zombie (listed but 'there is no publication') #30948

Open

Description

@Ariznawlll

Description

Dropping a publication leaves the subscriber's subscription database in a zombie state: the database still appears in SHOW DATABASES, but every access to it (SHOW TABLES, SELECT, etc.) fails with internal error: there is no publication <name>. The subscribed data is no longer reachable, and the only recovery is a manual DROP DATABASE.

Environment

  • MatrixOne dev build 3a1e42b430, server reports 8.0.30-MatrixOne-v1.3.0

Reproduction

-- publisher (account tenant_a):
CREATE DATABASE tdb; CREATE TABLE tdb.t1 (id INT PRIMARY KEY, v INT); INSERT INTO tdb.t1 VALUES (1,10);
CREATE PUBLICATION pub1 DATABASE tdb ACCOUNT tenant_b;

-- subscriber (account tenant_b):
CREATE DATABASE sub2 FROM tenant_a PUBLICATION pub1;
SELECT * FROM sub2.t1;              -- OK: 1 10 ...

-- publisher drops the publication:
DROP PUBLICATION pub1;

-- subscriber still sees the database, but can't use it:
SELECT * FROM sub2.t1;              -- ERROR 20101: internal error: there is no publication pub1
SHOW TABLES FROM sub2;              -- ERROR 20101: there is no publication pub1
SHOW DATABASES;                     -- sub2 still listed  ← zombie

DROP DATABASE sub2;                 -- only way to clean it up (succeeds)

Root cause

The subscription database's catalog metadata retains a dangling reference to the publication. Once the publication is dropped, resolving any object inside the subscription database fails at the publication lookup, but the database entry itself is not removed or converted to a standalone snapshot. DROP PUBLICATION neither cascades to the subscription databases nor detaches them into independent copies.

Impact

  • Any subscription database becomes unusable (but still visible) the moment its publication is dropped — data appears lost to the subscriber until a manual DROP DATABASE.
  • Breaking change in operations: a publisher can't retire a publication without silently breaking every subscriber that still references it.
  • The official tests (git4data/clone/clone_subscription.sql) always drop the subscription database before dropping the publication, so this ordering is untested.

Expected behavior

One of: (a) DROP PUBLICATION cascades and drops the dependent subscription databases, (b) subscription databases are detached into independent materialized copies and remain fully readable, or (c) DROP PUBLICATION is rejected while subscriptions exist. Silently leaving a visible-but-unusable zombie database is the bug.

Activity

  1. added
    kind/bug
    on Oct 23, 2026
  2. added this to the MO-202610 milestone on Oct 23, 2026
  3. added theissue type on Oct 23, 2026
  4. Ariznawlll commented on Oct 23, 2026

    @Ariznawlll
    CollaboratorAuthor

    Confirmed this also reproduces across CNs in a two-CN cluster (CN1: 16001, CN2: 16002, shared log service/TN):

    -- publisher mcn_pa on CN1: CREATE PUBLICATION mpub DATABASE pdb ACCOUNT mcn_sa;
    -- subscriber mcn_sa on CN2: CREATE DATABASE sdb FROM mcn_pa PUBLICATION mpub;  → SELECT * FROM sdb.pt; → 1 11  (OK)
    
    -- publisher on CN1: DROP PUBLICATION mpub;
    -- subscriber on CN2:  SELECT * FROM sdb.pt;
    --   ERROR 20101: internal error: there is no publication mpub
    -- subscriber on CN2:  SHOW DATABASES;  → sdb still listed  (zombie)
    

    So the same dangling-publication-reference / zombie-database state occurs whether publisher and subscriber land on the same CN or different CNs. The fix should be CN-independent (catalog-level) rather than relying on per-CN local state.

  5. gouhongshen commented on Oct 23, 2026

    @gouhongshen
    Contributor

    Automated AI triage

    This issue requires human involvement and cannot currently be completed independently by the
    automated fix loop.

    Reason

    A publication/subscription maintainer must decide whether to preserve the existing deleted-subscription lifecycle or replace it with cascade deletion, materialization, or rejection of DROP PUBLICATION while subscriptions exist.

    Evidence

    Current main deliberately retains subscribed databases, marks their subscriptions SubStatusDeleted, and rejects access after publication removal. Existing tests cover deletion and subsequent recovery through publication recreation. The requested alternatives change this established lifecycle contract; the evidence does not demonstrate physical data loss.

    Please use this analysis to provide the missing decision, environment, evidence, or ownership
    needed before the issue is returned to the AI candidate pool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

deferredkind/bug

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions