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 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
|
source include/master-slave.inc;
--echo ==== Verify that alter database does not stop replication ====
create database temp_db;
use temp_db; # to be different from initial `test' db of mysqltest client
show create schema temp_db;
sync_slave_with_master;
--source include/rpl_connection_slave.inc
show create schema temp_db;
--echo ==== Replication of default collation ====
--source include/rpl_connection_master.inc
alter database collate latin1_bin;
show create schema temp_db;
sync_slave_with_master;
--source include/rpl_connection_slave.inc
show create schema temp_db;
--echo ==== Replication of read only ====
--source include/rpl_connection_master.inc
create table temp_db.t(i int);
alter schema temp_db read only=1;
--error ER_SCHEMA_READ_ONLY
insert into temp_db.t values(1);
show create schema temp_db;
sync_slave_with_master;
--source include/rpl_connection_slave.inc
--error ER_SCHEMA_READ_ONLY
insert into temp_db.t values(2);
show create schema temp_db;
--source include/rpl_connection_master.inc
alter schema temp_db read only=0;
insert into temp_db.t values(1);
show create schema temp_db;
sync_slave_with_master;
--source include/rpl_connection_slave.inc
show create schema temp_db;
insert into temp_db.t values(2);
select * from temp_db.t;
show create schema temp_db;
--echo ==== No replication of read only when turning off binlog ====
--source include/rpl_connection_master.inc
drop table temp_db.t;
create table temp_db.t(i int);
set sql_log_bin = 0;
alter schema temp_db read only=1;
set sql_log_bin = 1;
show create schema temp_db;
--error ER_SCHEMA_READ_ONLY
insert into temp_db.t values(1);
sync_slave_with_master;
--source include/rpl_connection_slave.inc
show create schema temp_db;
insert into temp_db.t values(2);
select * from temp_db.t;
--source include/rpl_connection_master.inc
set sql_log_bin = 0;
alter schema temp_db read only=0;
set sql_log_bin = 1;
alter schema temp_db read only=1 collate utf8mb4_0900_ai_ci;
show create schema temp_db;
sync_slave_with_master;
--source include/rpl_connection_slave.inc
select * from temp_db.t;
show create schema temp_db;
--echo ==== Slave schema read only will not affect replication ====
--source include/rpl_connection_master.inc
set sql_log_bin = 0;
alter schema temp_db read only=0;
set sql_log_bin = 1;
alter schema temp_db collate latin1_bin;
show create schema temp_db;
drop table temp_db.t;
create table temp_db.t(i int);
insert into temp_db.t values(1);
sync_slave_with_master;
--source include/rpl_connection_slave.inc
show create schema temp_db;
--error ER_SCHEMA_READ_ONLY
insert into temp_db.t values(2);
select * from temp_db.t;
--echo ==== Clean up ====
--source include/rpl_connection_master.inc
drop database temp_db;
--source include/sync_slave_sql_with_master.inc
--source include/rpl_end.inc
|