[Bug]: Prepared SHOW TABLES/TABLE STATUS keeps stale plan after database becomes a subscription

オープン
#33,368 コメント 0 件 リアクション 0 件 担当者 1 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@matrix-meow がすでに取り組んでいます。

2026年11月27日 から。

評価

この issue はまだ評価されていません。

説明

kind/bug needs-triage

Is there an existing issue for the same bug?

  • I have checked the existing issues.

Searched open and closed issues for prepared SHOW TABLES/TABLE STATUS, subscription databases, stale plans, and publication lifecycle. #20596/#20584 cover direct SHOW TABLE STATUS errors for subscription databases, and #30948 covers a zombie database after DROP PUBLICATION. In this reproduction direct and fresh statements both work; only the old prepared statement is stale.

Branch Name

main

Commit ID

c0cef5c9cce2164fedd201c188bfffe4d2d09a96

A read-only check of main snapshot 9bf005bfcd06ef722351bccd9c9a59833ce2b5bd found the relevant PREPARE/SHOW function bodies unchanged. Runtime reproduction is against the commit above.

Other Environment Information

  • Hardware parameters: single-CN local deployment
  • OS type: macOS
  • Others: two subscriber sessions plus the sys publication owner; direct SQL and fresh PREPARE are the correctness controls

Actual Behavior

When an ordinary database is dropped and replaced by a same-name subscription database, old prepared SHOW TABLES and SHOW TABLE STATUS handles continue using the old ordinary-database plan and return empty result sets. Direct SHOW and freshly prepared statements in the same session both return the published table.

Expected Behavior

Changing the database identity or subscription route should invalidate and rebuild the prepared statement. At minimum, old EXECUTE should see the same current published table as direct SHOW and a fresh PREPARE, rather than silently returning an empty set.

Steps to Reproduce

-- As sys:root
CREATE DATABASE pub_db;
CREATE TABLE pub_db.pub_t(id INT PRIMARY KEY);
CREATE ACCOUNT sub ADMIN_NAME='root' IDENTIFIED BY '111';
CREATE PUBLICATION pub DATABASE pub_db TABLE pub_t ACCOUNT sub;

-- Open sessions S1 and S2 as sub:root
-- S1
CREATE DATABASE home_db;
CREATE DATABASE alias;
CREATE TABLE alias.local_t(id INT PRIMARY KEY);
USE home_db;
PREPARE p_tables FROM 'SHOW TABLES FROM alias';
PREPARE p_status FROM 'SHOW TABLE STATUS FROM alias';
EXECUTE p_tables;  -- local_t
EXECUTE p_status;  -- local_t

-- S2, with autocommit enabled
DROP DATABASE alias;
CREATE DATABASE alias FROM sys PUBLICATION pub;

-- S1
EXECUTE p_tables;  -- actual: success, zero rows
EXECUTE p_status;  -- actual: success, zero rows

The initial executions intentionally warm both prepared-plan reuse paths before the cross-session database replacement.

Controls

In S1 immediately after the stale executions:

SHOW TABLES FROM alias;        -- pub_t
SHOW TABLE STATUS FROM alias;  -- pub_t

PREPARE fresh_tables FROM 'SHOW TABLES FROM alias';
EXECUTE fresh_tables;          -- pub_t
PREPARE fresh_status FROM 'SHOW TABLE STATUS FROM alias';
EXECUTE fresh_status;          -- pub_t

Thus the subscription is not empty and direct subscription metadata handling is working. Two independent MatrixOne processes reproduced the complete old/direct/fresh comparison in two 31-event runs, including successful cleanup of the subscription database, publication, and temporary account.

Additional information

buildShowTables and buildShowTableStatus bake the database route into their rewritten queries at plan-build time. After the ordinary-to-subscription transition, the old prepared plans retain the ordinary-database route, while fresh plans resolve the current subscription metadata. The database identity/subscription change does not invalidate those old plans.

主要言語
Go
スター
1.9k
フォーク
312
平均マージ
21時間 57分
マージ済み PR(30日)
730

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

matrixorigin/matrixone のほかの issue

matrixorigin/matrixone の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。