mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
MDEV-17073 INSERT…ON DUPLICATE KEY UPDATE became more deadlock-prone
thd_rpl_stmt_based(): A new predicate to check if statement-based replication is active. (This can also hold when replication is not in use, but binlog is.) que_thr_stop(), row_ins_duplicate_error_in_clust(), row_ins_sec_index_entry_low(), row_ins(): On a duplicate key error, only lock all index records when statement-based replication is in use.
This commit is contained in:
@ -1,4 +1,3 @@
|
||||
drop table if exists t1;
|
||||
set global transaction isolation level repeatable read;
|
||||
CREATE TABLE t1(
|
||||
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
@ -79,20 +78,13 @@ affected rows: 0
|
||||
#
|
||||
# Parallel execution
|
||||
#
|
||||
connect con1, localhost, root;
|
||||
connect con2, localhost, root;
|
||||
SET DEBUG_SYNC='now WAIT_FOR write_row_done';
|
||||
connection con1;
|
||||
#
|
||||
# Connection 1
|
||||
#
|
||||
connect con1, localhost, root;
|
||||
SET DEBUG_SYNC='ha_write_row_end SIGNAL write_row_done WAIT_FOR continue';
|
||||
affected rows: 0
|
||||
INSERT INTO t1(k) VALUES (1), (2), (3) ON DUPLICATE KEY UPDATE c='1';
|
||||
connection con2;
|
||||
#
|
||||
# Connection 2
|
||||
#
|
||||
affected rows: 0
|
||||
SET DEBUG_SYNC='execute_command_after_close_tables SIGNAL continue';
|
||||
affected rows: 0
|
||||
@ -140,18 +132,10 @@ k INT,
|
||||
c CHAR(1),
|
||||
UNIQUE KEY(k)) ENGINE=InnoDB;
|
||||
connect con1, localhost, root;
|
||||
connect con2, localhost, root;
|
||||
connection con1;
|
||||
#
|
||||
# Connection 1
|
||||
#
|
||||
SET DEBUG_SYNC='ha_write_row_end SIGNAL continue2 WAIT_FOR continue1';
|
||||
affected rows: 0
|
||||
INSERT INTO t1(k) VALUES (1), (2), (3) ON DUPLICATE KEY UPDATE c='1';
|
||||
connection con2;
|
||||
#
|
||||
# Connection 2
|
||||
#
|
||||
connect con2, localhost, root;
|
||||
SET DEBUG_SYNC='ha_write_row_start WAIT_FOR continue2';
|
||||
affected rows: 0
|
||||
SET DEBUG_SYNC='after_mysql_insert SIGNAL continue1';
|
||||
@ -159,6 +143,7 @@ affected rows: 0
|
||||
INSERT INTO t1(k) VALUES (2), (4), (5) ON DUPLICATE KEY UPDATE c='2';
|
||||
affected rows: 3
|
||||
info: Records: 3 Duplicates: 0 Warnings: 0
|
||||
disconnect con2;
|
||||
connection con1;
|
||||
affected rows: 4
|
||||
info: Records: 3 Duplicates: 1 Warnings: 0
|
||||
@ -174,7 +159,6 @@ id k c
|
||||
5 4 NULL
|
||||
6 5 NULL
|
||||
disconnect con1;
|
||||
disconnect con2;
|
||||
connection default;
|
||||
DROP TABLE t1;
|
||||
set global transaction isolation level repeatable read;
|
||||
|
Reference in New Issue
Block a user