summaryrefslogtreecommitdiff
path: root/mysql-test/suite/galera/t/galera_bf_kill.test
blob: dce6808fd56df69ca7eb39193b58c952e48ff47f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
--source include/galera_cluster.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

#show create table information_schema.processlist;
#select ID,USER,COMMAND,STATE,QUERY_ID from INFORMATION_SCHEMA.PROCESSLIST;

--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 $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(b);

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(b);

select * from t1;

--disconnect node_2a
--disconnect node_2b

drop table t1;