| 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 |
CREATE TABLE mysql.ndb_replication |
| 6 |
(db VARBINARY(63), |
| 7 |
table_name VARBINARY(63), |
| 8 |
server_id INT UNSIGNED, |
| 9 |
binlog_type INT UNSIGNED, |
| 10 |
conflict_fn VARBINARY(128), |
| 11 |
PRIMARY KEY USING HASH (db,table_name,server_id)) |
| 12 |
ENGINE=NDB PARTITION BY KEY(db,table_name); |
| 13 |
|
| 14 |
--echo Log update-as-update |
| 15 |
insert into mysql.ndb_replication values ("test", "t1", 0, 7, NULL); |
| 16 |
|
| 17 |
|
| 18 |
--echo Create table with one row missing on slave |
| 19 |
|
| 20 |
create table test.t1 (a int primary key, b int) engine=ndb; |
| 21 |
|
| 22 |
insert into test.t1 values (3,3), (4,4); |
| 23 |
|
| 24 |
select * from test.t1 order by a; |
| 25 |
|
| 26 |
--sync_slave_with_master |
| 27 |
|
| 28 |
--connection slave |
| 29 |
|
| 30 |
delete from test.t1 where a=4; |
| 31 |
|
| 32 |
select * from test.t1 order by a; |
| 33 |
|
| 34 |
--echo Now create epoch transaction at master with 1 applicable and |
| 35 |
--echo n unapplicable operations |
| 36 |
--echo We hope that at least some of the unapplicable operations |
| 37 |
--echo will run in the same batch as the applicable one (so attempting |
| 38 |
--echo to get a COMMIT_ACK_MARKER), but will have their error handling |
| 39 |
--echo run afterwards. |
| 40 |
|
| 41 |
--connection master |
| 42 |
|
| 43 |
let $update_count=100; |
| 44 |
|
| 45 |
begin; |
| 46 |
update test.t1 set b=30 where a=3; # OK |
| 47 |
update test.t1 set b=40 where a=4; # Will fail |
| 48 |
commit; |
| 49 |
|
| 50 |
--disable_query_log |
| 51 |
while ($update_count) |
| 52 |
{ |
| 53 |
update test.t1 set b=4 where a=4; |
| 54 |
update test.t1 set b=40 where a=4; |
| 55 |
dec $update_count; |
| 56 |
} |
| 57 |
--enable_query_log |
| 58 |
|
| 59 |
--sync_slave_with_master |
| 60 |
|
| 61 |
--connection slave |
| 62 |
|
| 63 |
select * from test.t1 order by a; |
| 64 |
|
| 65 |
--echo Wait for LQH + TC Commit Ack Marker count to get to zero. |
| 66 |
--source suite/ndb_rpl/t/ndb_wait_for_zero_commit_ack_markers.inc |
| 67 |
--echo OK |
| 68 |
|
| 69 |
|
| 70 |
--echo Abort cleanup check |
| 71 |
begin; |
| 72 |
delete from test.t1; |
| 73 |
rollback; |
| 74 |
|
| 75 |
--echo Wait for LQH + TC Commit Ack Marker count to get to zero. |
| 76 |
--source suite/ndb_rpl/t/ndb_wait_for_zero_commit_ack_markers.inc |
| 77 |
--echo OK |
| 78 |
|
| 79 |
|
| 80 |
--echo Batched and multi-batch commit cleanup test |
| 81 |
begin; |
| 82 |
insert into test.t1 values (6,6),(7,7),(8,8),(9,9),(10,10); |
| 83 |
insert into test.t1 values (11,11); |
| 84 |
insert into test.t1 values (12,12); |
| 85 |
commit; |
| 86 |
|
| 87 |
--echo Wait for LQH + TC Commit Ack Marker count to get to zero. |
| 88 |
--source suite/ndb_rpl/t/ndb_wait_for_zero_commit_ack_markers.inc |
| 89 |
--echo OK |
| 90 |
|
| 91 |
--echo Cleanup |
| 92 |
|
| 93 |
--connection master |
| 94 |
drop table test.t1; |
| 95 |
drop table mysql.ndb_replication; |
| 96 |
|
| 97 |
--sync_slave_with_master |
| 98 |
|
| 99 |
--source include/rpl_end.inc |