Repository navigation
Description
Environment
- MatrixOne commit:
01d60e1c4ded1b0f3fc1a4ecd75ce54e95e23b90 - Deployment: local shared-TN cluster with two CNs
- Scope: asynchronous IVFFLAT maintenance through ISCP
Problem
An asynchronous IVFFLAT index that combines affine narrow quantization
(int8 or uint8) with any INCLUDE column never populates its entries
table. The metadata and centroid tables complete, but the entries table stays
empty indefinitely, so all index-using modes return an empty result.
The same table and workload complete when either feature is removed. They also
complete with float16 or bf16 quantization plus INCLUDE.
Minimal reproduction
set experimental_ivf_index=1;
create database ivf_async_affine_include;
use ivf_async_affine_include;
create table t(
id bigint primary key,
cat int,
v vecf32(2)
);
insert into t
select result, result % 3,
cast(concat('[', result, ',0]') as vecf32(2))
from generate_series(1, 20) g;
create index ix using ivfflat on t(v)
lists=2
op_type 'vector_l2_ops'
quantization 'int8'
include(cat)
async;After waiting 30-40 seconds, the metadata table contains its version and
quantization rows and the centroid table contains two centroids, but:
select count(*) from <ix entries table>;
-- 0 (expected 20)The same result occurs with quantization 'uint8'.
Reproduction matrix
The matrix was run repeatedly with independent databases on the same cluster:
| Configuration | Entries after 30-40 s |
|---|---|
int8 + INCLUDE(int) |
0 / 20 |
int8 + INCLUDE(varchar) |
0 / 20 |
uint8 + INCLUDE(int) |
0 / 20 |
float16 + INCLUDE(int) |
20 / 20 |
bf16 + INCLUDE(int) |
20 / 20 |
int8 without INCLUDE |
100 / 100 |
| INCLUDE without quantization | 100 / 100 |
Three independent int8 + INCLUDE databases remained at 0 entries while the
controls reached their full row count in about 12-14 seconds.
For the empty uint8 + INCLUDE index, both CNs returned:
| mode | result for nearest 3 rows around [10,0] |
|---|---|
force |
9,10,11 |
pre |
empty |
post |
empty |
include |
empty |
auto |
empty |
A FORCE_SYNC reindex builds all entries synchronously, but later asynchronous
delete/insert maintenance still does not move: the deleted key remains and the
inserted key never appears.
Root cause
The ISCP IVFFLAT writer builds its source-column order as:
primary key, vector part(s), include column(s)
However, toIvfflatUpsert assumes the last source column is always the vector
and applies the int8/uint8 quantization expression to that last column. Once
an INCLUDE column is present, the last source column is an INCLUDE value. The
generated projection therefore quantizes the wrong value and the batch cannot
be written to the entries table.
Relevant code:
pkg/iscp/index_sqlwriter.go:639-647appends vector parts and then INCLUDE columns.pkg/iscp/index_sqlwriter.go:741-768quantizes and replacescnames[len(cnames)-1].- The vector used by
CENTROIDXis correctly referenced ascnames[1]at line 805, confirming the projection index should also refer to the vector position rather than the final column.
The synchronous full-build path is not affected because it constructs the
entry expression directly from the indexed vector column before appending
INCLUDE projections (pkg/vectorindex/ivfflat/plugin/compile/compile.go).
Expected behavior
Async int8/uint8 IVFFLAT indexes with INCLUDE columns should populate all
existing rows and maintain later inserts, updates, and deletes. The quantization
expression must be applied to the indexed vector source column while INCLUDE
columns retain their original values.
Regression coverage
Add ISCP writer and end-to-end cases for:
int8anduint8with one and multiple INCLUDE columns;- nullable and non-null INCLUDE values of different supported types;
- initial async replay and later insert/update/delete batches;
- generated SQL column order: PK, quantized vector, INCLUDE values;
float16/bf16controls to keep the non-affine path covered.
Activity
Ariznawlll commentedon Sep 17, 2026
补充确认该问题同样覆盖
vector_l2sq_ops,不是只影响默认的vector_l2_ops。在固定提交
01d60e1c4ded1b0f3fc1a4ecd75ce54e95e23b90上,用同一份 100 行数据并行创建三个独立索引:等待异步初始构建后,三个 entries 表均保持
0/100。同批控制组中:vector_l2sq_ops + int8,去掉INCLUDE:100/100;vector_l2sq_ops + float16 + INCLUDE(grp):100/100。vector_l2sq_ops与vector_l2_ops共用平方 L2 几何,且代码明确允许其使用 int8/uint8。这里仍由 ISCP writer 把cnames[len(cnames)-1](最后一个 INCLUDE 列)当成 vector 做 affine quantization,属于本 issue 的同一列序错误。修复和回归矩阵需要同时覆盖vector_l2_ops、vector_l2sq_ops,以及 int8/uint8 两种 affine quantization。fix async ivfflat include and generated column updates (#29698)
Ariznawlll commentedon Oct 13, 2026
测试版本
main;commit:175a645a85994f2c95992d3aa8d6dacb6d9e167f;2026-10-13。原问题验证
异步 IVFFLAT 对 int8/uint8 × vector_l2_ops/vector_l2sq_ops 四种 INCLUDE 组合,初始各 20/20 条;UPDATE/DELETE/INSERT 后 hidden entries 的 cat 值和条目数均正确。 对应定向用例在 MOTR 入口重复执行 3 次均通过(每次脚本内再执行 3 轮)。
Happy Path 覆盖
非 affine 的 float16 INCLUDE 对照与源表一致。
Unhappy Path 覆盖
原先 int8/uint8 affine 误把最后 INCLUDE 列当向量、导致 entries 为 0 的路径不再复现;删除的 id20 不残留。
白盒验证
除 SQL 返回值外,读取系统索引元数据与 hidden entries,并以源表作为独立判定基准。
回归测试
MOTR PR #234 中的 issue_29012_29013_29015_29016_29019_29053_ivf.py 已提交;离线 CI 通过,仍待正常 review/merge。该缺陷由确定性语义/类型/协议边界触发,不需要另加 big-data 或 chaos 才能验收。
测试证据
PR 验证记录及 CI 运行。
测试结论
测试通过。