Repository navigation
Description
Description
An IVF/vector-index query submitted through a TP-only account can dispatch its generated internal SQL to an AP CN. This violates the CN label / compute-pool isolation contract and allows a TP workload to consume or depend on AP-pool resources.
This was observed during the TKE 1TP+2AP nightly Family run. The AP CN was also running TPCH 1T and was OOM-killed during TPCH Q10. The available evidence does not prove that IVF caused that OOM: TPCH Q10 was the direct memory-heavy workload at the OOM timestamp. However, the IVF trace independently proves that its internal SQL crossed from the TP pool to that AP CN, and the IVF query failed when that AP CN disappeared.
Environment
- MatrixOne commit:
fca65defc18d8df819bce8de3e00663200d7311e - Topology: 1 TP CN + 2 AP CNs, each CN limited to 48 GiB
- Workflow run: https://github.com/matrixorigin/mo-nightly-regression/actions/runs/33231526162
- AP job: https://github.com/matrixorigin/mo-nightly-regression/actions/runs/33231526162/job/99057705086
- Namespace:
mo-42-family-33231526162-2
Routing evidence
- TP CN UUID:
31356230-3332-3566-3836-393063663866 - AP CN UUID:
32656532-3439-3963-3739-326438353331 - AP CN pod/IP:
nightly-regression-dis-ap-cn-2gp42/10.143.18.21 - Client account:
tp_tail_index:admin(routed to the TP CN by the outer-query route proof) - Trace ID:
68ef8d99-289d-a76e-3082-dbafbcca3f3a
Outer SQL:
SELECT id
FROM ann.items_sift
ORDER BY inner_product(...)
LIMIT 10;Generated internal SQL included a query against the hidden IVF index table:
SELECT __mo_index_pri_col, inner_product(...)
FROM ann.__mo_index_secondary_...;The TP CN log then attempted to open a remote scope on the AP CN and failed with:
cannot connect to backend: dial tcp4 10.143.18.21:6002: connect: connection refused
The pod map in the same run confirms that 10.143.18.21 belonged to the AP pool.
Root-cause analysis
The outer frontend compile path preserves the session CN labels:
computation_wrapper.gopassesses.getCNLabels()into compile.
The vector-index path executes generated SQL through the internal SQL executor:
sqlexec.gocallsexec.Exec(...)for the nested SQL.
But the internal executor's backSession resets the label map instead of inheriting the upstream session labels:
back_exec.gousesbackSes.label = make(map[string]string).
As a result, generated internal SQL no longer carries the original TP compute-pool constraint, so distributed scheduling can select an AP CN.
Expected behavior
- Nested/internal SQL that is part of a user statement must inherit the immutable CN labels / compute-group constraint of the parent statement.
- Remote scopes for this query must be restricted to TP-compatible CNs.
- If no compatible TP CN is available, execution should fail closed instead of falling back to an AP CN.
- Add a regression test with separate TP/AP labels that proves an IVF query's outer and internal SQL never cross pools.
Impact
- Logical TP/AP resource isolation is not reliable for vector-index queries.
- TP traffic can contend with AP performance workloads and contaminate performance results.
- Failure or restart of an unrelated AP CN can break a query issued through a healthy TP CN.
Activity
slyunnn commentedon Sep 10, 2026
Regression and extended verification for #27966 (2026-09-10)
Verification Environment
4.2-dev. The original reproduction commitfca65defc18d8df819bce8de3e00663200d7311eis contained inorigin/4.2-dev, notorigin/main.4.2-devat4199b11c5c7bb24eccdb379cd6f68abcbd89e450—[4.2] fix(catalog): correct logical ID index primary column width (#28526).a33d3a1bbbfa507ef1efc7c3748ab70e07d3bcd9, merged into4.2-dev.4 CNcluster with3 TP / 1 APCN-label pools. The test uses a real MySQL wire-protocol client and proxyExtraInfolabel preface. Standard shared endpoints Proxy6001, CN116001, and CN216002were not used because they do not expose the required TP/AP label isolation.What Was Covered
SELECT id ... ORDER BY l2_distance(...) LIMIT 4against anIVFFLATindex completed with the TP-labelled client connection.__mo_index_secondary_...was observed and verified to select only TP-compatible CN workers.2, and a remote TP worker.no candidate CNinstead of falling back to an AP CN.TestIssue27966FrontendIVFInternalSQLPreservesQueryPoolpassed in15.755s.main; this issue was found and fixed on4.2-dev, while the fix has not yet been merged to main.Findings
PR
#28204preserves the initiating statement's CN-label and scheduling intent through frontend background sessions, process snapshots, remote pipeline serialization, vector-index execution, and nested compilation. The IVF-generated internal SQL therefore remains confined to the TP pool.No additional large-data regression is required. The failure depends on labelled multi-CN routing and nested scheduling intent, not row count, block/batch boundaries, memory/spill, skew, network volume, or resource scale. The exercised
3 TP / 1 APtopology is the minimal stable execution boundary.MOTR / BVT Coverage
pkg/tests/issues/issue_27966_test.gois the appropriate end-to-end BVT coverage and passed on4.2-dev.Final Conclusion
Fixed on
4.2-dev. The original and extended TP/AP routing scenarios pass with the#28204fix: internal IVF SQL inherits the parent pool constraint and fails closed when no compatible TP CN remains. Large-data regression is not required for this scheduling-state defect.