1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-19544 Remove innodb_locks_unsafe_for_binlog

The transaction isolation levels READ COMMITTED and READ UNCOMMITTED
should behave similarly to the old deprecated setting
innodb_locks_unsafe_for_binlog=1, that is, avoid acquiring gap locks.

row_search_mvcc(): Reduce the scope of some variables, and clean up
the initialization and use of the variable set_also_gap_locks.
This commit is contained in:
Marko Mäkelä
2019-05-22 14:49:38 +03:00
parent 47cede646b
commit 1a6f470464
29 changed files with 158 additions and 484 deletions

View File

@ -1,15 +1,13 @@
SET @save_timeout = @@GLOBAL.innodb_lock_wait_timeout;
SET GLOBAL innodb_lock_wait_timeout = 1;
SET GLOBAL TRANSACTION ISOLATION LEVEL REPEATABLE READ;
connection default;
SET SQL_MODE="";
SELECT @@global.tx_isolation;
@@global.tx_isolation
REPEATABLE-READ
SELECT @@global.innodb_locks_unsafe_for_binlog;
@@global.innodb_locks_unsafe_for_binlog
0
# keep_locks == 1
GRANT USAGE ON test.* TO mysqltest@localhost;
drop table if exists t1;
**
** two UPDATE's running and both changing distinct result sets
@ -47,7 +45,7 @@ begin;
** Update on t1 will cause a table scan which will be blocked because
** the previously initiated table scan applied exclusive key locks on
** all primary keys.
** Not so if innodb_locks_unsafe_for_binlog is set. The locks that
** Not so for READ UNCOMMITTED or READ COMMITTED. The locks that
** do not match the WHERE condition are released.
update t1 set eta=2 where tipo=22;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
@ -187,7 +185,7 @@ begin;
** Update on t1 will cause a table scan which will be blocked because
** the previously initiated table scan applied exclusive key locks on
** all primary keys.
** Not so if innodb_locks_unsafe_for_binlog is set. The locks that
** Not so for READ UNCOMMITTED or READ COMMITTED. The locks that
** do not match the WHERE condition are released.
update t1 set tipo=1 where tipo=2;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
@ -476,7 +474,7 @@ begin;
** Updating single row using a table scan. This will time out
** because of ongoing transaction on thread 1 holding lock on
** all primary keys in the scan.
** Not so if innodb_locks_unsafe_for_binlog is set. The locks that
** Not so for READ UNCOMMITTED or READ COMMITTED. The locks that
** do not match the WHERE condition are released.
update t1 set tipo=11 where tipo=22;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
@ -736,7 +734,7 @@ begin;
** Update on t1 will cause a table scan which will be blocked because
** the previously initiated table scan applied exclusive key locks on
** all primary keys.
** Not so if innodb_locks_unsafe_for_binlog is set. The locks that
** Not so for READ UNCOMMITTED or READ COMMITTED. The locks that
** do not match the WHERE condition are released.
update t1 set tipo=1 where tipo=22;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
@ -789,12 +787,10 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** Cleanup
connection thread1;
disconnect thread1;
connection thread2;
disconnect thread2;
connection default;
drop table t1;
drop user mysqltest@localhost;
SET SQL_MODE=default;
SET GLOBAL innodb_lock_wait_timeout = @save_timeout;