Description
Is there an existing issue for the same bug?
- I have checked the existing issues, including closed issues.
Open #33478 covers similar FK/IGNORE sibling loss for UPDATE/DELETE, and #30345 covered LOAD DATA IGNORE. Neither covers this INSERT IGNORE ... ON DUPLICATE KEY UPDATE action-stream path. #28254 is limited to missing warnings for rows already skipped correctly and does not cover this statement abort.
Branch Name
main
Commit ID
Other Environment Information
- Test date: 2026-11-30
- Deployment: local standalone
mo-service, 1 CN / 1 TN / 1 LogService, MySQL text protocol - Runtime identity checked with
git_version()='98b20975'andSELECT 42 - Comparator: MySQL 8.0.46, InnoDB
Description
When one INSERT IGNORE ... ON DUPLICATE KEY UPDATE batch contains both an FK-invalid duplicate UPDATE and a valid new sibling INSERT, MatrixOne raises error 1452 and rolls back the valid sibling operation.
MySQL instead downgrades the FK violation to warning 1452, skips only the invalid duplicate UPDATE, and commits the valid sibling INSERT.
Steps to Reproduce
CREATE TABLE fp(id INT PRIMARY KEY);
CREATE TABLE fc(
id INT PRIMARY KEY,
pid INT,
v VARCHAR(20),
CONSTRAINT fc_pid FOREIGN KEY(pid) REFERENCES fp(id)
);
INSERT INTO fp VALUES(1);
INSERT INTO fc VALUES(1,1,'old');
INSERT IGNORE INTO fc VALUES(1,999,'bad'),(2,1,'ok')
ON DUPLICATE KEY UPDATE pid=VALUES(pid),v=VALUES(v);
SHOW WARNINGS;
SELECT * FROM fc ORDER BY id;The conflict is on the existing PRIMARY KEY id=1; the UPDATE list modifies only pid and v, not a PRIMARY KEY or UNIQUE KEY. This is therefore distinct from the documented restriction on ODKU assignments to PK/UK columns and from UK-only conflict arbitration.
Actual Behavior
| Observable | MatrixOne | MySQL 8.0.46 |
|---|---|---|
| Statement result | Error 1452 | Success |
| FK diagnostic | Error 1452 | Warning 1452 |
| Fresh-connection rows | (1,1,'old') only |
(1,1,'old'),(2,1,'ok') |
MatrixOne discards the valid (2,1,'ok') sibling INSERT along with the invalid duplicate UPDATE.
Expected Behavior
Under IGNORE, the FK-invalid duplicate UPDATE should be skipped with warning 1452. The existing (1,1,'old') row should remain unchanged, and the valid sibling (2,1,'ok') should be inserted successfully.
Stability and Controls
- Reproduced in two independent MatrixOne databases and two independent MySQL databases.
- Readbacks used fresh connections before any positive control could alter the target rows.
- Pure
INSERT IGNOREwithout ODKU correctly skips the orphan row and inserts the valid sibling on both engines. - Fully valid ODKU FK updates and inserts succeed on both engines.
- A subsequent valid positive-control ODKU statement succeeds on MatrixOne, confirming that the target failure is specific to the invalid action rather than a broken session.
- Post-probe
SELECT 42succeeds; there is no panic, protocol failure, or availability failure.
Likely Mechanism from Read-only Source Inspection
- ODKU constructs typed FK assertions over its action stream and final merged image:
bind_insert.go,bind_insert.go. - The typed
fk_no_referenced_rowassertion returnsNewErrFKNoReferencedRow2directly. Unlike_check_constraint_assert, it has no statement-IGNORE warning/false-result branch:list_builtIn.go. - Filter execution propagates that error, aborting the statement rather than dropping only the offending action:
filter.go.
The dynamic result and this source path agree. Regression coverage should check both the skipped invalid UPDATE and preservation of the valid sibling INSERT.
Activity
fix(sql): preserve accepted INSERT IGNORE rows across constraint fail…
XuPeng-SH commentedon Nov 30, 2026
转测前验证:#33528 已合入
main@1dfcb9cf2e10ac9676411658f3eb8bc7。确认最终 merge 与实际受测的b5946447Git tree 均为5d96125429ffb9e3e21482d905ed5c19e48af836;多 CN Proxy BVT 日志 确认使用该 revision 的共享 mo-service,实际运行insert_ignore_constraint_actions.sql86/86,无跳过。x86 UT 和两项 BVT 已通过;Required 仍因独立的 JED Coverage setup 超时 #33533 为红。未在本轮重跑旧版本,不作生产验收结论。原场景回归:FK 无效的重复更新发出 1452,拒绝动作不污染上一版已接受行,合法的同批插入保留;普通非 IGNORE 路径仍严格报错并回滚同批兄弟行。交接建议:QA 复核原 issue 的两个输入行与提交后的新连接读回。
Ariznawlll commentedon Dec 1, 2026
已在当前官方 main
ba6081a1eaf7210acefd7181da5bfc07db10e8bc完成原场景验收并关闭。git_version()与精确源码 SHA 一致;binary SHA-256:a856cb87a5b5af72d1b4aa9536a13919e8b46c819adc5f25688d9742f98a0848。(1,1,'old')不变,合法兄弟(2,1,'ok')提交;新连接完整行集严格匹配。SELECT 42和新连接健康检查通过。dcb9259f9e7b8d0fe482c784a07fb524a9a0c540,本地 offline 967/967 PASS;未叠加旧 PR374/353。新 PR 的远端检查刚启动,不提前冒称全绿。证据:
qa-33521-constraints/main-ba608/。