mirror of
https://github.com/MariaDB/server.git
synced 2025-12-07 17:42:39 +03:00
The hang can happen between a lock connection issuing KILL CONNECTION for a victim, which is in committing phase. There happens two resource deadlockwhere killer is holding victim's LOCK_thd_data and requires trx mutex for the victim. The victim, otoh, holds his own trx mutex, but requires LOCK_thd_data in wsrep_commit_ordered(). Hence a classic two thread deadlock happens. The fix in this commit changes innodb commit so that wsrep_commit_ordered() is not called while holding trx mutex. With this, wsrep patch commit time mutex locking does not violate the locking protocol of KILL command (i.e. LOCK_thd_data -> trx mutex) Also, a new test case has been added in galera.galera_bf_kill.test for scenario where a client connection is killed in committting phase.
90 lines
2.0 KiB
Plaintext
90 lines
2.0 KiB
Plaintext
connection node_2;
|
|
connection node_1;
|
|
connection node_2;
|
|
CREATE TABLE t1(a int not null primary key auto_increment,b int) engine=InnoDB;
|
|
insert into t1 values (NULL,1);
|
|
connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
|
|
connection node_2a;
|
|
begin;
|
|
update t1 set a = 5;
|
|
connection node_2;
|
|
select * from t1;
|
|
a b
|
|
2 1
|
|
disconnect node_2a;
|
|
connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
|
|
connection node_2a;
|
|
begin;
|
|
update t1 set a =5;
|
|
connection node_2;
|
|
select * from t1;
|
|
a b
|
|
2 1
|
|
disconnect node_2a;
|
|
connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
|
|
connection node_2a;
|
|
begin;
|
|
update t1 set a =5, b=2;
|
|
connection node_2;
|
|
ALTER TABLE t1 ADD UNIQUE KEY b1(b);
|
|
ALTER TABLE t1 DROP KEY b1;
|
|
select * from t1;
|
|
a b
|
|
2 1
|
|
disconnect node_2a;
|
|
connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
|
|
connection node_2a;
|
|
begin;
|
|
update t1 set a =5, b=2;
|
|
connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2;
|
|
connection node_2b;
|
|
begin;
|
|
update t1 set a =6, b=7;
|
|
connection node_2;
|
|
ALTER TABLE t1 ADD UNIQUE KEY b2(b);
|
|
ALTER TABLE t1 DROP KEY b2;
|
|
select * from t1;
|
|
a b
|
|
2 1
|
|
disconnect node_2a;
|
|
disconnect node_2b;
|
|
connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
|
|
connection node_2a;
|
|
SET SESSION wsrep_on=OFF;
|
|
begin;
|
|
update t1 set a =5, b=2;
|
|
connection node_2;
|
|
ALTER TABLE t1 ADD UNIQUE KEY b3(b);
|
|
select * from t1;
|
|
a b
|
|
2 1
|
|
disconnect node_2a;
|
|
connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
|
|
connection node_2a;
|
|
SET SESSION wsrep_on=OFF;
|
|
begin;
|
|
update t1 set a =5, b=2;
|
|
connection node_2;
|
|
select * from t1;
|
|
a b
|
|
2 1
|
|
disconnect node_2a;
|
|
drop table t1;
|
|
connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
|
|
connection node_2a;
|
|
CREATE TABLE t1 (i int primary key);
|
|
SET DEBUG_SYNC = "before_wsrep_ordered_commit SIGNAL bwoc_reached WAIT_FOR bwoc_continue";
|
|
INSERT INTO t1 VALUES (1);
|
|
connection node_2;
|
|
SET DEBUG_SYNC = "now WAIT_FOR bwoc_reached";
|
|
SET DEBUG_SYNC = "now SIGNAL bwoc_continue";
|
|
SET DEBUG_SYNC='RESET';
|
|
connection node_2a;
|
|
connection node_2;
|
|
select * from t1;
|
|
i
|
|
1
|
|
disconnect node_2a;
|
|
connection node_2;
|
|
drop table t1;
|