Debian Codegraph @

mysql-test/suite/galera_3nodes/t/galera_var_dirty_reads2.test

raw
1 #
2 # Additional tests for wsrep_dirty_reads
3 #
4
5 --source include/galera_cluster.inc
6 --source include/have_innodb.inc
7
8 --let $galera_connection_name = node_3
9 --let $galera_server_number = 3
10 --source include/galera_connect.inc
11
12 # Save original auto_increment_offset values.
13 --let $node_1=node_1
14 --let $node_2=node_2
15 --let $node_3=node_3
16 --source ../galera/include/auto_increment_offset_save.inc
17
18 --connection node_1
19 CREATE TABLE t1 (f1 INTEGER) ENGINE=INNODB;
20 INSERT INTO t1 VALUES (1);
21
22 --connection node_2
23 --let $wait_condition = SELECT COUNT(*) = 1 FROM t1;
24 --source include/wait_condition.inc
25
26 SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
27
28 --connection node_1
29 --let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
30 --source include/wait_condition.inc
31
32 --connection node_2
33 SET SESSION wsrep_sync_wait = 0;
34 --let $wait_condition = SELECT VARIABLE_VALUE = 'non-Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
35 --source include/wait_condition.inc
36
37 SET SESSION wsrep_dirty_reads = 1;
38
39 # Those statements should succeed
40
41 --error 0
42 SELECT f1 FROM t1;
43
44 --error 0
45 USE test;
46
47 --error 0
48 SHOW CREATE TABLE t1;
49
50 --error 0
51 LOCK TABLE t1 WRITE;
52
53 --error 0
54 UNLOCK TABLES;
55
56 --error 0
57 FLUSH TABLES WITH READ LOCK;
58
59 --error 0
60 UNLOCK TABLES;
61
62 --error 0
63 PREPARE stmt_select FROM 'SELECT f1 FROM t1';
64
65 --error 0
66 EXECUTE stmt_select;
67
68 --error 0
69 PREPARE stmt_update FROM 'UPDATE t1 SET f1 = f1 + f1';
70
71 # Mysqldump should succeed
72
73 SET GLOBAL wsrep_dirty_reads = 1;
74 SET GLOBAL wsrep_sync_wait = 0;
75 --error 0
76 --exec $MYSQL_DUMP -u root -S $NODE_MYSOCK_2 test >/dev/null
77 SET GLOBAL wsrep_dirty_reads = 0;
78 SET GLOBAL wsrep_sync_wait = 15;
79
80 # Those statements should fail
81
82 SET SESSION wsrep_dirty_reads = 1;
83
84 --error ER_UNKNOWN_COM_ERROR
85 INSERT INTO t1 SELECT * FROM t1;
86
87 --error ER_UNKNOWN_COM_ERROR
88 DELETE FROM t1;
89
90 --error ER_UNKNOWN_COM_ERROR
91 UPDATE t1 SET f1 = f1 + 1;
92
93 --error ER_UNKNOWN_COM_ERROR
94 DROP TABLE t1;
95
96 --error ER_UNKNOWN_COM_ERROR
97 EXECUTE stmt_update;
98
99 # With wsrep_dirty_reads = 0 , even SELECTS are not allowed
100
101 SET SESSION wsrep_dirty_reads = 0;
102
103 --error ER_UNKNOWN_COM_ERROR
104 SELECT * FROM t1;
105
106 --error ER_UNKNOWN_COM_ERROR
107 EXECUTE stmt_select;
108
109 # But reads from INFORMATION_SCHEMA are allowed
110
111 --error 0
112 SELECT COUNT(*) > 0 FROM INFORMATION_SCHEMA.PROCESSLIST;
113
114 # Restore cluster
115 SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
116 --source include/galera_wait_ready.inc
117
118 --connection node_1
119 --let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
120 --source include/wait_condition.inc
121
122 --connection node_2
123 --let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
124 --source include/wait_condition.inc
125 --source include/galera_wait_ready.inc
126
127 DROP TABLE t1;
128
129 # Restore original auto_increment_offset values.
130 --source ../galera/include/auto_increment_offset_restore.inc