ndb_binlog_multi.test 2.35 KB
Newer Older
unknown's avatar
unknown committed
1 2 3 4 5 6 7 8 9 10 11
-- source include/have_ndb.inc
-- source include/have_multi_ndb.inc
-- source include/have_binlog_format_row.inc

--disable_warnings
connection server2;
drop table if exists t1,t2;
connection server1;
drop table if exists t1,t2;
--enable_warnings

12 13 14 15 16 17
# reset for test
connection server1;
reset master;
connection server2;
reset master;

unknown's avatar
unknown committed
18 19 20 21 22 23 24 25 26 27 28
#
# basic test to see if one server sees the table from the other
# and sets up the replication correctly
#

# create table on the other server
connection server2;
CREATE TABLE t2 (a INT PRIMARY KEY, b int) ENGINE = NDB;

# insert something on server2
INSERT INTO t2 VALUES (1,1),(2,2);
29 30
# verify that we get the data in the binlog
--source include/show_binlog_events.inc
unknown's avatar
unknown committed
31 32 33
select * from t2 order by a;
--replace_column 1 <the_epoch>
SELECT @the_epoch:=epoch,inserts,updates,deletes,schemaops FROM 
34
  cluster.binlog_index ORDER BY epoch DESC LIMIT 1;
unknown's avatar
unknown committed
35 36 37 38 39
let $the_epoch= `SELECT @the_epoch`;

# see if we got something on server1
connection server1;
SELECT * FROM t2 ORDER BY a;
40 41 42 43
# doing drop table will ensure that all the events have been received
DROP TABLE t2;
# verify thar we have table and data in binlog
--source include/show_binlog_events.inc
unknown's avatar
unknown committed
44 45
--replace_result $the_epoch <the_epoch>
eval SELECT inserts,updates,deletes,schemaops FROM 
46
  cluster.binlog_index WHERE epoch=$the_epoch;
unknown's avatar
unknown committed
47

48 49 50 51 52 53
# reset for next test
connection server1;
reset master;
connection server2;
reset master;

54
# single schema ops will not show
55
connection server2;
unknown's avatar
unknown committed
56 57
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE = NDB;
INSERT INTO t1 VALUES (1),(2);
58
--source include/show_binlog_events.inc
unknown's avatar
unknown committed
59 60
--replace_column 1 <the_epoch2>
SELECT @the_epoch2:=epoch,inserts,updates,deletes,schemaops FROM 
61
  cluster.binlog_index ORDER BY epoch DESC LIMIT 1;
unknown's avatar
unknown committed
62 63 64 65
let $the_epoch2= `SELECT @the_epoch2`;

--replace_result $the_epoch <the_epoch> $the_epoch2 <the_epoch2>
eval SELECT inserts,updates,deletes,schemaops FROM
66
   cluster.binlog_index WHERE epoch > $the_epoch AND epoch <= $the_epoch2;
unknown's avatar
unknown committed
67

68
# now see that we have the events on the other server
unknown's avatar
unknown committed
69
connection server2;
70 71 72 73
# doing drop table will ensure that all the events have been received
drop table t1;
# verify thar we have table and data in binlog
--source include/show_binlog_events.inc
unknown's avatar
unknown committed
74 75
--replace_result $the_epoch <the_epoch> $the_epoch2 <the_epoch2>
eval SELECT inserts,updates,deletes,schemaops FROM
76
   cluster.binlog_index WHERE epoch > $the_epoch AND epoch <= $the_epoch2;