2 --source suite/ndb_rpl/t/ndb_conflict_info_init.inc
6 --eval create
table t1 (a
int, b varchar(32), X $col_type, d varchar(9), primary key (a, d)) engine ndb
7 create
table t2 (a
int key, b varchar(32), c
int unsigned, d varchar(9)) engine ndb;
9 --echo ************************************************
10 --echo * some basic positive testing,
i.e. no conflicts
11 --echo ************************************************
13 --echo *** insert some data
15 insert into t1 values (1, "Master t1 a=1 at X=1", 1, '1');
16 insert into t1 values (2, "Master t1 a=2 at X=1", 1, '12');
17 insert into t1 values (3, "Master t1 a=3 at X=1", 1, '123');
18 insert into t2 values (1, "Master t2 a=1 at c=1", 1, '1');
19 insert into t2 values (2, "Master t2 a=2 at c=1", 1, '12');
20 insert into t2 values (3, "Master t2 a=3 at c=1", 1, '123');
22 --sync_slave_with_master
24 --echo *** master - update all
27 update t1 set b="Master t1 X=2", X=X+1;
28 update t2 set b="Master t2 c=2", c=c+1;
30 --echo *** slave - check update all
31 --sync_slave_with_master
33 select * from t1 order by a, d;
34 select * from t2 order by a, d;
35 --source suite/ndb_rpl/t/ndb_conflict_info.inc
37 --echo *** master - update 2 rows in different tables
39 update t1 set b="Master t1 a=2 at X=3", X=X+1 where a=2;
40 update t2 set b="Master t2 a=3 at c=3", c=c+1 where a=3;
41 --echo *** slave - check update 2 rows in different tables
42 --sync_slave_with_master
44 select * from t1 order by a, d;
45 select * from t2 order by a, d;
46 --source suite/ndb_rpl/t/ndb_conflict_info.inc
48 --echo *** master - delete all
52 --echo *** slave - check delete all
53 --sync_slave_with_master
55 select * from t1 order by a, d;
56 select * from t2 order by a, d;
57 --source suite/ndb_rpl/t/ndb_conflict_info.inc
58 --source suite/ndb_rpl/t/ndb_conflict_info_init.inc
60 --echo ************************
61 --echo * start conflict testing
62 --echo ************************
63 --echo *** master - insert some data
66 insert into t1 values (1, "Master t1 a=1 at X=10", 10, '111');
67 insert into t1 values (2, "Master t1 a=2 at X=10", 10, '111222');
68 insert into t1 values (3, "Master t1 a=3 at X=10", 10, '111222333');
69 insert into t1 values (4, "Master t1 a=4 at X=10", 10, '111222333');
70 insert into t2 values (1, "Master t2 a=1 at c=10", 10, '111');
71 insert into t2 values (2, "Master t2 a=2 at c=10", 10, '111222');
72 insert into t2 values (3, "Master t2 a=3 at c=10", 10, '111222333');
73 insert into t2 values (4, "Master t2 a=4 at c=10", 10, '111222333');
76 --echo *** slave - check conflict info, no conflicts yet
77 --sync_slave_with_master
79 --source suite/ndb_rpl/t/ndb_conflict_info.inc
81 --echo *** slave - check insert some data
82 select * from t1 order by a, d;
83 select * from t2 order by a, d;
85 --echo *** slave - update some data
to cause conflicts
87 update t1 set b="Slave t1 a=1 at X=12", X=12 where a=1 and d='111';
88 update t1 set b="Slave t1 a=2 at X=12", X=12 where a=2 and d='111222';
89 update t1 set b="Slave t1 a=3 at X=12", X=12 where a=3 and d='111222333';
90 update t1 set b="Slave t1 a=4 at X=12", X=12 where a=4 and d='111222333';
91 update t2 set b="Slave t2 a=1 at c=12", c=12 where a=1;
92 update t2 set b="Slave t2 a=2 at c=12", c=12 where a=2;
93 update t2 set b="Slave t2 a=3 at c=12", c=12 where a=3;
94 update t2 set b="Slave t2 a=4 at c=12", c=12 where a=4;
97 --echo *** master - update some data
to cause conflicts
100 update t1 set b="Master t1 a=1 at X=11", X=11 where a=1 and d='111';
101 update t1 set b="Master t1 a=2 at X=11", X=11 where a=2 and d='111222';
102 update t1 set b="Master t1 a=3 at X=11", X=11 where a=3 and d='111222333';
103 delete from t1 where a = 4;
104 update t2 set b="Master t2 a=1 at c=11", c=11 where a=1;
105 update t2 set b="Master t2 a=2 at c=11", c=11 where a=2;
106 update t2 set b="Master t2 a=3 at c=11", c=11 where a=3;
107 delete from t2 where a = 4;
110 --echo *** slave - check conflict info, there should be some
111 --sync_slave_with_master
113 --source suite/ndb_rpl/t/ndb_conflict_info.inc
115 --echo *** slave - check update some data that causes conflicts
116 select * from t1 order by a, d;
117 select * from t2 order by a, d;
118 --echo *** slave - correct some data
to correspond
to the master
119 update t1 set b="Slave t1 a=1 at X=11", X=11 where a=1 and d='111';
120 delete from t1 where a = 4;
122 --echo *** master - update some data, use higher timestamp
125 update t1 set b="Master t1 a=1 at X=13", X=13 where a=1 and d='111';
126 update t1 set b="Master t1 a=2 at X=13", X=13 where a=2 and d='111222';
127 update t1 set b="Master t1 a=3 at X=13", X=13 where a=3 and d='111222333';
128 update t2 set b="Master t2 a=1 at c=13", c=13 where a=1;
129 update t2 set b="Master t2 a=2 at c=13", c=13 where a=2;
130 update t2 set b="Master t2 a=3 at c=13", c=13 where a=3;
133 --echo *** slave - check conflict info, change depends on calling
test
134 --sync_slave_with_master
136 --source suite/ndb_rpl/t/ndb_conflict_info.inc
138 --echo *** slave - check higer timestamp
139 select * from t1 order by a, d;
140 select * from t2 order by a, d;