mariadb/storage/innobase/mysql-test/storage_engine
Marko Mäkelä 7fbbbc983f MDEV-36330: SERIALIZABLE read inconsistency
At TRANSACTION ISOLATION LEVEL SERIALIZABLE, InnoDB would fail to flag
a write/read conflict, which would be a violation already at the more
relaxed REPEATABLE READ level when innodb_snapshot_isolation=ON.

Fix: Create a read view and start the transaction at the same time.
Thus, lock checks will be able to consult the correct read view
to flag ER_CHECKREAD if we are about to lock a record that was committed
after the start of our transaction.

innobase_start_trx_and_assign_read_view(): At any other isolation level
than READ UNCOMMITTED, do create a read view. This is needed for the
correct operation of START TRANSACTION WITH CONSISTENT SNAPSHOT.

ha_innobase::store_lock(): At SERIALIZABLE isolation level, if the
transaction was not started yet, start it and open a read view.
An alternative way to achieve this would be to make trans_begin()
treat START TRANSACTION (or BEGIN) in the same way as
START TRANSACTION WITH CONSISTENT SNAPSHOT when the isolation level
is SERIALIZABLE.

innodb_isolation_level(const THD*): A simpler version of
innobase_map_isolation_level(). Compared to earlier, we will return
READ UNCOMMITTED also if the :newraw option is set for the
InnoDB system tablespace.

Reviewed by: Vladislav Lesin
2025-07-11 16:07:08 +03:00
..
parts Remove dates from all rdiff files 2025-01-05 16:40:11 +02:00
trx MDEV-36330: SERIALIZABLE read inconsistency 2025-07-11 16:07:08 +03:00
alter_tablespace.opt MDEV-11: Generic storage engine test suite 2012-07-16 06:17:56 +04:00
autoinc_secondary.rdiff Remove dates from all rdiff files 2025-01-05 16:40:11 +02:00
cache_index.rdiff Remove dates from all rdiff files 2025-01-05 16:40:11 +02:00
checksum_table_live.rdiff Remove dates from all rdiff files 2025-01-05 16:40:11 +02:00
col_opt_not_null.opt MDEV-20907 Set innodb_log_files_in_group=1 by default 2019-10-28 17:11:10 +02:00
col_opt_null.opt MDEV-20907 Set innodb_log_files_in_group=1 by default 2019-10-28 17:11:10 +02:00
define_engine.inc MDEV-11782: Redefine the innodb_encrypt_log format 2017-02-15 08:07:20 +02:00
disabled.def Adjust storage_engine suite according to server changes in 10.2 2017-06-03 02:47:52 +03:00
fulltext_search.rdiff Remove dates from all rdiff files 2025-01-05 16:40:11 +02:00
index_enable_disable.rdiff Remove dates from all rdiff files 2025-01-05 16:40:11 +02:00
index_type_hash.rdiff Remove dates from all rdiff files 2025-01-05 16:40:11 +02:00
insert_delayed.rdiff Remove dates from all rdiff files 2025-01-05 16:40:11 +02:00
lock_concurrent.rdiff Remove dates from all rdiff files 2025-01-05 16:40:11 +02:00
optimize_table.rdiff Remove dates from all rdiff files 2025-01-05 16:40:11 +02:00
repair_table.rdiff Remove dates from all rdiff files 2025-01-05 16:40:11 +02:00
suite.opt Adjust storage_engine suite according to server changes in 10.2 2017-06-03 02:47:52 +03:00
tbl_opt_index_dir.rdiff Remove dates from all rdiff files 2025-01-05 16:40:11 +02:00
tbl_opt_insert_method.rdiff Remove dates from all rdiff files 2025-01-05 16:40:11 +02:00
tbl_opt_row_format.rdiff Remove dates from all rdiff files 2025-01-05 16:40:11 +02:00
tbl_opt_union.rdiff Remove dates from all rdiff files 2025-01-05 16:40:11 +02:00
type_blob.opt MDEV-20907 Set innodb_log_files_in_group=1 by default 2019-10-28 17:11:10 +02:00
type_char_indexes.rdiff Remove dates from all rdiff files 2025-01-05 16:40:11 +02:00
type_float_indexes.rdiff Remove dates from all rdiff files 2025-01-05 16:40:11 +02:00
type_text.opt MDEV-20907 Set innodb_log_files_in_group=1 by default 2019-10-28 17:11:10 +02:00