Skip to content

[Bug]: IVF capability-probe failures lose their cause and are misreported as unsupported MORPC protocol #30408

Closed

Description

@LeftHandCold

Summary and scope

A failed CN protocol-capability probe loses its transport error when the parent statement is still active. Distributed IVF IndexSearchScan then returns ErrNotSupported / “requires MORPC protocol version 111 on every CN”, indistinguishable from a genuinely old peer.

This error-classification / lost-cause defect is reproduced with the real pkg/sql/compile implementation and an existing query-client fault-injection fixture. It is not a request to bypass the protocol guard or dispatch to an unverified peer.

The investigation was prompted by 11 failed queries in Main's Wiki 10M PRE benchmark. The nightly has exactly this public error. The underlying reason its capability check failed is not yet established: the report does not claim a protocol-111 serialization regression, prove that its 11 failures were all probe timeouts, or attribute them to HAKeeper based only on temporal correlation.

Versions and environment

  • Observed nightly MO subject: e8b3ed7f21c2b1966d74814adaa2bcd96d8c129f.
  • TKE Main Family, 1 TP CN + 2 AP CN; namespace mo-main-family-38757675628-1.
  • Collected resource artifact records all three CNs with the same image digest, sha256:bf735f52ce7f7501ad52e406e5abfba6b88b6433c189ec46ae4d300b801a4a8d, and restart count 0. This is a snapshot, not proof of every peer's effective protocol gate at failure time.
  • Inspected current main: 2cf7684062e71eece7af4ed74cabf37e0ca3a301 (2026-10-16); the relevant probe and IVF rejection paths remain present. The nightly workload has not been rerun on this head.
  • Native diagnostic test: Linux/amd64, bd9c69f8fcff893bc23c029149f8d915cef11191, using repository mo-cgo-test and matching native artifacts. expression_protocol.go, compile.go, vector_scan_protocol.go and the reused test-fixture files are byte-identical to the incident revision. Only a diagnostic test was added through a Go overlay; production code was unchanged.

Observed nightly failure

Main Wiki job / original runner output

The l2_only / pre / round 1 result reports:

expected=10000 completed=10000 failed=11 connection_errors=0
failure_samples: query_id 179,170,180,173,182,141,183,185,191,186,193
reason: OperationalError

Here completed counts terminal requests, including failures. The runner's zero connection_errors does not prove that internal RPC probing was healthy.

Bounded server-log collection found 11 matching errors on AP CN nightly-regression-dis-ap-cn-dscb9, at 2026-10-15 18:59:50.239–18:59:51.637 UTC (Oct 16 02:59:50–02:59:51 UTC+8):

not supported: index search scan requires MORPC protocol version 111 on every CN

Other Wiki modes subsequently emitted zero-query-error summaries. The collected CN image/restart snapshot does not show a rolling mixed-version deployment. Neither observation establishes the exact failed probe response or cluster-discovery state.

Evidence artifacts on that run:

  • test-control-product-receipt-runner-main-vector-wiki-38757675628-1
  • tke-family-weekly-shadow-1x2-resource-38757675628-1

Confirmed code mechanism

  1. remoteWorkerProtocolVersion returns cluster-discovery / GetProtocolVersion query-client errors.

  2. remoteWorkersSupportProtocol uses a five-second child probe context, but handles any probe error as:

    if err != nil {
        return false, parent.Err()
    }

    A child-probe timeout or connection failure does not necessarily cancel the statement's parent. In that case this becomes (false, nil) and discards the original cause.

  3. compileIndexSearchScan and constrainRequiredIVFWorkers interpret this as unsupported protocol and produce the same public error as a confirmed old peer. The send-time validation also shares the helper.

Failing closed is correct. Reporting “the peer does not support this protocol” after a failed observation, with no preserved failure cause, is the defect. It hides the actionable distinction between version incompatibility and an unavailable/timed-out capability check.

Deterministic native reproduction

The existing vectorPlacementCompile fixture sets both coordinator and successful peer responses to the required protocol. Inject an error only in its GetProtocolVersion transport; do not alter the production validator.

Add this diagnostic test to pkg/sql/compile at the test revision above:

package compile

import (
    "context"
    "testing"

    "github.com/matrixorigin/matrixone/pkg/common/moerr"
    "github.com/matrixorigin/matrixone/pkg/sql/colexec/vectorscan"
    "github.com/matrixorigin/matrixone/pkg/vm/engine"
    "github.com/stretchr/testify/require"
)

func TestCapabilityProbeMustRetainFailureCause(t *testing.T) {
    workers := engine.Nodes{{Id: "b", Addr: "b:6001"}, {Id: "a", Addr: "a:6001"}}
    t.Run("helper", func(t *testing.T) {
        c, client := vectorPlacementCompile(t, workers)
        client.customResponse, client.sendErr = true, context.DeadlineExceeded
        ok, err := remoteWorkersSupportProtocol(c.proc, workers, vectorscan.IndexSearchScanProtocolVersion)
        require.False(t, ok)
        require.NoError(t, c.proc.Ctx.Err())
        require.ErrorIs(t, err, context.DeadlineExceeded) // currently fails: err == nil
    })
    t.Run("public_placement_error", func(t *testing.T) {
        c, client := vectorPlacementCompile(t, workers)
        client.customResponse, client.sendErr = true, context.DeadlineExceeded
        scopes, err := c.compileIndexSearchScan(vectorPlacementNode())
        t.Cleanup(func() { ReleaseScopes(scopes) })
        require.Error(t, err)
        require.Empty(t, scopes) // rejection must remain fail-closed
        require.False(t, moerr.IsMoErrCode(err, moerr.ErrNotSupported)) // currently fails
    })
}
GOMAXPROCS=4 .agents/skills/mo-dev/scripts/mo-cgo-test \
  -p=2 -v -count=1 -timeout=90s \
  -run '^TestCapabilityProbeMustRetainFailureCause$' ./pkg/sql/compile

Actual diagnostic run used equivalent assertions plus successful-probe and actual-old-version controls:

successful_probe_control: PASS
actual_old_version_control: PASS
transport_timeout_cause:
  supported=false returned_error=<nil> parent_error=<nil> probe_calls=1
  FAIL: Expected context deadline exceeded in error chain, got nil
placement_preserves_transport_cause:
  placement_error=not supported: index search scan requires MORPC protocol version 111 on every CN
  is_not_supported=true probe_calls=1
  FAIL: transport failure classified as unsupported capability

The diagnostic was repeated with -count=3: both controls passed and both lost-cause assertions failed on all three executions. The unchanged TestIndexSearchScanPlacementRequiresProtocol passes all seven existing subtests, including probe failure. It currently intentionally groups probe failure and actual protocol incompatibility under the same assertion, so a green existing test does not validate error-cause accuracy. The diagnostic failure above is an assertion failure against real code, not a compile/link failure. Fault injection demonstrates the error mapping, not an end-to-end reproduction of the nightly network/cluster condition.

Expected behavior / fix boundaries

  • Keep genuinely old peers rejected and keep unknown peers fail-closed wherever this execution path requires it.
  • Preserve the probe failure/cancellation cause and distinguish it from an observed version below the required floor. Include a bounded worker identifier/required version if practical; do not dump full SQL/vector values.
  • Do not blindly replace the shared helper's policy without reviewing expression callers: some intentionally choose a safe local execution path for unknown capabilities. Preserve those valid fallbacks and response cleanup.
  • Cover healthy probes, actual old peers, probe-local timeout with a live parent, transport failure, parent cancellation, missing response/discovery and send-time revalidation.

The nightly's underlying availability trigger still needs a failed-peer/probe-cause observation. Changing this diagnostic alone must not be presented as fixing all 11 nightly query failures.

Duplicate check / related issues

Searched current open/closed Issues and relevant PRs for the helper name, capability probe, IVF and protocol-version symptoms. No existing issue specifically covering this demonstrated lost-cause / false-incompatibility classification was found.

Activity

  1. added a commit that references this issue on Oct 18, 2026
    4226537
  2. XuPeng-SH commented on Oct 18, 2026

    @XuPeng-SH
    Contributor

    本轮合并后实测已覆盖本 issue 明确限定的 main capability-probe 错误分类/丢失原因 范围,转 Ariznawlll 验收。

    环境:Linux/amd64、Go 1.27.1、按当前源码新构建 CPU/CGo;main 完整 SHA 4226537e5094995155eab9c2a883db649ff7b95b(包含 #30516)。生产源码未修改。

    新执行证据:

    • 将正文原始 TestCapabilityProbeMustRetainFailureCause 通过独立 Go overlay 加入,helper 与 public-placement 两个原始反例 normal + race 均通过,保持 live parent、拒绝空 scopes、保留 context.DeadlineExceeded 并验证不是 ErrNotSupported。
    • 同次 normal + race 执行 TestIndexSearchScanPlacementRequiresProtocol,healthy、old worker/coordinator、unknown worker、transport/deadline、parent cancellation、probe 中取消、forced-local 九个控制全部通过。两条命令均 exit 0。
    • 另外 8 个相关 probe/placement/destination 根在 normal 与 race 下均通过,覆盖 discovery、响应释放和 optional-placement fallback。
    • 真实认证两 CN 的 TestIndexSearchScanRefusesOlderCN 通过:健康 SQL 与旧协议拒绝。它是当前 CN 广告旧协议控制,不是假称运行旧二进制。

    原始复现命令(normal 删除 -race):

    .agents/skills/mo-dev/scripts/mo-cgo-test -race -p 1 -count=1 -v -timeout 3m \
      -overlay /workspace/work/pr-audit-continue18/capability-overlay.json \
      -run '^(TestCapabilityProbeMustRetainFailureCause|TestIndexSearchScanPlacementRequiresProtocol)$' ./pkg/sql/compile

    原始日志与真实退出码:logs/main-original30408{,-race}.log/.exit、main-probes.log、main-race.log 和 main-additional.log,位于 /workspace/work/pr-audit-continue18。

    范围限制:未复跑原 Wiki 10M TKE 部署,未证明其 11 个失败的底层可用性触发原因已消失;本 issue 正文已明确将该触发原因排除在诊断分类缺陷之外。原始 mapping 复现是 query-client fault injection,不是实际等待五秒的超时注入。本轮未宣称这些限制已验证。4.2-dev 35273bcd6a5cfa9468bcf7ca4031fe17560b5ab1 没有该 vectorscan/compileIndexSearchScan/remoteWorkersSupportProtocol 路径;不将 main 的结果外推为 4.2 修复。

  3. Ariznawlll commented on Oct 18, 2026

    @Ariznawlll
    Collaborator

    测试版本

    • 分支:官方 main,完整 commit 4226537e5094995155eab9c2a883db649ff7b95b(已含修复 PR #30516)。
    • 环境:隔离 macOS/arm64 本地工作树,Go 1.27.1、CPU/CGo;生产源码未修改。测试日期:2026-10-18。

    原问题验证

    针对正文限定的「capability probe 失败却丢失原错误、误报旧 MORPC 协议」执行修复后的真实 pkg/sql/compile 测试。注入 GetProtocolVersion 的 context.DeadlineExceeded,同时保持父 statement context 有效:3/3 均保留原错误链(errors.Is 成立),不再返回 ErrNotSupported;IndexSearchScan 仍拒绝分发并返回空 scopes。未将此结果解释为原 Wiki 10M 夜间任务中 11 次查询失败的底层可用性原因已消失。

    Happy Path 覆盖

    1. 正常 capability probe、所需版本的远端节点、可选表达式的安全本地回退及响应释放:相关定向 race 测试 3/3 通过。
    2. 独立双 CN 集成 fixture 中,正常协议/SQL 控制与真实节点声明旧协议的拒绝控制 -count=3 通过;后者不是运行旧版二进制。

    Unhappy Path 覆盖

    1. probe transport/deadline 错误、父 context 取消、discovery/缺失响应:错误原因或取消优先级保持,不能伪装为已确认旧协议;相关 race 测试 3/3 通过。
    2. 确认旧协议的 peer 仍 fail-closed;未取消协议保护,也未向未验证节点分发。

    白盒验证

    • go test -race -count=3 -run '^(TestIndexSearchScanPlacementRequiresProtocol|TestExpressionProtocolFailedResponsesAreReleased|TestExpressionProtocolDiscoveryFailure|TestRemoteExpressionPlacementProbeFailure|TestVectorScanPartitionTransportAndRollback)$' -timeout=12m ./pkg/sql/compile:通过。
    • go test -count=3 -run '^TestIndexSearchScanRefusesOlderCN$' -timeout=12m ./pkg/tests/sqlintegration/multicn:通过。
    • go test -race -count=1 -timeout=20m ./pkg/sql/compile:整个 package 通过。

    回归测试

    PR #30516 已把 capability-probe 错误分类和旧协议控制纳入 MatrixOne Go UT/双 CN 集成测试。此处依赖内部 query-client 故障注入,不是稳定可由外部 SQL 触发的场景,故未向 MOTR 强塞假定性的成功用例;原 Wiki 10M 分布式规模/真实探测失败原因仍未复跑、未判定。

    测试证据

    • PR #30516;Linux UT 与 双 CN BVT 成功。
    • TKE 镜像构建 在拉取 Docker Hub 基础镜像时网络超时,后续 TKE 测试被跳过;它不是产品测试失败,也不能算作 TKE 通过。未擅自重跑共享 CI。

    测试结论

    测试通过。

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

Metadata

Metadata

Assignees

Labels

kind/bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions