1include/master-slave.inc 2[connection master] 3SET binlog_format = STATEMENT; 4 5*** Test 1 *** 6 7create table t1 (a int key, b int) engine innodb; 8create table t2 (a int key, b int) engine innodb; 9 10alter table t1 engine ndb; 11alter table t2 engine ndb; 12 13insert into t1 values (1,2); 14 15select @log_name:=log_name, @start_pos:=start_pos, @end_pos:=end_pos 16from mysql.ndb_apply_status; 17@log_name:=log_name @start_pos:=start_pos @end_pos:=end_pos 18<log_name> <start_pos> <end_pos> 19 20# Now check that that is in the apply_status table is consistant 21# with what is in the binlog 22 23# since insert is done with transactional engine, expect a BEGIN 24# at <start_pos> 25 26show binlog events from <binlog_start> limit 1; 27Log_name Pos Event_type Server_id End_log_pos Info 28master-bin.000001 # Query # # BEGIN 29 30# Now the insert, one step after 31 32show binlog events from <binlog_start> limit 1,1; 33Log_name Pos Event_type Server_id End_log_pos Info 34master-bin.000001 # Query # # use `test`; insert into t1 values (1,2) 35 36# and the COMMIT should be at <end_pos> 37 38show binlog events from <binlog_start> limit 2,1; 39Log_name Pos Event_type Server_id End_log_pos Info 40master-bin.000001 # Xid # # COMMIT /* XID */ 41 42begin; 43insert into t1 values (2,3); 44insert into t2 values (3,4); 45commit; 46 47select @log_name:=log_name, @start_pos:=start_pos, @end_pos:=end_pos 48from mysql.ndb_apply_status; 49@log_name:=log_name @start_pos:=start_pos @end_pos:=end_pos 50<log_name> <start_pos> <end_pos> 51show binlog events from <binlog_start> limit 1; 52Log_name Pos Event_type Server_id End_log_pos Info 53master-bin.000001 # Query # # BEGIN 54 55show binlog events from <binlog_start> limit 1,2; 56Log_name Pos Event_type Server_id End_log_pos Info 57master-bin.000001 # Query # # use `test`; insert into t1 values (2,3) 58master-bin.000001 # Query # # use `test`; insert into t2 values (3,4) 59 60show binlog events from <binlog_start> limit 3,1; 61Log_name Pos Event_type Server_id End_log_pos Info 62master-bin.000001 # Xid # # COMMIT /* XID */ 63 64DROP TABLE test.t1, test.t2; 65SHOW TABLES; 66Tables_in_test 67 68*** Test 2 *** 69 70DROP DATABASE IF EXISTS tpcb; 71CREATE DATABASE tpcb; 72 73CREATE TABLE tpcb.account (id INT, bid INT, balance DECIMAL(10,2), 74filler CHAR(255), PRIMARY KEY(id)); 75 76CREATE TABLE tpcb.branch (bid INT, balance DECIMAL(10,2), filler VARCHAR(255), 77PRIMARY KEY(bid)); 78 79CREATE TABLE tpcb.teller (tid INT, balance DECIMAL(10,2), filler VARCHAR(255), 80PRIMARY KEY(tid)); 81 82CREATE TABLE tpcb.history (id MEDIUMINT NOT NULL AUTO_INCREMENT,aid INT, 83tid INT, bid INT, amount DECIMAL(10,2), 84tdate DATETIME, teller CHAR(20), uuidf LONGBLOB, 85filler CHAR(80),PRIMARY KEY (id)); 86 87--- Create stored procedures & functions --- 88 89 90*** Stored Procedures Created *** 91 92USE tpcb; 93ALTER TABLE account ENGINE NDB; 94ALTER TABLE branch ENGINE NDB; 95ALTER TABLE teller ENGINE NDB; 96ALTER TABLE history ENGINE NDB; 97 98select @log_name:=log_name, @start_pos:=start_pos, @end_pos:=end_pos 99from mysql.ndb_apply_status; 100@log_name:=log_name @start_pos:=start_pos @end_pos:=end_pos 101<log_name> <start_pos> <end_pos> 102 103show binlog events in 'master-bin.000001' from <start_pos> limit 6,1; 104Log_name Pos Event_type Server_id End_log_pos Info 105master-bin.000001 # Xid 1 <end_pos> COMMIT /* XID */ 106 107** Test 3 ** 108 109FLUSH LOGS; 110 111select @log_name:=log_name, @start_pos:=start_pos, @end_pos:=end_pos 112from mysql.ndb_apply_status; 113@log_name:=log_name @start_pos:=start_pos @end_pos:=end_pos 114<log_name> <start_pos> <end_pos> 115 116show binlog events in 'master-bin.000002' from <start_pos> limit 6,1; 117Log_name Pos Event_type Server_id End_log_pos Info 118master-bin.000002 # Xid 1 <end_pos> COMMIT /* XID */ 119 120** Test 4 ** 121 122include/rpl_reset.inc 123 124select @log_name:=log_name, @start_pos:=start_pos, @end_pos:=end_pos 125from mysql.ndb_apply_status; 126@log_name:=log_name @start_pos:=start_pos @end_pos:=end_pos 127<log_name> <start_pos> <end_pos> 128 129show binlog events in 'master-bin.000001' from <start_pos> limit 6,1; 130Log_name Pos Event_type Server_id End_log_pos Info 131master-bin.000001 # Xid 1 <end_pos> COMMIT /* XID */ 132 133*** DUMP MASTER & SLAVE FOR COMPARE ******** 134DROP DATABASE tpcb; 135****** Do dumps compare ************ 136include/rpl_end.inc 137