31 changed files with 275 additions and 377 deletions
-
12mysql-test/main/innodb_mysql_sync.result
-
13mysql-test/main/innodb_mysql_sync.test
-
1mysql-test/suite/federated/rpl.test
-
1mysql-test/suite/galera/disabled.def
-
17mysql-test/suite/innodb/r/instant_alter_debug.result
-
20mysql-test/suite/innodb/r/lock_delete_updated.result
-
27mysql-test/suite/innodb/r/lock_wait_conflict.result
-
7mysql-test/suite/innodb/r/page_reorganize.result
-
19mysql-test/suite/innodb/t/instant_alter_debug.test
-
34mysql-test/suite/innodb/t/lock_delete_updated.test
-
60mysql-test/suite/innodb/t/lock_wait_conflict.test
-
8mysql-test/suite/innodb/t/page_reorganize.test
-
29mysql-test/suite/innodb_fts/r/innodb-fts-ddl.result
-
1mysql-test/suite/innodb_fts/t/innodb-fts-ddl.opt
-
25mysql-test/suite/innodb_fts/t/innodb-fts-ddl.test
-
1mysql-test/suite/versioning/r/update.result
-
4mysql-test/suite/versioning/t/update.test
-
2plugin/type_mysql_json/type.cc
-
9scripts/mysql_install_db.sh
-
1scripts/mysqld_safe.sh
-
12sql/item_func.cc
-
10sql/sql_table.cc
-
3storage/innobase/btr/btr0cur.cc
-
49storage/innobase/fts/fts0fts.cc
-
48storage/innobase/handler/ha_innodb.cc
-
5storage/innobase/handler/ha_innodb.h
-
23storage/innobase/include/fts0fts.h
-
41storage/innobase/include/hash0hash.h
-
9storage/innobase/include/lock0lock.h
-
145storage/innobase/lock/lock0lock.cc
-
16storage/innobase/row/row0merge.cc
@ -0,0 +1,20 @@ |
|||
CREATE TABLE t(a INT PRIMARY KEY) ENGINE=InnoDB; |
|||
INSERT INTO t VALUES (3); |
|||
BEGIN; |
|||
connection default; |
|||
UPDATE t SET a = 2; |
|||
connect con1,localhost,root; |
|||
DELETE FROM t; |
|||
connection default; |
|||
UPDATE t SET a = 1; |
|||
COMMIT; |
|||
connection con1; |
|||
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction |
|||
disconnect con1; |
|||
connection default; |
|||
# The above DELETE must delete all the rows in the table, so the |
|||
# following SELECT must show 0 rows. |
|||
SELECT count(*) FROM t; |
|||
count(*) |
|||
1 |
|||
DROP TABLE t; |
|||
@ -1,27 +0,0 @@ |
|||
# |
|||
# MDEV-27025 insert-intention lock conflicts with waiting ORDINARY lock |
|||
# |
|||
CREATE TABLE t (a INT PRIMARY KEY, b INT NOT NULL UNIQUE) ENGINE=InnoDB; |
|||
connect prevent_purge,localhost,root,,; |
|||
start transaction with consistent snapshot; |
|||
connection default; |
|||
INSERT INTO t VALUES (20,20); |
|||
DELETE FROM t WHERE b = 20; |
|||
connect con_ins,localhost,root,,; |
|||
SET DEBUG_SYNC = 'row_ins_sec_index_entry_dup_locks_created SIGNAL ins_set_locks WAIT_FOR ins_cont'; |
|||
INSERT INTO t VALUES(10, 20); |
|||
connect con_del,localhost,root,,; |
|||
SET DEBUG_SYNC = 'now WAIT_FOR ins_set_locks'; |
|||
SET DEBUG_SYNC = 'lock_wait_suspend_thread_enter SIGNAL del_locked'; |
|||
DELETE FROM t WHERE b = 20; |
|||
connection default; |
|||
SET DEBUG_SYNC = 'now WAIT_FOR del_locked'; |
|||
SET DEBUG_SYNC = 'now SIGNAL ins_cont'; |
|||
connection con_ins; |
|||
disconnect con_ins; |
|||
connection con_del; |
|||
disconnect con_del; |
|||
disconnect prevent_purge; |
|||
connection default; |
|||
SET DEBUG_SYNC = 'RESET'; |
|||
DROP TABLE t; |
|||
@ -0,0 +1,34 @@ |
|||
--source include/have_innodb.inc |
|||
--source include/count_sessions.inc |
|||
|
|||
CREATE TABLE t(a INT PRIMARY KEY) ENGINE=InnoDB; |
|||
INSERT INTO t VALUES (3); |
|||
|
|||
BEGIN; |
|||
|
|||
connection default; |
|||
UPDATE t SET a = 2; |
|||
|
|||
connect con1,localhost,root; |
|||
send DELETE FROM t; |
|||
|
|||
connection default; |
|||
let $wait_condition= |
|||
select count(*) = 1 from information_schema.processlist |
|||
where state = "Updating" and info = "DELETE FROM t"; |
|||
--source include/wait_condition.inc |
|||
|
|||
UPDATE t SET a = 1; |
|||
COMMIT; |
|||
|
|||
connection con1; |
|||
error ER_LOCK_DEADLOCK; |
|||
reap; |
|||
disconnect con1; |
|||
|
|||
connection default; |
|||
--echo # The above DELETE must delete all the rows in the table, so the |
|||
--echo # following SELECT must show 0 rows. |
|||
SELECT count(*) FROM t; |
|||
DROP TABLE t; |
|||
--source include/wait_until_count_sessions.inc |
|||
@ -1,60 +0,0 @@ |
|||
--source include/have_innodb.inc |
|||
--source include/count_sessions.inc |
|||
--source include/have_debug.inc |
|||
--source include/have_debug_sync.inc |
|||
|
|||
--echo # |
|||
--echo # MDEV-27025 insert-intention lock conflicts with waiting ORDINARY lock |
|||
--echo # |
|||
|
|||
# The test checks the ability to acquire exclusive record lock if the acquiring |
|||
# transaction already holds a shared lock on the record and another transaction |
|||
# is waiting for a lock. |
|||
|
|||
CREATE TABLE t (a INT PRIMARY KEY, b INT NOT NULL UNIQUE) ENGINE=InnoDB; |
|||
|
|||
--connect(prevent_purge,localhost,root,,) |
|||
start transaction with consistent snapshot; |
|||
|
|||
--connection default |
|||
INSERT INTO t VALUES (20,20); |
|||
DELETE FROM t WHERE b = 20; |
|||
|
|||
--connect(con_ins,localhost,root,,) |
|||
SET DEBUG_SYNC = 'row_ins_sec_index_entry_dup_locks_created SIGNAL ins_set_locks WAIT_FOR ins_cont'; |
|||
send |
|||
INSERT INTO t VALUES(10, 20); |
|||
|
|||
--connect(con_del,localhost,root,,) |
|||
SET DEBUG_SYNC = 'now WAIT_FOR ins_set_locks'; |
|||
SET DEBUG_SYNC = 'lock_wait_suspend_thread_enter SIGNAL del_locked'; |
|||
############################################################################### |
|||
# This DELETE creates waiting ORDINARY X-lock for heap_no 2 as the record is |
|||
# delete-marked, this lock conflicts with ORDINARY S-lock set by the the last |
|||
# INSERT. After the last INSERT creates insert-intention lock on |
|||
# heap_no 2, this lock will conflict with waiting ORDINARY X-lock of this |
|||
# DELETE, what causes DEADLOCK error for this DELETE. |
|||
############################################################################### |
|||
send |
|||
DELETE FROM t WHERE b = 20; |
|||
|
|||
--connection default |
|||
SET DEBUG_SYNC = 'now WAIT_FOR del_locked'; |
|||
SET DEBUG_SYNC = 'now SIGNAL ins_cont'; |
|||
|
|||
--connection con_ins |
|||
--reap |
|||
--disconnect con_ins |
|||
|
|||
--connection con_del |
|||
# Without the fix, ER_LOCK_DEADLOCK would be reported here. |
|||
--reap |
|||
--disconnect con_del |
|||
|
|||
--disconnect prevent_purge |
|||
|
|||
--connection default |
|||
|
|||
SET DEBUG_SYNC = 'RESET'; |
|||
DROP TABLE t; |
|||
--source include/wait_until_count_sessions.inc |
|||
@ -1 +1,2 @@ |
|||
--enable-plugin-innodb-sys-tables |
|||
--innodb_ft_index_table |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue