Skip to content

IVF CREATE INDEX 第 3 个被 context canceled,导致后续 fulltext index 未创建,ANLI nqft/qft 99% 失败 #27261

Description

@Ariznawlll

问题描述

ANLI 测试的 数据准备阶段,连续创建 4 个 IVF index 时,第 3 个 CREATE INDEX 仅 3 秒就被 context canceled,导致 step 因 bash -e 退出,后续的 fulltext index 创建命令从未执行。最终 MATCH() AGAINST() 查询因没有 fulltext index 而报 20105,nqft/qft 99% 失败。

复现信息

根因:CREATE INDEX context canceled

时间线

23:25:50  "create vector index" step 开始
23:25:50  1st: CREATE INDEX ON ca_comprehensive_dataset     → ✅ 成功 (~66s)
23:26:56  2nd: CREATE INDEX ON ca_comprehensive_dataset_copy → ✅ 成功 (~66s)
23:28:02  3rd: CREATE INDEX ON ca_comprehensive_dataset_copy01 → ❌ 3s 后 context canceled
23:28:05  bash -e 退出 step
          → 4th IVF index 未执行
          → 4 条 fulltext index 创建命令全部未执行

执行的 SQL

SET experimental_ivf_index=1;
CREATE INDEX idx_vec_question USING ivfflat
  ON anli_test.ca_comprehensive_dataset_copy01(question_vector)
  lists = 256 op_type 'vector_l2_ops';
-- ERROR 1105 (HY000): context canceled

4 个表的 DDL 完全相同(仅表名不同),前两个正常完成,第 3 个仅 3 秒就被服务端 cancel。

为什么这是 bug

  1. 完全相同的 DDL 前两个成功、第 3 个 3 秒就被 cancel — 不是正常的超时行为
  2. context canceled 错误信息不明确 — 不是 timeout 也不是 OOM,说明 context 管理有异常
  3. 连续 DDL 不应互相干扰 — 3 张独立表的 CREATE INDEX 应该互不影响

连锁影响

3rd CREATE INDEX context canceled
  → bash -e 退出 "Test Data Preparation" step
    → "create fulltext index" 4 条命令从未执行
      → 表上没有 fulltext index
        → ANLI 测试 MATCH() AGAINST() 报 20105 not supported
          → nqft: 194,333/196,563 失败 (98.8%)
          → qft:  75,357/76,183 失败 (98.9%)
          → qvec: 0 失败 ✅ (IVF index 在失败的表上不存在,但 qvec 测试用了有 index 的表)

测试结果

查询类型 Total Success Failure 失败率
nqft 196,563 2,230 194,333 98.8%
qft 76,183 826 75,357 98.9%
qvec 90,647 90,647 0 0% ✅
IVF DML 32,046 searches - panics=0, errors=0 0% ✅

性能退化(附带)

qvec qpm 从 39,312 降到 18,109(-54%),超过 25% 阈值。

Activity

  1. added
    kind/bug
    severity/s0
    on Aug 18, 2026
  2. changed the title [-]Fulltext INDEX 不可用:MATCH() AGAINST() 报 20105 not supported,ANLI nqft/qft 99% 查询失败[/-] [+]IVF CREATE INDEX 第 3 个被 context canceled,导致后续 fulltext index 未创建,ANLI nqft/qft 99% 失败[/+] on Aug 18, 2026
  3. iamlinjunhong commented on Aug 18, 2026

    @iamlinjunhong
    Contributor

    193f22f18e36046529804092e29ac075ffecf539
    executor: add exact memory accounting for group, order, top, and fill (#27112)

    对应 PR:#27112
    判断依据:
    Issue 中使用的版本 ccb37f591 只修改了 Codex/Agent 文档和脚本,不涉及数据库运行时,因此它不是根因;它的作者 Eric Lam 也不是此次问题的责任作者。
    相同的 CREATE INDEX ... context canceled 在更早的 a3f8a30e nightly 中已经出现,排除了之后合入的 proxy balance、max_execution_time 等提交。
    第一次观察到失败的 good/bad 边界中,193f22f 是最可疑的运行时改动:它大范围修改了 executor 内存核算、CN 资源预算、远程执行资源释放等逻辑,而 IVF 建索引会先执行 count(vector_column),随后运行分布式 ivf_create,与这些改动直接交叉。
    失败具有间歇性:相邻版本出现过成功,后续又再次失败。客户端的 context canceled 也可能只是远端执行或资源准入失败的最终表现。

  4. added a commit that references this issue on Aug 21, 2026
    ec5382a
  5. Ariznawlll commented on Aug 22, 2026

    @Ariznawlll
    CollaboratorAuthor

    测试不通过。

    本次测试使用的 MatrixOne commit dae2725bef5c81dcb9b5d2fab9a48afe37e2c760 已包含 PR #27458 的修复。但在 Run 32556579446 的 IVF VECTOR INDEX TEST 中,第 4 条 IVF CREATE INDEX 仍在约 3.19 秒后报 ERROR 1105 (HY000): context canceled,导致后续 fulltext index 未创建,nqft/qft 仍约 99% 失败。

    现象与 #27261 一致,说明当前修复没有解决原测试场景。

  6. Ariznawlll commented on Aug 25, 2026

    @Ariznawlll
    CollaboratorAuthor

    测试不通过。

    本次 main nightly 使用的 MatrixOne commit b89a639b0c4ac30ae143cae3b67925678d347d3b 已包含 PR #27458,但 CREATE INDEX ... context canceled 仍在同一 Run 中复现两次。

    当前 Job 的失败时间线:

    1. ivf_sift128 和 ivf_sift128_cosine 两个 IVF 用例先执行成功;其中 cosine index 创建耗时约 14.03s。
    2. ivf_sift128_normalize_l2 于 04:07:33 UTC 启动,query、groundtruth 和 1M base 数据均下载成功。
    3. 建库、建表、设置 experimental_ivf_index/probe_limit 均成功;1M base 数据于 04:09:05 UTC 加载完成。
    4. 随后执行下面的第 3 个 IVF index,几乎立即返回 java.sql.SQLException: context canceled:
    CREATE INDEX ivf_500 USING ivfflat
    ON ann.items_sift (embedding)
    op_type 'vector_ip_ops'
    lists=500;

    同一 Run 的 IVF VECTOR INDEX TEST 更早也复现了原问题:前三个 IVF index 分别约 65s 创建成功,第 4 个只执行约 2.05s 就返回 ERROR 1105 (HY000): context canceled,后续 fulltext index 未创建。

    截图中的 SLF4J StaticLoggerBinder 仅为 Java 日志实现警告,不是失败原因;本次也不是 Recall/QPS 或 expected 结果比较失败,因为测试在 IVF index 创建阶段已经退出。

    结论:#27458 已包含在本次测试版本中,但修复尚未覆盖当前连续创建多个 IVF index 的失败场景,#27261 在修复后的 main commit 上仍然存在。客户端日志只能确认服务端返回了 context canceled;具体由哪条 CN cancellation 路径触发,仍需结合 04:09:05 UTC 附近的 CN 原始日志确认。

  7. assigned and unassigned on Aug 27, 2026
  8. Ariznawlll commented on Aug 30, 2026

    @Ariznawlll
    CollaboratorAuthor

    结论:本次失败与 #27261 是同一个问题,#27458 已经合入当前测试版本,但没有完全覆盖该 cancellation 场景。

    本次失败的不是 HNSW,而是 IVF Index Sift128 Vector 1M Cosine_distance Test。1,000,000 条数据加载完成后执行以下语句:

    CREATE INDEX ivf_500 USING ivfflat
    ON ann.items_sift (embedding)
    op_type 'vector_cosine_ops' lists=500;

    MatrixOne commit 为 46950ae0bd00e5a504445865abb6448f9dbefced。服务端日志显示,ivf_create 于 05:42:29.181764 UTC 开始执行 SELECT SAMPLE,约 230ms 后 CN 在 items_sift 的 LogReader 路径连续返回 context canceled,随后内部 ivf_create 和外层 CREATE INDEX 均以相同错误结束。

    失败前后没有 OOM、Pod 重启、panic 或 SQL timeout。相同 Job 中 HNSW、普通 IVF L2 和后续 Normalize IVF 均成功,因此不是 HNSW 性能门限、集群整体不可用、数据下载或测试 expected 问题,而是 MO 服务端 IVF 建索引内部上下文被异常取消。

    当前 commit 相对 #27458 的 merge commit a2d7e2cab6b61d8cff807dae295da80abebc2036 ahead 177 commits、behind 0,确认已经包含该修复。原问题多在连续创建第 3/4 个 IVF index 时触发,本次在 cosine 用例触发;触发顺序不同,但错误签名和 ivf_create -> SELECT SAMPLE -> LogReader 路径一致,说明修复仍有遗漏。

    失败证据:Run 33259334823 / Job 99211764575

    请 @aptend 继续检查 remote pipeline cancellation/context ownership,@cpegeric 协助检查 ivf_create 采样和 LogReader 生命周期。

    测试不通过。

  9. added and removed
    severity/s0
    on Sep 2, 2026
  10. assigned and unassigned on Sep 4, 2026
  11. LeftHandCold commented on Oct 18, 2026

    @LeftHandCold
    Collaborator

    2026-10-18: the IVF sampling-cancellation signature is observed on 4.2-dev

    This is a branch-specific recurrence report, not proof that the current main fix has regressed, nor proof of the same cancellation owner. Please reassess 4.2 coverage before deciding whether to reopen or split the issue.

    • Run 39043416481 / Vector job 117486996109, attempt 1.
    • Tested MO: ac27db31696c0394ab1b2787b7b0a8f4933f088f (4.2-dev).
    • Namespace: mo-42-family-39043416481-1; serving TP CN: nightly-regression-dis-tp-cn-snp4w.
    • Case: SIFT128 1M cosine, index creation, not recall/QPS comparison.

    After loading 1,000,000 rows, the client issues:

    CREATE INDEX ivf_500 USING ivfflat
    ON ann.items_sift (embedding)
    op_type 'vector_cosine_ops' lists=500;

    Server timeline, 2026-10-17 UTC (add 8 hours for Asia/Shanghai, i.e. October 18 04:02):

    20:02:23.591151  IVFFLAT START: pick sample
      SELECT SAMPLE(`embedding`, 10.000000 PERCENT)
      FROM `ann`.`items_sift`
      WHERE `embedding` IS NOT NULL LIMIT 25000
    20:02:23.849780–23.856832  LOGREADER-ERROR, items_sift, context canceled
    20:02:23.857499  internal SQL executor: sampling query -> context canceled
    20:02:23.857556  internal SQL executor: ivf_create(...) -> context canceled
    20:02:23.857888  outer CREATE INDEX: query trace status=fail, context canceled
    

    Sampling starts and fails within about 266 ms. All listed internal/outer error records with a transaction field bind to 92eecc1c5f13280318df5ac3548c8d63. Connector terminal Error/Abort warnings follow the cancellation; their text includes timeout=30s, but the timestamps do not show a 30-second wait. That warning must not be treated as the originating deadline.

    Controls and boundaries:

    • Same Job's HNSW, ordinary IVF L2, and following normalized IVF case completed. This is not a whole-Job dataset download failure or a comparison-threshold failure.
    • The serving TP CN did not restart/OOM in this incident. An AP CN OOM in this run occurred much later, at 05:38:28 Asia/Shanghai, and cannot explain the 04:02:23 cancellation.
    • The previous nightly cosine case passed; this is an intermittent observed success→failure, not a proven first-bad commit.
    • No new TKE test or case was launched for this investigation.

    I checked the deployed branch source rather than relying on cross-branch ancestry: RecordBuiltPipeline at ac27db3 already uses pipelineCancel := proc.Cancel, including the pre-registration cancellation handling introduced by #27458. Therefore “4.2 simply lacks that key fix” is not supported.

    The same cosine SQL and ivf_create -> SELECT SAMPLE -> LogReader failure chain were reported in the August 30 comment on this issue. This new evidence belongs here first to avoid creating another symptom-duplicate. What remains unproved is which cancellation source fired in this run; the original fix may cover one path but not this one, or another error may precede the propagated cancellation. No external cancel was identified in the captured narrow log window, which is not a proof that none occurred.

    For internal Loki review, use UTC 2026-10-17T20:02:15Z–20:02:35Z with:

    {namespace="mo-42-family-39043416481-1",pod="nightly-regression-dis-tp-cn-snp4w"}
    |~ "ivf_create|SELECT SAMPLE|LOGREADER-ERROR|context canceled"
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bugseverity/s-1

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions