| 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 (pk int primary key, uk int not null, unique(uk)) engine=ndb; |
| 7 |
insert into t1 values (1,1); |
| 8 |
insert into t1 values (2,2); |
| 9 |
insert into t1 values (3,3); |
| 10 |
insert into t1 values (4,4); |
| 11 |
insert into t1 values (5,5); |
| 12 |
select * from t1 where uk in (1,2,3,4,5); |
| 13 |
pk uk |
| 14 |
1 1 |
| 15 |
2 2 |
| 16 |
3 3 |
| 17 |
4 4 |
| 18 |
5 5 |
| 19 |
update t1 set uk=uk-1 order by pk; |
| 20 |
select * from t1 where uk in (0,1,2,3,4); |
| 21 |
pk uk |
| 22 |
1 0 |
| 23 |
2 1 |
| 24 |
3 2 |
| 25 |
4 3 |
| 26 |
5 4 |
| 27 |
Master table contents |
| 28 |
select * from t1 order by pk; |
| 29 |
pk uk |
| 30 |
1 0 |
| 31 |
2 1 |
| 32 |
3 2 |
| 33 |
4 3 |
| 34 |
5 4 |
| 35 |
flush logs; |
| 36 |
Slave table contents |
| 37 |
select * from t1 order by pk; |
| 38 |
pk uk |
| 39 |
1 0 |
| 40 |
2 1 |
| 41 |
3 2 |
| 42 |
4 3 |
| 43 |
5 4 |
| 44 |
select * from t1 where uk in (0,1,2,3,4); |
| 45 |
pk uk |
| 46 |
1 0 |
| 47 |
2 1 |
| 48 |
3 2 |
| 49 |
4 3 |
| 50 |
5 4 |
| 51 |
drop table t1; |
| 52 |
CREATE TABLE t1 (a int not null, |
| 53 |
b int auto_increment, |
| 54 |
uk int null, primary key(a,b), unique(uk)) |
| 55 |
engine=ndb partition by key(a); |
| 56 |
CREATE TABLE t2 (a int not null auto_increment primary key) engine = ndb; |
| 57 |
begin; |
| 58 |
insert into t1 values (1,null,1), (1,null, 2), (1,null, 3), (1,null, 4); |
| 59 |
insert into t2 values (null), (null), (null), (null); |
| 60 |
insert into t2 select null from t2; |
| 61 |
insert into t2 select null from t2; |
| 62 |
insert into t2 select null from t2; |
| 63 |
insert into t2 select null from t2; |
| 64 |
insert into t2 select null from t2; |
| 65 |
insert into t2 select null from t2; |
| 66 |
insert into t2 select null from t2; |
| 67 |
insert into t2 select null from t2; |
| 68 |
commit; |
| 69 |
select count(*) from t1; |
| 70 |
count(*) |
| 71 |
4 |
| 72 |
select count(*) from t2; |
| 73 |
count(*) |
| 74 |
1024 |
| 75 |
select count(*) from t1; |
| 76 |
count(*) |
| 77 |
4 |
| 78 |
select count(*) from t2; |
| 79 |
count(*) |
| 80 |
1024 |
| 81 |
drop table t1; |
| 82 |
drop table t2; |
| 83 |
Test that real uniqeuness constraint violations are detected |
| 84 |
when replicating |
| 85 |
create table t1 (a int primary key, b int, c int, unique(c)) engine=ndb; |
| 86 |
insert into t1 values (1,1,1), (2,2,2), (3,3,3), (4,4,4), (5,5,5), (6,6,6); |
| 87 |
Modify replica so that there can be conflicts in replication |
| 88 |
insert into t1 values (11,11,11), (12,12,12), (13,13,13), (14,14,14); |
| 89 |
call mtr.add_suppression(".*duplicate key in table.*"); |
| 90 |
call mtr.add_suppression(".*Duplicate key on write or update.*"); |
| 91 |
call mtr.add_suppression(".*duplicate value in unique index.*"); |
| 92 |
call mtr.add_suppression(".*coordinator and worker threads are stopped.*"); |
| 93 |
Single insert |
| 94 |
insert into t1 values (7,7,11); |
| 95 |
include/wait_for_slave_sql_error.inc [errno=1022] |
| 96 |
delete from t1 where c=11; |
| 97 |
start replica; |
| 98 |
Single update |
| 99 |
update t1 set c=12 where a=2; |
| 100 |
include/wait_for_slave_sql_error.inc [errno=1022] |
| 101 |
delete from t1 where c=12; |
| 102 |
start replica; |
| 103 |
Check blob handling |
| 104 |
create table t2 (a int primary key, b text, c int, unique(c)) engine=ndb; |
| 105 |
insert into t2 values (1, repeat('VRA', 10000),1); |
| 106 |
insert into t2 values (2, repeat('VRA', 10000),2); |
| 107 |
insert into t2 values (3, repeat('VRA', 10000),3); |
| 108 |
insert into t2 values (4, repeat('VRA', 10000),4); |
| 109 |
insert into t2 values (5, repeat('VRA', 10000),5); |
| 110 |
insert into t2 values (6, repeat('VRA', 10000),6); |
| 111 |
insert into t2 values (7, repeat('VRA', 10000),7); |
| 112 |
insert into t2 values (8, repeat('VRA', 10000),8); |
| 113 |
insert into t2 values (9, repeat('VRA', 10000),9); |
| 114 |
insert into t2 values (11, repeat('VRA', 10000), 11); |
| 115 |
update t2 set b=repeat('GEO', 20000), c=c+10 order by c desc; |
| 116 |
include/wait_for_slave_sql_error.inc [errno=1022] |
| 117 |
delete from t2 where c=11; |
| 118 |
start replica; |
| 119 |
drop table t1; |
| 120 |
drop table t2; |
| 121 |
include/rpl_end.inc |