[Bug]: RENAME during pending ASYNC IVFFLAT initialization leaves a permanently empty index
Maintainers usually reply within 1 day
@cpegeric is already working on this.
Since Nov 26, 2026.
Assessment
This issue has not been assessed yet.
Description
Description
Tested on MatrixOne main commit c0cef5c9cce2164fedd201c188bfffe4d2d09a96 (git_version() = c0cef5c), using autocommit and experimental_ivf_index=1. Both the RENAME TABLE and RENAME COLUMN variants were rerun on this commit.
Creating an ASYNC IVFFLAT index and immediately renaming either its source table or its indexed vector column leaves initialization permanently stuck. The visible index remains running with no error, its watermark remains 0-0, its entries table stays empty, and indexed ANN queries return false-empty results while an exact mode=force scan returns the correct rows.
This is specific to pending IVFFLAT initialization. A no-rename IVFFLAT control builds successfully, and renaming after initialization also works.
Minimal reproduction: RENAME TABLE
The following script uses only autocommit DDL; no transactional-DDL behavior is required. It includes a no-rename control and queries the hidden entries table through mo_catalog.mo_indexes.
Runnable Python reproducer (requires `pymysql`)
import time
import pymysql
conn = pymysql.connect(host='127.0.0.1', port=6001,
user='root', password='111', autocommit=True)
DB = 'qa_ivf_async_rename_auto'
def fetch(cur, sql, params=None):
cur.execute(sql, params)
return cur.fetchall() if cur.description else ()
def hidden_table(cur, table, kind):
return fetch(cur, """
SELECT index_table_name
FROM mo_catalog.mo_indexes
WHERE algo='ivfflat' AND algo_table_type=%s
AND table_id IN (
SELECT rel_id FROM mo_catalog.mo_tables
WHERE reldatabase=%s AND relname=%s)
LIMIT 1
""", (kind, DB, table))[0][0]
def status(cur, table):
return fetch(cur, f'SHOW INDEX STATUS FROM {table}')
def wait_built(cur, table, timeout=45):
entries = hidden_table(cur, table, 'entries')
deadline = time.time() + timeout
last = None
while time.time() < deadline:
try:
last = fetch(cur, f'SELECT COUNT(*) FROM {DB}.`{entries}`')[0][0]
if last > 0:
return last, status(cur, table)
except Exception as e:
last = str(e).splitlines()[0]
time.sleep(0.25)
return last, status(cur, table)
with conn.cursor() as cur:
cur.execute('SET experimental_ivf_index=1')
cur.execute(f'DROP DATABASE IF EXISTS {DB}')
cur.execute(f'CREATE DATABASE {DB}')
cur.execute(f'USE {DB}')
cur.execute('CREATE TABLE control_t(id INT PRIMARY KEY,v VECF32(2))')
cur.execute("INSERT INTO control_t VALUES(1,'[1,2]')")
cur.execute("CREATE INDEX ivf USING ivfflat ON control_t(v) "
"LISTS=1 OP_TYPE 'vector_l2_ops' ASYNC")
print('control-build', wait_built(cur, 'control_t'))
cur.execute('CREATE TABLE t(id INT PRIMARY KEY,v VECF32(2))')
cur.execute("INSERT INTO t VALUES(1,'[1,2]')")
cur.execute("CREATE INDEX ivf USING ivfflat ON t(v) "
"LISTS=1 OP_TYPE 'vector_l2_ops' ASYNC")
cur.execute('RENAME TABLE t TO t_new')
print('rename-initial-status', status(cur, 't_new'))
print('rename-build', wait_built(cur, 't_new', timeout=30))
cur.execute("INSERT INTO t_new VALUES(2,'[2,3]')")
time.sleep(2)
print('rename-final-status', status(cur, 't_new'))
print('iscp-log', fetch(cur, """
SELECT job_state,watermark,job_status
FROM mo_catalog.mo_iscp_log
WHERE table_id IN (
SELECT rel_id FROM mo_catalog.mo_tables
WHERE reldatabase=%s AND relname='t_new')
AND drop_at IS NULL
""", (DB,)))
for mode in ('post', 'force'):
print(mode, fetch(cur,
"SELECT id FROM t_new ORDER BY l2_distance(v,'[2,3]') "
f"LIMIT 2 BY RANK WITH OPTION 'mode={mode}'"))
Observed output, abbreviated to the relevant fields:
control-build: entries=1
rename-build: entries=0 after 30 seconds
rename-final-status: running, Error_message=NULL
iscp watermark: 0-0, job_status.ErrorMsg=''
mode=post: ()
mode=force: (2),(1)
The service log repeatedly retries ivf_create and reports:
invalid input: index maintenance config does not match its owner
Thus the empty index is not a normal build delay.
RENAME COLUMN variant
The same failure occurs when the indexed vector column is renamed while initialization is pending:
SET experimental_ivf_index=1;
CREATE DATABASE qa_ivf_async_rename_col;
USE qa_ivf_async_rename_col;
CREATE TABLE t(id INT PRIMARY KEY, v VECF32(2));
INSERT INTO t VALUES(1,'[1,2]'),(2,'[3,4]');
CREATE INDEX ivf USING IVFFLAT ON t(v)
LISTS=1 OP_TYPE 'vector_l2_ops' ASYNC;
-- Execute immediately, before the asynchronous build completes.
ALTER TABLE t RENAME COLUMN v TO v2;
INSERT INTO t VALUES(3,'[5,6]');
-- After waiting 30 seconds:
-- entries=0, watermark=0-0, STATUS=running, Error_message=NULL
SELECT id FROM t ORDER BY l2_distance(v2,'[5,6]')
LIMIT 3 BY RANK WITH OPTION 'mode=post';
-- actual: empty
SELECT id FROM t ORDER BY l2_distance(v2,'[5,6]')
LIMIT 3 BY RANK WITH OPTION 'mode=force';
-- actual: 3,2,1
In this variant, the worker keeps generating sampling SQL for the removed column v and repeatedly reports column v does not exist.
Expected behavior
RENAME must atomically update all state needed by a pending index build. Initialization must finish against the renamed table/column and subsequent ANN queries must include the committed rows. If a rename cannot safely be supported during initialization, the DDL should fail explicitly; it must not succeed while leaving a healthy-looking index that returns false-empty results indefinitely.
Code analysis and controls
For ASYNC creation, pkg/vectorindex/ivfflat/plugin/compile/compile.go captures the original source table and vector key in the deferred ivf_create InitSQL.
RENAME TABLE:pkg/iscp/watermark_updater.goupdates the registered table/source fields but does not rewrite the source name embedded inInitSQL.pkg/vectorindex/maintenance_config.gothen rejects the stale source during owner validation.RENAME COLUMN: liveIndexDef.Partsis updated, but the deferredivf_createstill samples the oldKeyPart.
Controls used to isolate the pending-IVFFLAT path:
- No-rename ASYNC IVFFLAT builds successfully.
- RENAME TABLE/COLUMN after IVFFLAT initialization succeeds and later DML is indexed.
- Immediate RENAME with ASYNC HNSW succeeds.
- Immediate RENAME with classic FULLTEXT and FULLTEXT2 succeeds.
Duplicate check
Searched IVFFLAT ASYNC RENAME, RENAME COLUMN, stale InitSQL, and the two error strings. #30275 is HNSW COPY ALTER with duplicate-key CDC retries; #29042 concerns PRE membership on an already-built IVFFLAT index after physical copy. Neither covers stale deferred initialization caused by RENAME.
- Dominant language
- Go
- Stars
- 1.9k
- Forks
- 312
- Avg merge
- 22h 59m
- Merged PRs (30d)
- 736
Getting set up
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from matrixorigin/matrixone
-
kind/bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
matrixorigin/matrixone#33363 ·
Maintainers usually reply within 1 day
-
kind/bug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
matrixorigin/matrixone#33362 ·
Maintainers usually reply within 1 day
-
SLEEP rejects NULL and negative durations that MySQL acceptsPossibly taken @XuPeng-SH claimed this 7 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
matrixorigin/matrixone#32653 ·
Maintainers usually reply within 1 day
-
[Bug]: TestChangeWatchProxy loses its first tenant connection during PingContext in Ubuntu CIPossibly taken @XuPeng-SH claimed this today. Openkind/bug needs-triage
matrixorigin/matrixone#33371 · 1 assignee ·
Maintainers usually reply within 1 day
-
[Bug]: TestDaemonClaimSQLRoundTrip exhausts its shared deadline during the stale claim update in Ubuntu CIPossibly taken @XuPeng-SH claimed this today. Openkind/bug needs-triage
matrixorigin/matrixone#33370 · 1 assignee ·
Maintainers usually reply within 1 day
All issues in matrixorigin/matrixone
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
zalando/postgres-operator#3257 ·
Maintainers usually reply within 2 days
-
[inputs.internal] README lists go_version tag on internal_gather instead of internal_agentPossibly taken @cvas22 claimed this today. Open
Difficulty 1/5 Under an hour Newbie friendliness 90/100
influxdata/telegraf#20264 ·
Maintainers usually reply within 1 day
-
[Bug] Standalone migration breaks existing Ingress routes using the envoy-http Service port nameOpenaccepted bug wg/enterprise-environment
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
vllm-project/semantic-router#7483 · 1 comment ·
Maintainers usually reply within 1 day
-
needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
stacklok/toolhive-catalog#2076 ·
Maintainers usually reply within 1 day