Skip to content

[Bug]: SHOW TABLES hides ordinary demo_index_data due to wildcarded internal-index prefix #31416

Description

@slyunnn

Description

MatrixOne permits users to create, insert into, and query the ordinary table demo_index_data, but SHOW TABLES silently omits it. The catalog identifies it as an ordinary table (relkind = 'r'), and its data remains readable. A client using SHOW TABLES for object discovery can therefore miss a valid user table.

This was discovered during regression of #30562. It is a MatrixOne server-side metadata discovery issue; the tested mo-dump version exported and restored this table successfully.

Environment

  • MatrixOne main: 1231f06468dacc4a2997abc6c2147362913a2043 — fix(python-sdk): quote export paths and line terminators (#31397).
  • The service binary was locally built from the above checkout. git_version() returned 1231f06468 on each tested endpoint.
  • Isolated deployment: 2 CN / 1 TN / 1 Log service / Proxy; MySQL text protocol.
  • Reproduced through Proxy, CN1 and CN2 on 2026-10-27.

Steps to reproduce

Run the following in a fresh database:

CREATE DATABASE issue_showtables_wildcard;
CREATE TABLE issue_showtables_wildcard.demo_index_data (id INT PRIMARY KEY);
INSERT INTO issue_showtables_wildcard.demo_index_data VALUES (7);
CREATE TABLE issue_showtables_wildcard.plain (id INT PRIMARY KEY);
INSERT INTO issue_showtables_wildcard.plain VALUES (8);

SHOW TABLES FROM issue_showtables_wildcard;
SELECT relname, relkind FROM mo_catalog.mo_tables
 WHERE reldatabase = 'issue_showtables_wildcard'
 ORDER BY relname;
SELECT id FROM issue_showtables_wildcard.demo_index_data;

Actual behavior

On each of the three endpoints:

  • SHOW TABLES returns plain, but omits demo_index_data.
  • The catalog returns both demo_index_data and plain with relkind = 'r'.
  • The direct query on demo_index_data returns 7.

The table was omitted from the listing without a reported error. The test establishes a listing failure, not loss of the underlying table or data.

Expected behavior

SHOW TABLES should list both ordinary user tables. A user table should not be hidden solely because its name matches a wildcard-expanded pattern intended for internal index tables. Genuine internal index helper tables should remain hidden.

Stability and controls

  • The same minimal reproduction was observed through Proxy, CN1 and CN2 against the same isolated deployment. These are three endpoint checks, not three independent clusters.
  • plain is a normal-name listing control; the catalog and direct SELECT independently confirm that demo_index_data exists and remains readable.
  • During [Bug]: mo-dump must select current-tenant objects without omitting valid user tables #30562 verification, the tested mo-dump version included and restored demo_index_data; that tool result does not imply that SHOW TABLES is correct.

Code analysis

In the tested commit, pkg/sql/plan/build_show.go generates a relname NOT LIKE filter using catalog.IndexTableNamePrefix + "%". The prefix is __mo_index_ (definition). In a SQL LIKE pattern, each underscore matches any single character, so demo_index_data matches the pattern even though it is a user table rather than an internal index helper.

This is the likely cause inferred from the generated predicate and observed output; the reproduction above is the direct behavioral evidence.

Regression coverage

  • Assert that SHOW TABLES returns demo_index_data and an ordinary-name control.
  • Add boundary names that match the wildcard-expanded pattern but do not have the literal internal prefix, and ordinary names outside that pattern.
  • Create a real secondary index and assert that its genuine internal helper remains excluded while user tables remain visible.
  • Exercise the relevant account/database scope and any other SHOW paths that use the same predicate, with independent catalog and direct-query controls.

Related: #30562. No MatrixOne source changes were made during this verification.

Activity

  1. added
    kind/bug
    on Oct 27, 2026
  2. added theissue type on Oct 27, 2026
  3. added this to the MO-202610 milestone on Oct 27, 2026
  4. added a commit that references this issue on Oct 29, 2026
    b4906fb
  5. XuPeng-SH commented on Oct 29, 2026

    @XuPeng-SH
    Contributor

    QA handoff for merged #31420 (b4906fbc65abe7abce1666b5ffb59e8fcb99191a): this isolated QA run inspected the source and issue history but did not run current-head functional tests or live SQL because the existing resource guard left insufficient headroom. Please verify SHOW TABLES and information_schema visibility, genuine index helpers, tenant scope and upgrade/maintenance retry. Author-reported PR tests are separate evidence and are not results of this QA run.

  6. added a commit that references this issue on Oct 30, 2026
    bbfe556
  7. Ariznawlll commented on Oct 30, 2026

    @Ariznawlll
    Collaborator

    结论

    测试不通过。新环境和旧租户的 SHOW TABLES 已正常,但旧租户升级后 information_schema.TABLES 仍遗漏合法用户表,不满足修复 PR 的元数据可见性范围。

    关键证据

    • 执行时官方 main@c32e75a2b26e7bfddc99e0aeafae4d66fafca114;修复 PR fix: show user tables matching the internal index pattern #31420 合并提交 b4906fbc65abe7abce1666b5ffb59e8fcb99191a 在其祖先链。二进制构建元数据和 git_version() 均对应当前 SHA。
    • 新建的隔离 2 CN / 1 TN / 1 LogService / Proxy 环境,3 个独立数据库分别从两个 CN 和 Proxy 查询:demo_index_data、plain 和 wildcard 边界用户表均出现在 SHOW TABLES 与 information_schema.TABLES,真实索引辅助表隐藏,数据为 (7,70),3/3。
    • 另在隔离 1 CN / 1 TN / 1 LogService 环境,以修复前 f847803802289b2b2d0df4f0a2f842c2804b823a 创建 3 个租户和同样的普通表,再保留数据升级至上述 main。每个旧租户中,SHOW TABLES 均列出 demo_index_data 与 plain,但 information_schema.TABLES 仅列出 plain;升级后新建的 demo_index_new 也只在 SHOW 中出现。原表数据均保持 (7,70)。这是一次升级、三个租户,之后重复检查 3 次,非三次独立升级。
    • 升级后进程运行约 3 分钟再检查,3 个租户的 TABLES 视图定义仍含使用未转义 __mo_index_ 的 NOT LIKE 条件。fix: show user tables matching the internal index pattern #31420 明确覆盖已完成升级租户的持久化视图收敛;当前结果需要研发核查维护/版本迁移路径,暂不推断唯一根因。测试租户已清理。
    • 新建环境的原始场景已补入 MOTR #298;不把旧租户错误结果写成成功 golden。

    待解决点

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

Metadata

Metadata

Assignees

Labels

kind/bugneeds-triage

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions