Repository navigation
Description
Description
在 main TKE nightly 的 HNSW + IVF benchmark 中,HNSW SIFT128 测试本身成功完成;紧接着 IVF SIFT128 初始化复用同一张表并执行 DROP TABLE IF EXISTS ann.items_sift 时,MatrixOne 在注销 HNSW ISCP 任务、更新 mo_catalog.mo_iscp_log 的过程中返回内部错误:
internal error: transfer rowids failed, length mismatch, expect 2, got 1
该错误具有时序性,发生在 HNSW 后台 ISCP 生命周期清理与前台 DROP TABLE 重叠的路径中。
Environment
- Branch:
main - Commit:
9a5dd0c6e32a62e4393c2e7fbcab57b53f0c58c0 - Deployment: TKE distributed cluster
- Namespace:
mo-main-commit-9a5dd0c6e3-20260910 - CN pod:
nightly-regression-dis-tp-cn-bcn4v - Test date: 2026-09-11
Steps to reproduce
-
在分布式 TKE 集群中导入 SIFT128 1M 数据集到
ann.items_sift。 -
创建并执行 HNSW L2 benchmark,使 HNSW/ISCP 后台维护任务
index_hnsw_sift处于已注册并工作过的状态。 -
HNSW benchmark 结束后,不增加固定 sleep,立即启动复用同名表的 IVF SIFT128 case。
-
IVF 初始化执行:
DROP TABLE IF EXISTS ann.items_sift;
-
观察 DROP TABLE 返回内部 RowID transfer 错误。
完整复现入口:
Actual behavior
HNSW benchmark 已成功:
- HNSW index create cost: 68,451.39 ms
- QPS/TPS: 16,943
- Recall: 92.50%
- Successful queries: 4,870,962
- Query errors: 0
随后 DROP TABLE 触发以下服务端错误链:
2026-09-11T02:47:15.782708Z
UPDATE mo_catalog.mo_iscp_log
SET drop_at = now()
WHERE account_id = 0
AND table_id = 273139
AND job_name = 'index_hnsw_sift'
AND job_id = 1
error: txn need retry in rc mode
2026-09-11T02:47:16.792108Z
iscp get task runner timeout
2026-09-11T02:47:18.339537Z
transfer rowids failed, length mismatch, expect 2, got 1
对应 TRANSFER-ROWIDS-ERROR-LEN-MISMATCH 记录:
table-name: mo_iscp_log
table-id: 272467
intents: 2
actual: 1
前台语句最终失败:
DROP TABLE IF EXISTS ann.items_sift
internal error: transfer rowids failed, length mismatch, expect 2, got 1
Expected behavior
DROP TABLE IF EXISTS 应与 HNSW/ISCP 后台任务的注销和 drain 正确协调:
- DROP TABLE 成功完成;或
- 对内部可重试事务冲突进行透明、有限的重试。
不应将 mo_iscp_log 的 tombstone/RowID 转移内部错误返回给客户端,也不应依赖测试侧固定 sleep 才能正确删除表。
Stability and controls
- Failure occurrence: 本次 nightly 复现 1 次;从相邻成功 nightly 可见该问题具有调度/时序相关性,尚无确定性最小复现。
- Control 1: 同一 job 中 HNSW 建索引和 5 分钟查询完整成功,排除 HNSW 查询、数据集下载和数据导入失败。
- Control 2: 失败后后续 IVF cosine/normalize case 均成功,排除集群整体不可用。
- Control 3: 2026-09-10 的同名 HNSW + IVF benchmark job 成功完成:
https://github.com/matrixorigin/mo-nightly-regression/actions/runs/34368139564/job/102728417241 - No fixed sleep was used. The immediate DROP is intentional to expose lifecycle coordination defects.
Evidence
- Failing Actions job:
https://github.com/matrixorigin/mo-nightly-regression/actions/runs/34493586679/job/103126876200 - Focused Loki window: 2026-09-11 02:44:48–02:49:48 UTC
- Error event: 2026-09-11 02:47:18 UTC
- Error pod:
nightly-regression-dis-tp-cn-bcn4v
Code analysis
服务端日志显示,DROP TABLE 正在注销 index_hnsw_sift:
iscp/watermark_updater.go使用外层 DDL transaction 更新mo_catalog.mo_iscp_log.drop_at,首先遇到txn need retry in rc mode。- ISCP task runner 查询和 rollback fence cleanup 随后超时。
- transaction unwind 期间,
disttae/transfer.go对mo_iscp_log进行 tombstone transfer,两个 transfer intents 只得到一个 target RowID,触发 length mismatch。
因此目前的根因方向是:DROP TABLE 与 HNSW ISCP unregister/drain 的异常回滚路径没有正确协调,导致系统表 tombstone transfer 的 RowID 基数不一致。具体是 retry 处理、drain 顺序还是 rollback cleanup 丢失 RowID,需要在修复时进一步确认。
Regression coverage
修复后建议加入无需固定 sleep 的重复回归:创建 HNSW 索引、产生 ISCP 更新,然后立即 DROP TABLE;连续执行并验证:
- DROP TABLE 不返回内部错误;
- 同名表可重新创建;
mo_iscp_log不残留活动任务;- 无死锁、hang、panic 或 RowID transfer mismatch。
适合放在多客户端/后台任务时序覆盖的 MOTR 场景中,并为 ISCP rollback/unregister 增加定向 UT。
Related
- [Bug]: DROP HNSW INDEX can deadlock with an in-flight ISCP update #25711: DROP HNSW INDEX 与 in-flight ISCP update 死锁,已由 Fix ISCP index consumer cancellation during DROP INDEX #25733 修复;本次是 DROP TABLE 的
mo_iscp_logRowID transfer 异常,错误路径不同。 - [Bug]: Secondary-index tombstone transfer can miss rowids after concurrent merge #27878: 普通二级索引在 concurrent merge 下 tombstone transfer 缺失 RowID,修复提交
b870113dab4d340b42ea0b489aae3430b49be6e1已包含在本次测试 commit 中;本次触发表和生命周期路径不同。 - [Bug]:drop pitr report internal error: transfer rowids failed, length mismatch, expect 1, got 3 #21198: 历史 DROP PITR 的相似 RowID transfer mismatch,已关闭;本次发生在 HNSW/ISCP 清理路径。
Activity
aptend commentedon Sep 11, 2026
Root-cause investigation is complete. The failure is caused by retry ownership in ISCP metadata helpers, not by RowID transfer itself.
Evidence from the failing run
Failing run: mo-nightly-regression 34493586679 / job 103126876200, MatrixOne commit
9a5dd0c6e32a62e4393c2e7fbcab57b53f0c58c0, namespacemo-main-commit-9a5dd0c6e3-20260910.Relevant UTC timeline:
02:47:15.239: the DROP transaction starts.02:47:15.354: another CN commits the ISCP watermark update from LSN 31 to 32;AffectedRows=1.02:47:15.777: the DROP transaction reads one matchingmo_iscp_logrow.02:47:15.782: its firstUPDATE mo_catalog.mo_iscp_log SET drop_at=now()returnstxn need retry in rc mode.02:47:16.788:UnregisterJobretries only its internal operation in the same caller transaction/workspace. The retry succeeds withAffectedRows=2, which is impossible in committed state because the predicate identifies the full(account_id, table_id, job_name, job_id)primary key.02:47:17.637–02:47:17.827: TN flushesmo_iscp_log; the source object has 6 rows and 5 deletes, leaving one target row.02:47:18.339: commit-time RowID transfer sees two source intents but only one target row and correctly reportstransfer rowids length not match, expect 2, got 1.A successful control run, 34368139564 / job 102728417241, completed its watermark update before DROP. Its
drop_atUPDATE affected one row, performed no local retry, and had no transfer mismatch.Root cause
ExecWithResultexecutes ISCP sub-SQL withWithDisableIncrStatement().WithTxn(txn). These operations are part of the caller-owned SQL statement: they do not open an independent statement boundary, internal compile retry is disabled, and the internal executor does not roll back an existing caller transaction.However,
RegisterJob,UnregisterJobsByDBName,UnregisterJob,RenameSrcTable, andUpdateJobSpecwrapped their work in the generic ISCPretryhelper. When a mutating sub-SQL returnedErrTxnNeedRetry, the failed attempt remained in the caller workspace. Retrying only the helper reused that dirty workspace and added a second intent for the same logical primary-key row. The later strict transfer cardinality check exposed the duplicate intent.The correct retry unit is the outer caller-owned SQL statement. A retryable child error must escape immediately so
Compile.Runcan executeRollbackLastStatement, advance the statement generation, and replay the complete DDL.The messages containing
iscp get task runner timeoutandrollback fence cleanup timeoutare not actual elapsed timeouts in this trace. They are timeout causes constructed when the contexts are created; subsequent operations completed successfully.HNSW is an exposure path rather than the correctness root cause. Frequent ISCP watermark updates make this RC conflict easier to hit. Relaxing or deduplicating the RowID transfer check would hide corrupted transaction state and is not the right fix.
Fix
PR #28693 removes local retry from the five caller-transaction ISCP metadata entry points while preserving the generic retry mechanism for self-owned background operations. A focused deterministic regression verifies that
UnregisterJobreturns the first retryable UPDATE error without issuing a fourth SQL execution; the existing register/unregister engine integration test also passes.fix(iscp): delegate caller transaction retries (#28693)
Ariznawlll commentedon Sep 14, 2026
测试版本
main7eb9e0a4cbf20ed9a8e696fc0c0fa2f2795c73d9。a68a200c0bfb0c18f1b7f49d26b20b8d0d9b017f。main:07fdd4ae0f80f287b93fc4b525fd296d5617abc7,包含 fix(iscp): delegate caller transaction retries #28693。ann.items_sift执行 IVF L2、cosine、normalize 初始化。原问题验证
故障版本
9a5dd0c6e32a62e4393c2e7fbcab57b53f0c58c0中,DROP TABLE 与 HNSW ISCP unregister/watermark 更新发生 RC retry 冲突时,ISCP metadata helper 在 caller-owned DDL transaction 内局部重试。第一次失败的写入仍留在 caller workspace,第二次写入又为同一逻辑主键增加 transfer intent;最终 commit 的 RowID transfer 严格校验发现expect 2, got 1,并将内部错误返回给DROP TABLE。原始失败证据:run 34493586679 / job 103126876200。
修复说明
#28693 移除了
RegisterJob、UnregisterJobsByDBName、UnregisterJob、RenameSrcTable、UpdateJobSpec等 caller-transaction ISCP metadata 入口的局部 retry。可重试子错误现在直接交给外层 SQL compiler,由外层执行 statement rollback 和完整 replay;自拥有 transaction 的后台任务仍保留原有 retry 机制。该修复避免在同一 caller workspace 内留下重复的
mo_iscp_logtransfer intent,而没有放宽 RowID transfer 的基数校验。修复后验证
修复后的原始 HNSW→IVF 连续生命周期路径已在 TKE main nightly 执行:
success。4,987,236successful queries、0query errors、QPS16,786、Recall92.23%。DROP TABLE IF EXISTS ann.items_sift成功执行。DROP TABLE IF EXISTS ann.items_sift也均成功。DROP TABLE IF EXISTS ann.items_sift,均未返回异常;IVF L2、cosine、normalize 的索引创建均成功。transfer rowids failed、length mismatch、txn need retry in rc mode、iscp get task runner timeout均为 0 次。回归测试
#28693 增加
TestUnregisterJobPropagatesRetryableErrorWithoutLocalRetry,验证UnregisterJob遇到 retryable UPDATE 错误后只执行第一次尝试并向外层传播;既有TestISCPRegisterUnregisterIdempotence同时通过。PR 的 CI Required、TKE BVT、分布式 multi-CN BVT、UT、TPCH/SSB、Sysbench、TPCC 与覆盖率检查均通过。测试证据
测试结论
测试通过。
fix(iscp): delegate caller transaction retries (matrixorigin#28693)
fix(iscp): delegate caller transaction retries (matrixorigin#28693)
fix(iscp): delegate caller transaction retries (matrixorigin#28693)