Repository navigation
fix(index): keep synchronous FULLTEXT2 and HNSW builders on coordinator - #29568
mergify[bot] merged 1 commit into
Conversation
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.
Deep review completed at 41238efc092c1f013a61d047a119982b242ccae8 (base/merge-base d50a2d475a406829f67127fef7b2ad4abc1c1d3d). APPROVE — no blocking findings.
Design / ownership
The defect is transaction-workspace ownership, not insufficient builder parallelism. IsSingle cannot make a remote mirror workspace part of the initiating transaction. Declaring coordinator placement in the existing table-function registry and enforcing it in the existing compiler merge path is the appropriate boundary. Only fulltext2_create and hnsw_create opt in; this adds neither an algorithm-name dispatch in the compiler nor a second transaction/commit protocol. Standalone, child-bearing TABLE_FUNCTION, CROSS APPLY, and OUTER APPLY placement are covered; source scans retain their placement/DOP. Search and ordinary TVFs retain the previous behavior, and the existing mo_view_columns exception is preserved.
Correctness / unhappy paths / impact
Traced merge-process creation to the coordinator's shared Process.Base, the builders' internal SQL to the borrowed transaction, and error propagation to ordinary statement rollback. Existing merge/connector cancellation and pipeline cleanup retain ownership of remote producers, batches, builder resources, and spill-file cleanup; this change does not introduce another wait/cleanup state machine. Adjacent checks include zero-source rebuild plus rollback, opposite initiating CNs, standalone TVFs, OUTER APPLY, and unchanged search placement—not just the original successful nonempty rebuild.
The performance tradeoff is explicit and acceptable for this correctness fix: gathering source data adds network/coordinator work, and synchronous build execution is centralized; source reads remain parallel, FULLTEXT2's streaming segment caps and HNSW's existing build lifecycle remain in effect. This is not evidence of improved large-index build performance. There is no changed disk/catalog encoding or stored-data migration requirement. Mixed-version rollout compatibility was outside this review's requested scope.
Tests / evidence / comments
Read every hunk in all 7 files. Production changes are a small registry-property/compiler-placement change. The registry test, typed plan-placement tests, and one real two-CN frontend fixture prove distinct layers. The integration test uses minimal persisted rows and compares actual indexed results plus replacement metadata and rollback restoration; it is not merely an EXPLAIN assertion or a mocked builder. Rebuilding from both CNs removes the source-owner lottery. Existing fixture/query helpers are reused where available; no production diagnostic path was added.
Reused the exact-head author evidence recorded in the PR (focused package/race tests, repeated registry cleanup test, operator controls, and real multi-CN test), and independently checked successful exact-head CI run 36978831130. Its UT log explicitly selects TestIssue29566IndexRebuildCoordinator in pkg/tests/sqlintegration/multicn; the completed UT and both active BVT jobs passed. No skipped job is treated as validation. No additional local cluster run was needed to repeat this already-covered topology.
There were no prior human review threads to resolve. The issue/PR correctly distinguish the reproducible distributed-path defect from the still-unproven attribution of every original nightly mismatch. Ordinary bug-fix design exemption applies; no feature-design artifact is required. No repository source was modified during review; no subagent was used.
Merge Queue Status
This pull request spent 13 seconds in the queue, including 1 second running CI. Required conditions to merge
|
|
补充深度复核:未发现需要阻断的正确性、性能实现缺陷或其他业务路径回归,建议通过。 PR 已获 Approve 并合并,这里补充记录复核范围与性能边界,不重复提交正式批准。 复核范围为最终 HEAD 正确性闭环: 用户特别关心的性能/其他业务影响:
按
验证:复用作者记录的 focused/race/operator 证据,并独立核对 exact-head CI 36978831130。UT artifact 明确出现 验证限制:三个源行的测试明确使用现有 scoped multi-CN hook,不声称复现了原 nightly 的自然调度;物理 peer 断言来自单独的 forced SELECT。原 nightly 每项 mismatch 的完整归因和规模性能仍不在已证明范围内。后续 TKE BVT 不是全绿:首个 |
## What type of PR is this? - [ ] API-change - [x] BUG - [x] Improvement - [x] Documentation - [ ] Feature - [x] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Fixes #29399 on `main`; forward-ports the remaining fixes from #29431 (`4.2-dev`). ## What this PR does / why we need it: Repeated restore can mistake CLONE provenance or a view definition for legacy CHECK metadata, lose ownership/current grants, or preserve revoked authorization in an existing connection. Partial restore also treated a role name as identity: renaming an owner blocked restore, while reusing its old name could transfer DROP authority to a different role. - Preserve structured CHECK recovery; recognize CLONE provenance and exclude view definitions from legacy table CHECK parsing. - Recreate objects under historical creator/owner IDs. Partial restore validates and pins required live principals within their physical catalog generation. Role renames preserve identity; name reuse cannot acquire ownership. Table restore locks and retains an existing database without requiring its historical creator/owner. - Resolve partial restore's historical logical source once, including existing view dependency planning, before ownership checks and destructive DDL. Ownership lookup intersects that source after existing external-table and unservable-view omissions. Execution reuses the same objects and classifications; FK/master/publication guards can still reject or omit candidates. This prevents an irrelevant deleted view principal from blocking ordinary data restoration, without exempting servable views. Explicit external-table restore still rejects; skipped single-view restore preserves the live view. - Full account restore rebuilds principal catalogs and can rewind their auto-increment IDs. **Partial restore across rebuilt catalogs rejects ordinary custom principals before DROP, even if IDs/names match or full restore legitimately reconstructed them.** Only reserved bootstrap identities with verified IDs/names and required direct admin grants can cross that boundary. Use a point in the current catalog generation or full restore; documented in `docs/ai-skills/backup-restore.md`. - Keep principal pins and current scoped grant capture/rebinding in the existing restore transaction. DROP USER/ROLE use private pessimistic RC transactions to honor those locks even under ordinary optimistic SI. Partial restore preserves current grants; full/cross-account catalog rebuilding retains its mapping. - Apply existing DATA BRANCH authorization to ordinary-user CLONE, preserving administrator historical/cross-account behavior, subscription errors and recreated publisher identity mapping. - Recheck authorization in existing and text/binary prepared connections across CNs. Within one privilege evaluation, deduplicate only identical SQL misses while retaining ordered errors, early hits and role/view scope. An enum-bounded stack buffer satisfies SCA preallocation without suppression or extra persistent authorization state. The upstream merge at `54af0d38290c66b61ac78a46aa07a363eb576aae` is preserved, including #29563 ESQL and #29568 FULLTEXT2/HNSW coordinator placement. No force push, workflow change or merge-policy bypass. ### Validation Go 1.26.4 / macOS ARM64, verified native provenance. Latest source-selection correction (`93405cdc0ea`): - Authenticated public SQL regression covers snapshot/PITR, independently deleted view creator/owner, ordinary-table data recovery, skipped live-view ID/definition/result preservation, and servable-view missing-principal rejection before DROP. Existing external rejection, retained/recreated DB and unchanged principal-generation controls remain. - Ownership tests cover excluded raw physical metadata, required servable views/sequences and fail-closed missing ownership. FK lookup tests verify shared pointers and scope without fresh enumeration. - After preserving the upstream merge: full frontend **26.886 s**, all six `TestIssue29399*` public tests **31.475 s**, and configured incremental golangci-lint **0 issues**. The byte-identical correction also passed all six tests under race detection before the merge (**69.920 s**). Go vet and repository molint completed with exit 0; existing molint recover diagnostics outside changed code are retained. No linter suppression/configuration weakening. Unchanged evidence from the whole-PR review is retained: planner/compiler and V406 maintenance tests; prepared/cache/active-role controls; normal BVT comparisons including metadata (ownership/CLONE 125/125, builtin full-then-partial 213/213, cache 37/37, revoked-role 39/39). The inherited target merge separately passed compiler/index owning packages and two-CN FULLTEXT2/HNSW rebuild integration. Its initial `TestConnMeasuresDelayedBufferedFlush` timing failure remains recorded; isolated repetitions and subsequent full frontend passed without weakening assertions. ### Performance and limitations Partial source selection adds bounded name maps, uses existing view planning once and avoids repeated partial source enumeration. It adds no persistent state, catalog format, principal query per object or new lock. Current-dependent runtime guards can conservatively omit a prevalidated candidate; this change does not claim exact prediction of every dynamic FK skip. Existing matched public microbenchmark: reader p50 median **1.617 → 1.333 ms (~17.6% lower)**; admin **243.5 → 244.3 µs**, with comparable controls. These local measurements do not recover the old stale-cache roughly 80 µs latency or establish production throughput. Authorization code is unchanged by the latest source-selection correction. The latest correction's design and final overall review use actual **gpt-6.1-sol / xhigh**, reconciling the whole-PR evidence with the changed paths. The source-selection correction's remote CI remains distinct from the target synchronization below; skipped jobs are not passes. ### Prior target synchronization and CI Prior synchronization head: `b190162ef097987a71e9252a49266caaee810451`; target `main`: `401d153150d9076f84aaaf2a32cdcf880b478395`. Normal merge parents are the preserved live `93405cdc0eafd1d2ce15a65d75d5afe2d531b36a` and the new target. This closes the observed strict-baseline BEHIND condition without rebasing, force-pushing or changing Ready/base state. Only #29570's two prepared-DECIMAL SQL/result files change relative to the first parent, byte-identically to the target; every other tracked file is unchanged. The existing source selection, ownership, current-grant transaction, authorization implementation and disclosed performance limits are preserved. Fresh monitor-local exact-merge binary build passes. The new upstream prepared-DECIMAL case passes strict JDBC metadata validation **213/213**, with named database cleanup zero (macOS ARM64 / Go 1.26.4 / Java 20). Independent read-only mechanical merge review approves and whitespace/worktree checks are clean. The prior `93405cdc` frontend/public/race proof above is external local unchanged-Go evidence, not a fresh whole-suite execution or current-head remote CI pass. No source-branch cache-certificate or internal-executor fix is blindly copied to main. XuPeng-SH approved `93405cdc` at 14:21 UTC after whole-PR follow-up; this is an actual submitted review, not the local mechanical approval. Prior-head Connector/J run [37015828472](https://github.com/matrixorigin/matrixone/actions/runs/37015828472) attempt 1 fails during ONNX Runtime download (HTTP 504), before the server/test. Exactly one failed-job rerun request was accepted. Attempt 2 / [110870725085](https://github.com/matrixorigin/matrixone/actions/runs/37015828472/job/110870725085) downloads the dependency and actually passes pool-reset tests for all four Connector/J versions at 14:07:46 UTC. That success belongs to `93405cdc`, not this new merge head. No healthy jobs or whole ALL CI run were rerun/cancelled and no build/workflow/tester/business workaround was added. That head's Connector/J [37023553819](https://github.com/matrixorigin/matrixone/actions/runs/37023553819) actually succeeds at 15:01:50 UTC; ALL CI remains unfinished when it is superseded by the next target merge. This is historical evidence, not a result for the current head. ### Prior target synchronization and validation Prior head: `380bbce20601196b9c9b09ea48089bb666985857`; target `main`: `5a09e1ffbf40a59f50c55fe89e6f0c23eba143a3`. After main merges #29567, strict protection marks the previous head BEHIND again. A normal merge preserves parents `b190162ef097987a71e9252a49266caaee810451` and the new target, without conflicts, manual overwrites, rebasing or force push. Its 15-file delta matches the upstream commit exactly, including modes and blob IDs. All existing PR changes from the approved implementation remain intact. Inherited prepared runtime-plan statistics admission does not bypass schema invalidation or text/binary EXECUTE reauthorization; shared restore source selection, ownership preflight and current-grant transactions are unchanged. Fresh monitor-local exact-head proof (macOS ARM64 / Go 1.26.4): - Full frontend/plan/hashmap **-race passes: 34.982 s / 36.546 s / 3.344 s**. - All six authenticated `TestIssue29399*` tests pass (**29.908 s**), including the eight optimistic-SI privilege-removal arms, snapshot/PITR ownership and source-selection boundaries, principal pins and invalid-grant rollback. Upstream reordered-join semantics and prepared workspace visibility tests pass (**13.031 s**), including integer/bigint/string/composite unique controls. The test-only atomic output `[no statements]` is not production coverage. - Exact binary build and version `380bbce206` pass. Configured incremental lint across all five upstream changed package roots reports **0 issues**. Worktree and whitespace checks are clean. Independent read-only merge/integration review approves; it checks inheritance and interaction, not the general upstream statistics policy. A fresh OPEN/Ready/head guard was awaited and read before the accepted normal push. Latest current-head CI is newly triggered and not complete; no BVT, full coverage, required-context or merge-gate pass is claimed. Prior-head successes are not substituted for current-head results. No workflow, tester or source cache-certificate/internal-executor framework is copied into main. Existing performance limitations and the separate constant-view issue #29572 remain unchanged. ### Current target synchronization and validation Current head: `ae4460f455bafa98a5beb301906adbd0abc522b6`; target `main`: `9078a8bd87af49ea06f52e09d64e7740122aea61` (#29573 vector UnionOne/marshal). Strict-baseline BEHIND is addressed by a normal merge with first parent `380bbce20601196b9c9b09ea48089bb666985857`, without conflict, manual overwrite, rebasing or force push. The four-file delta is byte/mode-identical to the upstream delta; the original 43-file PR patch remains identical against the new target. Restore source selection, ownership/current-grant transactions, principal-generation restriction, protocol/DAG and authorization implementation are preserved. Independent exact-merge local proof (macOS ARM64 / Go 1.26.4, verified inherited native inputs and absolute CGo paths): - Complete vector/batch/mergeutil **-race passes (6.392 s / 3.393 s / 3.712 s)**; complete frontend/plan **-race passes (34.427 s / 34.374 s)**. - All six authenticated `TestIssue29399*` plus authenticated fixture configuration pass **under race (65.232 s)**, including all eight optimistic-SI privilege-removal arms. Another 28 objectio/hashbuild marshal, recovery/area and runtime-filter consumer tests pass **under race (2.722 s / 2.297 s)**. - Configured incremental lint in the two upstream changed package roots: **0 issues**. Exact-head binary build/version, gofmt, whitespace and worktree checks pass. Native/packaged binary artifacts are preserved; the exact-head validation binary is separate. - Independent read-only integration/mechanical review **APPROVE**, covering ownership/aliasing, NULL reuse, errors, marshal and restore/clone consumers. This is local correctness evidence for this merge, not a GitHub approval, full BVT/BigData, Linux/GPU proof or performance comparison. Test-only atomic `[no statements]` is not production coverage. A fresh OPEN/Ready/head/body guard is awaited and read before the accepted normal push. The source-only SQL-task principal follow-up is not blindly copied into main's unchanged adapter/authorization path. Existing performance limitations and separate constant-view issue #29572 remain. Current exact-head [ALL CI run 37034311275](https://github.com/matrixorigin/matrixone/actions/runs/37034311275), attempt 1, completes **SUCCESS** at **2026-10-02 17:51:19 UTC**. Actual Ubuntu UT, arm64 SCA, shared build, UT Coverage, PROXY/PESSIMISTIC multi-CN BVT, Coverage and CI Required all succeed. The [CI Required log](https://github.com/matrixorigin/matrixone/actions/runs/37034311275/job/110959138144) confirms `full` scope, generation `37034311275-1`, all five dependency groups successful and `coverage_ready=true` / `coverage_status=passed`. The [Coverage log](https://github.com/matrixorigin/matrixone/actions/runs/37034311275/job/110952754024) selects UT and both complementary BVT profiles from that same generation and publishes the merged result. Current-head Connector/J succeeds; Iceberg is **SKIPPED**, not a functional test pass. No failed-job or whole-run rerun/cancellation is performed this round. The PR remains **OPEN / Ready / MERGEABLE / BLOCKED / APPROVED**. The retained approval was submitted on the earlier `93405cdc` implementation; it is not a new review of this target-merge head. All four discussion threads remain unresolved, with no new human findings. Completed CI Required and test jobs do not establish that every review/protection requirement has been satisfied; no Ready/base/approval/merge or protection policy is changed. --------- Co-authored-by: XuPeng-SH <[email protected]>
What type of PR is this?
Which issue(s) this PR fixes:
issue #29566
Fixes #29566
What this PR does / why we need it:
A synchronous FULLTEXT2/HNSW rebuild can report success but commit an empty
index when its side-effecting build TVF runs on a remote scan worker.
IsSinglelimits each input scope's parallelism; it does not establish thetransaction-owning coordinator as the writer. The remote process uses a
mirror transaction with a separate workspace. Internal index INSERTs borrow
that transaction, and SELECT pipeline results do not transfer those workspace
writes back to the coordinator for commit.
Declare coordinator-required placement in the existing table-function plugin
registry, and opt in only
fulltext2_createandhnsw_create. Both APPLY andchild-bearing table-function compilation gather input through the existing
coordinator merge scope before invoking the writer. Standalone TVFs are
already local. Source scans retain their placement and parallelism; searches
and ordinary table functions retain their existing behavior. There is no new
algorithm-name dispatch in the compiler, protocol, persistence format, retry,
worker, or transaction-commit behavior.
Add registry and typed placement tests plus one real two-CN MySQL frontend
regression. The SQL test persists three rows per algorithm using public DN
flush, rebuilds from both coordinators, asserts indexed results and replacement
metadata, and checks empty-input rebuild followed by transaction rollback.
The existing scoped multi-CN plan hook bypasses the tiny query's classification
threshold, not the builder, storage, transaction, or remote transport. Ordinary
default scheduling is a passing control, not a standalone reproducer.
On clean pre-fix
52eecb55, the same public SQL assertions fail after successfulALTER: FULLTEXT2 returns no rows instead of IDs 1,3 and HNSW no rows instead of
IDs 1,2,3. Pre-fix
b75086c6also fails the typed writer-placement assertionswhile view/search controls pass. With this fix, both builder cases, metadata,
source-row, empty-input, and rollback assertions pass.
Scope and risk: this fixes the demonstrated remote-writer ownership defect.
The original nightly did not retain its exact builder-CN/mirror trace, so this
does not establish the cause of every nightly mismatch or an introducing
commit. Gathering build input can increase network traffic and concentrate
builder work; full-scale build performance was not benchmarked. Search runtime
and placement are unchanged. No 4.2 backport is included.
Validated final head
41238efc09, based onmain@d50a2d47, with Go 1.26.4,darwin/arm64, using
.agents/skills/mo-dev/scripts/mo-cgo-test. Registrystress evidence was reused across the rebase because its source, tests, and
dependencies were unchanged; the remaining final checks ran after the rebase:
All completed with exit 0. Full multi-CN package: 61.806s; new SQL test:
19.06s normal / 20.48s race. Tests are local embedded clusters, not server 50
or the original TKE environment. No CI/BVT result is claimed before it runs.