mariadb/storage
Sergei Golubchik 564a792d72 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 logs 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-15 13:34:25 +02:00
..
archive Merge 10.5 into 10.6 2024-06-24 13:09:47 +03:00
blackhole MDEV-34348: my_hash_get_key fixes 2024-11-23 08:14:22 -07:00
columnstore ColumnStore 6.4.10-1 2025-01-29 10:44:18 +01:00
connect Fixed compiler warning from clang in connect/tabxcl.cpp 2025-06-02 14:02:53 +03:00
csv MDEV-34348: Miscellaneous fixes 2024-11-23 08:14:23 -07:00
example MDEV-36729: ha_example::show_func_example is incorrectly defined 2025-05-29 10:10:52 +10:00
federated Merge 10.5 into 10.6 2024-11-29 12:37:46 +02:00
federatedx MDEV-36341 UBSAN: FederatedX fill_server runtime error: applying non-zero offset to null pointer 2025-04-07 11:04:53 +02:00
heap Merge 10.5 into 10.6 2025-01-20 09:57:37 +02:00
innobase MDEV-37199 UNIQUE KEY USING HASH accepting duplicate records 2025-07-15 13:34:25 +02:00
maria Updated storage/maria/ma_test_big.sh to use aria_ instead of maria_ 2025-06-02 14:02:53 +03:00
mroonga MDEV-34388: Stack overflow on Alpine Linux (postfix) mroonga+asan 2025-05-28 17:07:53 +10:00
myisam Removed safemalloc warnings from myisamchk --version 2025-06-28 14:48:34 +03:00
myisammrg Remove dates from all rdiff files 2025-01-05 16:40:11 +02:00
oqgraph Merge 10.5 into 10.6 2024-11-29 12:37:46 +02:00
perfschema MDEV-34388: Stack overflow on Alpine Linux 2025-05-20 17:27:05 +03:00
rocksdb MDEV-34388: Stack overflow on Alpine Linux 2025-05-20 17:27:05 +03:00
sequence MDEV-33746 Supply missing override markings 2024-06-20 11:32:13 -04:00
sphinx Merge 10.5 into 10.6 2024-11-29 12:37:46 +02:00
spider MDEV-30436 [fixup] Add missing check for HAVE_PSI_INTERFACE 2025-07-14 15:45:28 +10:00
test_sql_discovery Merge 10.5 into 10.6 2024-06-24 13:09:47 +03:00