Repository navigation
Description
Description
During the 4.2-dev distributed Chaos run, IVF vector queries repeatedly failed after CN kill injection with:
internal error: query schedule cannot satisfy placement, reason required-current-cn-outside-pool, current CN policy required
The scheduler reported two eligible workers in the resolved pool, but rejected the query because the current coordinator CN was outside that pool. This caused the qvec failure rate to increase across consecutive days.
Environment
- Branch:
4.2-dev - Build commit:
b83878b(build identifier recorded by the Chaos namespace and runner path) - Deployment: distributed TKE Chaos cluster
- Namespace:
mo-chaos-4-2-dev-b83878b-202608110022 - Analysis window: 2026-08-12 14:37 CST to 2026-08-14 14:37 CST
- GitHub Actions run: https://github.com/matrixorigin/mo-nightly-regression/actions/runs/31410702267
This report is based on the long-running 4.2-dev Chaos environment. It has not yet been independently reproduced 3/3 on the latest official main.
Steps to reproduce
- Deploy a distributed MatrixOne cluster with separate CN pools/labels.
- Run the
fulltext_vector_testqvec workload using IVF vector queries, for example a query ordered byl2_distance(question_vector, ?). - Inject
task_kill_cnagainst a CN for 30 seconds. - Continue issuing qvec queries during the fault and recovery window.
- Inspect qvec results and the CN scheduler warning logs.
Observed timeline from one occurrence:
- 2026-08-14 14:02:37 CST:
task_kill_cnstarted. - 2026-08-14 14:02:46 CST: scheduler emitted
required-current-cn-outside-pool. - 2026-08-14 14:03:07 CST: Chaos resource cleanup completed.
Actual behavior
The scheduler rejected IVF vector queries even though the resolved pool still contained eligible workers:
reason=required-current-cn-outside-pool
current-cn-policy=required
exec-type=ap-multi-cn
worker-count=0
eligible-worker-count=2
dropped-worker-count=0
requested-pool=tenant:fulltext_vector_test
resolved-pool=shared-unlabeled
pool-fallback=true
worker-set=all
is-internal=false
The failing request was handled by a TP CN, while the requested tenant pool fell back to shared-unlabeled. Since the current CN was not a member of the resolved pool and IVF scheduling required the current CN, no worker was selected.
Impact over the two-day window:
- First-day incremental qvec failure rate: approximately 6.79%.
- Second-day incremental qvec failure rate: approximately 11.57%.
- qvec QPS: 2.2 -> 1.7.
- qvec average latency: 3.67 s -> 4.83 s.
- Cumulative
required-current-cn-outside-poolerrors: 14,425.
Expected behavior
After a CN is killed, an IVF vector query should recover by reconnecting or being routed to a valid CN in the resolved pool. A request must not repeatedly fail solely because its new/current coordinator CN is outside the resolved pool when eligible pool CNs are available.
If IVF correctness requires execution on the current CN, the connection/router should ensure that the current CN is a member of the required pool before accepting or retrying the query.
Stability and controls
- Reproducer: repeatedly observed in the long-running Chaos run and correlated with
task_kill_cn; a standalone 3/3 reproduction has not yet been executed. - Control: the nqft workload did not show the same placement error and had approximately 0.16% incremental failures on the second day.
- A sampled
task_network_cnoccurrence recovered after cleanup and did not increase the cumulativerequired-current-cn-outside-poolcounter. - No data inconsistency was observed in this investigation; the confirmed impact is query failure and throughput degradation.
Evidence
- Chaos run: https://github.com/matrixorigin/mo-nightly-regression/actions/runs/31410702267
- The server-side warning includes the requested/resolved pool, current-CN policy, and eligible-worker count shown above.
- The error was emitted by the TP CN serving the qvec session approximately nine seconds after
task_kill_cnstarted.
Code analysis
The current code path appears intentional at the individual scheduler decision level:
pkg/sql/compile/scheduler.goforcesCurrentCNRequiredwhen an IVF entries internal scan is detected.pkg/sql/schedule/placement.goreturnsrequired-current-cn-outside-poolwhen the required current CN is not present in the resolved worker pool.
The suspected defect is at the interaction boundary between CN kill recovery, connection routing/pool resolution, and the IVF current-CN requirement. After failover, a qvec session can be accepted by a TP CN that is outside the resolved shared-unlabeled pool, making the query unschedulable despite two eligible pool workers.
The fix should preserve the IVF local-range correctness requirement while ensuring that post-kill routing/reconnection selects a CN belonging to the resolved pool, or otherwise provides a bounded retry/recovery path.
Regression coverage
Add a focused Chaos regression:
- Run continuous IVF qvec traffic through the normal service endpoint.
- Kill the current CN.
- Verify that the replacement connection lands on an eligible pool CN.
- Require qvec queries to recover within the defined recovery SLO.
- Assert that
required-current-cn-outside-pooldoes not continue after cleanup. - Repeat at least 10 times across CN replacements.
A focused scheduler/router integration test should also cover a required-current IVF request whose post-failover coordinator is outside the resolved pool while other eligible workers exist.
Related
- Pool-aware scheduler change: scheduler: add pool-aware deterministic worker subsets #25990
Activity
LeftHandCold commentedon Aug 14, 2026
已完成针对事故环境、Loki 时间线和当前代码的交叉核验,根因可以收敛,不是 IVF 本身算错,也不是“已有两个 eligible worker 却随机调度失败”。
结论
CN 被 kill 后,replacement CN 已经被 Proxy 发现并开始接收新连接,但它自己的本地
MOClusterinventory 还是 replacement 启动前取得的旧快照,快照中没有 replacement 自己。IVF entries 扫描必须把当前协调 CN 放在 worker ordinal 0,因为 appendable IVF ranges 只有当前 CN 能提供;#25990 又把“当前 CN 不在 resolved pool”从隐式补入改成了 fail-closed。因此,在这段启动窗口内,scheduler 必然返回required-current-cn-outside-pool。这是一条确定的启动时序竞态:
事故证据
目标 namespace:
mo-chaos-4-2-dev-b83878b-202608110022。pod-kill-cnChaos 创建。...-4cfwd,service UUID36663962-3139-3037-3664-366263643233。...-kk57k进程启动;新 UUID63383835-3661-3262-3763-303066633733,pipeline address10.10.65.151:6002。CreateTask/JoinGossipCluster。eligible-worker-count=2、resolved-pool=shared-unlabeled、dropped-worker-count=0,但 current CN 不在候选快照中。10.10.17.215,证明是 Proxy 新路由到 replacement 的连接,不是旧 CN 残留 session。部署 CR 实际只有
tp.replicas=2,没有独立 AP pool,也没有显式 CN label;因此shared-unlabeledfallback 是当前拓扑下的预期结果。Issue 原文“separate CN pools/labels”不是本次触发条件。代码闭环
pkg/cnservice/server_heartbeat.go:CN heartbeat 由 ticker 驱动,启动时没有先同步发送一次。pkg/clusterservice/cluster.go:NewMOCluster.refreshTask会立即执行首次 refresh;只要 HAKeeper 查询成功,就发布 snapshot 并关闭 ready gate,不检查 snapshot 是否包含本 CN。pkg/sql/compile/scheduler.go:IVF entries scan 使用CurrentCNRequired,并要求当前 CN 位于 ordinal 0。pkg/sql/schedule/placement.go:required current CN 不在 resolved candidates 时返回required-current-cn-outside-pool。#25990(commit
d1aeadeb9d)没有制造 inventory 竞态,但它移除了旧的ensureCurrentWorker隐式补入行为,使这个已有启动竞态从潜在错误路由变成了可见 query failure。因此,本次用户可见 availability 回归边界是 #25990,影响 4.2 和 main;4.1/4.0/3.0 没有这条精确报错路径。当前 main 源码仍存在相同启动窗口。修复边界
不应恢复“无条件把 current CN 塞进候选池”,那会破坏 #25990 的 pool 隔离语义;也不应放松 IVF 的
CurrentCNRequired,否则 appendable local ranges 有漏读风险。低风险修复应放在 CN 启动入口:在开放 SQL/query ingress 之前,等待本 CN heartbeat 成功,强制刷新本地 authoritative MOCluster,并确认 inventory 已包含本 CN;未满足时 fail closed,不对外提供服务。 这只增加 replacement CN 的启动门槛,不进入正常 query 热路径,也不改变 pool/IVF 调度语义。
我会按这个边界向 main 提交修复和确定性启动时序回归测试。
fix(cnservice): gate startup on self-visible cluster inventory (#27166)
Ariznawlll commentedon Aug 20, 2026
验证结论
4.2-dev 当前部署版本为
e9d53c4997e3e022df5aedc3795f16d9739b4aae,已包含修复 PR #27167(commit04e204c7cb5aa7d1b3cb1b74f8dfea7c858549ca)。在 128 Chaos 环境
mo-chaos-4-2-dev-aaac595-202608161347上核验:修复版本运行超过 18 小时,期间执行了 10 次pod-kill-cn,两个 CN 日志中required-current-cn-outside-pool和query schedule cannot satisfy placement均为 0,未发现 panic;故障后 qvec 可继续执行,TPCC 一致性检查持续成功。原问题未再复现,测试通过,关闭 issue。
fix(cnservice): gate startup on self-visible cluster inventory (matri…
fix(cnservice): gate startup on self-visible cluster inventory (matri…
fix(cnservice): gate startup on self-visible cluster inventory (matri…