mariadb/mysql-test/suite/period/r
Sergei Golubchik 9703c90712 MDEV-37199 UNIQUE KEY USING HASH accepting duplicate records
Server-level UNIQUE constraints (namely, WITHOUT OVERLAPS and USING HASH)
only worked with InnoDB in REPEATABLE READ isolation mode, when the
constraint was checked first and then the row was inserted or updated.
Gap locks prevented race conditions when a concurrent connection
could've also checked the constraint and inserted/updated a row
at the same time.

In READ COMMITTED there are no gap locks. To avoid race conditions,
we now check the constraint *after* the row operation. This is
enabled by the HA_CHECK_UNIQUE_AFTER_WRITE table flag that InnoDB
sets in the READ COMMITTED transactions.

Checking the constraint after the row operation is more complex.
First, the constraint will see the current (inserted/updated) row,
and needs to skip it. Second, IGNORE operations become tricky,
as we need to revert the insert/update and continue statement execution.

write_row() (INSERT IGNORE) is reverted with delete_row(). Conveniently
it deletes the current row, that is, the last inserted row.

update_row(a,b) (UPDATE IGNORE) is reverted with a reversed update,
update_row(b,a). Conveniently, it updates the current row too.

Except in InnoDB when the PK is updated - in this case InnoDB internally
performs delete+insert, but does not move the cursor, so the "current"
row is the deleted one and the reverse update doesn't work.
This combination now throws an "unsupported" error and will
be fixed in MDEV-37233
2025-07-16 13:02:44 +02:00
..
alter.result Merge remote-tracking branch 'origin/10.4' into 10.5 2022-09-14 16:24:51 +04:00
create.result Merge 10.4 into 10.5 2022-11-30 13:10:52 +02:00
delete,myisam.rdiff Remove dates from all rdiff files 2025-01-05 16:40:11 +02:00
delete.result Merge 10.5 into 10.6 2022-12-05 18:04:23 +02:00
innodb_debug.result MDEV-37199 UNIQUE KEY USING HASH accepting duplicate records 2025-07-16 13:02:44 +02:00
long_unique.result cleanup: prepare "update_handler" for WITHOUT OVERLAPS 2020-03-31 17:42:34 +02:00
overlaps.result MDEV-25370 Update for portion changes autoincrement key in bi-temp table 2024-01-31 16:03:38 +01:00
update.result MDEV-22805 SIGSEGV in check_fields on UPDATE 2020-10-29 13:47:50 +03:00
versioning.result various test failures post-merge 2019-09-06 20:04:47 +02:00