| 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 ( |
| 7 |
a int not null, |
| 8 |
b int, |
| 9 |
c int, |
| 10 |
unique(c) |
| 11 |
) engine=NDB; |
| 12 |
insert into t1 values(1000, 1000, 1000); |
| 13 |
insert into t1 values(999, 999, 999); |
| 14 |
insert into t1 values(998, 998, 998); |
| 15 |
insert into t1 values(997, 997, 997); |
| 16 |
include/sync_slave_sql_with_master.inc |
| 17 |
select count(*) from t1; |
| 18 |
count(*) |
| 19 |
4 |
| 20 |
# Add rows on replica, used for causing uniqueness violation |
| 21 |
insert into t1 values (2001,2001,1001); |
| 22 |
insert into t1 values (2002,2002,1002); |
| 23 |
insert into t1 values (2003,2003,1003); |
| 24 |
# Replica is configured to skip unique key violation error |
| 25 |
SELECT @@GLOBAL.replica_skip_errors; |
| 26 |
@@GLOBAL.replica_skip_errors |
| 27 |
1022 |
| 28 |
# Configure the ndbcluster plugin to not verify epoch sequence |
| 29 |
set global ndb_applier_allow_skip_epoch = 1; |
| 30 |
[connection master] |
| 31 |
# Cause a conflict |
| 32 |
insert into t1 values (1002,1002,1002); |
| 33 |
# Show the binlog events that will cause error. All the Write_rows events |
| 34 |
# will be batched and not send to NDB until the final Query_log_event |
| 35 |
# containing the COMMIT, that's when the error should be skipped |
| 36 |
include/show_binlog_events.inc |
| 37 |
Log_name Pos Event_type Server_id End_log_pos Info |
| 38 |
master-bin.000001 # Query # # BEGIN |
| 39 |
master-bin.000001 # Table_map # # table_id: # (test.t1) |
| 40 |
master-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) |
| 41 |
master-bin.000001 # Write_rows # # table_id: # |
| 42 |
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F |
| 43 |
master-bin.000001 # Query # # COMMIT |
| 44 |
# Sync with master, will succeed |
| 45 |
include/sync_slave_sql_with_master.inc |
| 46 |
# Show that row change was skipped on replica |
| 47 |
select * from t1 where a=1002; |
| 48 |
a b c |
| 49 |
# Show that subsequent changes are replicated |
| 50 |
[connection master] |
| 51 |
insert into t1 values (3001,3001,3001); |
| 52 |
include/sync_slave_sql_with_master.inc |
| 53 |
select * from t1 where a=3001; |
| 54 |
a b c |
| 55 |
3001 3001 3001 |
| 56 |
set global ndb_applier_allow_skip_epoch=0; |
| 57 |
[connection master] |
| 58 |
drop table t1; |
| 59 |
include/rpl_end.inc |