| 1 |
-- source include/have_ndb.inc |
| 2 |
-- source include/have_binlog_format_mixed_or_row.inc |
| 3 |
-- source suite/ndb_rpl/ndb_master-slave.inc |
| 4 |
|
| 5 |
# |
| 6 |
# Bug#28170 replicate-ignore-db=mysql should not ignore mysql.ndb_apply_status |
| 7 |
# |
| 8 |
# Slave is started with --replicate-ignore-db=mysql |
| 9 |
# |
| 10 |
sync_slave_with_master; |
| 11 |
echo *** on slave there should be zero rows ***; |
| 12 |
select count(*) from mysql.ndb_apply_status; |
| 13 |
|
| 14 |
connection master; |
| 15 |
create table t1 (a int key, b int) engine ndb; |
| 16 |
insert into t1 values (1,1); |
| 17 |
echo *** on master it should be empty ***; |
| 18 |
#filter away stuff put there with server_id = 0 (from ndb_restore) |
| 19 |
select * from mysql.ndb_apply_status where server_id <> 0; |
| 20 |
|
| 21 |
sync_slave_with_master; |
| 22 |
|
| 23 |
--echo # |
| 24 |
--echo # Bug#14139386 DDL APPLY SET MYSQL.NDB_APPLY_STATUS EPOCH=0 |
| 25 |
--echo # - check that ndb_apply_status.epoch is not set to 0 by DDL |
| 26 |
--echo # |
| 27 |
# *** |
| 28 |
connection slave; |
| 29 |
select epoch from mysql.ndb_apply_status into @epoch_before_alter; |
| 30 |
|
| 31 |
connection master; |
| 32 |
alter table t1 add key k(b); |
| 33 |
|
| 34 |
sync_slave_with_master; |
| 35 |
select epoch=@epoch_before_alter from mysql.ndb_apply_status; |
| 36 |
|
| 37 |
--echo # Check again with copying alter table |
| 38 |
--source include/rpl_connection_master.inc |
| 39 |
alter table t1 modify b varchar(255); |
| 40 |
|
| 41 |
sync_slave_with_master; |
| 42 |
select epoch=@epoch_before_alter from mysql.ndb_apply_status; |
| 43 |
|
| 44 |
--echo # Check copying alter without any row in ndb_apply_status -> should insert |
| 45 |
--echo # row for source server_id with epoch 0 |
| 46 |
--source include/rpl_connection_slave.inc |
| 47 |
stop replica; |
| 48 |
reset replica; |
| 49 |
select count(*) from mysql.ndb_apply_status; |
| 50 |
|
| 51 |
--source include/rpl_connection_master.inc |
| 52 |
reset master; |
| 53 |
alter table t1 modify b varchar(255); |
| 54 |
|
| 55 |
--source include/rpl_connection_slave.inc |
| 56 |
start replica; |
| 57 |
|
| 58 |
--source include/rpl_connection_master.inc |
| 59 |
sync_slave_with_master; |
| 60 |
select server_id, epoch, log_name from mysql.ndb_apply_status; |
| 61 |
|
| 62 |
# *** |
| 63 |
--echo # End of test for Bug#14139386 |
| 64 |
|
| 65 |
echo *** on slave there should be one row ***; |
| 66 |
select count(*) from mysql.ndb_apply_status; |
| 67 |
|
| 68 |
connection master; |
| 69 |
drop table t1; |
| 70 |
sync_slave_with_master; |
| 71 |
|
| 72 |
connection master; |
| 73 |
--echo *** Test reset slave clearing ndb_apply_status *** |
| 74 |
create table test.t1 (a int primary key) engine=ndb; |
| 75 |
|
| 76 |
insert into test.t1 values (1); |
| 77 |
|
| 78 |
sync_slave_with_master; |
| 79 |
|
| 80 |
connection slave; |
| 81 |
|
| 82 |
--echo Add a dummy entry |
| 83 |
insert into mysql.ndb_apply_status values (999, 9677, 'CaramelLog', 1977, 2015); |
| 84 |
|
| 85 |
select count(1) from mysql.ndb_apply_status; |
| 86 |
|
| 87 |
--echo *** Standard reset slave should clear ndb_apply_status *** |
| 88 |
stop slave; |
| 89 |
reset slave; |
| 90 |
|
| 91 |
select count(1) from mysql.ndb_apply_status; |
| 92 |
|
| 93 |
--connection master |
| 94 |
reset master; |
| 95 |
--source include/rpl_start_slaves.inc |
| 96 |
|
| 97 |
--echo *** Test reset slave all *** |
| 98 |
|
| 99 |
insert into test.t1 values (2); |
| 100 |
|
| 101 |
sync_slave_with_master; |
| 102 |
|
| 103 |
connection slave; |
| 104 |
--echo Add a dummy entry |
| 105 |
insert into mysql.ndb_apply_status values (999, 9677, 'CaramelLog', 1977, 2015); |
| 106 |
|
| 107 |
select count(1) from mysql.ndb_apply_status; |
| 108 |
|
| 109 |
--echo *** Reset slave all should clear ndb_apply_status *** |
| 110 |
stop slave; |
| 111 |
reset slave all; |
| 112 |
|
| 113 |
select count(1) from mysql.ndb_apply_status; |
| 114 |
|
| 115 |
--connection master |
| 116 |
reset master; |
| 117 |
--echo RESET SLAVE ALL zapped Master info - re-set it. |
| 118 |
--let $rpl_unconditional_change_master=1 |
| 119 |
--source include/rpl_change_topology.inc |
| 120 |
--source include/rpl_start_slaves.inc |
| 121 |
|
| 122 |
--connection slave |
| 123 |
|
| 124 |
--echo *** Test effect of ndb_clear_apply_status = 0 *** |
| 125 |
|
| 126 |
set global ndb_clear_apply_status=0; |
| 127 |
|
| 128 |
--connection master |
| 129 |
insert into test.t1 values (3); |
| 130 |
|
| 131 |
sync_slave_with_master; |
| 132 |
|
| 133 |
connection slave; |
| 134 |
|
| 135 |
--echo Add a dummy entry |
| 136 |
insert into mysql.ndb_apply_status values (999, 9677, 'CaramelLog', 1977, 2015); |
| 137 |
|
| 138 |
select count(1) from mysql.ndb_apply_status; |
| 139 |
|
| 140 |
--echo *** Standard reset slave should NOT clear ndb_apply_status *** |
| 141 |
stop slave; |
| 142 |
reset slave; |
| 143 |
|
| 144 |
select count(1) from mysql.ndb_apply_status; |
| 145 |
|
| 146 |
delete from mysql.ndb_apply_status; |
| 147 |
|
| 148 |
--connection master |
| 149 |
reset master; |
| 150 |
--source include/rpl_start_slaves.inc |
| 151 |
|
| 152 |
--connection master |
| 153 |
|
| 154 |
--echo *** Test reset slave all *** |
| 155 |
|
| 156 |
insert into test.t1 values (4); |
| 157 |
|
| 158 |
sync_slave_with_master; |
| 159 |
|
| 160 |
connection slave; |
| 161 |
|
| 162 |
--echo Add a dummy entry |
| 163 |
insert into mysql.ndb_apply_status values (999, 9677, 'CaramelLog', 1977, 2015); |
| 164 |
|
| 165 |
select count(1) from mysql.ndb_apply_status; |
| 166 |
|
| 167 |
--echo *** Reset slave all should NOT clear ndb_apply_status *** |
| 168 |
stop slave; |
| 169 |
reset slave all; |
| 170 |
|
| 171 |
select count(1) from mysql.ndb_apply_status; |
| 172 |
|
| 173 |
--connection master |
| 174 |
reset master; |
| 175 |
--echo RESET SLAVE ALL zapped Master info - re-set it. |
| 176 |
--let $rpl_unconditional_change_master=1 |
| 177 |
--source include/rpl_change_topology.inc |
| 178 |
--source include/rpl_start_slaves.inc |
| 179 |
|
| 180 |
--connection slave |
| 181 |
set global ndb_clear_apply_status=1; |
| 182 |
|
| 183 |
--connection master |
| 184 |
drop table test.t1; |
| 185 |
|
| 186 |
sync_slave_with_master; |
| 187 |
|
| 188 |
|
| 189 |
--source include/rpl_end.inc |