| 1 |
connection node_2; |
| 2 |
connection node_1; |
| 3 |
CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB; |
| 4 |
connection node_2; |
| 5 |
SET GLOBAL read_only=TRUE; |
| 6 |
connection node_1; |
| 7 |
INSERT INTO t1 VALUES (1); |
| 8 |
connection node_2; |
| 9 |
SELECT COUNT(*) = 1 FROM t1; |
| 10 |
COUNT(*) = 1 |
| 11 |
1 |
| 12 |
CREATE USER foo@localhost; |
| 13 |
GRANT ALL ON test.* to foo@localhost; |
| 14 |
# Open connection to node 2 using 'foo' user. |
| 15 |
connect foo_node_2,127.0.0.1,foo,,test,$port_2,; |
| 16 |
|
| 17 |
# Connect with foo_node_2 |
| 18 |
connection foo_node_2; |
| 19 |
INSERT INTO t1 VALUES (2); |
| 20 |
ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement |
| 21 |
CREATE TEMPORARY TABLE t2(id int not null primary key) engine=innodb; |
| 22 |
INSERT INTO t2 values (1); |
| 23 |
DROP TABLE t2; |
| 24 |
connection node_2; |
| 25 |
SELECT COUNT(*) AS EXPECT_1 FROM t1; |
| 26 |
EXPECT_1 |
| 27 |
1 |
| 28 |
connection node_2; |
| 29 |
SET GLOBAL read_only=TRUE; |
| 30 |
CREATE TEMPORARY TABLE t2(id int not null primary key) engine=innodb; |
| 31 |
INSERT INTO t2 values (1); |
| 32 |
DROP TABLE t2; |
| 33 |
SET GLOBAL read_only=FALSE; |
| 34 |
DROP TABLE t1; |
| 35 |
DROP USER foo@localhost; |