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: two single-node standalone instances on one host — publisher (mysql port 16001) and subscriber (port 16201), same main build
- OS: macOS
Actual Behavior
Cross-cluster subscription is impossible for any non-sys tenant, even when the publication is explicitly authorized to that tenant.
The subscriber connects upstream with the authorized tenant's credentials; every internal command of the subscription protocol is then rejected by the publisher:
ERROR 20101 (HY000): failed to get databases from upstream:
Error 20101 (HY000): internal error: tenant xclang user admin is not allowed to execute publication internal command get_databases
Reproduction (both instances freshly started):
-- On the publisher (16001), sys tenant:
create account xclang admin_name 'admin' identified by 'admin123';
create publication pubxc database pubsrc account xclang; -- authorization targets xclang
-- On the subscriber (16201), sys tenant:
create database pubsrc from 'mysql://xclang#admin:[email protected]:16001' xclang publication pubxc;
-- ERROR: tenant xclang user admin is not allowed to execute publication internal command get_databasesControl (same-cluster subscription works, because it runs through the internal background executor which is exempt from the check):
-- On the same cluster (16001), logged in as acc1:
create database resub01 from sys publication pub1; -- succeeds, data syncs fully and incrementallyRoot cause
pkg/frontend/publication_internal_auth.go:
func canExecPublicationInternalCmd(tenant *TenantInfo) bool {
return tenant != nil && tenant.IsSysTenant()
}
func ensurePublicationInternalCmdAccess(ctx context.Context, ses FeSession, cmd string) error {
if !ses.GetFromRealUser() { // internal executor: exempt
return nil
}
if canExecPublicationInternalCmd(tenant) { // sys tenant: allowed
return nil
}
...reject...
}A cross-cluster subscription connects upstream as a real user (GetFromRealUser() == true). The CREATE DATABASE ... FROM '<uri>' <account> PUBLICATION grammar (mysql_sql.y, FROM STRING ident PUBLICATION ident sync_interval_opt) and the URI format mysql://[account#]user:password@host:port (publication_subscription.go:1996) are first-class, documented syntax — but the authorization model only exempts the sys tenant, so any publication authorized to a normal tenant can never be subscribed to across clusters, making the authorization clause ACCOUNT <tenant> dead for the cross-cluster path.
The same-cluster path works only because the internal background executor has GetFromRealUser() == false and bypasses the check.
Expected Behavior
A tenant explicitly authorized by CREATE PUBLICATION ... ACCOUNT <tenant> must be able to execute the subscription's internal commands (get_databases, get_object, object_list, etc.) on the upstream limited to the scope of that publication — or the cross-cluster subscription syntax should be restricted/documented accordingly. Note: upstream BVT (test/distributed/cases/publication_subscription/) contains zero cross-cluster (uri-based) cases, so this path is entirely untested.
Steps to Reproduce
- Start two standalone instances (ports 16001, 16201)
- On 16001:
create account xclang admin_name 'admin' identified by 'admin123'; create database pubsrc; create table pubsrc.t(...); create publication pubxc database pubsrc account xclang; - On 16201:
create database pubsrc from 'mysql://xclang#admin:[email protected]:16001' xclang publication pubxc; - Observe the internal-command rejection; the same subscription succeeds within a single cluster via the internal executor path.
Verified deterministic across fresh instances; same-cluster control passes with exact full + incremental sync (insert/update/delete all verified byte-identical between ends).
Activity