############################################# #Authors: TU and Jeb #Date: 2007/04 #Purpose: Generic replication to cluster # and ensuring that the ndb_apply_status # table is updated. ############################################# ## Includes ## --disable_query_log --source include/have_ndb.inc --source include/have_innodb.inc --source include/have_binlog_format_mixed_or_statement.inc --source include/master-slave.inc --enable_query_log --echo *** Test 1 *** --echo connection master; create table t1 (a int key, b int) engine innodb; create table t2 (a int key, b int) engine innodb; --sync_slave_with_master alter table t1 engine ndb; alter table t2 engine ndb; # check binlog position without begin connection master; insert into t1 values (1,2); --sync_slave_with_master --source include/select_ndb_apply_status.inc connection master; # here is actually a bug, since there is no begin statement, the # query is autocommitted, and end_pos shows end of the insert and not # end of the commit --replace_result $start_pos --replace_column 5 # --eval show binlog events from $start_pos limit 1 --replace_result $start_pos $end_pos --replace_column 2 # --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ --eval show binlog events from $start_pos limit 1,1 # check binlog position with begin begin; insert into t1 values (2,3); insert into t2 values (3,4); commit; --sync_slave_with_master --source include/select_ndb_apply_status.inc connection master; --replace_result $start_pos --replace_column 5 # --eval show binlog events from $start_pos limit 1 --replace_result $start_pos --replace_column 2 # 4 # 5 # --eval show binlog events from $start_pos limit 1,2 --replace_result $start_pos $end_pos --replace_column 2 # --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ --eval show binlog events from $start_pos limit 3,1 --disable_query_log connection master; SHOW TABLES; connection slave; SHOW TABLES; --enable_query_log connection master; DROP TABLE test.t1, test.t2; SHOW TABLES; --sync_slave_with_master SHOW TABLES; --echo *** Test 2 *** connection master; --source include/tpcb.inc --sync_slave_with_master USE tpcb; ALTER TABLE account ENGINE NDB; ALTER TABLE branch ENGINE NDB; ALTER TABLE teller ENGINE NDB; ALTER TABLE history ENGINE NDB; connection master; --disable_query_log CALL tpcb.load(); SET AUTOCOMMIT=0; let $run= 5; while ($run) { CALL tpcb.trans(); dec $run; } SET AUTOCOMMIT=1; --enable_query_log --sync_slave_with_master --source include/select_ndb_apply_status.inc connection master; --source include/show_binlog_events2.inc --echo ** Test 3 ** FLUSH LOGS; --disable_query_log SET AUTOCOMMIT=0; let $run= 5; while ($run) { CALL tpcb.trans(); dec $run; } SET AUTOCOMMIT=1; --enable_query_log --sync_slave_with_master --source include/select_ndb_apply_status.inc connection master; --source include/show_binlog_events2.inc --source include/master-slave-reset.inc connection master; --disable_query_log SET AUTOCOMMIT=0; let $run= 5; while ($run) { CALL tpcb.trans(); dec $run; } SET AUTOCOMMIT=1; --enable_query_log --sync_slave_with_master --source include/select_ndb_apply_status.inc connection master; --source include/show_binlog_events2.inc connection master; DROP DATABASE tpcb; CREATE TABLE T1 (c1 INT KEY)ENGINE=NDB; --sync_slave_with_master --source include/select_ndb_apply_status.inc connection master; --eval SHOW BINLOG EVENTS in '$log_name' from $start_pos --source include/show_binlog_events2.inc