| 1 |
--source include/have_ndb.inc |
| 2 |
--source suite/ndb_rpl/ndb_master-slave.inc |
| 3 |
|
| 4 |
connection master; |
| 5 |
CREATE TABLE t1 (a int key, b int) ENGINE=NDB; |
| 6 |
sync_slave_with_master; |
| 7 |
SHOW TABLES; |
| 8 |
|
| 9 |
# Lose the events from the slave binary log: there is no |
| 10 |
# need to re-create the table on the master. |
| 11 |
connection slave; |
| 12 |
RESET MASTER; |
| 13 |
|
| 14 |
# Insert some values on the slave and master |
| 15 |
connection master; |
| 16 |
INSERT INTO t1 VALUES (1,2); |
| 17 |
# Switch to slave once event is applied and insert a row |
| 18 |
sync_slave_with_master; |
| 19 |
connection slave; |
| 20 |
INSERT INTO t1 VALUES (2,3); |
| 21 |
|
| 22 |
# ... it is now very probable that we have a mixed event in the binary |
| 23 |
# log. If we don't, the test should still pass, but will not test the |
| 24 |
# mixed event situation. |
| 25 |
|
| 26 |
# The statement is disabled since it cannot reliably show the same |
| 27 |
# info all the time. Use it for debug purposes. |
| 28 |
|
| 29 |
#SHOW BINLOG EVENTS; |
| 30 |
|
| 31 |
# Replicate back to the master to test this mixed event on the master |
| 32 |
STOP SLAVE; |
| 33 |
|
| 34 |
--let $rpl_topology= 1->2->1 |
| 35 |
--source include/rpl_change_topology.inc |
| 36 |
connection master; |
| 37 |
|
| 38 |
START SLAVE; |
| 39 |
|
| 40 |
connection slave; |
| 41 |
sync_slave_with_master master; |
| 42 |
|
| 43 |
# The statement is disabled since it cannot reliably show the same |
| 44 |
# info all the time. Use it for debug purposes. |
| 45 |
|
| 46 |
#SHOW BINLOG EVENTS; |
| 47 |
|
| 48 |
# Wait for slave threads to start before SHOWing status |
| 49 |
--source include/wait_for_slave_to_start.inc |
| 50 |
|
| 51 |
# Check that there is no error in replication |
| 52 |
source include/check_slave_is_running.inc; |
| 53 |
|
| 54 |
# Check that we have the data on the master |
| 55 |
SELECT * FROM t1 ORDER BY a; |
| 56 |
|
| 57 |
# We should now have another mixed event, likely with "slave" server |
| 58 |
# id last, and with the STMT_END_F flag set. |
| 59 |
|
| 60 |
# The statement is disabled since it cannot reliably show the same |
| 61 |
# info all the time. Use it for debug purposes. |
| 62 |
|
| 63 |
#SHOW BINLOG EVENTS; |
| 64 |
|
| 65 |
# now lets see that this data is applied correctly on the slave |
| 66 |
STOP SLAVE; |
| 67 |
save_master_pos; |
| 68 |
|
| 69 |
connection slave; |
| 70 |
START SLAVE; |
| 71 |
|
| 72 |
# check that we have the data on the slave |
| 73 |
sync_with_master; |
| 74 |
SELECT * FROM t1 ORDER BY a; |
| 75 |
|
| 76 |
# Wait for slave threads to start before SHOWing status |
| 77 |
--source include/wait_for_slave_to_start.inc |
| 78 |
|
| 79 |
# Check that there is no error in replication |
| 80 |
source include/check_slave_is_running.inc; |
| 81 |
|
| 82 |
-- connection master |
| 83 |
DROP TABLE t1; |
| 84 |
-- sync_slave_with_master |
| 85 |
|
| 86 |
--let $rpl_only_running_threads= 1 |
| 87 |
--source include/rpl_end.inc |