Skip to content

[Bug]: pub+fulltext index,can not use select * from where match() against() #20210

Closed

Description

@tom-csf

Is there an existing issue for the same bug?

  • I have checked the existing issues.

Branch Name

main

Commit ID

44f4d5b

Other Environment Information

- Hardware parameters:
- OS type:
- Others:

Actual Behavior

image

Expected Behavior

No response

Steps to Reproduce

1、use root login
2、create database tpch_1g;
3、create table tab1(col1 int primary key, col2 text);
4、set experimental_fulltext_index=1;
insert into tab1 values (1, "hello world");
 insert into tab1 values (2, "hello world");
create fulltext index fdx1 on tab1(col2);
5、create account a1 ADMIN_NAME 'admin1' IDENTIFIED BY 'test123';
6、create publication pb2 database tpch_1g table tab1 account a1;
7、use a1 login //mysql -h 10.222.6.253 -ua1#admin1 -P6001 -ptest123
8、create database pb2 from sys publication pb2;
9、use pb2;
10、select * from tab1 where match(col2) against('hello');

Additional information

No response

Activity

  1. added
    kind/bug
    severity/s0
    on Nov 20, 2024
  2. added this to the 2.0.1 milestone on Nov 20, 2024
  3. assigned and unassigned on Nov 21, 2024
  4. cpegeric commented on Nov 21, 2024

    @cpegeric
    Contributor

    You can reproduce this case without fulltext index.

    1、use root login
    2、create database tpch_1g;
    3、create table tab1(col1 int primary key, col2 text);
    insert into tab1 values (1, "hello world");
    insert into tab1 values (2, "hello world");
    5、create account a1 ADMIN_NAME 'admin1' IDENTIFIED BY 'test123';
    6、create publication pb2 database tpch_1g table tab1 account a1;
    7、use a1 login //mysql -h 10.222.6.253 -ua1#admin1 -P6001 -ptest123
    8、create database pb2 from sys publication pb2;
    9、use pb2;
    10、select * from tpch_1g.tab1;

    image
  5. cpegeric commented on Nov 21, 2024

    @cpegeric
    Contributor

    This happens when fulltext_index_scan() table function run a SQL select count(*) from tpch_1g.tab1 and database tcph_1g database cannot be found.

    This issue is that sql/compile/sql_executor_context.go CompilerContext doesn't have subscriptionMeta yet. I consider this is a not bug fix. It is rather a missing feature in CompilerContext.

  6. removed this from the 2.0.1 milestone on Nov 22, 2024
  7. 38 remaining items

  8. VioletQwQ-0 commented on Aug 4, 2026

    @VioletQwQ-0
    Collaborator

    Reproduced deterministically on exact main 6091b418fd529badca4e1855843bd38804de396f in an isolated single-CN deployment.

    • A non-sys publisher created publisher_db.articles, a FULLTEXT index, and a table-level publication to a non-sys subscriber.
    • The publisher query select id from articles where match(body) against('hello') returned id = 1.
    • The subscriber created the subscription as a different alias, and an ordinary scan returned both published rows.
    • The subscriber FULLTEXT query failed with ERROR 1049 (HY000): Unknown database publisher_db.

    This locates the failure in the generated FULLTEXT internal SQL: the plan carries the publisher database name, but the internal SQL executor still uses the subscriber account context. I am implementing a scoped fix that derives publisher execution identity only from planner-resolved source/index object references; user table-function arguments will not be able to select an account. QA remains required for multi-CN, revoke/drop, and cross-tenant permission validation.

  9. VioletQwQ-0 commented on Aug 4, 2026

    @VioletQwQ-0
    Collaborator

    QA handoff for merged PR #26702.

    • PR head: 83d84fd72512c6dd6d46d1fdfeea48428e2f22ee
    • Merge commit and main head: 8fc0655ac55fad63960f7c433b01cbad2fe7e7c6
    • Automated evidence: exact-head Ubuntu UT, Linux arm64 SCA, coverage, Proxy Compose BVT, and pessimistic launch BVT passed. The PR also adds publication + FULLTEXT BVT and protobuf round-trip coverage.

    Remaining QA: test a deployed build containing the merge with table and database publications, multiple concurrent subscribers, differing subscription aliases, FULLTEXT index update visibility, and revoke/drop invalidation across multi-CN placement. Verify that an authorized subscriber MATCH ... AGAINST query returns the expected published rows and never exposes unpublished publisher objects or catalog data.

    Expected PASS: the subscriber FULLTEXT terminal results match the publisher-visible authorized data through create, insert/update/delete, revoke/drop, and reauthorization scenarios. On FAIL, include MatrixOne version/build, environment/topology, SQL or fixture, terminal error/result, and relevant statement or log evidence. Keep this issue open until explicit tester PASS.

  10. removed their assignment
    on Aug 5, 2026
  11. removed
    severity/s1
    on Aug 6, 2026
  12. Ariznawlll commented on Aug 7, 2026

    @Ariznawlll
    Collaborator

    测试版本

    • 分支:main
    • commit:ab49099c0f487255df131f45c3aecf4a4650fed7
    • 部署方式:macOS arm64 本地单 CN 与双 CN;publication + FULLTEXT SQL 黑盒验证
    • 测试日期:2026-08-07

    原问题验证

    非 sys 发布者创建 FULLTEXT index 并发布表/库后,订阅账户以不同数据库 alias 查询 MATCH ... AGAINST,可返回被授权的发布数据。

    Happy Path 覆盖

    1. 表级和库级 publication、两个订阅账户、不同 subscription alias 均可检索 FULLTEXT。
    2. 发布端 insert/update/delete 后,订阅端 MATCH 结果正确;prepared statement 跨发布端索引维护后仍正确。
    3. 双 CN:CN1 创建发布/索引,CN2 订阅初始命中 id=1;CN2 执行发布端 insert/update/delete 后,CN1 订阅端命中 id=2,3,总行数为 2。

    Unhappy Path 覆盖

    1. 订阅账户不能读取未发布的 secret_table,也不能用直接的 fulltext table-function 参数选择发布者私有对象。
    2. 撤销授权、删除 publication 后,原订阅端 prepared/MATCH 查询被拒绝;重新授权后可恢复查询。

    白盒验证

    不适用。跨账户身份、对象可见性、撤销和跨 CN 数据更新均通过公开 SQL 验证。

    回归测试

    执行 pub_sub_fulltext.sql 对应场景及独立双 CN 场景;未新增代码或回归文件。

    测试证据

    • 单 CN 表级/库级发布、多订阅者、授权撤销/恢复均通过。
    • 双 CN 发布端交叉写入、订阅端 MATCH 读取通过。

    测试结论

    测试通过。

  13. Ariznawlll commented on Aug 12, 2026

    @Ariznawlll
    Collaborator

    关闭说明:原 publication + FULLTEXT 查询路径已在 current main 完成单 CN、双 CN 黑盒验证,订阅账户通过不同数据库 alias 执行 MATCH ... AGAINST 均返回正确结果,权限隔离与异常路径也已覆盖。

    该问题属于权限、目录解析和 FULLTEXT 查询组合的功能语义,不依赖规模阈值,因此不需要额外加入 big-data 回归。测试证据见:#20210 (comment)

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

Metadata

Metadata

Assignees

Labels

ai-mediumkind/bugphase/testing

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions