Skip to content

fix: expose subscription tables in information schema - #27942

Merged
XuPeng-SH merged 10 commits into
matrixorigin:mainfrom
ck89119:issue-27794-main
Sep 4, 2026
Merged

XuPeng-SH merged 10 commits into
matrixorigin:mainfrom
ck89119:issue-27794-main

Conversation

@ck89119

@ck89119 ck89119 commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

issue #27794

What this PR does / why we need it:

Subscription tables are resolved through the subscriber's local database alias, while their physical table and column catalog rows belong to the publisher account. As a result, readable subscription tables were missing from information_schema.TABLES and information_schema.COLUMNS.

This PR:

  • adds private, zero-argument subscription metadata table functions for TABLES and COLUMNS;
  • discovers live subscriptions at statement execution time and scans publisher catalogs using trusted execution identities;
  • rewrites returned metadata to the subscriber account and local subscription alias;
  • applies the existing active-role table visibility rules to subscription metadata;
  • enforces current publication account and table scope, using table_list as the authoritative scope after ALTER PUBLICATION;
  • keeps the functions inaccessible to direct SQL and user-created wrapper views;
  • bounds candidate pagination, table-list chunks, streaming buffers, and output batches, with cancellation and deterministic cleanup;
  • keeps the latest TABLES plan to exactly one reachable subscription producer and returns AUTO_INCREMENT = 0 for subscription rows;
  • introduces protocol version 46 on the merged main baseline, where versions 43-45 are already assigned, so pre-v46 clusters retain local-only view definitions until every CN supports the new functions;
  • updates all upgrade entries that can persist the latest TABLES or COLUMNS definitions.

Validation:

  • make build
  • full tests for pkg/sql/plan, pkg/sql/colexec/table_function, and pkg/util/sysview
  • exact persisted information_schema.TABLES plan-shape test: one reachable mo_subscription_tables producer
  • affected bootstrap version package tests and pkg/frontend tests
  • race tests for planner, table-function, and sysview packages
  • go vet for affected packages
  • publication/subscription BVT: 53/53
  • subscription privilege BVT: 30/30
  • clean single-CN issue reproduction: 3/3 successful
  • git diff --check

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deep review of exact head 2b18aac69a17c22f570307a95c5c6cab7c962415: approved.

The prior blocking cancellation race is closed. readStreamResult now re-checks the caller context before reporting clean EOF when the closed stream and caller cancellation are simultaneously ready, and the deterministic 100-iteration regression pins that select race. The check reads proc.Ctx, not the producer child context, so private cleanup cancellation remains a clean lifecycle event.

I also rechecked the current complete diff from the merge base from these angles: cross-account identity and publication/table-scope filtering, private planner admission and clone fallback, v41-v45/v46 bootstrap and upgrade gates, TABLES/COLUMNS type and projection parity, pagination/buffer/output bounds, and cancellation/error/LIMIT/reset/free ownership. The Q1-Q3 lifecycle graph closes: queued/current executor results have one effective close owner, cleanup cancels and drains before joining the producer, and retained work is bounded. I did not find another correctness, authorization, leak, hang, or OOM blocker.

Exact-head required CI is terminal green (success/skip/neutral). The branch is mergeable but currently behind main; v46 is still the next protocol number on current main.

@XuPeng-SH
XuPeng-SH merged commit fa829e5 into matrixorigin:main Sep 4, 2026
7 of 10 checks passed
@ck89119
ck89119 deleted the issue-27794-main branch September 4, 2026 15:02

This branch was previously deployed

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

Labels

kind/bug Something isn't working size/XXL Denotes a PR that changes 2000+ lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants