mirror of
https://github.com/MariaDB/server.git
synced 2025-12-06 05:42:06 +03:00
191 lines
4.5 KiB
Plaintext
191 lines
4.5 KiB
Plaintext
--source include/galera_cluster.inc
|
|
--source include/have_innodb.inc
|
|
--source include/have_debug.inc
|
|
--source include/have_debug_sync.inc
|
|
|
|
#
|
|
# Test case 1: Start a transaction on node_2a and kill it
|
|
# from other connection on same node
|
|
#
|
|
|
|
--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
|
|
|
|
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'root' AND COMMAND = 'Sleep' LIMIT 1
|
|
--source include/wait_condition.inc
|
|
|
|
--let $k_thread = `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'root' AND COMMAND = 'Sleep' LIMIT 1`
|
|
|
|
--disable_query_log
|
|
--eval KILL $k_thread
|
|
--enable_query_log
|
|
|
|
select * from t1;
|
|
--disconnect node_2a
|
|
|
|
#
|
|
# Test case 2: Start a transaction on node_2a and use
|
|
# kill query from other connection on same node
|
|
#
|
|
|
|
--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
|
|
--connection node_2a
|
|
begin;
|
|
update t1 set a =5;
|
|
|
|
--connection node_2
|
|
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'root' AND COMMAND = 'Sleep' LIMIT 1
|
|
--source include/wait_condition.inc
|
|
|
|
--let $k_thread = `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'root' AND COMMAND = 'Sleep' LIMIT 1`
|
|
|
|
--disable_query_log
|
|
--eval KILL QUERY $k_thread
|
|
--enable_query_log
|
|
|
|
select * from t1;
|
|
--disconnect node_2a
|
|
#
|
|
# Test case 3: Start a transaction on node_2a and start a DDL on other transaction
|
|
# that will then abort node_2a transaction
|
|
#
|
|
--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;
|
|
|
|
--disconnect node_2a
|
|
|
|
#
|
|
# Test case 4: Start a transaction on node_2a and conflicting transaction on node_2b
|
|
# and start a DDL on other transaction that will then abort node_2a and node_2b
|
|
# transactions
|
|
#
|
|
|
|
--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;
|
|
send 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;
|
|
|
|
--disconnect node_2a
|
|
--disconnect node_2b
|
|
|
|
#
|
|
# 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
|
|
# transactions
|
|
#
|
|
|
|
--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;
|
|
|
|
--disconnect node_2a
|
|
|
|
#
|
|
# Test case 6: Start a transaction on node_2a with wsrep disabled
|
|
# and kill it from other connection on same node
|
|
#
|
|
|
|
--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
|
|
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'root' AND COMMAND = 'Sleep' LIMIT 1
|
|
--source include/wait_condition.inc
|
|
|
|
--let $k_thread = `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'root' AND COMMAND = 'Sleep' LIMIT 1`
|
|
|
|
--disable_query_log
|
|
--eval KILL $k_thread
|
|
--enable_query_log
|
|
|
|
|
|
select * from t1;
|
|
|
|
--disconnect node_2a
|
|
|
|
drop table t1;
|
|
|
|
|
|
#
|
|
# Test case 7:
|
|
# run a transaction in node 2, and set a sync point to pause the transaction
|
|
# in commit phase.
|
|
# Through another connection to node 2, kill the committing transaction by
|
|
# KILL QUERY command
|
|
#
|
|
|
|
--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
|
|
--connection node_2a
|
|
--let $connection_id = `SELECT CONNECTION_ID()`
|
|
|
|
CREATE TABLE t1 (i int primary key);
|
|
|
|
# Set up sync point
|
|
SET DEBUG_SYNC = "before_wsrep_ordered_commit SIGNAL bwoc_reached WAIT_FOR bwoc_continue";
|
|
|
|
# Send insert which will block in the sync point above
|
|
--send INSERT INTO t1 VALUES (1)
|
|
|
|
--connection node_2
|
|
SET DEBUG_SYNC = "now WAIT_FOR bwoc_reached";
|
|
|
|
--disable_query_log
|
|
--disable_result_log
|
|
# victim has passed the point of no return, kill is not possible anymore
|
|
--eval KILL QUERY $connection_id
|
|
--enable_result_log
|
|
--enable_query_log
|
|
|
|
SET DEBUG_SYNC = "now SIGNAL bwoc_continue";
|
|
SET DEBUG_SYNC='RESET';
|
|
--connection node_2a
|
|
--error 0,1213
|
|
--reap
|
|
|
|
--connection node_2
|
|
# victim was able to complete the INSERT
|
|
select * from t1;
|
|
|
|
--disconnect node_2a
|
|
|
|
--connection node_2
|
|
drop table t1;
|
|
|