Debian Codegraph @

mysql-test/suite/rpl/t/rpl_alter_db.test

raw
1 source include/master-slave.inc;
2
3 --echo ==== Verify that alter database does not stop replication ====
4
5 create database temp_db;
6 use temp_db; # to be different from initial `test' db of mysqltest client
7 show create schema temp_db;
8
9 sync_slave_with_master;
10
11 --source include/rpl_connection_slave.inc
12 show create schema temp_db;
13
14 --echo ==== Replication of default collation ====
15
16 --source include/rpl_connection_master.inc
17 alter database collate latin1_bin;
18 show create schema temp_db;
19
20 sync_slave_with_master;
21
22 --source include/rpl_connection_slave.inc
23 show create schema temp_db;
24
25 --echo ==== Replication of read only ====
26
27 --source include/rpl_connection_master.inc
28 create table temp_db.t(i int);
29 alter schema temp_db read only=1;
30 --error ER_SCHEMA_READ_ONLY
31 insert into temp_db.t values(1);
32 show create schema temp_db;
33
34 sync_slave_with_master;
35
36 --source include/rpl_connection_slave.inc
37 --error ER_SCHEMA_READ_ONLY
38 insert into temp_db.t values(2);
39 show create schema temp_db;
40
41 --source include/rpl_connection_master.inc
42 alter schema temp_db read only=0;
43 insert into temp_db.t values(1);
44 show create schema temp_db;
45
46 sync_slave_with_master;
47
48 --source include/rpl_connection_slave.inc
49 show create schema temp_db;
50 insert into temp_db.t values(2);
51 select * from temp_db.t;
52 show create schema temp_db;
53
54 --echo ==== No replication of read only when turning off binlog ====
55
56 --source include/rpl_connection_master.inc
57 drop table temp_db.t;
58 create table temp_db.t(i int);
59 set sql_log_bin = 0;
60 alter schema temp_db read only=1;
61 set sql_log_bin = 1;
62 show create schema temp_db;
63 --error ER_SCHEMA_READ_ONLY
64 insert into temp_db.t values(1);
65
66 sync_slave_with_master;
67
68 --source include/rpl_connection_slave.inc
69 show create schema temp_db;
70 insert into temp_db.t values(2);
71 select * from temp_db.t;
72
73 --source include/rpl_connection_master.inc
74 set sql_log_bin = 0;
75 alter schema temp_db read only=0;
76 set sql_log_bin = 1;
77 alter schema temp_db read only=1 collate utf8mb4_0900_ai_ci;
78 show create schema temp_db;
79
80 sync_slave_with_master;
81
82 --source include/rpl_connection_slave.inc
83 select * from temp_db.t;
84 show create schema temp_db;
85
86 --echo ==== Slave schema read only will not affect replication ====
87
88 --source include/rpl_connection_master.inc
89 set sql_log_bin = 0;
90 alter schema temp_db read only=0;
91 set sql_log_bin = 1;
92 alter schema temp_db collate latin1_bin;
93 show create schema temp_db;
94
95 drop table temp_db.t;
96 create table temp_db.t(i int);
97 insert into temp_db.t values(1);
98
99 sync_slave_with_master;
100
101 --source include/rpl_connection_slave.inc
102 show create schema temp_db;
103 --error ER_SCHEMA_READ_ONLY
104 insert into temp_db.t values(2);
105 select * from temp_db.t;
106
107 --echo ==== Clean up ====
108 --source include/rpl_connection_master.inc
109 drop database temp_db;
110 --source include/sync_slave_sql_with_master.inc
111 --source include/rpl_end.inc