rpl_truncate_7ndb.test 1.57 KB
Newer Older
1 2

--source include/have_ndb.inc
3
--source include/ndb_master-slave.inc
4
--source include/have_binlog_format_mixed_or_row.inc
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25

--disable_query_log
--disable_warnings
connection slave;
STOP SLAVE;
connection master;
DROP TABLE IF EXISTS t1;
RESET MASTER;
connection slave;
DROP TABLE IF EXISTS t1;
RESET SLAVE;
START SLAVE;
--enable_warnings
--enable_query_log

--echo **** On Master ****
connection master;
CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB;
INSERT INTO t1 VALUES (1,1), (2,2);
SELECT * FROM t1 ORDER BY a,b;
--echo **** On Slave ****
26 27
# This is silly, but NDB doesn't add to the binlog fast enough
--real_sleep 10
28 29 30 31 32 33 34 35 36 37 38 39 40 41
sync_slave_with_master;
INSERT INTO t1 VALUE (3,3);
SELECT * FROM t1 ORDER BY a,b;
--echo **** On Master ****
connection master;
TRUNCATE TABLE t1;
SELECT * FROM t1 ORDER BY a,b;
--echo **** On Slave ****
sync_slave_with_master;
# Should be empty
SELECT * FROM t1 ORDER BY a,b;
--echo **** On Master ****
connection master;
DROP TABLE t1;
42
--source include/show_binlog_events.inc
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63

--echo **** On Master ****
connection master;
CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB;
INSERT INTO t1 VALUES (1,1), (2,2);
SELECT * FROM t1 ORDER BY a,b;
--echo **** On Slave ****
sync_slave_with_master;
INSERT INTO t1 VALUE (3,3);
SELECT * FROM t1 ORDER BY a,b;
--echo **** On Master ****
connection master;
DELETE FROM t1;
SELECT * FROM t1 ORDER BY a,b;
--echo **** On Slave ****
sync_slave_with_master;
# Should be empty
SELECT * FROM t1 ORDER BY a,b;
--echo **** On Master ****
connection master;
DROP TABLE t1;
64
--source include/show_binlog_events.inc
65

66
--source include/rpl_end.inc