| 1 |
-- source include/have_multi_ndb.inc |
| 2 |
-- source include/have_binlog_format_mixed_or_row.inc |
| 3 |
|
| 4 |
# Dummy table create/drop to avoid a race where table is created |
| 5 |
# before event subscription is set up, causing test failure (BUG#20677). |
| 6 |
connection server2; |
| 7 |
CREATE TABLE t3 (dummy INT PRIMARY KEY) ENGINE = NDB; |
| 8 |
connection server1; |
| 9 |
DROP TABLE t3; |
| 10 |
|
| 11 |
# reset for test |
| 12 |
connection server1; |
| 13 |
reset master; |
| 14 |
connection server2; |
| 15 |
reset master; |
| 16 |
|
| 17 |
# |
| 18 |
# basic test to see if one server sees the table from the other |
| 19 |
# and sets up the replication correctly |
| 20 |
# |
| 21 |
|
| 22 |
# create table on the other server |
| 23 |
connection server2; |
| 24 |
CREATE TABLE t2 (a INT PRIMARY KEY, b int) ENGINE = NDB; |
| 25 |
|
| 26 |
# insert something on server2 |
| 27 |
INSERT INTO t2 VALUES (1,1),(2,2); |
| 28 |
# verify that we get the data in the binlog |
| 29 |
--source include/show_binlog_events.inc |
| 30 |
select * from t2 order by a; |
| 31 |
SELECT epoch FROM |
| 32 |
mysql.ndb_binlog_index ORDER BY epoch DESC LIMIT 1 into @the_epoch; |
| 33 |
--replace_column 1 <the_epoch> |
| 34 |
SELECT @the_epoch,inserts,updates,deletes,schemaops FROM |
| 35 |
mysql.ndb_binlog_index ORDER BY epoch DESC LIMIT 1; |
| 36 |
let $the_epoch= `SELECT @the_epoch`; |
| 37 |
|
| 38 |
# see if we got something on server1 |
| 39 |
connection server1; |
| 40 |
SELECT * FROM t2 ORDER BY a; |
| 41 |
# doing drop table will ensure that all the events have been received |
| 42 |
DROP TABLE t2; |
| 43 |
# verify thar we have table and data in binlog |
| 44 |
--source include/show_binlog_events.inc |
| 45 |
--replace_result $the_epoch <the_epoch> |
| 46 |
eval SELECT inserts,updates,deletes,schemaops FROM |
| 47 |
mysql.ndb_binlog_index WHERE epoch=$the_epoch; |
| 48 |
|
| 49 |
# reset for next test |
| 50 |
connection server1; |
| 51 |
reset master; |
| 52 |
connection server2; |
| 53 |
reset master; |
| 54 |
|
| 55 |
# single schema ops will not show |
| 56 |
connection server2; |
| 57 |
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE = NDB; |
| 58 |
INSERT INTO t1 VALUES (1),(2); |
| 59 |
--source include/show_binlog_events.inc |
| 60 |
select epoch FROM |
| 61 |
mysql.ndb_binlog_index ORDER BY epoch DESC LIMIT 1 into @the_epoch2; |
| 62 |
--replace_column 1 <the_epoch2> |
| 63 |
SELECT @the_epoch2,inserts,updates,deletes,schemaops FROM |
| 64 |
mysql.ndb_binlog_index ORDER BY epoch DESC LIMIT 1; |
| 65 |
let $the_epoch2= `SELECT @the_epoch2`; |
| 66 |
|
| 67 |
--replace_result $the_epoch <the_epoch> $the_epoch2 <the_epoch2> |
| 68 |
eval SELECT inserts,updates,deletes,schemaops FROM |
| 69 |
mysql.ndb_binlog_index WHERE epoch > $the_epoch AND epoch <= $the_epoch2; |
| 70 |
|
| 71 |
# now see that we have the events on the other server |
| 72 |
connection server2; |
| 73 |
# doing drop table will ensure that all the events have been received |
| 74 |
drop table t1; |
| 75 |
# verify thar we have table and data in binlog |
| 76 |
--source include/show_binlog_events.inc |
| 77 |
--replace_result $the_epoch <the_epoch> $the_epoch2 <the_epoch2> |
| 78 |
eval SELECT inserts,updates,deletes,schemaops FROM |
| 79 |
mysql.ndb_binlog_index WHERE epoch > $the_epoch AND epoch <= $the_epoch2; |