mirror of
https://github.com/MariaDB/server.git
synced 2025-01-31 02:51:44 +01:00
33d41167c5
When MDEV-19544 (commit 1a6f470464
)
simplified the initialization of the local variable
set_also_gap_locks, an inadvertent change was included.
Essentially, all code branches that are executed when
set_also_gap_locks hold must also ensure that
trx->isolation_level > TRX_ISO_READ_COMMITTED holds.
This was being violated in a few code paths.
It turns out that there is an even simpler fix: Remove the test
of thd_is_select() completely. In that way, the first part of
UPDATE or DELETE should work exactly like SELECT...FOR UPDATE.
thd_is_select(): Remove.
29 lines
765 B
Text
29 lines
765 B
Text
--source include/have_innodb.inc
|
|
|
|
CREATE TABLE t1(a INT PRIMARY KEY, b VARCHAR(40), c INT, INDEX(b,c))
|
|
ENGINE=InnoDB;
|
|
INSERT INTO t1 VALUES (1,'1',1),(2,'2',1);
|
|
|
|
SET @save_locks= @@GLOBAL.innodb_status_output_locks;
|
|
SET GLOBAL INNODB_STATUS_OUTPUT_LOCKS = 'ON';
|
|
|
|
let $isolation= 4;
|
|
while ($isolation) {
|
|
let $tx_isolation= `SELECT CASE $isolation
|
|
WHEN 1 THEN 'READ UNCOMMITTED'
|
|
WHEN 2 THEN 'READ COMMITTED'
|
|
WHEN 3 THEN 'REPEATABLE READ'
|
|
ELSE 'SERIALIZABLE' END`;
|
|
|
|
eval SET TRANSACTION ISOLATION LEVEL $tx_isolation;
|
|
BEGIN;
|
|
DELETE FROM t1 WHERE b='2' AND c=2;
|
|
--replace_regex /.*(\d+ lock struct...), heap size \d+(, \d+ row lock...).*/\1\2/
|
|
SHOW ENGINE INNODB STATUS;
|
|
ROLLBACK;
|
|
|
|
dec $isolation;
|
|
}
|
|
|
|
SET GLOBAL INNODB_STATUS_OUTPUT_LOCKS = @save_locks;
|
|
DROP TABLE t1;
|