| 1 |
include/master-slave.inc |
| 2 |
Warnings: |
| 3 |
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. |
| 4 |
Note #### Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information. |
| 5 |
[connection master] |
| 6 |
create table t1 (a int not null, b int, c int, unique(c)) engine=ndb; |
| 7 |
Insert some records |
| 8 |
Connect to replica and ensure data is there. |
| 9 |
select count(*) from t1; |
| 10 |
count(*) |
| 11 |
1000 |
| 12 |
Make a replica side change |
| 13 |
This can cause uniqueness violations when we replicate data |
| 14 |
insert into t1 values (2001,2001,1001); |
| 15 |
insert into t1 values (2002,2002,1002); |
| 16 |
insert into t1 values (2003,2003,1003); |
| 17 |
Scenario 1 : skipping causes problem with epoch sequence check |
| 18 |
-------------------------------------------------------------- |
| 19 |
Cause a conflict |
| 20 |
insert into t1 values (1001,1001,1001); |
| 21 |
Sync with master, will succeed |
| 22 |
Show that row was not replicated to slave |
| 23 |
select * from t1 where a=1001; |
| 24 |
a b c |
| 25 |
Show that subsequent changes cause an error |
| 26 |
insert into t1 values (3000,3000,3000); |
| 27 |
Expect replication to stop with an error |
| 28 |
include/wait_for_slave_sql_error.inc [errno=1296] |
| 29 |
Data not replicated |
| 30 |
select * from t1 where a=3000; |
| 31 |
a b c |
| 32 |
Simply starting the slave again should be enough |
| 33 |
to move on |
| 34 |
start replica; |
| 35 |
Data now replicated |
| 36 |
select * from t1 where a=3000; |
| 37 |
a b c |
| 38 |
3000 3000 3000 |
| 39 |
Scenario 2 : ndb_applier_allow_skip_epoch avoids slave stop |
| 40 |
----------------------------------------------------------- |
| 41 |
show variables like 'ndb_applier_allow_skip_epoch'; |
| 42 |
Variable_name Value |
| 43 |
ndb_applier_allow_skip_epoch OFF |
| 44 |
set global ndb_applier_allow_skip_epoch = 1; |
| 45 |
show variables like 'ndb_applier_allow_skip_epoch'; |
| 46 |
Variable_name Value |
| 47 |
ndb_applier_allow_skip_epoch ON |
| 48 |
Cause a conflict |
| 49 |
insert into t1 values (1002,1002,1002); |
| 50 |
Sync with master, will succeed |
| 51 |
Show that row was not replicated to slave |
| 52 |
select * from t1 where a=1001; |
| 53 |
a b c |
| 54 |
Show that subsequent changes have no problem |
| 55 |
insert into t1 values (3001,3001,3001); |
| 56 |
Data replicated |
| 57 |
select * from t1 where a=3001; |
| 58 |
a b c |
| 59 |
3001 3001 3001 |
| 60 |
Show that whole epoch is skipped |
| 61 |
-------------------------------- |
| 62 |
Single transaction shown here |
| 63 |
begin; |
| 64 |
update t1 set b=1234 where a < 500; |
| 65 |
update t1 set b=1234, c=1003 where a = 500; |
| 66 |
update t1 set b=1234 where a > 500 and a <= 1000; |
| 67 |
commit; |
| 68 |
select count(1) from t1 where b=1234; |
| 69 |
count(1) |
| 70 |
1000 |
| 71 |
Replica has none of the changes |
| 72 |
select count(1) from t1 where b=1234; |
| 73 |
count(1) |
| 74 |
0 |
| 75 |
select * from t1 where a=500; |
| 76 |
a b c |
| 77 |
500 500 500 |
| 78 |
Show epoch unchanged (diff is zero) |
| 79 |
epoch_diff |
| 80 |
0 |
| 81 |
set global ndb_applier_allow_skip_epoch=0; |
| 82 |
drop table t1; |
| 83 |
include/rpl_end.inc |