Debian Codegraph @

mysql-test/suite/galera/t/galera_read_only.test

raw
1 --source include/galera_cluster.inc
2 --source include/have_innodb.inc
3
4 #
5 # Ensure that the read_only option does not apply to Galera appliers and that replication
6 # continues, the way MySQL replication would.
7 #
8
9 CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
10
11 --connection node_2
12 SET GLOBAL read_only=TRUE;
13
14 --connection node_1
15 INSERT INTO t1 VALUES (1);
16
17 --connection node_2
18 SELECT COUNT(*) = 1 FROM t1;
19
20 CREATE USER foo@localhost;
21 GRANT ALL ON test.* to foo@localhost;
22
23 --echo # Open connection to node 2 using 'foo' user.
24 --let $port_2= \$NODE_MYPORT_2
25 --connect(foo_node_2,127.0.0.1,foo,,test,$port_2,)
26
27 --echo
28 --echo # Connect with foo_node_2
29 --connection foo_node_2
30 --error ER_OPTION_PREVENTS_STATEMENT
31 INSERT INTO t1 VALUES (2);
32 # Writes to temporary tables are allowed
33 CREATE TEMPORARY TABLE t2(id int not null primary key) engine=innodb;
34 INSERT INTO t2 values (1);
35 DROP TABLE t2;
36
37 --connection node_2
38 SELECT COUNT(*) AS EXPECT_1 FROM t1;
39
40 --connection node_2
41 SET GLOBAL read_only=TRUE;
42 # Writes to temporary tables are allowed
43 CREATE TEMPORARY TABLE t2(id int not null primary key) engine=innodb;
44 INSERT INTO t2 values (1);
45 DROP TABLE t2;
46
47 # Cleanup
48 SET GLOBAL read_only=FALSE;
49 DROP TABLE t1;
50 DROP USER foo@localhost;