Repository navigation
Description
Description
An out-of-range vector committed to a VECF32 table with an existing QUANTIZATION 'float16' HNSW index blocks that index's asynchronous maintenance. A later, fully representable vector remains absent from indexed Top-K results, while the base table and exact scan contain it. The query continues to select the HNSW index and silently returns incomplete rows.
Environment
- Branch:
main - Commit:
f847803802289b2b2d0df4f0a2f842c2804b823a - Deployment: isolated local one-CN MatrixOne cluster;
git_version()=f847803802; HNSW freshness interval set to 1 second for the probe.
Steps to reproduce
Run in a fresh database, with experimental_hnsw_index=1:
CREATE TABLE t(id BIGINT PRIMARY KEY, v VECF32(2));
INSERT INTO t VALUES (1,'[1,1]');
CREATE INDEX i USING HNSW ON t(v)
OP_TYPE 'vector_l2_ops' QUANTIZATION 'float16';
-- The base VECF32 column accepts this value, but float16 cannot represent it.
INSERT INTO t VALUES (2,'[100000,100000]');
INSERT INTO t VALUES (3,'[2,2]');
-- Wait 30 seconds (the test cluster's index freshness interval is 1 second).
SELECT id FROM t ORDER BY l2_distance(v,'[2,2]')
LIMIT 3 BY RANK WITH OPTION 'mode=pre';
SELECT id FROM t ORDER BY l2_distance(v,'[2,2]')
LIMIT 3 BY RANK WITH OPTION 'mode=force';
EXPLAIN SELECT id FROM t ORDER BY l2_distance(v,'[2,2]')
LIMIT 3 BY RANK WITH OPTION 'mode=pre';
SELECT id,v FROM t ORDER BY id;Actual behavior
- Both inserts commit. The base table contains
(1,[1,1]),(2,[100000,100000]),(3,[2,2]). - At 0, 5 and 30 seconds,
mode=prereturns only(1), whereas exactmode=forcereturns(3,1,2). EXPLAINincludesVector Index Scan on i. No error or fallback warns that the result is incomplete.
Expected behavior
An unsupported index-storage value must not silently strand subsequent valid changes. The write could be rejected atomically with an actionable error, or the index/query could explicitly fail or fall back until consistency is restored. At minimum, valid row id=3 must not remain invisible to an indexed query after the freshness window.
Stability and controls
- Reproducer: 3/3 fresh databases (
qoverflow_02,_03,_04), each observed through 30 seconds. An earlier exploratory run (_01) showed the same behavior through 10 seconds. - Control: an independent
VECF32table with the same float16 HNSW index, but only valid values[1,1]and[2,2], converged to(3,1)in all three full runs; its exact scan also returned(3,1). - Failure atomicity/data check: the abnormal vector and the later valid row both remain in the base table; the index omits both, and the later valid row does not recover within 30 seconds.
Evidence
- Exact SQL and observed rows above; local probe and full output:
/private/tmp/mo-explore-run-20261028/hnsw_sync_overflow.pyand the recordedqoverflow_02/_03/_04terminal runs. - The normal-control and failure paths were run against the same isolated server and commit.
Code analysis
pkg/vectorindex/hnsw/types.go converts to float16 in ToStorage and checkNarrowed returns an out-of-range error when a finite VECF32 element overflows. pkg/vectorindex/hnsw/model.go propagates that error from Add/AddWithoutIncr; pkg/vectorindex/hnsw/sync.go propagates an insert/update error from HnswSync.Update. This explains why a committed out-of-range row can prevent the async consumer from applying that change range. The exact retry/watermark policy needs owner confirmation; the persistent missing later row is directly observed.
Regression coverage
Add an HNSW CDC BVT with an indexed VECF32 column stored as float16, a committed out-of-range value, a subsequent valid value, indexed and exact Top-K, and an explicit post-error consistency/recovery assertion. Cover insert and update independently.
Related
- Feature and contract: [Feature Request]: HNSW quantization, narrow vector columns, exact prefiltered search, memory-sized models #31467 / feat(hnsw): quantization, narrow vector columns, exact prefilter, memory-sized models #31468 (new HNSW quantization support).
- The MySQL compatibility contract's
HNSW-001does not permit index-maintenance stalls: it explicitly warns that rejecting an async CDC vector can prevent the watermark from advancing. This report uses L2 + float16 storage overflow, not the documented cosine-query restriction.
Activity
feat(hnsw): ignore and record rows an index cannot store (matrixorigi…
feat(hnsw): ignore and record rows an index cannot store; SHOW INDEX …
XuPeng-SH commentedon Nov 2, 2026
QA 交接(转测,不代表验收通过)
修复已合入 main:PR #31596,merge SHA
da44e7ecce310f285fb867eb46a02981009ed99d。本 issue 的 HNSW 不可存储行导致异步维护停滞范围进入 QA;#31583 的其他索引交付仍是研发总项。证据:已核对 PR 修复范围、完整讨论和本 issue 全部评论。作者报告 HNSW ignored SQL、23/23 对抗 SQL、相关包及 race 验证;后续评审确认旧 BF16、COPY 策略、权限与无界内存问题已修复,统一 MAX_BAD_RECORDS 合同替代旧 CREATE/REINDEX 区分。这些是作者/远端证据,不是本轮本地实测。最新 PR head
1bfc0906b5361a0ff455f74f3fa21ed362a3acb2的 CI Required 为 failure,UT、SCA、共享构建和 coverage 有 cancelled,兼容测试 skipped;不沿用旧 head 的绿色结果作为当前全绿,也未据此确认新的功能反例。建议在包含上述 merge SHA 的版本复测:新建索引 MAX_BAD_RECORDS 默认 0 的显式 stopped/error 与 REINDEX 恢复;正额度下异常行被记录且后续合法行可见;insert/update/delete、BF16→F16、超限回滚、分区额度、SHOW 的租户/SELECT 权限,以及 restart/restore 和 spill 清理。旧索引没有 ignored 表,保持旧行为,需 DROP/CREATE 才进入新合同,REINDEX 不补表;这不是旧索引自动升级保证。最终 main、多 CN、升级兼容与现场数据本轮未测。
当前未见适用于新修复的已验证反例或未完成 HNSW 开发 follow-up,交 @Ariznawlll 独立验证,issue 保持开放。
Ariznawlll commentedon Nov 3, 2026
结论
测试通过。新合同下,允许忽略异常向量的 HNSW 索引可继续同步并检索后续合法记录;默认零额度会明确停止或拒绝构建。
关键证据
git_version()为官方main@d61a7206c16b30baa4efc525eb6067c4364035aa;重启检查使用同一二进制与数据目录。MAX_BAD_RECORDS 10后,写入超范围向量再写入合法向量;异常行出现在SHOW INDEX IGNORED,EXPLAIN确认使用 Vector Index Scan,索引结果包含后续合法行,精确扫描同时能看到所有基表行。更新异常/合法向量和删除异常行后,索引及 ignored 记录相应更新;核心场景重复 3 轮通过。State最终为stopped并包含超额原因;提高额度后 REINDEX 恢复,后续合法行可见。额外验证 BF16 到 FLOAT16 的超范围、超过允许额度时建索引拒绝且基表行保留、分区各自额度,以及无 SELECT 拒绝查看 / 授权后允许查看;这些边界各 3 轮通过。vector_hnsw_ignored.sql使用支持@wait_expect的新版 mo-tester 执行,150/150 条成功、无跳过,覆盖克隆、重建和租户权限等。停机重启同一隔离实例后,异常记录和基表数据仍在,新写入合法向量继续进入索引。7657aa8b的issue_31493_hnsw_ignored本地连续 3 轮通过;该 PR 当前提交的 4 项离线 CI 均通过。待解决点
旧版本已存在的索引没有 ignored 表,REINDEX 不会补建;需要 DROP/CREATE 才进入新合同。本次未执行旧版本到新版本的滚动升级,也未单独验证 spill 清理。