MDEV-28237 Assertion `0' failed in row_upd_sec_index_entry on DELETE

- InnoDB bulk insert operation fails to rollback when it detect
DB_DUPLICATE_KEY error. It leads to orphaned records in primary
indexes. Consecutive update/delete operation assumes that record
should exist in secondary index and it leads to failure.
parent b678f881
......@@ -260,3 +260,11 @@ SPATIAL INDEX(f2))ENGINE=InnoDB;
INSERT INTO t1(f1) VALUES(0), (1), (2);
ERROR 23000: Duplicate entry '1' for key 'f1'
DROP TABLE t1;
#
# MDEV-28237 Assertion `0' failed in row_upd_sec_index_entry on DELETE
#
CREATE TABLE t1 (c0 YEAR UNIQUE) ENGINE=InnoDB;
INSERT INTO t1 VALUES (0),(0),(0),(0),(0),(0),(0);
ERROR HY000: Got error 1 "Operation not permitted" during COMMIT
DELETE FROM t1;
DROP TABLE t1;
......@@ -272,3 +272,12 @@ SPATIAL INDEX(f2))ENGINE=InnoDB;
--error ER_DUP_ENTRY
INSERT INTO t1(f1) VALUES(0), (1), (2);
DROP TABLE t1;
--echo #
--echo # MDEV-28237 Assertion `0' failed in row_upd_sec_index_entry on DELETE
--echo #
CREATE TABLE t1 (c0 YEAR UNIQUE) ENGINE=InnoDB;
--error ER_ERROR_DURING_COMMIT
INSERT INTO t1 VALUES (0),(0),(0),(0),(0),(0),(0);
DELETE FROM t1;
DROP TABLE t1;
......@@ -17000,6 +17000,10 @@ innobase_xa_prepare(
SQL statement */
trx_mark_sql_stat_end(trx);
if (UNIV_UNLIKELY(trx->error_state != DB_SUCCESS)) {
trx_rollback_for_mysql(trx);
return 1;
}
}
if (thd_sql_command(thd) != SQLCOM_XA_PREPARE
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment