Commit c1dc0397 authored by Daniele Sciascia's avatar Daniele Sciascia Committed by Julius Goryavsky

MDEV-33523 Spurious deadlock error when wsrep_on=OFF

Avoid starting transactions in wsrep-lib side when wsrep is
disabled. It is unnecessary, and causes spurious deadlock errors on
transaction clean up.
Signed-off-by: default avatarJulius Goryavsky <julius.goryavsky@mariadb.com>
parent d328705a
...@@ -47,6 +47,9 @@ wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port' ...@@ -47,6 +47,9 @@ wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port'
wsrep-on=OFF wsrep-on=OFF
server-id=3 server-id=3
[sst]
sst-log-archive-dir=@ENV.MYSQLTEST_VARDIR/log
[ENV] [ENV]
NODE_MYPORT_1= @mysqld.1.port NODE_MYPORT_1= @mysqld.1.port
NODE_MYSOCK_1= @mysqld.1.socket NODE_MYSOCK_1= @mysqld.1.socket
......
...@@ -46,6 +46,9 @@ wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port' ...@@ -46,6 +46,9 @@ wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port'
wsrep-on=OFF wsrep-on=OFF
server-id=3 server-id=3
[sst]
sst-log-archive-dir=@ENV.MYSQLTEST_VARDIR/log
[ENV] [ENV]
NODE_MYPORT_1= @mysqld.1.port NODE_MYPORT_1= @mysqld.1.port
NODE_MYSOCK_1= @mysqld.1.socket NODE_MYSOCK_1= @mysqld.1.socket
......
...@@ -11,7 +11,6 @@ default-storage-engine=innodb ...@@ -11,7 +11,6 @@ default-storage-engine=innodb
wsrep_gtid_mode=1 wsrep_gtid_mode=1
gtid_ignore_duplicates gtid_ignore_duplicates
auto_increment_increment=3 auto_increment_increment=3
wsrep-provider=@ENV.WSREP_PROVIDER wsrep-provider=@ENV.WSREP_PROVIDER
# enforce read-committed characteristics across the cluster # enforce read-committed characteristics across the cluster
# wsrep-causal-reads=ON # wsrep-causal-reads=ON
...@@ -61,6 +60,9 @@ wsrep_node_address='127.0.0.1:@mysqld.4.#galera_port' ...@@ -61,6 +60,9 @@ wsrep_node_address='127.0.0.1:@mysqld.4.#galera_port'
wsrep_node_incoming_address=127.0.0.1:@mysqld.4.port wsrep_node_incoming_address=127.0.0.1:@mysqld.4.port
wsrep_sst_receive_address='127.0.0.1:@mysqld.4.#sst_port' wsrep_sst_receive_address='127.0.0.1:@mysqld.4.#sst_port'
[sst]
sst-log-archive-dir=@ENV.MYSQLTEST_VARDIR/log
[ENV] [ENV]
NODE_MYPORT_1= @mysqld.1.port NODE_MYPORT_1= @mysqld.1.port
NODE_MYSOCK_1= @mysqld.1.socket NODE_MYSOCK_1= @mysqld.1.socket
...@@ -73,5 +75,3 @@ NODE_MYSOCK_3= @mysqld.3.socket ...@@ -73,5 +75,3 @@ NODE_MYSOCK_3= @mysqld.3.socket
NODE_MYPORT_4= @mysqld.4.port NODE_MYPORT_4= @mysqld.4.port
NODE_MYSOCK_4= @mysqld.4.socket NODE_MYSOCK_4= @mysqld.4.socket
...@@ -59,6 +59,9 @@ wsrep_sst_receive_address='127.0.0.1:@mysqld.3.#sst_port' ...@@ -59,6 +59,9 @@ wsrep_sst_receive_address='127.0.0.1:@mysqld.3.#sst_port'
wsrep-on=OFF wsrep-on=OFF
server-id=4 server-id=4
[sst]
sst-log-archive-dir=@ENV.MYSQLTEST_VARDIR/log
[ENV] [ENV]
NODE_MYPORT_1= @mysqld.1.port NODE_MYPORT_1= @mysqld.1.port
NODE_MYSOCK_1= @mysqld.1.socket NODE_MYSOCK_1= @mysqld.1.socket
......
...@@ -59,6 +59,9 @@ wsrep_node_incoming_address=127.0.0.1:@mysqld.4.port ...@@ -59,6 +59,9 @@ wsrep_node_incoming_address=127.0.0.1:@mysqld.4.port
wsrep_sst_receive_address='127.0.0.1:@mysqld.4.#sst_port' wsrep_sst_receive_address='127.0.0.1:@mysqld.4.#sst_port'
auto-increment-offset=4 auto-increment-offset=4
[sst]
sst-log-archive-dir=@ENV.MYSQLTEST_VARDIR/log
[ENV] [ENV]
NODE_MYPORT_1= @mysqld.1.port NODE_MYPORT_1= @mysqld.1.port
NODE_MYSOCK_1= @mysqld.1.socket NODE_MYSOCK_1= @mysqld.1.socket
......
connection node_2;
connection node_1;
SET SESSION wsrep_on=OFF;
BEGIN;
ROLLBACK;
SET SESSION wsrep_on=OFF;
...@@ -49,16 +49,23 @@ a b ...@@ -49,16 +49,23 @@ a b
disconnect node_2a; disconnect node_2a;
disconnect node_2b; disconnect node_2b;
connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2;
connection node_2a; connection node_2a;
SET SESSION wsrep_on=OFF; SET SESSION wsrep_on=OFF;
begin; begin;
update t1 set a =5, b=2; update t1 set a =5, b=2;
connection node_2; connection node_2;
ALTER TABLE t1 ADD UNIQUE KEY b3(b); ALTER TABLE t1 ADD UNIQUE KEY b3(b);
connection node_2b;
SET SESSION wsrep_sync_wait=0;
connection node_2a;
select * from t1; select * from t1;
a b a b
2 1 5 2
commit;
connection node_2;
disconnect node_2a; disconnect node_2a;
disconnect node_2b;
connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
connection node_2a; connection node_2a;
SET SESSION wsrep_on=OFF; SET SESSION wsrep_on=OFF;
...@@ -67,7 +74,7 @@ update t1 set a =5, b=2; ...@@ -67,7 +74,7 @@ update t1 set a =5, b=2;
connection node_2; connection node_2;
select * from t1; select * from t1;
a b a b
2 1 5 2
disconnect node_2a; disconnect node_2a;
connection node_1; connection node_1;
drop table t1; drop table t1;
#
# MDEV-33523: Spurious deadlock error when wsrep_on=OFF
#
--source include/galera_cluster.inc
SET SESSION wsrep_on=OFF;
BEGIN;
# If bug is present, the following rollback
# results in ER_LOCK_DEADLOCK error.
ROLLBACK;
SET SESSION wsrep_on=OFF;
...@@ -94,27 +94,43 @@ select * from t1; ...@@ -94,27 +94,43 @@ select * from t1;
--disconnect node_2b --disconnect node_2b
# #
# Test case 5: Start a transaction on node_2a with wsrep disabled # Test case 5: Start a transaction on node_2a with wsrep disabled.
# and start a DDL on other transaction that will then abort node_2a # A conflicting DDL on other transaction can't BF abort
# transactions # transaction from node_2a (wsrep disabled).
# #
--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 --connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
--connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2
--connection node_2a --connection node_2a
SET SESSION wsrep_on=OFF; SET SESSION wsrep_on=OFF;
begin; begin;
update t1 set a =5, b=2; update t1 set a =5, b=2;
--connection node_2 --connection node_2
ALTER TABLE t1 ADD UNIQUE KEY b3(b); --send ALTER TABLE t1 ADD UNIQUE KEY b3(b)
--connection node_2b
SET SESSION wsrep_sync_wait=0;
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = 'Waiting for table metadata lock';
--source include/wait_condition.inc
--connection node_2a
select * from t1; select * from t1;
# We expect that ALTER should not be able to BF abort
# this transaction, it must wait for it to finish.
# Expect commit to succeed.
commit;
--connection node_2
--reap
--disconnect node_2a --disconnect node_2a
--disconnect node_2b
# #
# Test case 6: Start a transaction on node_2a with wsrep disabled # Test case 6: Start a transaction on node_2a with wsrep disabled
# and kill it from other connection on same node # and kill it from other connection on same node.
# #
--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 --connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
......
...@@ -83,6 +83,9 @@ wsrep_node_address='127.0.0.1:@mysqld.6.#galera_port' ...@@ -83,6 +83,9 @@ wsrep_node_address='127.0.0.1:@mysqld.6.#galera_port'
wsrep_node_incoming_address=127.0.0.1:@mysqld.6.port wsrep_node_incoming_address=127.0.0.1:@mysqld.6.port
wsrep_sst_receive_address='127.0.0.1:@mysqld.6.#sst_port' wsrep_sst_receive_address='127.0.0.1:@mysqld.6.#sst_port'
[sst]
sst-log-archive-dir=@ENV.MYSQLTEST_VARDIR/log
[ENV] [ENV]
NODE_MYPORT_1= @mysqld.1.port NODE_MYPORT_1= @mysqld.1.port
NODE_MYSOCK_1= @mysqld.1.socket NODE_MYSOCK_1= @mysqld.1.socket
......
...@@ -46,6 +46,9 @@ wsrep_node_address='127.0.0.1:@mysqld.3.#galera_port' ...@@ -46,6 +46,9 @@ wsrep_node_address='127.0.0.1:@mysqld.3.#galera_port'
wsrep_node_incoming_address=127.0.0.1:@mysqld.3.port wsrep_node_incoming_address=127.0.0.1:@mysqld.3.port
wsrep_sst_receive_address='127.0.0.1:@mysqld.3.#sst_port' wsrep_sst_receive_address='127.0.0.1:@mysqld.3.#sst_port'
[sst]
sst-log-archive-dir=@ENV.MYSQLTEST_VARDIR/log
[ENV] [ENV]
NODE_MYPORT_1= @mysqld.1.port NODE_MYPORT_1= @mysqld.1.port
NODE_MYSOCK_1= @mysqld.1.socket NODE_MYSOCK_1= @mysqld.1.socket
......
...@@ -191,7 +191,7 @@ bool trans_begin(THD *thd, uint flags) ...@@ -191,7 +191,7 @@ bool trans_begin(THD *thd, uint flags)
} }
#ifdef WITH_WSREP #ifdef WITH_WSREP
if (wsrep_thd_is_local(thd)) if (WSREP(thd) && wsrep_thd_is_local(thd))
{ {
if (wsrep_sync_wait(thd)) if (wsrep_sync_wait(thd))
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment