ndb_binlog_multi.test 1.98 KB
Newer Older
tomas@poseidon.ndb.mysql.com's avatar
tomas@poseidon.ndb.mysql.com committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
-- 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

#
# basic test to see if one server sees the table from the other
# and sets up the replication correctly
#

17
# no tables and nothing in cluster.binlog_index;
tomas@poseidon.ndb.mysql.com's avatar
tomas@poseidon.ndb.mysql.com committed
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
connection server1;
SHOW TABLES;

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

# make sure the first mysql server knows about this table
connection server1;
show tables;

# insert something on server2
connection server2;
INSERT INTO t2 VALUES (1,1),(2,2);
select * from t2 order by a;
save_master_pos;
--replace_column 1 <the_epoch>
SELECT @the_epoch:=epoch,inserts,updates,deletes,schemaops FROM 
36
  cluster.binlog_index ORDER BY epoch DESC LIMIT 1;
tomas@poseidon.ndb.mysql.com's avatar
tomas@poseidon.ndb.mysql.com committed
37 38 39 40 41 42 43
let $the_epoch= `SELECT @the_epoch`;

# see if we got something on server1
connection server1;
SELECT * FROM t2 ORDER BY a;
--replace_result $the_epoch <the_epoch>
eval SELECT inserts,updates,deletes,schemaops FROM 
44
  cluster.binlog_index WHERE epoch=$the_epoch;
tomas@poseidon.ndb.mysql.com's avatar
tomas@poseidon.ndb.mysql.com committed
45

46
# single schema ops will not show
tomas@poseidon.ndb.mysql.com's avatar
tomas@poseidon.ndb.mysql.com committed
47 48 49 50 51 52 53
# drop the table on server1
DROP TABLE t2;
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE = NDB;
INSERT INTO t1 VALUES (1),(2);
save_master_pos;
--replace_column 1 <the_epoch2>
SELECT @the_epoch2:=epoch,inserts,updates,deletes,schemaops FROM 
54
  cluster.binlog_index ORDER BY epoch DESC LIMIT 1;
tomas@poseidon.ndb.mysql.com's avatar
tomas@poseidon.ndb.mysql.com committed
55 56 57 58
let $the_epoch2= `SELECT @the_epoch2`;

--replace_result $the_epoch <the_epoch> $the_epoch2 <the_epoch2>
eval SELECT inserts,updates,deletes,schemaops FROM
59
   cluster.binlog_index WHERE epoch > $the_epoch AND epoch < $the_epoch2;
tomas@poseidon.ndb.mysql.com's avatar
tomas@poseidon.ndb.mysql.com committed
60 61 62 63 64 65 66
drop table t1;

# flush on server2
connection server2;
SHOW TABLES;
--replace_result $the_epoch <the_epoch> $the_epoch2 <the_epoch2>
eval SELECT inserts,updates,deletes,schemaops FROM
67
   cluster.binlog_index WHERE epoch > $the_epoch AND epoch < $the_epoch2;
tomas@poseidon.ndb.mysql.com's avatar
tomas@poseidon.ndb.mysql.com committed
68 69 70 71

# reset
connection server1;