Repository navigation
Conversation
Set the publisher database on subscription metadata when resolving hidden index tables. Add BVT coverage that forces regular secondary-index scans through a subscription alias.\n\nRefs matrixorigin#28279
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
XuPeng-SH
left a comment
There was a problem hiding this comment.
REQUEST_CHANGES(reviewed commit 7f32413fbb05249b1f489c2a2f5c6d672dbd23a7)。
生产修复方向正确:ResolveIndexTableByRef 必须同时携带 publisher tenant 和 ref.SchemaName(publisher database);非订阅路径不受影响,生产性能风险可忽略。
需要补齐以下测试门禁:
- 缺少 resolver 边界的确定性 UT。 这是本次修复的直接不变量:publisher tenant、publisher database、隐藏 index relation 和返回的 subscription identity 必须同时正确。当前只有依赖优化器/统计信息的 BVT。main 的 #28284 已有可直接 backport 的
TestResolveIndexTableByRefUsesPublisherDatabase,建议补到 4.2。 - 第二个索引没有证明实际走索引。
idx_created_at查询只有 FORCE INDEX 和结果断言,没有 EXPLAIN。4.2 受影响版本可能静默退化成 base-table scan,结果仍可能为 2。请补充对应 plan-shape 断言,或删除这个不能独立证明的重复场景。 - BVT 使用固定
sleep(1),且 100k/flush 的成本没有说明。sleep不是同步条件,慢环境仍可能不够,快环境固定浪费时间。请改为可观测条件/去除不必要等待;若 100k 是为了让优化器选择二级索引,请给出最小必要基数及 BVT 时间增量,否则缩小 fixture。main 的同类覆盖已使用 100k 但没有固定 sleep。
以上不是生产逻辑方向问题,而是回归证据的确定性、覆盖边界和 CI 成本问题。补齐后我可以重新审核。
XuPeng-SH
left a comment
There was a problem hiding this comment.
APPROVE。
生产修复本身正确:ResolveIndexTableByRef 补齐 publisher database 后,订阅表的普通二级索引可以在正确的 publisher tenant/database 下解析;非订阅路径不变,生产性能风险可忽略。
补充的非阻塞建议(不影响本次合入):
- 可 backport main #28284 的 resolver 边界 UT,直接锁定 publisher tenant/database 不变量;
idx_created_at最好补对应 EXPLAIN,避免仅凭结果值误判为索引扫描;- BVT 的固定
sleep(1)和 100k/flush 成本可后续优化为可观测同步或更小 fixture。
这些属于测试证据和 CI 成本改进,不是生产逻辑缺陷。
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #28279
What this PR does / why we need it:
Regular secondary-index scans over a subscribed database resolve the hidden index table under the publisher account.
ResolveIndexTableByRefcarried the publisher account ID but omitted the publisher database name, sogetRelationreplaced the valid source database with an empty name and returnedno such table <publisher_db>.__mo_index_secondary_*.This PR:
SubscriptionMeta.DbNamefrom the planner-resolved published table reference;idx_event_type, preventing the regression case from silently falling back to a table scan.This is the focused
4.2-devbackport of the subscription metadata fix already merged intomainby #26702. It does not backport the unrelated FULLTEXT implementation from that PR.Validation:
c8b8e2c046: the regression SQL reproduced the production failure for both hidden secondary-index tables.7f32413fbb:pub_sub_secondary_indexpassed, 19/19 statements.make buildpassed.git diff --checkpassed.QA required: yes. The BVT reproduces and verifies the single-node planner/resolver path; normal 4.2 CI and publication/subscription testing should run on the PR.