Repository navigation
Description
Is there an existing issue for the same bug?
- I searched existing issues, including [Bug]: 使用索引拿到的数据不正确 #25460, [Bug]: protocol prepared UPDATE corrupts indexed readback for VARBINARY and BIGINT UNSIGNED #25437, and [Bug]: REPLACE / INSERT ... ON DUPLICATE KEY UPDATE report non-MySQL affected-rows #24907.
Branch Name
MatrixOne v4.1.2
Commit ID
ce99d32
Other Environment Information
- MySQL-compatible version string:
8.0.30-MatrixOne-v4.1.2 - The cluster was upgraded to this version on 2026-07-17.
- Table and column names below are simplified. No customer data or credentials are included.
Actual Behavior
A task table has approximately 1.07 million base rows and these relevant indexes:
CREATE TABLE task_queue (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
source_system VARCHAR(32) NOT NULL DEFAULT '',
status VARCHAR(16) NOT NULL DEFAULT 'PENDING',
retry_count INT NOT NULL DEFAULT 0,
worker_id VARCHAR(128) NOT NULL DEFAULT '',
KEY idx_status_id (status, id),
KEY idx_source (source_system, status)
);The base table and both hidden index tables have the same catalog creation time,
but their row counts are inconsistent:
base table: 1,069,515
idx_status_id hidden: 2,978
idx_source hidden: 1,069,515
As a result, indexed reads and forced base-table scans return radically different
results:
SELECT COUNT(*) FROM task_queue WHERE status = 'FAILED';
-- 5
SELECT COUNT(*) FROM task_queue WHERE HEX(status) = '4641494C4544';
-- 202,865More importantly, updating the indexed status column on an affected historical
row returns success but does not change the base row:
START TRANSACTION;
UPDATE task_queue
SET status = 'RUNNING'
WHERE id = 10001;
SELECT id, status FROM task_queue WHERE id = 10001;
-- 10001, FAILED
ROLLBACK;Updating a non-indexed column on the same row works:
START TRANSACTION;
UPDATE task_queue SET worker_id = 'probe' WHERE id = 10001;
SELECT id, worker_id FROM task_queue WHERE id = 10001;
-- 10001, probe
ROLLBACK;EXPLAIN UPDATE ... SET status=... WHERE id=10001 shows a Multi Update plan
that inner-joins the base row with both hidden secondary-index tables. Because the
idx_status_id entry is missing, the inner join removes the base row and the
statement becomes a silent no-op.
The plan for updating worker_id scans only the base table and succeeds.
Additional Evidence
The following controlled tests were performed in transactions or disposable
scratch tables:
- A fresh table with no secondary indexes updates correctly.
- A fresh table with
idx_status_idupdates correctly. - A fresh table with both secondary indexes updates correctly.
- A fresh row inserted into the affected production table updates correctly.
- A fresh 10,000-row
INSERT ... SELECTinto an equivalent scratch table creates
10,000 visible index rows and updates correctly. - Historical rows missing from
idx_status_idsilently fail to updatestatus. - Rewriting one of those rows through
INSERT ... ON DUPLICATE KEY UPDATE
recreates its hidden index entry; subsequent ordinary UPDATEs then work. - While processing historical rows with this UPSERT workaround, the hidden
idx_status_idrow count increased from 2,978 to 72,657, confirming that row
rewrites repopulate the missing index.
There is also an upgrade correlation:
- On 2026-07-16, before the reported upgrade, the same application code using
ordinary UPDATE successfully claimed and completed more than 13,000 tasks. - After the upgrade, affected historical rows return success without changing.
- Catalog metadata does not show the indexes being recreated during upgrade.
idx_sourceremains complete, so there is no evidence of blanket secondary-index loss.
The leading hypothesis is that idx_status_id was already incomplete and the
new UPDATE/Multi Update path now requires the missing hidden-index row. However,
direct index loss during upgrade has not been ruled out because no pre-upgrade
hidden-table row-count snapshot is available.
Expected Behavior
- Secondary-index hidden tables must remain consistent with the base table.
- UPDATE of an indexed column must update the base row and all indexes.
- If index corruption makes the update impossible, the statement must return an
error instead of reporting success while changing nothing. - Upgrade must not change a previously working UPDATE into a silent no-op.
Steps to Reproduce
The index-loss creation path has not yet been reproduced on a fresh table. The
silent UPDATE behavior is reproducible on the affected historical rows with:
SELECT COUNT(*) FROM task_queue WHERE status = 'FAILED';
SELECT COUNT(*) FROM task_queue WHERE HEX(status) = '4641494C4544';
START TRANSACTION;
UPDATE task_queue SET status = 'RUNNING' WHERE id = 10001;
SELECT id, status FROM task_queue WHERE id = 10001;
ROLLBACK;We have preserved the affected table/index state and can collect additional
object-level diagnostics before rebuilding the damaged index.
Related Issues
- [Bug]: 使用索引拿到的数据不正确 #25460: indexed reads return different results from full scans
- [Bug]: protocol prepared UPDATE corrupts indexed readback for VARBINARY and BIGINT UNSIGNED #25437: prepared UPDATE corrupts indexed readback
- [Bug]: REPLACE / INSERT ... ON DUPLICATE KEY UPDATE report non-MySQL affected-rows #24907: affected-row reporting differs from MySQL
Activity
lxw665 commentedon Jul 20, 2026
Additional resource-impact evidence from
system.statement_info:document_file_taskwithHEX(status)cumulatively reported about 4.02 billion rows read and 3.13 TB logical bytes scanned.HEX(status)bypasses the incomplete index, each claim performs a base-table scan. WhenUPDATE statussilently no-ops, the same tasks remain eligible and are selected again. The subsequentworker_id + HEX(status)read also scans the table.This creates a scan/no-op/re-scan amplification loop. It is a strong resource-pressure correlate and can contribute to CN CPU/memory exhaustion, although it does not by itself prove the root cause of every observed OOM.
lxw665 commentedon Jul 20, 2026
Additional cross-table audit: same corruption pattern on four queue tables
We audited all conventional secondary indexes in the affected account and performed transaction/rollback probes on the other queue tables. Table names are simplified below; no credentials or customer data are included.
All four tables have the same relevant shape:
They are application-owned state-machine queues that repeatedly transition PENDING -> RUNNING -> DONE/FAILED.
For the three additional queues, indexed predicates returned missing or nearly empty results while expressions that bypass the status index returned the base-table truth:
A transaction/rollback probe on one historical row from each additional table reproduced the silent no-op:
No SQL error was returned.
This is not blanket index loss:
The first two queue/index definitions existed in application DDL since 2026-05-21; the candidate queue definitions existed since 2026-07-08. All predate the 2026-07-17 cluster upgrade. Therefore this audit still does not prove that the upgrade originally removed the entries. It does show that the post-upgrade Multi Update behavior turns the pre-existing/inherited index inconsistency into silent UPDATE no-ops across multiple independent queues.
Operational impact:
We are preserving the affected index state before rebuilding and can provide additional catalog/plan/profile evidence if needed.
ck89119 commentedon Jul 21, 2026
index是在有问题的老版本上建的,update有问题且静默通过,新版本已经修复了该问题且重建了index,试运行没问题
lxw665 commentedon Jul 21, 2026
在新版本后 修复index 后 正常