--source include/have_ndb.inc --source include/have_innodb.inc --source include/have_binlog_format_mixed_or_statement.inc --source include/master-slave.inc --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 --connection slave 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 --connection slave --replace_column 1 2 select @start_pos:=start_pos, @end_pos:=end_pos from mysql.ndb_apply_status; --let $start_pos = `select @start_pos` --let $end_pos = `select @end_pos` --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 --connection master begin; insert into t1 values (2,3); insert into t2 values (3,4); commit; --sync_slave_with_master --connection slave --replace_column 1 2 select @start_pos:=start_pos, @end_pos:=end_pos from mysql.ndb_apply_status; --let $start_pos = `select @start_pos` --let $end_pos = `select @end_pos` --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 DROP TABLE t1,t2; --sync_slave_with_master STOP SLAVE; RESET SLAVE; --connection master RESET MASTER; --sync_slave_with_master START SLAVE; --connection master CREATE TABLE t1 (c1 INT AUTO_INCREMENT NOT NULL PRIMARY KEY, c2 INT NOT NULL, c3 INT NOT NULL); SHOW CREATE TABLE t1; --echo ***** insert some data ***** let $j= 10; --disable_query_log while ($j) { eval INSERT INTO t1 VALUES(NULL,$j*2,$j+3); dec $j; } --enable_query_log --sync_slave_with_master --connection slave SHOW CREATE TABLE t1; --replace_column 1 2 select @start_pos:=start_pos, @end_pos:=end_pos from mysql.ndb_apply_status; --let $start_pos = `select @start_pos` --let $end_pos = `select @end_pos` --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 set autocommit=0; let $j= 10; --disable_query_log START TRANSACTION; while ($j) { eval INSERT INTO t1 VALUES(NULL,$j*2,$j+3); dec $j; } COMMIT; --enable_query_log --sync_slave_with_master --connection slave --replace_column 1 2 select @start_pos:=start_pos, @end_pos:=end_pos from mysql.ndb_apply_status; --let $start_pos = `select @start_pos` --let $end_pos = `select @end_pos` --connection master --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 # 5 # --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ --eval show binlog events from $start_pos limit 1,1 --sync_slave_with_master --connection master let $j= 10; --disable_query_log START TRANSACTION; while ($j) { eval INSERT INTO t1 VALUES(NULL,$j*2,$j+3); dec $j; } --enable_query_log --replace_result $start_pos $end_pos --replace_column 2 # 5 # --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ SHOW BINLOG EVENTS; --sync_slave_with_master --connection slave SELECT * FROM test.t1 ORDER BY c1; --connection master SELECT * FROM test.t1 ORDER BY c1; ROLLBACK; SELECT * FROM test.t1 ORDER BY c1; --sync_slave_with_master --connection slave SELECT * FROM test.t1 ORDER BY c1; --connection master --replace_result $start_pos $end_pos --replace_column 2 # 5 # --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ SHOW BINLOG EVENTS; DROP TABLE t1; --sync_slave_with_master --connection master CREATE TABLE t1 (c1 INT AUTO_INCREMENT NOT NULL PRIMARY KEY, c2 INT NOT NULL, c3 INT NOT NULL); delimiter |; create procedure foo() deterministic begin insert into t1 values(NULL,2,3); end| create procedure foo2() deterministic begin START TRANSACTION; insert into t1 values(NULL,2,3); end| delimiter ;| set autocommit=0; START TRANSACTION; CALL test.foo; ROLLBACK; SELECT * FROM t1; --sync_slave_with_master SELECT * FROM t1; --connection master CALL test.foo2; ROLLBACK; SELECT * FROM t1; --sync_slave_with_master SELECT * FROM t1; --connection master DROP TABLE t1; --sync_slave_with_master