diff options
74 files changed, 1371 insertions, 1097 deletions
diff --git a/mysql-test/extra/binlog_tests/binlog.test b/mysql-test/extra/binlog_tests/binlog.test index e569e15e519..ff43debf967 100644 --- a/mysql-test/extra/binlog_tests/binlog.test +++ b/mysql-test/extra/binlog_tests/binlog.test @@ -22,6 +22,7 @@ insert t2 values (5); commit; # first COMMIT must be Query_log_event, second - Xid_log_event --replace_column 2 # 5 # +--replace_regex /table_id: [0-9]+/table_id: #/ show binlog events from 102; drop table t1,t2; @@ -43,6 +44,8 @@ while ($1) commit; drop table t1; --replace_column 2 # 5 # +--replace_regex /table_id: [0-9]+/table_id: #/ show binlog events in 'master-bin.000001' from 102; --replace_column 2 # 5 # +--replace_regex /table_id: [0-9]+/table_id: #/ show binlog events in 'master-bin.000002' from 102; diff --git a/mysql-test/extra/binlog_tests/blackhole.test b/mysql-test/extra/binlog_tests/blackhole.test index bd77286a9fe..71aec90e9a0 100644 --- a/mysql-test/extra/binlog_tests/blackhole.test +++ b/mysql-test/extra/binlog_tests/blackhole.test @@ -123,6 +123,7 @@ select * from t3; let $VERSION=`select version()`; --replace_result $VERSION VERSION --replace_column 2 # 5 # +--replace_regex /table_id: [0-9]+/table_id: #/ show binlog events; drop table t1,t2,t3; @@ -144,4 +145,5 @@ rollback; set autocommit=1; --replace_result $VERSION VERSION --replace_column 2 # 5 # +--replace_regex /table_id: [0-9]+/table_id: #/ show binlog events; diff --git a/mysql-test/extra/binlog_tests/ctype_cp932_binlog.test b/mysql-test/extra/binlog_tests/ctype_cp932_binlog.test index a17f8f827a6..5e93d6e126e 100644 --- a/mysql-test/extra/binlog_tests/ctype_cp932_binlog.test +++ b/mysql-test/extra/binlog_tests/ctype_cp932_binlog.test @@ -27,6 +27,7 @@ SET @var1= x'8300'; # exercise this code from mysql-test-run. EXECUTE stmt1 USING @var1; --replace_column 2 # 5 # +--replace_regex /table_id: [0-9]+/table_id: #/ SHOW BINLOG EVENTS FROM 102; SELECT HEX(f1) FROM t1; DROP table t1; diff --git a/mysql-test/extra/binlog_tests/ctype_ucs_binlog.test b/mysql-test/extra/binlog_tests/ctype_ucs_binlog.test index 940310e4499..afe594b8d36 100644 --- a/mysql-test/extra/binlog_tests/ctype_ucs_binlog.test +++ b/mysql-test/extra/binlog_tests/ctype_ucs_binlog.test @@ -9,6 +9,7 @@ create table t2 (c char(30)) charset=ucs2; set @v=convert('abc' using ucs2); reset master; insert into t2 values (@v); +--replace_regex /table_id: [0-9]+/table_id: #/ show binlog events from 102; # more important than SHOW BINLOG EVENTS, mysqlbinlog (where we # absolutely need variables names to be quoted and strings to be diff --git a/mysql-test/extra/binlog_tests/drop_temp_table.test b/mysql-test/extra/binlog_tests/drop_temp_table.test index bc06de4096c..9c8647395bf 100644 --- a/mysql-test/extra/binlog_tests/drop_temp_table.test +++ b/mysql-test/extra/binlog_tests/drop_temp_table.test @@ -25,6 +25,7 @@ select get_lock("a",10); let $VERSION=`select version()`; --replace_result $VERSION VERSION --replace_column 2 # 5 # +--replace_regex /table_id: [0-9]+/table_id: #/ show binlog events; drop database `drop-temp+table-test`; diff --git a/mysql-test/extra/binlog_tests/insert_select-binlog.test b/mysql-test/extra/binlog_tests/insert_select-binlog.test index a665dfda2b0..268e9280b32 100644 --- a/mysql-test/extra/binlog_tests/insert_select-binlog.test +++ b/mysql-test/extra/binlog_tests/insert_select-binlog.test @@ -19,6 +19,7 @@ insert into t1 select * from t2; # verify the binlog : let $VERSION=`select version()`; --replace_result $VERSION VERSION +--replace_regex /table_id: [0-9]+/table_id: #/ show binlog events; select * from t1; drop table t1, t2; @@ -33,6 +34,7 @@ create table t2(unique(a)) select a from t1; # The above should produce an error, *and* not appear in the binlog let $VERSION=`select version()`; --replace_result $VERSION VERSION +--replace_regex /table_id: [0-9]+/table_id: #/ show binlog events; drop table t1; diff --git a/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test b/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test index 05d36b8b831..b75a326d5a8 100644 --- a/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test +++ b/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test @@ -30,6 +30,7 @@ insert into t2 select * from t1; commit; --replace_column 5 # +--replace_regex /table_id: [0-9]+/table_id: #/ show binlog events from 102; delete from t1; @@ -43,6 +44,7 @@ insert into t2 select * from t1; rollback; --replace_column 5 # +--replace_regex /table_id: [0-9]+/table_id: #/ show binlog events from 102; delete from t1; @@ -58,6 +60,7 @@ rollback to savepoint my_savepoint; commit; --replace_column 5 # +--replace_regex /table_id: [0-9]+/table_id: #/ show binlog events from 102; delete from t1; @@ -75,6 +78,7 @@ commit; select a from t1 order by a; # check that savepoints work :) --replace_column 5 # +--replace_regex /table_id: [0-9]+/table_id: #/ show binlog events from 102; # and when ROLLBACK is not explicit? @@ -96,6 +100,7 @@ connection con2; # logging has been done, we use a user lock. select get_lock("a",10); --replace_column 5 # +--replace_regex /table_id: [0-9]+/table_id: #/ show binlog events from 102; # and when not in a transact1on? @@ -107,6 +112,7 @@ insert into t1 values(9); insert into t2 select * from t1; --replace_column 5 # +--replace_regex /table_id: [0-9]+/table_id: #/ show binlog events from 102; # Check that when the query updat1ng the MyISAM table is the first in the @@ -119,11 +125,13 @@ insert into t1 values(10); # first make t1 non-empty begin; insert into t2 select * from t1; --replace_column 5 # +--replace_regex /table_id: [0-9]+/table_id: #/ show binlog events from 102; insert into t1 values(11); commit; --replace_column 5 # +--replace_regex /table_id: [0-9]+/table_id: #/ show binlog events from 102; @@ -142,6 +150,7 @@ insert into t2 select * from t1; commit; --replace_column 5 # +--replace_regex /table_id: [0-9]+/table_id: #/ show binlog events from 102; delete from t1; @@ -154,6 +163,7 @@ insert into t2 select * from t1; rollback; --replace_column 5 # +--replace_regex /table_id: [0-9]+/table_id: #/ show binlog events from 102; delete from t1; @@ -169,6 +179,7 @@ rollback to savepoint my_savepoint; commit; --replace_column 5 # +--replace_regex /table_id: [0-9]+/table_id: #/ show binlog events from 102; delete from t1; @@ -186,6 +197,7 @@ commit; select a from t1 order by a; # check that savepoints work :) --replace_column 5 # +--replace_regex /table_id: [0-9]+/table_id: #/ show binlog events from 102; # Test for BUG#5714, where a MyISAM update in the transaction used to @@ -246,6 +258,7 @@ disconnect con2; connection con3; select get_lock("lock1",60); --replace_column 5 # +--replace_regex /table_id: [0-9]+/table_id: #/ show binlog events from 102; do release_lock("lock1"); drop table t0,t2; diff --git a/mysql-test/extra/rpl_tests/rpl_flsh_tbls.test b/mysql-test/extra/rpl_tests/rpl_flsh_tbls.test index c5db667e29b..cfa943228fa 100644 --- a/mysql-test/extra/rpl_tests/rpl_flsh_tbls.test +++ b/mysql-test/extra/rpl_tests/rpl_flsh_tbls.test @@ -19,6 +19,7 @@ flush no_write_to_binlog tables; # Check that it's not in the binlog. --replace_result $SERVER_VERSION SERVER_VERSION --replace_column 2 # 5 # +--replace_regex /table_id: [0-9]+/table_id: #/ eval SHOW BINLOG EVENTS FROM $rename_event_pos ; # Check that the master is not confused. select * from t3; @@ -27,6 +28,7 @@ flush tables; # Check that it's in the binlog. --replace_result $SERVER_VERSION SERVER_VERSION --replace_column 2 # 5 # +--replace_regex /table_id: [0-9]+/table_id: #/ eval SHOW BINLOG EVENTS FROM $rename_event_pos ; save_master_pos; connection slave; diff --git a/mysql-test/extra/rpl_tests/rpl_log.test b/mysql-test/extra/rpl_tests/rpl_log.test index c2e0cc085c2..0c638281ecb 100644 --- a/mysql-test/extra/rpl_tests/rpl_log.test +++ b/mysql-test/extra/rpl_tests/rpl_log.test @@ -38,16 +38,16 @@ load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines; select count(*) from t1; --replace_result $VERSION VERSION --replace_column 2 # 5 # ---replace_regex /\/\* xid=.* \*\//\/* XID *\// +--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ show binlog events; --replace_column 2 # 5 # ---replace_regex /\/\* xid=.* \*\//\/* XID *\// +--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ show binlog events from 102 limit 1; --replace_column 2 # 5 # ---replace_regex /\/\* xid=.* \*\//\/* XID *\// +--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ show binlog events from 102 limit 2; --replace_column 2 # 5 # ---replace_regex /\/\* xid=.* \*\//\/* XID *\// +--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ show binlog events from 102 limit 2,1; flush logs; @@ -88,11 +88,11 @@ eval create table t2 (n int)ENGINE=$engine_type; insert into t2 values (1); --replace_result $VERSION VERSION --replace_column 2 # 5 # ---replace_regex /\/\* xid=.* \*\//\/* XID *\// +--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ show binlog events; --replace_result $VERSION VERSION --replace_column 2 # 5 # ---replace_regex /\/\* xid=.* \*\//\/* XID *\// +--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ show binlog events in 'master-bin.000002'; show binary logs; save_master_pos; @@ -102,11 +102,11 @@ sync_with_master; show binary logs; --replace_result $MASTER_MYPORT MASTER_PORT $VERSION VERSION --replace_column 2 # 5 # ---replace_regex /\/\* xid=.* \*\//\/* XID *\// +--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ show binlog events in 'slave-bin.000001' from 4; --replace_result $MASTER_MYPORT MASTER_PORT $VERSION VERSION --replace_column 2 # 5 # ---replace_regex /\/\* xid=.* \*\//\/* XID *\// +--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ show binlog events in 'slave-bin.000002' from 4; --replace_result $MASTER_MYPORT MASTER_PORT --replace_column 1 # 8 # 9 # 16 # 23 # 33 # diff --git a/mysql-test/extra/rpl_tests/rpl_multi_query.test b/mysql-test/extra/rpl_tests/rpl_multi_query.test index a0062bd04bf..30a83886a86 100644 --- a/mysql-test/extra/rpl_tests/rpl_multi_query.test +++ b/mysql-test/extra/rpl_tests/rpl_multi_query.test @@ -24,6 +24,7 @@ sync_slave_with_master; select * from mysqltest.t1; connection master; --replace_column 2 # 5 # +--replace_regex /table_id: [0-9]+/table_id: #/ show binlog events from 102; drop database mysqltest; sync_slave_with_master; diff --git a/mysql-test/extra/rpl_tests/rpl_row_charset.test b/mysql-test/extra/rpl_tests/rpl_row_charset.test index d0fea6f9580..336a038db10 100644 --- a/mysql-test/extra/rpl_tests/rpl_row_charset.test +++ b/mysql-test/extra/rpl_tests/rpl_row_charset.test @@ -114,6 +114,7 @@ connection master; drop database mysqltest2; drop database mysqltest3; --replace_column 2 # 5 # +--replace_regex /table_id: [0-9]+/table_id: #/ show binlog events from 102; sync_slave_with_master; diff --git a/mysql-test/extra/rpl_tests/rpl_row_delayed_ins.test b/mysql-test/extra/rpl_tests/rpl_row_delayed_ins.test index 6069a2973ef..2059717b225 100644 --- a/mysql-test/extra/rpl_tests/rpl_row_delayed_ins.test +++ b/mysql-test/extra/rpl_tests/rpl_row_delayed_ins.test @@ -14,6 +14,7 @@ sync_slave_with_master; connection master; --replace_result $VERSION VERSION +--replace_regex /table_id: [0-9]+/table_id: #/ show binlog events; sync_slave_with_master; SELECT * FROM t1 ORDER BY a; diff --git a/mysql-test/extra/rpl_tests/rpl_stm_charset.test b/mysql-test/extra/rpl_tests/rpl_stm_charset.test index e5209a9b9ac..d29a82cfd31 100644 --- a/mysql-test/extra/rpl_tests/rpl_stm_charset.test +++ b/mysql-test/extra/rpl_tests/rpl_stm_charset.test @@ -110,6 +110,7 @@ connection master; drop database mysqltest2; drop database mysqltest3; --replace_column 2 # 5 # +--replace_regex /table_id: [0-9]+/table_id: #/ show binlog events from 102; sync_slave_with_master; diff --git a/mysql-test/include/rpl_row_basic.inc b/mysql-test/include/rpl_row_basic.inc index 9f1cc186388..ea2c4c1688c 100644 --- a/mysql-test/include/rpl_row_basic.inc +++ b/mysql-test/include/rpl_row_basic.inc @@ -174,22 +174,16 @@ SELECT C1,HEX(B1),HEX(B2) FROM t4 ORDER BY C1; connection master; eval CREATE TABLE t7 (C1 INT PRIMARY KEY, C2 INT) ENGINE = $type ; sync_slave_with_master; ---disable_query_log -SELECT "--- on slave: original values ---" AS ""; ---enable_query_log +--echo --- on slave: original values --- INSERT INTO t7 VALUES (1,3), (2,6), (3,9); SELECT * FROM t7 ORDER BY C1; connection master; ---disable_query_log -SELECT "--- on master: new values inserted ---" AS ""; ---enable_query_log +--echo --- on master: new values inserted --- INSERT INTO t7 VALUES (1,2), (2,4), (3,6); SELECT * FROM t7 ORDER BY C1; sync_slave_with_master; ---disable_query_log -SELECT "--- on slave: old values should be overwritten by replicated values ---" AS ""; ---enable_query_log +--echo --- on slave: old values should be overwritten by replicated values --- SELECT * FROM t7 ORDER BY C1; # @@ -197,42 +191,33 @@ SELECT * FROM t7 ORDER BY C1; # causing a conflict for a key that is not "last". # connection master; ---disable_query_log -SELECT "--- on master ---" AS ""; ---enable_query_log -DROP TABLE t7; -eval CREATE TABLE t7 (a INT PRIMARY KEY, b INT UNIQUE, c INT UNIQUE) ENGINE = $type ; +--echo --- on master --- +eval CREATE TABLE t8 (a INT PRIMARY KEY, b INT UNIQUE, c INT UNIQUE) ENGINE = $type ; # First we make sure that the constraints are correctly set. -INSERT INTO t7 VALUES (99,99,99); +INSERT INTO t8 VALUES (99,99,99); --error 1062 -INSERT INTO t7 VALUES (99,22,33); +INSERT INTO t8 VALUES (99,22,33); --error 1062 -INSERT INTO t7 VALUES (11,99,33); +INSERT INTO t8 VALUES (11,99,33); --error 1062 -INSERT INTO t7 VALUES (11,22,99); -SELECT * FROM t7 ORDER BY a; +INSERT INTO t8 VALUES (11,22,99); +SELECT * FROM t8 ORDER BY a; sync_slave_with_master; ---disable_query_log -SELECT "--- on slave ---" AS ""; ---enable_query_log -SELECT * FROM t7 ORDER BY a; -INSERT INTO t7 VALUES (1,2,3), (2,4,6), (3,6,9); -SELECT * FROM t7 ORDER BY a; +--echo --- on slave --- +SELECT * FROM t8 ORDER BY a; +INSERT INTO t8 VALUES (1,2,3), (2,4,6), (3,6,9); +SELECT * FROM t8 ORDER BY a; connection master; ---disable_query_log -SELECT "--- on master ---" AS ""; ---enable_query_log +--echo --- on master --- # We insert a row that will cause conflict on the primary key but not # on the other keys. -INSERT INTO t7 VALUES (2,4,8); +INSERT INTO t8 VALUES (2,4,8); sync_slave_with_master; ---disable_query_log -SELECT "--- on slave ---" AS ""; ---enable_query_log -SELECT * FROM t7 ORDER BY a; +--echo --- on slave --- +SELECT * FROM t8 ORDER BY a; # # Test conflicting operations when changing in a table referenced by a @@ -245,5 +230,4 @@ SELECT * FROM t7 ORDER BY a; # connection master; -DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7; -sync_slave_with_master; +DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8; diff --git a/mysql-test/include/show_binlog_events.inc b/mysql-test/include/show_binlog_events.inc index fbdcdf66494..ae848d10687 100644 --- a/mysql-test/include/show_binlog_events.inc +++ b/mysql-test/include/show_binlog_events.inc @@ -1,4 +1,5 @@ --let $binlog_start=102 --replace_result $binlog_start <binlog_start> --replace_column 2 # 4 # 5 # +--replace_regex /table_id: [0-9]+/table_id: #/ --eval show binlog events from $binlog_start diff --git a/mysql-test/r/binlog_row_binlog.result b/mysql-test/r/binlog_row_binlog.result index df69ca29b2f..6cb086109b4 100644 --- a/mysql-test/r/binlog_row_binlog.result +++ b/mysql-test/r/binlog_row_binlog.result @@ -13,12 +13,12 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; create table t1 (a int) engine=bdb master-bin.000001 # Query 1 # use `test`; create table t2 (a int) engine=innodb master-bin.000001 # Query 1 # use `test`; BEGIN -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Query 1 # use `test`; COMMIT master-bin.000001 # Query 1 # use `test`; BEGIN -master-bin.000001 # Table_map 1 # test.t2 -master-bin.000001 # Write_rows 1 # +master-bin.000001 # Table_map 1 # table_id: # (test.t2) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Xid 1 # COMMIT /* xid= */ drop table t1,t2; reset master; @@ -30,206 +30,206 @@ show binlog events in 'master-bin.000001' from 102; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; create table t1 (n int) engine=innodb master-bin.000001 # Query 1 # use `test`; BEGIN -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Xid 1 # COMMIT /* xid= */ master-bin.000001 # Rotate 1 # master-bin.000002;pos=4 show binlog events in 'master-bin.000002' from 102; diff --git a/mysql-test/r/binlog_row_blackhole.result b/mysql-test/r/binlog_row_blackhole.result index 941d208a10b..aa5c943de00 100644 --- a/mysql-test/r/binlog_row_blackhole.result +++ b/mysql-test/r/binlog_row_blackhole.result @@ -109,22 +109,34 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4 master-bin.000001 # Query 1 # use `test`; drop table t1,t2 master-bin.000001 # Query 1 # use `test`; create table t1 (a int) engine=blackhole -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Query 1 # use `test`; COMMIT -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Query 1 # use `test`; COMMIT -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Query 1 # use `test`; COMMIT +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Query 1 # use `test`; COMMIT +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Query 1 # use `test`; COMMIT master-bin.000001 # Query 1 # use `test`; create table t2 (a varchar(200)) engine=blackhole -master-bin.000001 # Table_map 1 # test.t2 -master-bin.000001 # Write_rows 1 # +master-bin.000001 # Table_map 1 # table_id: # (test.t2) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Query 1 # use `test`; COMMIT master-bin.000001 # Query 1 # use `test`; alter table t1 add b int master-bin.000001 # Query 1 # use `test`; alter table t1 drop b master-bin.000001 # Query 1 # use `test`; create table t3 like t1 +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Query 1 # use `test`; COMMIT +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Query 1 # use `test`; COMMIT drop table t1,t2,t3; reset master; create table t1 (a int) engine=blackhole; @@ -141,6 +153,6 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4 master-bin.000001 # Query 1 # use `test`; create table t1 (a int) engine=blackhole master-bin.000001 # Query 1 # use `test`; BEGIN -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Query 1 # use `test`; COMMIT diff --git a/mysql-test/r/binlog_row_ctype_ucs.result b/mysql-test/r/binlog_row_ctype_ucs.result index 12f7062d38a..5feb17cde13 100644 --- a/mysql-test/r/binlog_row_ctype_ucs.result +++ b/mysql-test/r/binlog_row_ctype_ucs.result @@ -5,8 +5,8 @@ reset master; insert into t2 values (@v); show binlog events from 102; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 102 Table_map 1 141 test.t2 -master-bin.000001 141 Write_rows 1 231 +master-bin.000001 102 Table_map 1 141 table_id: # (test.t2) +master-bin.000001 141 Write_rows 1 231 table_id: # flags: STMT_END_F /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; ROLLBACK; diff --git a/mysql-test/r/binlog_row_drop_tmp_tbl.result b/mysql-test/r/binlog_row_drop_tmp_tbl.result index 2b09fe069e3..771bc5f5e44 100644 --- a/mysql-test/r/binlog_row_drop_tmp_tbl.result +++ b/mysql-test/r/binlog_row_drop_tmp_tbl.result @@ -14,5 +14,7 @@ get_lock("a",10) show binlog events; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4 +master-bin.000001 # Table_map 1 # table_id: # (mysql.proc) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Query 1 # create database `drop-temp+table-test` drop database `drop-temp+table-test`; diff --git a/mysql-test/r/binlog_row_insert_select.result b/mysql-test/r/binlog_row_insert_select.result index 0a98a6d7233..14cef6709b6 100644 --- a/mysql-test/r/binlog_row_insert_select.result +++ b/mysql-test/r/binlog_row_insert_select.result @@ -9,8 +9,8 @@ ERROR 23000: Duplicate entry '2' for key 'a' show binlog events; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 4 Format_desc 1 102 Server ver: VERSION, Binlog ver: 4 -master-bin.000001 102 Table_map 1 141 test.t1 -master-bin.000001 141 Write_rows 1 175 +master-bin.000001 102 Table_map 1 141 table_id: # (test.t1) +master-bin.000001 141 Write_rows 1 175 table_id: # flags: STMT_END_F select * from t1; a 1 diff --git a/mysql-test/r/binlog_row_mix_innodb_myisam.result b/mysql-test/r/binlog_row_mix_innodb_myisam.result index 7572bccca7c..078a95d5abd 100644 --- a/mysql-test/r/binlog_row_mix_innodb_myisam.result +++ b/mysql-test/r/binlog_row_mix_innodb_myisam.result @@ -9,10 +9,10 @@ commit; show binlog events from 102; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 102 Query 1 # use `test`; BEGIN -master-bin.000001 170 Table_map 1 # test.t1 -master-bin.000001 209 Write_rows 1 # -master-bin.000001 243 Table_map 1 # test.t2 -master-bin.000001 282 Write_rows 1 # +master-bin.000001 170 Table_map 1 # table_id: # (test.t1) +master-bin.000001 209 Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 243 Table_map 1 # table_id: # (test.t2) +master-bin.000001 282 Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 316 Xid 1 # COMMIT /* xid= */ delete from t1; delete from t2; @@ -26,10 +26,10 @@ Warning 1196 Some non-transactional changed tables couldn't be rolled back show binlog events from 102; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 102 Query 1 # use `test`; BEGIN -master-bin.000001 170 Table_map 1 # test.t1 -master-bin.000001 209 Write_rows 1 # -master-bin.000001 243 Table_map 1 # test.t2 -master-bin.000001 282 Write_rows 1 # +master-bin.000001 170 Table_map 1 # table_id: # (test.t1) +master-bin.000001 209 Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 243 Table_map 1 # table_id: # (test.t2) +master-bin.000001 282 Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 316 Query 1 # use `test`; ROLLBACK delete from t1; delete from t2; @@ -46,13 +46,13 @@ commit; show binlog events from 102; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 102 Query 1 # use `test`; BEGIN -master-bin.000001 170 Table_map 1 # test.t1 -master-bin.000001 209 Write_rows 1 # +master-bin.000001 170 Table_map 1 # table_id: # (test.t1) +master-bin.000001 209 Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 243 Query 1 # use `test`; savepoint my_savepoint -master-bin.000001 328 Table_map 1 # test.t1 -master-bin.000001 367 Write_rows 1 # -master-bin.000001 401 Table_map 1 # test.t2 -master-bin.000001 440 Write_rows 1 # +master-bin.000001 328 Table_map 1 # table_id: # (test.t1) +master-bin.000001 367 Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 401 Table_map 1 # table_id: # (test.t2) +master-bin.000001 440 Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 479 Query 1 # use `test`; rollback to savepoint my_savepoint master-bin.000001 576 Xid 1 # COMMIT /* xid= */ delete from t1; @@ -75,16 +75,16 @@ a show binlog events from 102; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 102 Query 1 # use `test`; BEGIN -master-bin.000001 170 Table_map 1 # test.t1 -master-bin.000001 209 Write_rows 1 # +master-bin.000001 170 Table_map 1 # table_id: # (test.t1) +master-bin.000001 209 Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 243 Query 1 # use `test`; savepoint my_savepoint -master-bin.000001 328 Table_map 1 # test.t1 -master-bin.000001 367 Write_rows 1 # -master-bin.000001 401 Table_map 1 # test.t2 -master-bin.000001 440 Write_rows 1 # +master-bin.000001 328 Table_map 1 # table_id: # (test.t1) +master-bin.000001 367 Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 401 Table_map 1 # table_id: # (test.t2) +master-bin.000001 440 Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 479 Query 1 # use `test`; rollback to savepoint my_savepoint -master-bin.000001 576 Table_map 1 # test.t1 -master-bin.000001 615 Write_rows 1 # +master-bin.000001 576 Table_map 1 # table_id: # (test.t1) +master-bin.000001 615 Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 649 Xid 1 # COMMIT /* xid= */ delete from t1; delete from t2; @@ -101,10 +101,10 @@ get_lock("a",10) show binlog events from 102; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 102 Query 1 # use `test`; BEGIN -master-bin.000001 170 Table_map 1 # test.t1 -master-bin.000001 209 Write_rows 1 # -master-bin.000001 243 Table_map 1 # test.t2 -master-bin.000001 282 Write_rows 1 # +master-bin.000001 170 Table_map 1 # table_id: # (test.t1) +master-bin.000001 209 Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 243 Table_map 1 # table_id: # (test.t2) +master-bin.000001 282 Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 316 Query 1 # use `test`; ROLLBACK delete from t1; delete from t2; @@ -113,11 +113,11 @@ insert into t1 values(9); insert into t2 select * from t1; show binlog events from 102; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 102 Table_map 1 # test.t1 -master-bin.000001 141 Write_rows 1 # +master-bin.000001 102 Table_map 1 # table_id: # (test.t1) +master-bin.000001 141 Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 175 Xid 1 # COMMIT /* xid= */ -master-bin.000001 202 Table_map 1 # test.t2 -master-bin.000001 241 Write_rows 1 # +master-bin.000001 202 Table_map 1 # table_id: # (test.t2) +master-bin.000001 241 Write_rows 1 # table_id: # flags: STMT_END_F delete from t1; delete from t2; reset master; @@ -126,23 +126,23 @@ begin; insert into t2 select * from t1; show binlog events from 102; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 102 Table_map 1 # test.t1 -master-bin.000001 141 Write_rows 1 # +master-bin.000001 102 Table_map 1 # table_id: # (test.t1) +master-bin.000001 141 Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 175 Xid 1 # COMMIT /* xid= */ -master-bin.000001 202 Table_map 1 # test.t2 -master-bin.000001 241 Write_rows 1 # +master-bin.000001 202 Table_map 1 # table_id: # (test.t2) +master-bin.000001 241 Write_rows 1 # table_id: # flags: STMT_END_F insert into t1 values(11); commit; show binlog events from 102; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 102 Table_map 1 # test.t1 -master-bin.000001 141 Write_rows 1 # +master-bin.000001 102 Table_map 1 # table_id: # (test.t1) +master-bin.000001 141 Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 175 Xid 1 # COMMIT /* xid= */ -master-bin.000001 202 Table_map 1 # test.t2 -master-bin.000001 241 Write_rows 1 # +master-bin.000001 202 Table_map 1 # table_id: # (test.t2) +master-bin.000001 241 Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 275 Query 1 # use `test`; BEGIN -master-bin.000001 343 Table_map 1 # test.t1 -master-bin.000001 382 Write_rows 1 # +master-bin.000001 343 Table_map 1 # table_id: # (test.t1) +master-bin.000001 382 Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 416 Xid 1 # COMMIT /* xid= */ alter table t2 engine=INNODB; delete from t1; @@ -155,10 +155,10 @@ commit; show binlog events from 102; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 102 Query 1 # use `test`; BEGIN -master-bin.000001 170 Table_map 1 # test.t1 -master-bin.000001 209 Write_rows 1 # -master-bin.000001 243 Table_map 1 # test.t2 -master-bin.000001 282 Write_rows 1 # +master-bin.000001 170 Table_map 1 # table_id: # (test.t1) +master-bin.000001 209 Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 243 Table_map 1 # table_id: # (test.t2) +master-bin.000001 282 Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 316 Xid 1 # COMMIT /* xid= */ delete from t1; delete from t2; @@ -182,8 +182,8 @@ commit; show binlog events from 102; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 102 Query 1 # use `test`; BEGIN -master-bin.000001 170 Table_map 1 # test.t1 -master-bin.000001 209 Write_rows 1 # +master-bin.000001 170 Table_map 1 # table_id: # (test.t1) +master-bin.000001 209 Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 243 Xid 1 # COMMIT /* xid= */ delete from t1; delete from t2; @@ -203,10 +203,10 @@ a show binlog events from 102; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 102 Query 1 # use `test`; BEGIN -master-bin.000001 170 Table_map 1 # test.t1 -master-bin.000001 209 Write_rows 1 # -master-bin.000001 243 Table_map 1 # test.t1 -master-bin.000001 282 Write_rows 1 # +master-bin.000001 170 Table_map 1 # table_id: # (test.t1) +master-bin.000001 209 Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 243 Table_map 1 # table_id: # (test.t1) +master-bin.000001 282 Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 316 Xid 1 # COMMIT /* xid= */ delete from t1; delete from t2; @@ -257,28 +257,32 @@ get_lock("lock1",60) show binlog events from 102; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 102 Query 1 # use `test`; BEGIN -master-bin.000001 170 Table_map 1 # test.t1 -master-bin.000001 209 Write_rows 1 # -master-bin.000001 243 Table_map 1 # test.t1 -master-bin.000001 282 Write_rows 1 # +master-bin.000001 170 Table_map 1 # table_id: # (test.t1) +master-bin.000001 209 Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 243 Table_map 1 # table_id: # (test.t1) +master-bin.000001 282 Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 316 Xid 1 # COMMIT /* xid= */ -master-bin.000001 343 Query 1 # use `test`; delete from t1 -master-bin.000001 420 Xid 1 # COMMIT /* xid= */ -master-bin.000001 447 Query 1 # use `test`; delete from t2 -master-bin.000001 524 Xid 1 # COMMIT /* xid= */ -master-bin.000001 551 Query 1 # use `test`; alter table t2 engine=MyISAM -master-bin.000001 642 Table_map 1 # test.t1 -master-bin.000001 681 Write_rows 1 # -master-bin.000001 715 Xid 1 # COMMIT /* xid= */ -master-bin.000001 742 Table_map 1 # test.t2 -master-bin.000001 781 Write_rows 1 # -master-bin.000001 815 Query 1 # use `test`; drop table t1,t2 -master-bin.000001 894 Query 1 # use `test`; create table t0 (n int) -master-bin.000001 980 Table_map 1 # test.t0 -master-bin.000001 1019 Write_rows 1 # -master-bin.000001 1053 Table_map 1 # test.t0 -master-bin.000001 1092 Write_rows 1 # -master-bin.000001 1126 Query 1 # use `test`; create table t2 (n int) engine=innodb +master-bin.000001 343 Table_map 1 # table_id: # (test.t1) +master-bin.000001 382 Query 1 # use `test`; delete from t1 +master-bin.000001 459 Xid 1 # COMMIT /* xid= */ +master-bin.000001 486 Table_map 1 # table_id: # (test.t2) +master-bin.000001 525 Query 1 # use `test`; delete from t2 +master-bin.000001 602 Xid 1 # COMMIT /* xid= */ +master-bin.000001 629 Query 1 # use `test`; alter table t2 engine=MyISAM +master-bin.000001 720 Table_map 1 # table_id: # (test.t1) +master-bin.000001 759 Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 793 Xid 1 # COMMIT /* xid= */ +master-bin.000001 820 Query 1 # use `test`; BEGIN +master-bin.000001 888 Table_map 1 # table_id: # (test.t1) +master-bin.000001 927 Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 956 Xid 1 # COMMIT /* xid= */ +master-bin.000001 983 Query 1 # use `test`; drop table t1,t2 +master-bin.000001 1062 Query 1 # use `test`; create table t0 (n int) +master-bin.000001 1148 Table_map 1 # table_id: # (test.t0) +master-bin.000001 1187 Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 1221 Table_map 1 # table_id: # (test.t0) +master-bin.000001 1260 Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 1294 Query 1 # use `test`; create table t2 (n int) engine=innodb do release_lock("lock1"); drop table t0,t2; reset master; diff --git a/mysql-test/r/ctype_cp932_binlog_row.result b/mysql-test/r/ctype_cp932_binlog_row.result index 913e8125619..f1a64241fbb 100644 --- a/mysql-test/r/ctype_cp932_binlog_row.result +++ b/mysql-test/r/ctype_cp932_binlog_row.result @@ -9,8 +9,8 @@ EXECUTE stmt1 USING @var1; SHOW BINLOG EVENTS FROM 102; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; CREATE TABLE t1(f1 blob) -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F SELECT HEX(f1) FROM t1; HEX(f1) 8300 diff --git a/mysql-test/r/ndb_binlog_ignore_db.result b/mysql-test/r/ndb_binlog_ignore_db.result index 8dc2c1ff1f8..e83c7b8e70f 100644 --- a/mysql-test/r/ndb_binlog_ignore_db.result +++ b/mysql-test/r/ndb_binlog_ignore_db.result @@ -7,4 +7,8 @@ insert into t1 values (1, 1); show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # use `test`; drop table if exists t1 +master-bin.000001 # Table_map # # table_id: # (mysql.proc) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysql.event) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F drop database mysqltest; diff --git a/mysql-test/r/rpl_ndb_charset.result b/mysql-test/r/rpl_ndb_charset.result index 423f70761e7..3fac0703d01 100644 --- a/mysql-test/r/rpl_ndb_charset.result +++ b/mysql-test/r/rpl_ndb_charset.result @@ -112,36 +112,56 @@ drop database mysqltest3; show binlog events from 102; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # drop database if exists mysqltest2 +master-bin.000001 # Table_map 1 # table_id: # (mysql.proc) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (mysql.event) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Query 1 # drop database if exists mysqltest3 +master-bin.000001 # Table_map 1 # table_id: # (mysql.proc) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (mysql.event) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Query 1 # create database mysqltest2 character set latin2 master-bin.000001 # Query 1 # create database mysqltest3 master-bin.000001 # Query 1 # drop database mysqltest3 +master-bin.000001 # Table_map 1 # table_id: # (mysql.proc) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (mysql.event) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Query 1 # create database mysqltest3 master-bin.000001 # Query 1 # use `mysqltest2`; create table t1 (a int auto_increment primary key, b varchar(100)) -master-bin.000001 # Table_map 1 # mysqltest2.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # mysqltest2.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # mysqltest2.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # mysqltest2.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # mysqltest2.t1 -master-bin.000001 # Write_rows 1 # +master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Query 1 # use `mysqltest2`; truncate table t1 -master-bin.000001 # Table_map 1 # mysqltest2.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # mysqltest2.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # mysqltest2.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # mysqltest2.t1 -master-bin.000001 # Write_rows 1 # +master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Query 1 # use `mysqltest2`; truncate table t1 -master-bin.000001 # Table_map 1 # mysqltest2.t1 -master-bin.000001 # Write_rows 1 # +master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Query 1 # drop database mysqltest2 +master-bin.000001 # Table_map 1 # table_id: # (mysql.proc) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (mysql.event) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Query 1 # drop database mysqltest3 +master-bin.000001 # Table_map 1 # table_id: # (mysql.proc) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (mysql.event) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F select "--- --global--" as ""; --- --global-- diff --git a/mysql-test/r/rpl_ndb_dd_basic.result b/mysql-test/r/rpl_ndb_dd_basic.result index 1afe235bd72..4c88c74a9ba 100644 --- a/mysql-test/r/rpl_ndb_dd_basic.result +++ b/mysql-test/r/rpl_ndb_dd_basic.result @@ -57,10 +57,10 @@ master-bin.000001 798 Query 1 978 use `test`; CREATE TABLE t1 tablespace ts1 storage disk engine ndb master-bin.000001 978 Query 1 1042 BEGIN -master-bin.000001 1042 Table_map 1 53 cluster.apply_status -master-bin.000001 1095 Write_rows 1 95 -master-bin.000001 1137 Table_map 1 136 test.t1 -master-bin.000001 1178 Write_rows 1 178 +master-bin.000001 1042 Table_map 1 41 table_id: # (test.t1) +master-bin.000001 1083 Table_map 1 94 table_id: # (cluster.apply_status) +master-bin.000001 1136 Write_rows 1 136 table_id: # +master-bin.000001 1178 Write_rows 1 178 table_id: # flags: STMT_END_F master-bin.000001 1220 Query 1 1285 COMMIT drop table t1; alter tablespace ts1 diff --git a/mysql-test/r/rpl_row_basic_11bugs.result b/mysql-test/r/rpl_row_basic_11bugs.result index 46ea9c26422..4ed7d54647b 100644 --- a/mysql-test/r/rpl_row_basic_11bugs.result +++ b/mysql-test/r/rpl_row_basic_11bugs.result @@ -25,6 +25,11 @@ SHOW TABLES; Tables_in_test_ignore t2 INSERT INTO t2 VALUES (3,3), (4,4); +SHOW BINLOG EVENTS FROM 102; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 102 Query 1 195 use `test`; CREATE TABLE t1 (a INT, b INT) +master-bin.000001 195 Table_map 1 235 table_id: # (test.t1) +master-bin.000001 235 Write_rows 1 282 table_id: # flags: STMT_END_F **** On Slave **** SHOW DATABASES; Database diff --git a/mysql-test/r/rpl_row_basic_2myisam.result b/mysql-test/r/rpl_row_basic_2myisam.result index 972e69cd619..a6877b27b95 100644 --- a/mysql-test/r/rpl_row_basic_2myisam.result +++ b/mysql-test/r/rpl_row_basic_2myisam.result @@ -363,7 +363,6 @@ SELECT C1,HEX(B1),HEX(B2) FROM t4 ORDER BY C1; C1 HEX(B1) HEX(B2) 1 NULL 0 CREATE TABLE t7 (C1 INT PRIMARY KEY, C2 INT) ENGINE = 'MYISAM' ; - --- on slave: original values --- INSERT INTO t7 VALUES (1,3), (2,6), (3,9); SELECT * FROM t7 ORDER BY C1; @@ -371,7 +370,6 @@ C1 C2 1 3 2 6 3 9 - --- on master: new values inserted --- INSERT INTO t7 VALUES (1,2), (2,4), (3,6); SELECT * FROM t7 ORDER BY C1; @@ -379,48 +377,42 @@ C1 C2 1 2 2 4 3 6 - --- on slave: old values should be overwritten by replicated values --- SELECT * FROM t7 ORDER BY C1; C1 C2 1 2 2 4 3 6 - --- on master --- -DROP TABLE t7; -CREATE TABLE t7 (a INT PRIMARY KEY, b INT UNIQUE, c INT UNIQUE) ENGINE = 'MYISAM' ; -INSERT INTO t7 VALUES (99,99,99); -INSERT INTO t7 VALUES (99,22,33); +CREATE TABLE t8 (a INT PRIMARY KEY, b INT UNIQUE, c INT UNIQUE) ENGINE = 'MYISAM' ; +INSERT INTO t8 VALUES (99,99,99); +INSERT INTO t8 VALUES (99,22,33); ERROR 23000: Duplicate entry '99' for key 'PRIMARY' -INSERT INTO t7 VALUES (11,99,33); +INSERT INTO t8 VALUES (11,99,33); ERROR 23000: Duplicate entry '99' for key 'b' -INSERT INTO t7 VALUES (11,22,99); +INSERT INTO t8 VALUES (11,22,99); ERROR 23000: Duplicate entry '99' for key 'c' -SELECT * FROM t7 ORDER BY a; +SELECT * FROM t8 ORDER BY a; a b c 99 99 99 - --- on slave --- -SELECT * FROM t7 ORDER BY a; +SELECT * FROM t8 ORDER BY a; a b c 99 99 99 -INSERT INTO t7 VALUES (1,2,3), (2,4,6), (3,6,9); -SELECT * FROM t7 ORDER BY a; +INSERT INTO t8 VALUES (1,2,3), (2,4,6), (3,6,9); +SELECT * FROM t8 ORDER BY a; a b c 1 2 3 2 4 6 3 6 9 99 99 99 - --- on master --- -INSERT INTO t7 VALUES (2,4,8); - +INSERT INTO t8 VALUES (2,4,8); --- on slave --- -SELECT * FROM t7 ORDER BY a; +SELECT * FROM t8 ORDER BY a; a b c 1 2 3 2 4 8 3 6 9 99 99 99 -DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7; +DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8; diff --git a/mysql-test/r/rpl_row_basic_3innodb.result b/mysql-test/r/rpl_row_basic_3innodb.result index aa0361b38bc..4c6ec627db5 100644 --- a/mysql-test/r/rpl_row_basic_3innodb.result +++ b/mysql-test/r/rpl_row_basic_3innodb.result @@ -363,7 +363,6 @@ SELECT C1,HEX(B1),HEX(B2) FROM t4 ORDER BY C1; C1 HEX(B1) HEX(B2) 1 NULL 0 CREATE TABLE t7 (C1 INT PRIMARY KEY, C2 INT) ENGINE = 'INNODB' ; - --- on slave: original values --- INSERT INTO t7 VALUES (1,3), (2,6), (3,9); SELECT * FROM t7 ORDER BY C1; @@ -371,7 +370,6 @@ C1 C2 1 3 2 6 3 9 - --- on master: new values inserted --- INSERT INTO t7 VALUES (1,2), (2,4), (3,6); SELECT * FROM t7 ORDER BY C1; @@ -379,48 +377,42 @@ C1 C2 1 2 2 4 3 6 - --- on slave: old values should be overwritten by replicated values --- SELECT * FROM t7 ORDER BY C1; C1 C2 1 2 2 4 3 6 - --- on master --- -DROP TABLE t7; -CREATE TABLE t7 (a INT PRIMARY KEY, b INT UNIQUE, c INT UNIQUE) ENGINE = 'INNODB' ; -INSERT INTO t7 VALUES (99,99,99); -INSERT INTO t7 VALUES (99,22,33); +CREATE TABLE t8 (a INT PRIMARY KEY, b INT UNIQUE, c INT UNIQUE) ENGINE = 'INNODB' ; +INSERT INTO t8 VALUES (99,99,99); +INSERT INTO t8 VALUES (99,22,33); ERROR 23000: Duplicate entry '99' for key 'PRIMARY' -INSERT INTO t7 VALUES (11,99,33); +INSERT INTO t8 VALUES (11,99,33); ERROR 23000: Duplicate entry '99' for key 'b' -INSERT INTO t7 VALUES (11,22,99); +INSERT INTO t8 VALUES (11,22,99); ERROR 23000: Duplicate entry '99' for key 'c' -SELECT * FROM t7 ORDER BY a; +SELECT * FROM t8 ORDER BY a; a b c 99 99 99 - --- on slave --- -SELECT * FROM t7 ORDER BY a; +SELECT * FROM t8 ORDER BY a; a b c 99 99 99 -INSERT INTO t7 VALUES (1,2,3), (2,4,6), (3,6,9); -SELECT * FROM t7 ORDER BY a; +INSERT INTO t8 VALUES (1,2,3), (2,4,6), (3,6,9); +SELECT * FROM t8 ORDER BY a; a b c 1 2 3 2 4 6 3 6 9 99 99 99 - --- on master --- -INSERT INTO t7 VALUES (2,4,8); - +INSERT INTO t8 VALUES (2,4,8); --- on slave --- -SELECT * FROM t7 ORDER BY a; +SELECT * FROM t8 ORDER BY a; a b c 1 2 3 2 4 8 3 6 9 99 99 99 -DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7; +DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8; diff --git a/mysql-test/r/rpl_row_basic_7ndb.result b/mysql-test/r/rpl_row_basic_7ndb.result index ccf94a02ed8..8c77a82f02b 100644 --- a/mysql-test/r/rpl_row_basic_7ndb.result +++ b/mysql-test/r/rpl_row_basic_7ndb.result @@ -363,7 +363,6 @@ SELECT C1,HEX(B1),HEX(B2) FROM t4 ORDER BY C1; C1 HEX(B1) HEX(B2) 1 NULL 0 CREATE TABLE t7 (C1 INT PRIMARY KEY, C2 INT) ENGINE = 'NDB' ; - --- on slave: original values --- INSERT INTO t7 VALUES (1,3), (2,6), (3,9); SELECT * FROM t7 ORDER BY C1; @@ -371,7 +370,6 @@ C1 C2 1 3 2 6 3 9 - --- on master: new values inserted --- INSERT INTO t7 VALUES (1,2), (2,4), (3,6); SELECT * FROM t7 ORDER BY C1; @@ -379,48 +377,42 @@ C1 C2 1 2 2 4 3 6 - --- on slave: old values should be overwritten by replicated values --- SELECT * FROM t7 ORDER BY C1; C1 C2 1 2 2 4 3 6 - --- on master --- -DROP TABLE t7; -CREATE TABLE t7 (a INT PRIMARY KEY, b INT UNIQUE, c INT UNIQUE) ENGINE = 'NDB' ; -INSERT INTO t7 VALUES (99,99,99); -INSERT INTO t7 VALUES (99,22,33); +CREATE TABLE t8 (a INT PRIMARY KEY, b INT UNIQUE, c INT UNIQUE) ENGINE = 'NDB' ; +INSERT INTO t8 VALUES (99,99,99); +INSERT INTO t8 VALUES (99,22,33); ERROR 23000: Duplicate entry '99' for key 'PRIMARY' -INSERT INTO t7 VALUES (11,99,33); +INSERT INTO t8 VALUES (11,99,33); ERROR 23000: Duplicate entry '11' for key 'PRIMARY' -INSERT INTO t7 VALUES (11,22,99); +INSERT INTO t8 VALUES (11,22,99); ERROR 23000: Duplicate entry '11' for key 'PRIMARY' -SELECT * FROM t7 ORDER BY a; +SELECT * FROM t8 ORDER BY a; a b c 99 99 99 - --- on slave --- -SELECT * FROM t7 ORDER BY a; +SELECT * FROM t8 ORDER BY a; a b c 99 99 99 -INSERT INTO t7 VALUES (1,2,3), (2,4,6), (3,6,9); -SELECT * FROM t7 ORDER BY a; +INSERT INTO t8 VALUES (1,2,3), (2,4,6), (3,6,9); +SELECT * FROM t8 ORDER BY a; a b c 1 2 3 2 4 6 3 6 9 99 99 99 - --- on master --- -INSERT INTO t7 VALUES (2,4,8); - +INSERT INTO t8 VALUES (2,4,8); --- on slave --- -SELECT * FROM t7 ORDER BY a; +SELECT * FROM t8 ORDER BY a; a b c 1 2 3 2 4 8 3 6 9 99 99 99 -DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7; +DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8; diff --git a/mysql-test/r/rpl_row_charset.result b/mysql-test/r/rpl_row_charset.result index 3b065a06826..d80b5fa60de 100644 --- a/mysql-test/r/rpl_row_charset.result +++ b/mysql-test/r/rpl_row_charset.result @@ -112,36 +112,46 @@ drop database mysqltest3; show binlog events from 102; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # drop database if exists mysqltest2 +master-bin.000001 # Table_map 1 # table_id: # (mysql.proc) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Query 1 # drop database if exists mysqltest3 +master-bin.000001 # Table_map 1 # table_id: # (mysql.proc) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Query 1 # create database mysqltest2 character set latin2 master-bin.000001 # Query 1 # create database mysqltest3 master-bin.000001 # Query 1 # drop database mysqltest3 +master-bin.000001 # Table_map 1 # table_id: # (mysql.proc) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Query 1 # create database mysqltest3 master-bin.000001 # Query 1 # use `mysqltest2`; create table t1 (a int auto_increment primary key, b varchar(100)) -master-bin.000001 # Table_map 1 # mysqltest2.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # mysqltest2.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # mysqltest2.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # mysqltest2.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # mysqltest2.t1 -master-bin.000001 # Write_rows 1 # +master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Query 1 # use `mysqltest2`; truncate table t1 -master-bin.000001 # Table_map 1 # mysqltest2.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # mysqltest2.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # mysqltest2.t1 -master-bin.000001 # Write_rows 1 # -master-bin.000001 # Table_map 1 # mysqltest2.t1 -master-bin.000001 # Write_rows 1 # +master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Query 1 # use `mysqltest2`; truncate table t1 -master-bin.000001 # Table_map 1 # mysqltest2.t1 -master-bin.000001 # Write_rows 1 # +master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Query 1 # drop database mysqltest2 +master-bin.000001 # Table_map 1 # table_id: # (mysql.proc) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Query 1 # drop database mysqltest3 +master-bin.000001 # Table_map 1 # table_id: # (mysql.proc) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F select "--- --global--" as ""; --- --global-- diff --git a/mysql-test/r/rpl_row_create_table.result b/mysql-test/r/rpl_row_create_table.result index bf6a2fd0e8b..b3a8f5e1a0f 100644 --- a/mysql-test/r/rpl_row_create_table.result +++ b/mysql-test/r/rpl_row_create_table.result @@ -127,7 +127,7 @@ NULL 5 10 NULL 6 12 CREATE TABLE t7 (UNIQUE(b)) SELECT a,b FROM tt3; ERROR 23000: Duplicate entry '2' for key 'b' -SHOW BINLOG EVENTS FROM 1256; +SHOW BINLOG EVENTS FROM 1326; Log_name Pos Event_type Server_id End_log_pos Info CREATE TABLE t7 (a INT, b INT UNIQUE); INSERT INTO t7 SELECT a,b FROM tt3; @@ -137,11 +137,11 @@ a b 1 2 2 4 3 6 -SHOW BINLOG EVENTS FROM 1256; +SHOW BINLOG EVENTS FROM 1326; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 1256 Query 1 1356 use `test`; CREATE TABLE t7 (a INT, b INT UNIQUE) -master-bin.000001 1356 Table_map 1 1396 test.t7 -master-bin.000001 1396 Write_rows 1 1452 +master-bin.000001 1326 Query 1 1426 use `test`; CREATE TABLE t7 (a INT, b INT UNIQUE) +master-bin.000001 1426 Table_map 1 1466 table_id: # (test.t7) +master-bin.000001 1466 Write_rows 1 1522 table_id: # flags: STMT_END_F SELECT * FROM t7 ORDER BY a,b; a b 1 2 @@ -154,10 +154,10 @@ INSERT INTO t7 SELECT a,b FROM tt4; ROLLBACK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back -SHOW BINLOG EVENTS FROM 1452; +SHOW BINLOG EVENTS FROM 1522; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 1452 Table_map 1 1492 test.t7 -master-bin.000001 1492 Write_rows 1 1548 +master-bin.000001 1522 Table_map 1 1562 table_id: # (test.t7) +master-bin.000001 1562 Write_rows 1 1618 table_id: # flags: STMT_END_F SELECT * FROM t7 ORDER BY a,b; a b 1 2 @@ -191,10 +191,10 @@ Create Table CREATE TABLE `t9` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -SHOW BINLOG EVENTS FROM 1548; +SHOW BINLOG EVENTS FROM 1618; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 1548 Query 1 1634 use `test`; CREATE TABLE t8 LIKE t4 -master-bin.000001 1634 Query 1 1773 use `test`; CREATE TABLE `t9` ( +master-bin.000001 1618 Query 1 1704 use `test`; CREATE TABLE t8 LIKE t4 +master-bin.000001 1704 Query 1 1843 use `test`; CREATE TABLE `t9` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL ) diff --git a/mysql-test/r/rpl_row_delayed_ins.result b/mysql-test/r/rpl_row_delayed_ins.result index eb7fa5ccbb3..16001b96ac2 100644 --- a/mysql-test/r/rpl_row_delayed_ins.result +++ b/mysql-test/r/rpl_row_delayed_ins.result @@ -16,8 +16,8 @@ show binlog events; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 4 Format_desc 1 102 Server ver: VERSION, Binlog ver: 4 master-bin.000001 102 Query 1 222 use `test`; create table t1(a int not null primary key) engine=myisam -master-bin.000001 222 Table_map 1 261 test.t1 -master-bin.000001 261 Write_rows 1 305 +master-bin.000001 222 Table_map 1 261 table_id: # (test.t1) +master-bin.000001 261 Write_rows 1 305 table_id: # flags: STMT_END_F master-bin.000001 305 Query 1 380 use `test`; flush tables SELECT * FROM t1 ORDER BY a; a diff --git a/mysql-test/r/rpl_row_drop.result b/mysql-test/r/rpl_row_drop.result index a5abc2837e3..4ef21884fda 100644 --- a/mysql-test/r/rpl_row_drop.result +++ b/mysql-test/r/rpl_row_drop.result @@ -41,6 +41,12 @@ t1 t2 **** On Master **** DROP TABLE t1,t2; +SHOW BINLOG EVENTS; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 4 Format_desc 1 102 Server ver: VERSION, Binlog ver: 4 +master-bin.000001 102 Query 1 188 use `test`; CREATE TABLE t1 (a int) +master-bin.000001 188 Query 1 274 use `test`; CREATE TABLE t2 (a int) +master-bin.000001 274 Query 1 378 use `test`; DROP TABLE `t1` /* generated by server */ SHOW TABLES; Tables_in_test t2 diff --git a/mysql-test/r/rpl_row_log.result b/mysql-test/r/rpl_row_log.result index 0059f6d48d9..c40efaaf952 100644 --- a/mysql-test/r/rpl_row_log.result +++ b/mysql-test/r/rpl_row_log.result @@ -20,22 +20,22 @@ show binlog events; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4 master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Query 1 # use `test`; drop table t1 master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F show binlog events from 102 limit 1; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM show binlog events from 102 limit 2; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM -master-bin.000001 # Table_map 1 # test.t1 +master-bin.000001 # Table_map 1 # table_id: # (test.t1) show binlog events from 102 limit 2,1; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Write_rows 1 # +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F flush logs; create table t3 (a int)ENGINE=MyISAM; start slave; @@ -47,50 +47,54 @@ show binlog events; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4 master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Query 1 # use `test`; drop table t1 master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Rotate 1 # master-bin.000002;pos=4 show binlog events in 'master-bin.000002'; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000002 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4 +master-bin.000002 # Table_map 1 # table_id: # (mysql.slow_log) +master-bin.000002 # Table_map 1 # table_id: # (mysql.general_log) master-bin.000002 # Query 1 # use `test`; create table t3 (a int)ENGINE=MyISAM master-bin.000002 # Query 1 # use `test`; create table t2 (n int)ENGINE=MyISAM -master-bin.000002 # Table_map 1 # test.t2 -master-bin.000002 # Write_rows 1 # +master-bin.000002 # Table_map 1 # table_id: # (test.t2) +master-bin.000002 # Write_rows 1 # table_id: # flags: STMT_END_F show binary logs; Log_name File_size master-bin.000001 1256 -master-bin.000002 373 +master-bin.000002 483 start slave; show binary logs; Log_name File_size slave-bin.000001 1354 -slave-bin.000002 274 +slave-bin.000002 384 show binlog events in 'slave-bin.000001' from 4; Log_name Pos Event_type Server_id End_log_pos Info slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4 slave-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM -slave-bin.000001 # Table_map 1 # test.t1 -slave-bin.000001 # Write_rows 1 # +slave-bin.000001 # Table_map 1 # table_id: # (test.t1) +slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F slave-bin.000001 # Query 1 # use `test`; drop table t1 slave-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM -slave-bin.000001 # Table_map 1 # test.t1 -slave-bin.000001 # Write_rows 1 # +slave-bin.000001 # Table_map 1 # table_id: # (test.t1) +slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F slave-bin.000001 # Query 1 # use `test`; create table t3 (a int)ENGINE=MyISAM slave-bin.000001 # Rotate 2 # slave-bin.000002;pos=4 show binlog events in 'slave-bin.000002' from 4; Log_name Pos Event_type Server_id End_log_pos Info slave-bin.000002 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4 +slave-bin.000002 # Table_map 2 # table_id: # (mysql.slow_log) +slave-bin.000002 # Table_map 2 # table_id: # (mysql.general_log) slave-bin.000002 # Query 1 # use `test`; create table t2 (n int)ENGINE=MyISAM -slave-bin.000002 # Table_map 1 # test.t2 -slave-bin.000002 # Write_rows 1 # +slave-bin.000002 # Table_map 1 # table_id: # (test.t2) +slave-bin.000002 # Write_rows 1 # table_id: # flags: STMT_END_F show slave status; Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master -# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 373 # # master-bin.000002 Yes Yes # 0 0 373 # None 0 No # +# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 483 # # master-bin.000002 Yes Yes # 0 0 483 # None 0 No # show binlog events in 'slave-bin.000005' from 4; ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log DROP TABLE t1; diff --git a/mysql-test/r/rpl_row_log_innodb.result b/mysql-test/r/rpl_row_log_innodb.result index c89208add8e..fa0de780095 100644 --- a/mysql-test/r/rpl_row_log_innodb.result +++ b/mysql-test/r/rpl_row_log_innodb.result @@ -20,13 +20,13 @@ show binlog events; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4 master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Xid 1 # COMMIT /* XID */ master-bin.000001 # Query 1 # use `test`; drop table t1 master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=InnoDB -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Xid 1 # COMMIT /* XID */ show binlog events from 102 limit 1; Log_name Pos Event_type Server_id End_log_pos Info @@ -34,10 +34,10 @@ master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_in show binlog events from 102 limit 2; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB -master-bin.000001 # Table_map 1 # test.t1 +master-bin.000001 # Table_map 1 # table_id: # (test.t1) show binlog events from 102 limit 2,1; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Write_rows 1 # +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F flush logs; create table t3 (a int)ENGINE=InnoDB; start slave; @@ -49,56 +49,60 @@ show binlog events; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4 master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Xid 1 # COMMIT /* XID */ master-bin.000001 # Query 1 # use `test`; drop table t1 master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=InnoDB -master-bin.000001 # Table_map 1 # test.t1 -master-bin.000001 # Write_rows 1 # +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Xid 1 # COMMIT /* XID */ master-bin.000001 # Rotate 1 # master-bin.000002;pos=4 show binlog events in 'master-bin.000002'; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000002 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4 +master-bin.000002 # Table_map 1 # table_id: # (mysql.slow_log) +master-bin.000002 # Table_map 1 # table_id: # (mysql.general_log) master-bin.000002 # Query 1 # use `test`; create table t3 (a int)ENGINE=InnoDB master-bin.000002 # Query 1 # use `test`; create table t2 (n int)ENGINE=InnoDB -master-bin.000002 # Table_map 1 # test.t2 -master-bin.000002 # Write_rows 1 # +master-bin.000002 # Table_map 1 # table_id: # (test.t2) +master-bin.000002 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000002 # Xid 1 # COMMIT /* XID */ show binary logs; Log_name File_size master-bin.000001 1310 -master-bin.000002 400 +master-bin.000002 510 start slave; show binary logs; Log_name File_size slave-bin.000001 1408 -slave-bin.000002 301 +slave-bin.000002 411 show binlog events in 'slave-bin.000001' from 4; Log_name Pos Event_type Server_id End_log_pos Info slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4 slave-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB -slave-bin.000001 # Table_map 1 # test.t1 -slave-bin.000001 # Write_rows 1 # +slave-bin.000001 # Table_map 1 # table_id: # (test.t1) +slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F slave-bin.000001 # Xid 1 # COMMIT /* XID */ slave-bin.000001 # Query 1 # use `test`; drop table t1 slave-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=InnoDB -slave-bin.000001 # Table_map 1 # test.t1 -slave-bin.000001 # Write_rows 1 # +slave-bin.000001 # Table_map 1 # table_id: # (test.t1) +slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F slave-bin.000001 # Xid 1 # COMMIT /* XID */ slave-bin.000001 # Query 1 # use `test`; create table t3 (a int)ENGINE=InnoDB slave-bin.000001 # Rotate 2 # slave-bin.000002;pos=4 show binlog events in 'slave-bin.000002' from 4; Log_name Pos Event_type Server_id End_log_pos Info slave-bin.000002 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4 +slave-bin.000002 # Table_map 2 # table_id: # (mysql.slow_log) +slave-bin.000002 # Table_map 2 # table_id: # (mysql.general_log) slave-bin.000002 # Query 1 # use `test`; create table t2 (n int)ENGINE=InnoDB -slave-bin.000002 # Table_map 1 # test.t2 -slave-bin.000002 # Write_rows 1 # +slave-bin.000002 # Table_map 1 # table_id: # (test.t2) +slave-bin.000002 # Write_rows 1 # table_id: # flags: STMT_END_F slave-bin.000002 # Xid 1 # COMMIT /* XID */ show slave status; Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master -# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 400 # # master-bin.000002 Yes Yes # 0 0 400 # None 0 No # +# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 510 # # master-bin.000002 Yes Yes # 0 0 510 # None 0 No # show binlog events in 'slave-bin.000005' from 4; ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log DROP TABLE t1; diff --git a/mysql-test/r/rpl_row_max_relay_size.result b/mysql-test/r/rpl_row_max_relay_size.result index 6146d623ec5..b7afe0b0515 100644 --- a/mysql-test/r/rpl_row_max_relay_size.result +++ b/mysql-test/r/rpl_row_max_relay_size.result @@ -58,4 +58,4 @@ Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File flush logs; show master status; File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000002 102 <Binlog_Ignore_DB> +master-bin.000002 212 <Binlog_Ignore_DB> diff --git a/mysql-test/r/rpl_switch_stm_row_mixed.result b/mysql-test/r/rpl_switch_stm_row_mixed.result index 3459320b59d..762a21a4370 100644 --- a/mysql-test/r/rpl_switch_stm_row_mixed.result +++ b/mysql-test/r/rpl_switch_stm_row_mixed.result @@ -139,63 +139,64 @@ select * from t1 where a="alarm"; a show binlog events from 102; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 102 Query 1 205 drop database if exists mysqltest1 -master-bin.000001 205 Query 1 300 create database mysqltest1 -master-bin.000001 300 Query 1 401 use `mysqltest1`; CREATE TABLE t1 (a varchar(100)) -master-bin.000001 401 Table_map 1 446 mysqltest1.t1 -master-bin.000001 446 Write_rows 1 481 -master-bin.000001 481 Table_map 1 526 mysqltest1.t1 -master-bin.000001 526 Write_rows 1 602 -master-bin.000001 602 Table_map 1 647 mysqltest1.t1 -master-bin.000001 647 Write_rows 1 718 -master-bin.000001 718 Table_map 1 763 mysqltest1.t1 -master-bin.000001 763 Write_rows 1 803 -master-bin.000001 803 Table_map 1 848 mysqltest1.t1 -master-bin.000001 848 Write_rows 1 918 -master-bin.000001 918 Table_map 1 963 mysqltest1.t1 -master-bin.000001 963 Write_rows 1 1003 -master-bin.000001 1003 Table_map 1 1048 mysqltest1.t1 -master-bin.000001 1048 Write_rows 1 1082 -master-bin.000001 1082 Query 1 1180 use `mysqltest1`; insert into t1 values("work") -master-bin.000001 1180 User var 1 1228 @`string`=_latin1 0x656D657267656E6379 COLLATE latin1_swedish_ci -master-bin.000001 1228 Query 1 1328 use `mysqltest1`; insert into t1 select @'string' -master-bin.000001 1328 Query 1 1426 use `mysqltest1`; insert into t1 values("work") -master-bin.000001 1426 User var 1 1474 @`string`=_latin1 0x656D657267656E6379 COLLATE latin1_swedish_ci -master-bin.000001 1474 Query 1 1574 use `mysqltest1`; insert into t1 select @'string' -master-bin.000001 1574 Query 1 1671 use `mysqltest1`; insert into t1 values("for") -master-bin.000001 1671 Query 1 1773 use `mysqltest1`; insert into t1 select "yesterday" -master-bin.000001 1773 Query 1 1871 use `mysqltest1`; insert into t1 values("work") -master-bin.000001 1871 User var 1 1919 @`string`=_latin1 0x656D657267656E6379 COLLATE latin1_swedish_ci -master-bin.000001 1919 Query 1 2019 use `mysqltest1`; insert into t1 select @'string' -master-bin.000001 2019 Query 1 2117 use `mysqltest1`; insert into t1 values("work") -master-bin.000001 2117 User var 1 2165 @`string`=_latin1 0x656D657267656E6379 COLLATE latin1_swedish_ci -master-bin.000001 2165 Query 1 2265 use `mysqltest1`; insert into t1 select @'string' -master-bin.000001 2265 Query 1 2362 use `mysqltest1`; insert into t1 values("for") -master-bin.000001 2362 Query 1 2464 use `mysqltest1`; insert into t1 select "yesterday" -master-bin.000001 2464 Query 1 2562 use `mysqltest1`; insert into t1 values("work") -master-bin.000001 2562 Table_map 1 2607 mysqltest1.t1 -master-bin.000001 2607 Write_rows 1 2683 -master-bin.000001 2683 Table_map 1 2728 mysqltest1.t1 -master-bin.000001 2728 Write_rows 1 2799 -master-bin.000001 2799 User var 1 2847 @`string`=_latin1 0x656D657267656E6379 COLLATE latin1_swedish_ci -master-bin.000001 2847 Query 1 2947 use `mysqltest1`; insert into t1 select @'string' -master-bin.000001 2947 Table_map 1 2992 mysqltest1.t1 -master-bin.000001 2992 Write_rows 1 3062 -master-bin.000001 3062 Query 1 3164 use `mysqltest1`; insert into t1 select "yesterday" -master-bin.000001 3164 Table_map 1 3209 mysqltest1.t1 -master-bin.000001 3209 Write_rows 1 3280 -master-bin.000001 3280 User var 1 3328 @`string`=_latin1 0x656D657267656E6379 COLLATE latin1_swedish_ci -master-bin.000001 3328 Query 1 3428 use `mysqltest1`; insert into t1 select @'string' -master-bin.000001 3428 Table_map 1 3473 mysqltest1.t1 -master-bin.000001 3473 Write_rows 1 3543 -master-bin.000001 3543 Query 1 3645 use `mysqltest1`; insert into t1 select "yesterday" -master-bin.000001 3645 Query 1 3857 use `mysqltest1`; create procedure foo() +master-bin.000001 # Query 1 # drop database if exists mysqltest1 +master-bin.000001 # Table_map 1 # table_id: # (mysql.proc) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Query 1 # create database mysqltest1 +master-bin.000001 # Query 1 # use `mysqltest1`; CREATE TABLE t1 (a varchar(100)) +master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values("work") +master-bin.000001 # User var 1 # @`string`=_latin1 0x656D657267656E6379 COLLATE latin1_swedish_ci +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select @'string' +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values("work") +master-bin.000001 # User var 1 # @`string`=_latin1 0x656D657267656E6379 COLLATE latin1_swedish_ci +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select @'string' +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values("for") +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select "yesterday" +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values("work") +master-bin.000001 # User var 1 # @`string`=_latin1 0x656D657267656E6379 COLLATE latin1_swedish_ci +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select @'string' +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values("work") +master-bin.000001 # User var 1 # @`string`=_latin1 0x656D657267656E6379 COLLATE latin1_swedish_ci +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select @'string' +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values("for") +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select "yesterday" +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values("work") +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # User var 1 # @`string`=_latin1 0x656D657267656E6379 COLLATE latin1_swedish_ci +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select @'string' +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select "yesterday" +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # User var 1 # @`string`=_latin1 0x656D657267656E6379 COLLATE latin1_swedish_ci +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select @'string' +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select "yesterday" +master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo() begin insert into t1 values("work"); insert into t1 values(concat("for",UUID())); insert into t1 select "yesterday"; end -master-bin.000001 3857 Query 1 4214 use `mysqltest1`; create procedure foo2() +master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo2() begin insert into t1 values(concat("emergency",UUID())); insert into t1 values("work"); @@ -204,21 +205,18 @@ set session binlog_format=row; # accepted for stored procs insert into t1 values("more work"); set session binlog_format=mixed; end -master-bin.000001 4214 Query 1 4442 use `mysqltest1`; create function foo3() returns bigint unsigned +master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function foo3() returns bigint unsigned begin set session binlog_format=row; # rejected for stored funcs insert into t1 values("alarm"); return 100; end -master-bin.000001 4442 Query 1 4548 use `mysqltest1`; insert into t1 values("work") -master-bin.000001 4548 Table_map 1 4593 mysqltest1.t1 -master-bin.000001 4593 Write_rows 1 4663 -master-bin.000001 4663 Query 1 4773 use `mysqltest1`; insert into t1 select "yesterday" -master-bin.000001 4773 Table_map 1 4818 mysqltest1.t1 -master-bin.000001 4818 Write_rows 1 4894 -master-bin.000001 4894 Query 1 5000 use `mysqltest1`; insert into t1 values("work") -master-bin.000001 5000 Table_map 1 5045 mysqltest1.t1 -master-bin.000001 5045 Write_rows 1 5115 -master-bin.000001 5115 Table_map 1 5160 mysqltest1.t1 -master-bin.000001 5160 Write_rows 1 5200 +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values("work") +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select "yesterday" +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values("work") +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F drop database mysqltest1; diff --git a/mysql-test/t/binlog_stm_binlog.test b/mysql-test/t/binlog_stm_binlog.test index 826ce54ae2c..f22e7e45aea 100644 --- a/mysql-test/t/binlog_stm_binlog.test +++ b/mysql-test/t/binlog_stm_binlog.test @@ -5,7 +5,7 @@ create table t1 (a int, b int) engine=innodb; begin; insert into t1 values (1,2); commit; ---replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ +--replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/ show binlog events; drop table t1; diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index 0751c07847c..d089faf6f35 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -26,6 +26,8 @@ rpl_ndb_2innodb : Bugs#17400: delete & update of rows in table without p rpl_ndb_2myisam : Bugs#17400: delete & update of rows in table without pk fails rpl_ndb_auto_inc : Bug#17086 #rpl_ndb_basic : Bug#16228 [IN REVIEW] +rpl_ndb_blob : interferes with following tests, causing hang +rpl_ndb_blob2 : interferes with following tests, causing hang rpl_ndb_ddl : Bug#17400: delete & update of rows in table without pk fails rpl_ndb_delete_nowhere : Bug#17400: delete & update of rows in table without pk fails rpl_ndb_innodb2ndb : Bugs#17400: delete & update of rows in table without pk fails @@ -36,6 +38,9 @@ rpl_ndb_relay_space : Bug#16993 rpl_ndb_multi_update2 : BUG#17738 In progress rpl_ndb_multi_update3 : Bug#17400: delete & update of rows in table without pk fails rpl_ndb_sp007 : Bug #17290 +rpl_row_inexist_tbl : Disabled since patch makes this test wait forever rpl_sp : Bug#16456 rpl_until : Unstable test case, bug#15886 sp-goto : GOTO is currently is disabled - will be fixed in the future +rpl_rbr_to_sbr : BUG#18108 +mysqldump : BUG#18078 diff --git a/mysql-test/t/ndb_binlog_ddl_multi.test b/mysql-test/t/ndb_binlog_ddl_multi.test index 8cba100f1ec..50111681301 100644 --- a/mysql-test/t/ndb_binlog_ddl_multi.test +++ b/mysql-test/t/ndb_binlog_ddl_multi.test @@ -34,7 +34,7 @@ create table t2 (a int primary key) engine=ndb; --source include/show_binlog_events.inc --connection server1 --- source include/show_binlog_events.inc +--source include/show_binlog_events.inc # alter table --connection server1 @@ -48,7 +48,6 @@ alter table t2 add column (b int); --connections server1 --source include/show_binlog_events.inc - # alter database --connection server1 reset master; @@ -64,9 +63,7 @@ ALTER DATABASE mysqltest CHARACTER SET latin1; drop table mysqltest.t1; --connection server1 ---replace_result $binlog_start <binlog_start> ---replace_column 2 # 4 # 5 # ---eval show binlog events from $binlog_start +--source include/show_binlog_events.inc # drop database and drop should come after data events diff --git a/mysql-test/t/ndb_binlog_ignore_db.test b/mysql-test/t/ndb_binlog_ignore_db.test index a46266f209a..82a261ffe13 100644 --- a/mysql-test/t/ndb_binlog_ignore_db.test +++ b/mysql-test/t/ndb_binlog_ignore_db.test @@ -14,6 +14,7 @@ create table t1 (a int primary key, b int) engine=ndb; insert into t1 values (1, 1); --replace_result $binlog_start <binlog_start> --replace_column 2 # 4 # 5 # +--replace_regex /table_id: [0-9]+/table_id: #/ --eval show binlog events from $binlog_start drop database mysqltest; diff --git a/mysql-test/t/rpl_heap.test b/mysql-test/t/rpl_heap.test index 2436b851a03..b35983ad4d7 100644 --- a/mysql-test/t/rpl_heap.test +++ b/mysql-test/t/rpl_heap.test @@ -22,6 +22,7 @@ create table t1 engine=HEAP select 10 as a; insert into t1 values(11); save_master_pos; --replace_column 2 # 5 # +--replace_regex /table_id: [0-9]+/table_id: #/ show binlog events from 79; connection slave; reset slave; @@ -40,6 +41,7 @@ select * from t1; select * from t1 limit 10; save_master_pos; --replace_column 2 # 5 # +--replace_regex /table_id: [0-9]+/table_id: #/ show binlog events in 'master-bin.002' from 79; connection slave; diff --git a/mysql-test/t/rpl_loaddata_s.test b/mysql-test/t/rpl_loaddata_s.test index 8e2bf012bc9..72a5d1a8ec1 100644 --- a/mysql-test/t/rpl_loaddata_s.test +++ b/mysql-test/t/rpl_loaddata_s.test @@ -21,6 +21,7 @@ connection slave; sync_with_master; select count(*) from test.t1; # check that LOAD was replicated --replace_column 2 # 5 # +--replace_regex /table_id: [0-9]+/table_id: #/ show binlog events from 102; # should be nothing # Cleanup diff --git a/mysql-test/t/rpl_ndb_dd_basic.test b/mysql-test/t/rpl_ndb_dd_basic.test index f1aa1ee2bf1..0e8e4124100 100644 --- a/mysql-test/t/rpl_ndb_dd_basic.test +++ b/mysql-test/t/rpl_ndb_dd_basic.test @@ -69,6 +69,7 @@ select * from t1 order by pk1; --connection master let $VERSION=`select version()`; --replace_result $VERSION VERSION +--replace_regex /table_id: [0-9]+/table_id: #/ show binlog events; # diff --git a/mysql-test/t/rpl_row_basic_11bugs.test b/mysql-test/t/rpl_row_basic_11bugs.test index c976ce247b3..d098723644f 100644 --- a/mysql-test/t/rpl_row_basic_11bugs.test +++ b/mysql-test/t/rpl_row_basic_11bugs.test @@ -17,7 +17,8 @@ USE test_ignore; CREATE TABLE t2 (a INT, b INT); SHOW TABLES; INSERT INTO t2 VALUES (3,3), (4,4); -#SHOW BINLOG EVENTS FROM 102; +--replace_regex /table_id: [0-9]+/table_id: #/ +SHOW BINLOG EVENTS FROM 102; sync_slave_with_master; --echo **** On Slave **** SHOW DATABASES; diff --git a/mysql-test/t/rpl_row_create_table.test b/mysql-test/t/rpl_row_create_table.test index faabf489bba..6897dc5c718 100644 --- a/mysql-test/t/rpl_row_create_table.test +++ b/mysql-test/t/rpl_row_create_table.test @@ -26,6 +26,7 @@ CREATE TABLE t2 (a INT, b INT) ENGINE=Merge; CREATE TABLE t3 (a INT, b INT) CHARSET=utf8; CREATE TABLE t4 (a INT, b INT) ENGINE=Merge CHARSET=utf8; --replace_column 1 # 4 # 5 # +--replace_regex /table_id: [0-9]+/table_id: #/ --query_vertical SHOW BINLOG EVENTS FROM 212 --echo **** On Master **** --query_vertical SHOW CREATE TABLE t1 @@ -60,7 +61,8 @@ connection master; --error 1062 CREATE TABLE t7 (UNIQUE(b)) SELECT a,b FROM tt3; # Shouldn't be written to the binary log -SHOW BINLOG EVENTS FROM 1256; +--replace_regex /table_id: [0-9]+/table_id: #/ +SHOW BINLOG EVENTS FROM 1326; # Test that INSERT-SELECT works the same way as for SBR. CREATE TABLE t7 (a INT, b INT UNIQUE); @@ -68,7 +70,8 @@ CREATE TABLE t7 (a INT, b INT UNIQUE); INSERT INTO t7 SELECT a,b FROM tt3; SELECT * FROM t7 ORDER BY a,b; # Should be written to the binary log -SHOW BINLOG EVENTS FROM 1256; +--replace_regex /table_id: [0-9]+/table_id: #/ +SHOW BINLOG EVENTS FROM 1326; sync_slave_with_master; SELECT * FROM t7 ORDER BY a,b; @@ -78,7 +81,8 @@ INSERT INTO tt4 VALUES (4,8), (5,10), (6,12); BEGIN; INSERT INTO t7 SELECT a,b FROM tt4; ROLLBACK; -SHOW BINLOG EVENTS FROM 1452; +--replace_regex /table_id: [0-9]+/table_id: #/ +SHOW BINLOG EVENTS FROM 1522; SELECT * FROM t7 ORDER BY a,b; sync_slave_with_master; SELECT * FROM t7 ORDER BY a,b; @@ -91,7 +95,8 @@ CREATE TEMPORARY TABLE tt6 LIKE tt4; --echo **** On Master **** --query_vertical SHOW CREATE TABLE t8 --query_vertical SHOW CREATE TABLE t9 -SHOW BINLOG EVENTS FROM 1548; +--replace_regex /table_id: [0-9]+/table_id: #/ +SHOW BINLOG EVENTS FROM 1618; sync_slave_with_master; --echo **** On Slave **** --query_vertical SHOW CREATE TABLE t8 diff --git a/mysql-test/t/rpl_row_drop.test b/mysql-test/t/rpl_row_drop.test index dd6ef331508..20c217a7c3a 100644 --- a/mysql-test/t/rpl_row_drop.test +++ b/mysql-test/t/rpl_row_drop.test @@ -31,8 +31,9 @@ connection master; # Should drop the non-temporary table t1 and the temporary table t2 DROP TABLE t1,t2; let $VERSION=`select version()`; -#--replace_result $VERSION VERSION -#SHOW BINLOG EVENTS; +--replace_result $VERSION VERSION +--replace_regex /table_id: [0-9]+/table_id: #/ +SHOW BINLOG EVENTS; SHOW TABLES; sync_slave_with_master; --echo **** On Slave **** diff --git a/mysql-test/t/rpl_sp.test b/mysql-test/t/rpl_sp.test index d5bd7c75648..f9072b5a711 100644 --- a/mysql-test/t/rpl_sp.test +++ b/mysql-test/t/rpl_sp.test @@ -341,6 +341,7 @@ drop trigger trg; insert into t1 values (1); select * from t1; --replace_column 2 # 5 # +--replace_regex /table_id: [0-9]+/table_id: #/ show binlog events in 'master-bin.000001' from 102; sync_slave_with_master; select * from t1; diff --git a/mysql-test/t/rpl_switch_stm_row_mixed.test b/mysql-test/t/rpl_switch_stm_row_mixed.test index f607148a4b4..ef4eef6cc7b 100644 --- a/mysql-test/t/rpl_switch_stm_row_mixed.test +++ b/mysql-test/t/rpl_switch_stm_row_mixed.test @@ -147,6 +147,8 @@ select * from t1 where a="alarm"; # and now compare: +--replace_column 2 # 5 # +--replace_regex /table_id: [0-9]+/table_id: #/ show binlog events from 102; sync_slave_with_master; # as we're using UUID we don't SELECT but use "diff" like in rpl_row_UUID diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index b025b2969b9..3b1ee7f5076 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -2944,6 +2944,7 @@ begin show warnings; end| --disable_parsing +--replace_regex /table_id: [0-9]+/table_id: #/ show binlog events; show storage engines; show master status; diff --git a/mysql-test/t/user_var-binlog.test b/mysql-test/t/user_var-binlog.test index a7726c990f1..7f1561b925b 100644 --- a/mysql-test/t/user_var-binlog.test +++ b/mysql-test/t/user_var-binlog.test @@ -14,6 +14,7 @@ set @var1= "';aaa"; SET @var2=char(ascii('a')); insert into t1 values (@var1),(@var2); --replace_column 2 # 5 # +--replace_regex /table_id: [0-9]+/table_id: #/ show binlog events from 102; # more important than SHOW BINLOG EVENTS, mysqlbinlog (where we # absolutely need variables names to be quoted and strings to be diff --git a/sql/ha_ndbcluster_binlog.cc b/sql/ha_ndbcluster_binlog.cc index 3d84647e0db..62497903ced 100644 --- a/sql/ha_ndbcluster_binlog.cc +++ b/sql/ha_ndbcluster_binlog.cc @@ -23,6 +23,7 @@ #include "rpl_filter.h" #include "slave.h" #include "ha_ndbcluster_binlog.h" +#include "NdbDictionary.hpp" #ifdef ndb_dynamite #undef assert @@ -1842,15 +1843,20 @@ static int open_binlog_index(THD *thd, TABLE_LIST *tables, /* Insert one row in the binlog_index - - declared friend in handler.h to be able to call write_row directly - so that this insert is not replicated */ int ndb_add_binlog_index(THD *thd, void *_row) { Binlog_index_row &row= *(Binlog_index_row *) _row; int error= 0; bool need_reopen; + + /* + Turn of binlogging to prevent the table changes to be written to + the binary log. + */ + ulong saved_options= thd->options; + thd->options&= ~(OPTION_BIN_LOG); + for ( ; ; ) /* loop for need_reopen */ { if (!binlog_index && open_binlog_index(thd, &binlog_tables, &binlog_index)) @@ -1886,7 +1892,7 @@ int ndb_add_binlog_index(THD *thd, void *_row) binlog_index->field[6]->store(row.n_schemaops); int r; - if ((r= binlog_index->file->write_row(binlog_index->record[0]))) + if ((r= binlog_index->file->ha_write_row(binlog_index->record[0]))) { sql_print_error("NDB Binlog: Writing row to binlog_index: %d", r); error= -1; @@ -1895,10 +1901,12 @@ int ndb_add_binlog_index(THD *thd, void *_row) mysql_unlock_tables(thd, thd->lock); thd->lock= 0; + thd->options= saved_options; return 0; add_binlog_index_err: close_thread_tables(thd); binlog_index= 0; + thd->options= saved_options; return error; } @@ -3077,12 +3085,19 @@ pthread_handler_t ndb_binlog_thread_func(void *arg) DBUG_PRINT("info", ("no share or table !")); continue; } - TABLE* table=share->table; - const LEX_STRING& name=table->s->table_name; - DBUG_PRINT("info", ("use_table: %.*s", name.length, name.str)); - injector::transaction::table tbl(table, true); - // TODO enable when mats patch pushed - //trans.use_table(::server_id, tbl); + + Uint32 const bits= + NdbDictionary::Event::TE_INSERT | + NdbDictionary::Event::TE_DELETE | + NdbDictionary::Event::TE_UPDATE; + if (event_types & bits) + { + TABLE* table=share->table; + const LEX_STRING& name=table->s->table_name; + DBUG_PRINT("info", ("use_table: %.*s", name.length, name.str)); + injector::transaction::table tbl(table, true); + trans.use_table(::server_id, tbl); + } } } gci= pOp->getGCI(); @@ -3093,8 +3108,7 @@ pthread_handler_t ndb_binlog_thread_func(void *arg) const LEX_STRING& name=table->s->table_name; DBUG_PRINT("info", ("use_table: %.*s", name.length, name.str)); injector::transaction::table tbl(table, true); - // TODO enable when mats patch pushed - //trans.use_table(::server_id, tbl); + trans.use_table(::server_id, tbl); MY_BITMAP b; uint32 bitbuf; diff --git a/sql/handler.cc b/sql/handler.cc index 3c79a1af8bd..76c3ebd3387 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -3137,10 +3137,12 @@ bool ha_show_status(THD *thd, handlerton *db_type, enum ha_stat_type stat) correct for the table. A row in the given table should be replicated if: - - Row-based replication is on - - It is not a temporary table + - Row-based replication is enabled in the current thread - The binlog is enabled - - The table shall be binlogged (binlog_*_db rules) + - It is not a temporary table + - The binary log is open + - The database the table resides in shall be binlogged (binlog_*_db rules) + - table is not mysql.event */ #ifdef HAVE_ROW_BASED_REPLICATION @@ -3154,7 +3156,10 @@ namespace { thd->current_stmt_binlog_row_based && thd && (thd->options & OPTION_BIN_LOG) && (table->s->tmp_table == NO_TMP_TABLE) && - binlog_filter->db_ok(table->s->db.str); + mysql_bin_log.is_open() && + binlog_filter->db_ok(table->s->db.str) && + (strcmp(table->s->db.str, "mysql") || + strcmp(table->s->table_name.str, "event")); } } @@ -3204,40 +3209,81 @@ template int binlog_log_row<Update_rows_log_event>(TABLE *, const byte *, const #endif /* HAVE_ROW_BASED_REPLICATION */ -int handler::ha_write_row(byte *buf) +int handler::ha_external_lock(THD *thd, int lock_type) { + DBUG_ENTER("handler::ha_external_lock"); int error; - if (likely(!(error= write_row(buf)))) + if (unlikely(error= external_lock(thd, lock_type))) + DBUG_RETURN(error); +#ifdef HAVE_ROW_BASED_REPLICATION + if (table->file->is_injective()) + DBUG_RETURN(0); + + /* + There is a number of statements that are logged statement-based + but call external lock. For these, we do not need to generate a + table map. + + TODO: The need for this switch is an indication that the model for + locking combined with row-based replication needs to be looked + over. Ideally, no such special handling should be needed. + */ + switch (thd->lex->sql_command) + { + case SQLCOM_TRUNCATE: + case SQLCOM_ALTER_TABLE: + DBUG_RETURN(0); + } + + /* + If we are locking a table for writing, we generate a table map. + For all other kinds of locks, we don't do anything. + */ + if (lock_type == F_WRLCK && check_table_binlog_row_based(thd, table)) { + int const has_trans= table->file->has_transactions(); + error= thd->binlog_write_table_map(table, has_trans); + if (unlikely(error)) + DBUG_RETURN(error); + } +#endif + DBUG_RETURN(0); +} + +int handler::ha_write_row(byte *buf) +{ + int error; + if (unlikely(error= write_row(buf))) + return error; #ifdef HAVE_ROW_BASED_REPLICATION - error= binlog_log_row<Write_rows_log_event>(table, 0, buf); + if (unlikely(error= binlog_log_row<Write_rows_log_event>(table, 0, buf))) + return error; #endif - } - return error; + return 0; } int handler::ha_update_row(const byte *old_data, byte *new_data) { int error; - if (likely(!(error= update_row(old_data, new_data)))) - { + if (unlikely(error= update_row(old_data, new_data))) + return error; #ifdef HAVE_ROW_BASED_REPLICATION - error= binlog_log_row<Update_rows_log_event>(table, old_data, new_data); + if (unlikely(error= binlog_log_row<Update_rows_log_event>(table, old_data, new_data))) + return error; #endif - } - return error; + return 0; } int handler::ha_delete_row(const byte *buf) { int error; - if (likely(!(error= delete_row(buf)))) - { + if (unlikely(error= delete_row(buf))) + return error; #ifdef HAVE_ROW_BASED_REPLICATION - error= binlog_log_row<Delete_rows_log_event>(table, buf, 0); + if (unlikely(error= binlog_log_row<Delete_rows_log_event>(table, buf, 0))) + return error; #endif - } - return error; + return 0; } diff --git a/sql/handler.h b/sql/handler.h index d71841fe6b0..d564c7ee28e 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -664,7 +664,35 @@ typedef struct st_ha_create_information bool store_on_disk; /* 1 if table stored on disk */ } HA_CREATE_INFO; +/* + Class for maintaining hooks used inside operations on tables such + as: create table functions, delete table functions, and alter table + functions. + + Class is using the Template Method pattern to separate the public + usage interface from the private inheritance interface. This + imposes no overhead, since the public non-virtual function is small + enough to be inlined. + + The hooks are usually used for functions that does several things, + e.g., create_table_from_items(), which both create a table and lock + it. + */ +class TABLEOP_HOOKS +{ +public: + inline void prelock(TABLE **tables, uint count) + { + do_prelock(tables, count); + } +private: + /* Function primitive that is called prior to locking tables */ + virtual void do_prelock(TABLE **tables, uint count) + { + /* Default is to do nothing */ + } +}; typedef struct st_savepoint SAVEPOINT; extern ulong savepoint_alloc_size; @@ -1015,15 +1043,24 @@ public: uint get_index(void) const { return active_index; } virtual int open(const char *name, int mode, uint test_if_locked)=0; virtual int close(void)=0; - virtual int ha_write_row(byte * buf); - virtual int ha_update_row(const byte * old_data, byte * new_data); - virtual int ha_delete_row(const byte * buf); + + /* + These functions represent the public interface to *users* of the + handler class, hence they are *not* virtual. For the inheritance + interface, see the (private) functions write_row(), update_row(), + and delete_row() below. + */ + int ha_external_lock(THD *thd, int lock_type); + int ha_write_row(byte * buf); + int ha_update_row(const byte * old_data, byte * new_data); + int ha_delete_row(const byte * buf); + /* If the handler does it's own injection of the rows, this member function should return 'true'. */ virtual bool is_injective() const { return false; } - + /* SYNOPSIS start_bulk_update() @@ -1155,7 +1192,6 @@ public: { return 0; } virtual int extra_opt(enum ha_extra_function operation, ulong cache_size) { return extra(operation); } - virtual int external_lock(THD *thd, int lock_type) { return 0; } /* In an UPDATE or DELETE, if the row under the cursor was locked by another transaction, and the engine used an optimistic read of the last @@ -1429,28 +1465,31 @@ public: { return COMPATIBLE_DATA_NO; } private: - /* - Row-level primitives for storage engines. - These should be overridden by the storage engine class. To call - these methods, use the corresponding 'ha_*' method above. + Row-level primitives for storage engines. These should be + overridden by the storage engine class. To call these methods, use + the corresponding 'ha_*' method above. */ - friend int ndb_add_binlog_index(THD *, void *); + virtual int external_lock(THD *thd __attribute__((unused)), + int lock_type __attribute__((unused))) + { + return 0; + } - virtual int write_row(byte *buf __attribute__((unused))) - { - return HA_ERR_WRONG_COMMAND; + virtual int write_row(byte *buf __attribute__((unused))) + { + return HA_ERR_WRONG_COMMAND; } virtual int update_row(const byte *old_data __attribute__((unused)), byte *new_data __attribute__((unused))) - { - return HA_ERR_WRONG_COMMAND; + { + return HA_ERR_WRONG_COMMAND; } virtual int delete_row(const byte *buf __attribute__((unused))) - { - return HA_ERR_WRONG_COMMAND; + { + return HA_ERR_WRONG_COMMAND; } }; diff --git a/sql/lock.cc b/sql/lock.cc index 9cd0dcce610..40a7a29942b 100644 --- a/sql/lock.cc +++ b/sql/lock.cc @@ -229,12 +229,12 @@ static int lock_external(THD *thd, TABLE **tables, uint count) ((*tables)->reginfo.lock_type >= TL_READ && (*tables)->reginfo.lock_type <= TL_READ_NO_INSERT)) lock_type=F_RDLCK; - if ((error=(*tables)->file->external_lock(thd,lock_type))) + if ((error=(*tables)->file->ha_external_lock(thd,lock_type))) { print_lock_error(error, (*tables)->file->table_type()); for (; i-- ; tables--) { - (*tables)->file->external_lock(thd, F_UNLCK); + (*tables)->file->ha_external_lock(thd, F_UNLCK); (*tables)->current_lock=F_UNLCK; } DBUG_RETURN(error); @@ -578,7 +578,7 @@ static int unlock_external(THD *thd, TABLE **table,uint count) if ((*table)->current_lock != F_UNLCK) { (*table)->current_lock = F_UNLCK; - if ((error=(*table)->file->external_lock(thd, F_UNLCK))) + if ((error=(*table)->file->ha_external_lock(thd, F_UNLCK))) { error_code=error; print_lock_error(error_code, (*table)->file->table_type()); diff --git a/sql/log.cc b/sql/log.cc index 7d893eadc52..8f22e9accd1 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1044,6 +1044,12 @@ binlog_end_trans(THD *thd, binlog_trx_data *trx_data, Log_event *end_ev) if (end_ev) { + /* + We can always end the statement when ending a transaction since + transactions are not allowed inside stored functions. If they + were, we would have to ensure that we're not ending a statement + inside a stored function. + */ thd->binlog_flush_pending_rows_event(true); error= mysql_bin_log.write(thd, trans_log, end_ev); } @@ -1063,7 +1069,7 @@ binlog_end_trans(THD *thd, binlog_trx_data *trx_data, Log_event *end_ev) generated instead of the one that was written to the thrown-away transaction cache. */ - ++mysql_bin_log.m_table_map_version; + mysql_bin_log.update_table_map_version(); statistic_increment(binlog_cache_use, &LOCK_status); if (trans_log->disk_writes != 0) @@ -2601,6 +2607,41 @@ int THD::binlog_setup_trx_data() DBUG_RETURN(0); } +/* + Write a table map to the binary log. + + This function is called from ha_external_lock() after the storage + engine has registered for the transaction. + */ + +int THD::binlog_write_table_map(TABLE *table, bool is_trans) +{ + DBUG_ENTER("THD::binlog_write_table_map"); + DBUG_PRINT("enter", ("table=%p (%s: #%u)", + table, table->s->table_name, table->s->table_map_id)); + + /* Pre-conditions */ + DBUG_ASSERT(current_stmt_binlog_row_based && mysql_bin_log.is_open()); + DBUG_ASSERT(table->s->table_map_id != ULONG_MAX); + + Table_map_log_event::flag_set const + flags= Table_map_log_event::TM_NO_FLAGS; + + Table_map_log_event + the_event(this, table, table->s->table_map_id, is_trans, flags); + + if (is_trans) + trans_register_ha(this, options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN), + &binlog_hton); + + if (int error= mysql_bin_log.write(&the_event)) + DBUG_RETURN(error); + + ++binlog_table_maps; + table->s->table_map_version= mysql_bin_log.table_map_version(); + DBUG_RETURN(0); +} + Rows_log_event* THD::binlog_get_pending_rows_event() const { @@ -2618,8 +2659,12 @@ THD::binlog_get_pending_rows_event() const void THD::binlog_set_pending_rows_event(Rows_log_event* ev) { + if (ha_data[binlog_hton.slot] == NULL) + binlog_setup_trx_data(); + binlog_trx_data *const trx_data= (binlog_trx_data*) ha_data[binlog_hton.slot]; + DBUG_ASSERT(trx_data); trx_data->pending= ev; } @@ -2643,6 +2688,8 @@ int MYSQL_LOG::flush_and_set_pending_rows_event(THD *thd, Rows_log_event* event) DBUG_ASSERT(trx_data); + DBUG_PRINT("info", ("trx_data->pending=%p", trx_data->pending)); + if (Rows_log_event* pending= trx_data->pending) { IO_CACHE *file= &log_file; @@ -2663,15 +2710,6 @@ int MYSQL_LOG::flush_and_set_pending_rows_event(THD *thd, Rows_log_event* event) pthread_mutex_lock(&LOCK_log); /* - Write a table map if necessary - */ - if (pending->maybe_write_table_map(thd, file, this)) - { - pthread_mutex_unlock(&LOCK_log); - DBUG_RETURN(2); - } - - /* Write pending event to log file or transaction cache */ if (pending->write(file)) @@ -2712,18 +2750,8 @@ int MYSQL_LOG::flush_and_set_pending_rows_event(THD *thd, Rows_log_event* event) pthread_mutex_unlock(&LOCK_log); } - else if (event && event->get_cache_stmt()) /* && pending == 0 */ - { - /* - If we are setting a non-null event for a table that is - transactional, we start a transaction here as well. - */ - trans_register_ha(thd, - thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN), - &binlog_hton); - } - trx_data->pending= event; + thd->binlog_set_pending_rows_event(event); DBUG_RETURN(error); } @@ -2755,21 +2783,13 @@ bool MYSQL_LOG::write(Log_event *event_info) mutex, we do this before aquiring the LOCK_log mutex in this function. - This is not optimal, but necessary in the current implementation - since there is code that writes rows to system tables without - using some way to flush the pending event (e.g., binlog_query()). - - TODO: There shall be no writes to any system table after calling - binlog_query(), so these writes has to be moved to before the call - of binlog_query() for correct functioning. - - This is necessesary not only for RBR, but the master might crash - after binlogging the query but before changing the system tables. - This means that the slave and the master are not in the same state - (after the master has restarted), so therefore we have to - eliminate this problem. + We only end the statement if we are in a top-level statement. If + we are inside a stored function, we do not end the statement since + this will close all tables on the slave. */ - thd->binlog_flush_pending_rows_event(true); + bool const end_stmt= + thd->prelocked_mode && thd->lex->requires_prelocking(); + thd->binlog_flush_pending_rows_event(end_stmt); pthread_mutex_lock(&LOCK_log); @@ -2792,8 +2812,9 @@ bool MYSQL_LOG::write(Log_event *event_info) (!binlog_filter->db_ok(local_db))) { VOID(pthread_mutex_unlock(&LOCK_log)); - DBUG_PRINT("info",("db_ok('%s')==%d", local_db, - binlog_filter->db_ok(local_db))); + DBUG_PRINT("info",("OPTION_BIN_LOG is %s, db_ok('%s') == %d", + (thd->options & OPTION_BIN_LOG) ? "set" : "clear", + local_db, binlog_filter->db_ok(local_db))); DBUG_RETURN(0); } #endif /* HAVE_REPLICATION */ @@ -3511,44 +3532,6 @@ void MYSQL_LOG::signal_update() DBUG_VOID_RETURN; } -#ifndef MYSQL_CLIENT -bool MYSQL_LOG::write_table_map(THD *thd, IO_CACHE *file, TABLE* table, - bool is_transactional) -{ - DBUG_ENTER("MYSQL_LOG::write_table_map()"); - DBUG_PRINT("enter", ("table=%p (%s: %u)", - table, table->s->table_name, table->s->table_map_id)); - - /* Pre-conditions */ - DBUG_ASSERT(thd->current_stmt_binlog_row_based && is_open()); - DBUG_ASSERT(table->s->table_map_id != ULONG_MAX); - -#ifndef DBUG_OFF - /* - We only need to execute under the LOCK_log mutex if we are writing - to the log file; otherwise, we are writing to a thread-specific - transaction cache and there is no need to serialize this event - with events in other threads. - */ - if (file == &log_file) - safe_mutex_assert_owner(&LOCK_log); -#endif - - Table_map_log_event::flag_set const - flags= Table_map_log_event::TM_NO_FLAGS; - - Table_map_log_event - the_event(thd, table, table->s->table_map_id, is_transactional, flags); - - if (the_event.write(file)) - DBUG_RETURN(1); - - table->s->table_map_version= m_table_map_version; - DBUG_RETURN(0); -} -#endif /* !defined(MYSQL_CLIENT) */ - - #ifdef __NT__ void print_buffer_to_nt_eventlog(enum loglevel level, char *buff, uint length, int buffLen) diff --git a/sql/log.h b/sql/log.h index 8a83e7b66d0..391ef54dff7 100644 --- a/sql/log.h +++ b/sql/log.h @@ -203,9 +203,11 @@ class MYSQL_LOG: public TC_LOG bool no_auto_events; friend class Log_event; -public: ulonglong m_table_map_version; + int write_to_file(IO_CACHE *cache); + +public: /* These describe the log's format. This is used only for relay logs. _for_exec is used by the SQL thread, _for_queue by the I/O thread. It's @@ -232,9 +234,12 @@ public: #if !defined(MYSQL_CLIENT) bool is_table_mapped(TABLE *table) const { - return table->s->table_map_version == m_table_map_version; + return table->s->table_map_version == table_map_version(); } + ulonglong table_map_version() const { return m_table_map_version; } + void update_table_map_version() { ++m_table_map_version; } + int flush_and_set_pending_rows_event(THD *thd, Rows_log_event* event); #endif /* !defined(MYSQL_CLIENT) */ @@ -302,8 +307,6 @@ public: bool write(Log_event* event_info); // binary log write bool write(THD *thd, IO_CACHE *cache, Log_event *commit_event); - bool write_table_map(THD *thd, IO_CACHE *cache, TABLE *table, bool is_trans); - void start_union_events(THD *thd); void stop_union_events(THD *thd); bool is_query_in_union(THD *thd, query_id_t query_id_param); diff --git a/sql/log_event.cc b/sql/log_event.cc index 0a48cff34d0..a6034c8d5b0 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1685,6 +1685,7 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli, const char *query DBUG_PRINT("info", ("log_pos: %lu", (ulong) log_pos)); clear_all_errors(thd, rli); + rli->clear_tables_to_lock(); /* Note: We do not need to execute reset_one_shot_variables() if this @@ -5063,17 +5064,21 @@ char* sql_ex_info::init(char* buf,char* buf_end,bool use_new_format) Rows_log_event::Rows_log_event(THD *thd_arg, TABLE *tbl_arg, ulong tid, MY_BITMAP const *cols, bool is_transactional) : Log_event(thd_arg, 0, is_transactional), + m_row_count(0), m_table(tbl_arg), m_table_id(tid), - m_width(tbl_arg->s->fields), - m_rows_buf((byte*)my_malloc(opt_binlog_rows_event_max_size * - sizeof(*m_rows_buf), MYF(MY_WME))), - m_rows_cur(m_rows_buf), - m_rows_end(m_rows_buf + opt_binlog_rows_event_max_size), + m_width(tbl_arg ? tbl_arg->s->fields : 1), + m_rows_buf(0), m_rows_cur(0), m_rows_end(0), m_flags(0) { - DBUG_ASSERT(m_table && m_table->s); - DBUG_ASSERT(m_table_id != ULONG_MAX); + /* + We allow a special form of dummy event when the table, and cols + are null and the table id is ~0UL. This is a temporary + solution, to be able to terminate a started statement in the + binary log: the extreneous events will be removed in the future. + */ + DBUG_ASSERT(tbl_arg && tbl_arg->s && tid != ~0UL || + !tbl_arg && !cols && tid == ~0UL); if (thd_arg->options & OPTION_NO_FOREIGN_KEY_CHECKS) set_flags(NO_FOREIGN_KEY_CHECKS_F); @@ -5084,7 +5089,11 @@ Rows_log_event::Rows_log_event(THD *thd_arg, TABLE *tbl_arg, ulong tid, m_width <= sizeof(m_bitbuf)*8 ? m_bitbuf : NULL, (m_width + 7) & ~7UL, false))) - memcpy(m_cols.bitmap, cols->bitmap, no_bytes_in_map(cols)); + { + /* Cols can be zero if this is a dummy binrows event */ + if (likely(cols != NULL)) + memcpy(m_cols.bitmap, cols->bitmap, no_bytes_in_map(cols)); + } else m_cols.bitmap= 0; // to not free it } @@ -5095,6 +5104,7 @@ Rows_log_event::Rows_log_event(const char *buf, uint event_len, const Format_description_log_event *description_event) : Log_event(buf, description_event), + m_row_count(0), m_rows_buf(0), m_rows_cur(0), m_rows_end(0) { DBUG_ENTER("Rows_log_event::Rows_log_event(const char*,...)"); @@ -5120,8 +5130,6 @@ Rows_log_event::Rows_log_event(const char *buf, uint event_len, post_start+= RW_FLAGS_OFFSET; } - DBUG_ASSERT(m_table_id != ULONG_MAX); - m_flags= uint2korr(post_start); byte const *const var_start= (const byte *)buf + common_header_len + @@ -5178,7 +5186,7 @@ int Rows_log_event::do_add_row_data(byte *const row_data, DBUG_DUMP("row_data", (const char*)row_data, min(length, 32)); DBUG_ASSERT(m_rows_buf <= m_rows_cur); - DBUG_ASSERT(m_rows_buf < m_rows_end); + DBUG_ASSERT(!m_rows_buf || m_rows_end && m_rows_buf < m_rows_end); DBUG_ASSERT(m_rows_cur <= m_rows_end); /* The cast will always work since m_rows_cur <= m_rows_end */ @@ -5186,12 +5194,12 @@ int Rows_log_event::do_add_row_data(byte *const row_data, { my_size_t const block_size= 1024; my_ptrdiff_t const old_alloc= m_rows_end - m_rows_buf; - my_ptrdiff_t const new_alloc= - old_alloc + block_size * (length / block_size + block_size - 1); my_ptrdiff_t const cur_size= m_rows_cur - m_rows_buf; + my_ptrdiff_t const new_alloc= + block_size * ((cur_size + length) / block_size + block_size - 1); - byte* const new_buf= - (byte*)my_realloc((gptr)m_rows_buf, new_alloc, MYF(MY_WME)); + byte* const new_buf= (byte*)my_realloc((gptr)m_rows_buf, new_alloc, + MYF(MY_ALLOW_ZERO_PTR|MY_WME)); if (unlikely(!new_buf)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); @@ -5212,6 +5220,7 @@ int Rows_log_event::do_add_row_data(byte *const row_data, DBUG_ASSERT(m_rows_cur + length < m_rows_end); memcpy(m_rows_cur, row_data, length); m_rows_cur+= length; + m_row_count++; DBUG_RETURN(0); } #endif @@ -5255,10 +5264,29 @@ static char const *unpack_row(TABLE *table, int Rows_log_event::exec_event(st_relay_log_info *rli) { DBUG_ENTER("Rows_log_event::exec_event(st_relay_log_info*)"); - DBUG_ASSERT(m_table_id != ULONG_MAX); int error= 0; char const *row_start= (char const *)m_rows_buf; - TABLE* table= rli->m_table_map.get_table(m_table_id); + + /* + If m_table_id == ~0UL, then we have a dummy event that does + not contain any data. In that case, we just remove all tables in + the tables_to_lock list, close the thread tables, step the relay + log position, and return with success. + */ + if (m_table_id == ~0UL) + { + /* + This one is supposed to be set: just an extra check so that + nothing strange has happened. + */ + DBUG_ASSERT(get_flags(STMT_END_F)); + + rli->clear_tables_to_lock(); + close_thread_tables(thd); + thd->clear_error(); + rli->inc_event_relay_log_pos(); + DBUG_RETURN(0); + } /* 'thd' has been set by exec_relay_log_event(), just before calling @@ -5267,85 +5295,51 @@ int Rows_log_event::exec_event(st_relay_log_info *rli) DBUG_ASSERT(rli->sql_thd == thd); /* - lock_tables() reads the contents of thd->lex, so they must be - initialized, so we should call lex_start(); to be even safer, we call - mysql_init_query() which does a more complete set of inits. + If there is no locks taken, this is the first binrow event seen + after the table map events. We should then lock all the tables + used in the transaction and proceed with execution of the actual + event. */ - mysql_init_query(thd, NULL, 0); - - if (table) + if (!thd->lock) { + bool need_reopen= 1; /* To execute the first lap of the loop below */ + /* - table == NULL means that this table should not be - replicated (this was set up by Table_map_log_event::exec_event() which - tested replicate-* rules). + lock_tables() reads the contents of thd->lex, so they must be + initialized, so we should call lex_start(); to be even safer, we + call mysql_init_query() which does a more complete set of inits. */ - TABLE_LIST table_list; - TABLE_LIST *tables= &table_list; - bool need_reopen; - uint count= 1; - bzero(&table_list, sizeof(table_list)); - table_list.lock_type= TL_WRITE; - table_list.next_global= table_list.next_local= 0; - table_list.table= table; - - for ( ; ; ) - { - table_list.db= const_cast<char*>(table->s->db.str); - table_list.alias= table_list.table_name= - const_cast<char*>(table->s->table_name.str); + mysql_init_query(thd, NULL, 0); - if ((error= lock_tables(thd, &table_list, count, &need_reopen)) == 0) - break; + while ((error= lock_tables(thd, rli->tables_to_lock, + rli->tables_to_lock_count, &need_reopen))) + { if (!need_reopen) { slave_print_msg(ERROR_LEVEL, rli, error, - "Error in %s event: error during table %s.%s lock", - get_type_str(), table->s->db.str, - table->s->table_name.str); + "Error in %s event: when locking tables", + get_type_str()); DBUG_RETURN(error); } + /* - we need to store a local copy of the table names since the table object - will become invalid after close_tables_for_reopen - */ - char *db= my_strdup(table->s->db.str, MYF(MY_WME)); - char *table_name= my_strdup(table->s->table_name.str, MYF(MY_WME)); + So we need to reopen the tables. - if (db == 0 || table_name == 0) - { - /* - Since the lock_tables() failed, the table is not locked, so - we don't need to unlock them. - */ - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } + We need to flush the pending RBR event, since it keeps a + pointer to an open table. - /* - We also needs to flush the pending RBR event, since it keeps a - pointer to an open table. + ALTERNATIVE SOLUTION (not implemented): Extract a pointer to + the pending RBR event and reset the table pointer after the + tables has been reopened. - ALTERNATIVE SOLUTION: Extract a pointer to the pending RBR - event and reset the table pointer after the tables has been - reopened. + NOTE: For this new scheme there should be no pending event: + need to add code to assert that is the case. */ thd->binlog_flush_pending_rows_event(false); + close_tables_for_reopen(thd, &rli->tables_to_lock); - close_tables_for_reopen(thd, &tables); - - /* open the table again, same as in Table_map_event::exec_event */ - table_list.db= const_cast<char*>(db); - table_list.alias= table_list.table_name= const_cast<char*>(table_name); - table_list.updating= 1; - if ((error= open_tables(thd, &tables, &count, 0)) == 0) - { - /* reset some variables for the table list*/ - table_list.updating= 0; - /* retrieve the new table reference and update the table map */ - table= table_list.table; - error= rli->m_table_map.set_table(m_table_id, table); - } - else /* error in open_tables */ + if ((error= open_tables(thd, &rli->tables_to_lock, + &rli->tables_to_lock_count, 0))) { if (thd->query_error || thd->is_fatal_error) { @@ -5355,19 +5349,41 @@ int Rows_log_event::exec_event(st_relay_log_info *rli) */ uint actual_error= thd->net.last_errno; slave_print_msg(ERROR_LEVEL, rli, actual_error, - "Error '%s' on reopening table `%s`.`%s`", + "Error '%s' on reopening tables", (actual_error ? thd->net.last_error : - "unexpected success or fatal error"), - db, table_name); + "unexpected success or fatal error")); thd->query_error= 1; } - } - my_free((char*) db, MYF(MY_ALLOW_ZERO_PTR)); - my_free((char*) table_name, MYF(MY_ALLOW_ZERO_PTR)); - - if (error) DBUG_RETURN(error); + } + } + /* + When the open and locking succeeded, we add all the tables to + the table map and remove them from tables to lock. + */ + + TABLE_LIST *ptr= rli->tables_to_lock; + while (ptr) + { + rli->m_table_map.set_table(ptr->table_id, ptr->table); + rli->touching_table(ptr->db, ptr->table_name, ptr->table_id); + char *to_free= reinterpret_cast<char*>(ptr); + ptr= ptr->next_global; + my_free(to_free, MYF(MY_WME)); } + rli->tables_to_lock= 0; + rli->tables_to_lock_count= 0; + } + + TABLE* table= rli->m_table_map.get_table(m_table_id); + + if (table) + { + /* + table == NULL means that this table should not be replicated + (this was set up by Table_map_log_event::exec_event() which + tested replicate-* rules). + */ /* It's not needed to set_time() but @@ -5522,52 +5538,25 @@ int Rows_log_event::exec_event(st_relay_log_info *rli) DBUG_RETURN(error); } - if (table) + if (table && (table->s->primary_key == MAX_KEY) && !cache_stmt) { /* - As "table" is not NULL, we did a successful lock_tables(), without any - prior LOCK TABLES and are not in prelocked mode, so this assertion should - be true. + ------------ Temporary fix until WL#2975 is implemented --------- + + This event is not the last one (no STMT_END_F). If we stop now + (in case of terminate_slave_thread()), how will we restart? We + have to restart from Table_map_log_event, but as this table is + not transactional, the rows already inserted will still be + present, and idempotency is not guaranteed (no PK) so we risk + that repeating leads to double insert. So we desperately try to + continue, hope we'll eventually leave this buggy situation (by + executing the final Rows_log_event). If we are in a hopeless + wait (reached end of last relay log and nothing gets appended + there), we timeout after one minute, and notify DBA about the + problem. When WL#2975 is implemented, just remove the member + st_relay_log_info::unsafe_to_stop_at and all its occurences. */ - DBUG_ASSERT(thd->lock); - /* - If we are here, there are more events to come which may use our mappings - and our table. So don't clear mappings or close tables, just unlock - tables. - Why don't we lock the table once for all in - Table_map_log_event::exec_event() ? Because we could have in binlog: - BEGIN; - Table_map t1 -> 1 - Write_rows to id 1 - Table_map t2 -> 2 - Write_rows to id 2 - Xid_log_event - So we cannot lock t1 when executing the first Table_map, because at that - moment we don't know we'll also have to lock t2, and all tables must be - locked at once in MySQL. - */ - mysql_unlock_tables(thd, thd->lock); - thd->lock= 0; - if ((table->s->primary_key == MAX_KEY) && - !cache_stmt) - { - /* - ------------ Temporary fix until WL#2975 is implemented --------- - This event is not the last one (no STMT_END_F). If we stop now (in - case of terminate_slave_thread()), how will we restart? We have to - restart from Table_map_log_event, but as this table is not - transactional, the rows already inserted will still be present, and - idempotency is not guaranteed (no PK) so we risk that repeating leads - to double insert. So we desperately try to continue, hope we'll - eventually leave this buggy situation (by executing the final - Rows_log_event). If we are in a hopeless wait (reached end of last - relay log and nothing gets appended there), we timeout after one - minute, and notify DBA about the problem. - When WL#2975 is implemented, just remove the member - st_relay_log_info::unsafe_to_stop_at and all its occurences. - */ - rli->unsafe_to_stop_at= time(0); - } + rli->unsafe_to_stop_at= time(0); } DBUG_ASSERT(error == 0); @@ -5581,7 +5570,6 @@ int Rows_log_event::exec_event(st_relay_log_info *rli) #ifndef MYSQL_CLIENT bool Rows_log_event::write_data_header(IO_CACHE *file) { - DBUG_ASSERT(m_table_id != ULONG_MAX); byte buf[ROWS_HEADER_LEN]; // No need to init the buffer DBUG_EXECUTE_IF("old_row_based_repl_4_byte_map_id_master", { @@ -5614,16 +5602,15 @@ bool Rows_log_event::write_data_body(IO_CACHE*file) } #endif -#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) && defined(DBUG_RBR) +#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) void Rows_log_event::pack_info(Protocol *protocol) { - char buf[256]; - char const *const flagstr= get_flags(STMT_END_F) ? "STMT_END_F" : ""; - char const *const dbnam= m_table->s->db.str; - char const *const tblnam= m_table->s->table_name.str; - my_size_t bytes= snprintf(buf, sizeof(buf), - "%s.%s - %s", dbnam, tblnam, flagstr); - protocol->store(buf, bytes, &my_charset_bin); + char buf[256]; + char const *const flagstr= + get_flags(STMT_END_F) ? " flags: STMT_END_F" : ""; + my_size_t bytes= snprintf(buf, sizeof(buf), + "table_id: %lu%s", m_table_id, flagstr); + protocol->store(buf, bytes, &my_charset_bin); } #endif @@ -5649,7 +5636,7 @@ Table_map_log_event::Table_map_log_event(THD *thd, TABLE *tbl, ulong tid, m_table_id(tid), m_flags(flags) { - DBUG_ASSERT(m_table_id != ULONG_MAX); + DBUG_ASSERT(m_table_id != ~0UL); /* In TABLE_SHARE, "db" and "table_name" are 0-terminated (see this comment in table.cc / alloc_table_share(): @@ -5717,7 +5704,7 @@ Table_map_log_event::Table_map_log_event(const char *buf, uint event_len, post_start+= TM_FLAGS_OFFSET; } - DBUG_ASSERT(m_table_id != ULONG_MAX); + DBUG_ASSERT(m_table_id != ~0UL); m_flags= uint2korr(post_start); @@ -5767,59 +5754,6 @@ Table_map_log_event::~Table_map_log_event() } /* - Find a table based on database name and table name. - - DESCRIPTION - - Currently, only the first table of the 'table_list' is located. If the - table is found in the list of open tables for the thread, the 'table' - field of 'table_list' is filled in. - - PARAMETERS - - thd Thread structure - table_list List of tables to locate in the thd->open_tables list. - count Pointer to a variable that will be set to the number of - tables found. If the pointer is NULL, nothing will be stored. - - RETURN VALUE - - The number of tables found. - - TO DO - - Replace the list of table searches with a hash based on the combined - database and table name. The handler_tables_hash is inappropriate since - it hashes on the table alias. At the same time, the function can be - extended to handle a full list of table names, in the same spirit as - open_tables() and lock_tables(). -*/ -#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) -static uint find_tables(THD *thd, TABLE_LIST *table_list, uint *count) -{ - uint result= 0; - - /* we verify that the caller knows our limitation */ - DBUG_ASSERT(table_list->next_global == 0); - for (TABLE *table= thd->open_tables; table ; table= table->next) - { - if (strcmp(table->s->db.str, table_list->db) == 0 - && strcmp(table->s->table_name.str, table_list->table_name) == 0) - { - /* Copy the table pointer into the table list. */ - table_list->table= table; - result= 1; - break; - } - } - - if (count) - *count= result; - return result; -} -#endif - -/* Return value is an error code, one of: -1 Failure to open table [from open_tables()] @@ -5842,20 +5776,37 @@ int Table_map_log_event::exec_event(st_relay_log_info *rli) thd->query_id= next_query_id(); pthread_mutex_unlock(&LOCK_thread_count); - TABLE_LIST table_list; + TABLE_LIST *table_list; + char *db_mem, *tname_mem; + void *const memory= + my_multi_malloc(MYF(MY_WME), + &table_list, sizeof(TABLE_LIST), + &db_mem, NAME_LEN + 1, + &tname_mem, NAME_LEN + 1, + NULL); + + /* + If memory is allocated, it the pointer to it should be stored in + table_list. If this is not true, the memory will not be correctly + free:ed later. + */ + DBUG_ASSERT(memory == NULL || memory == table_list); + uint32 dummy_len; - bzero(&table_list, sizeof(table_list)); - table_list.db= const_cast<char *> - (rpl_filter->get_rewrite_db(m_dbnam, &dummy_len)); - table_list.alias= table_list.table_name= const_cast<char*>(m_tblnam); - table_list.lock_type= TL_WRITE; - table_list.next_global= table_list.next_local= 0; - table_list.updating= 1; + bzero(table_list, sizeof(*table_list)); + table_list->db = db_mem; + table_list->alias= table_list->table_name = tname_mem; + table_list->lock_type= TL_WRITE; + table_list->next_global= table_list->next_local= 0; + table_list->table_id= m_table_id; + table_list->updating= 1; + strmov(table_list->db, rpl_filter->get_rewrite_db(m_dbnam, &dummy_len)); + strmov(table_list->table_name, m_tblnam); int error= 0; - if (rpl_filter->db_ok(table_list.db) && - (!rpl_filter->is_on() || rpl_filter->tables_ok("", &table_list))) + if (rpl_filter->db_ok(table_list->db) && + (!rpl_filter->is_on() || rpl_filter->tables_ok("", table_list))) { /* Check if the slave is set to use SBR. If so, it should switch @@ -5875,36 +5826,52 @@ int Table_map_log_event::exec_event(st_relay_log_info *rli) be a no-op. */ uint count; - if (find_tables(thd, &table_list, &count) == 0) + /* + open_tables() reads the contents of thd->lex, so they must be + initialized, so we should call lex_start(); to be even safer, we + call mysql_init_query() which does a more complete set of inits. + */ + mysql_init_query(thd, NULL, 0); + if ((error= open_tables(thd, &table_list, &count, 0))) { - /* - open_tables() reads the contents of thd->lex, so they must be - initialized, so we should call lex_start(); to be even safer, we call - mysql_init_query() which does a more complete set of inits. - */ - mysql_init_query(thd, NULL, 0); - TABLE_LIST *tables= &table_list; - if ((error= open_tables(thd, &tables, &count, 0))) + if (thd->query_error || thd->is_fatal_error) { - if (thd->query_error || thd->is_fatal_error) + /* + Error reporting borrowed from Query_log_event with many excessive + simplifications (we don't honour --slave-skip-errors) + + BUG: There can be extreneous table maps in the binary log, + so in case we fail to open the table, we just generate a + warning and do not add the table to the list of tables to + open and lock. + */ + uint actual_error= thd->net.last_errno; + switch (actual_error) { - /* - Error reporting borrowed from Query_log_event with many excessive - simplifications (we don't honour --slave-skip-errors) - */ - uint actual_error= thd->net.last_errno; + case ER_NO_SUCH_TABLE: + slave_print_msg(WARNING_LEVEL, rli, actual_error, + thd->net.last_error ? + thd->net.last_error : + "<no message>"); + clear_all_errors(thd, rli); + rli->inc_event_relay_log_pos(); // Continue with next event + error= 0; + break; + + default: slave_print_msg(ERROR_LEVEL, rli, actual_error, "Error '%s' on opening table `%s`.`%s`", (actual_error ? thd->net.last_error : "unexpected success or fatal error"), - table_list.db, table_list.table_name); + table_list->db, table_list->table_name); thd->query_error= 1; + break; } - DBUG_RETURN(error); } + DBUG_RETURN(error); } - m_table= table_list.table; + m_table= table_list->table; /* This will fail later otherwise, the 'in_use' field should be @@ -5982,19 +5949,16 @@ int Table_map_log_event::exec_event(st_relay_log_info *rli) } /* - We record in the slave's information that the number m_table_id is - mapped to the m_table object + We record in the slave's information that the table should be + locked by linking the table into the list of tables to lock, and + tell the RLI that we are touching a table. */ if (!error) - error= rli->m_table_map.set_table(m_table_id, m_table); - - /* - Tell the RLI that we are touching a table. - - TODO: Maybe we can combine this with the previous operation? - */ - if (!error) - rli->touching_table(m_dbnam, m_tblnam, m_table_id); + { + table_list->next_global= table_list->next_local= rli->tables_to_lock; + rli->tables_to_lock= table_list; + rli->tables_to_lock_count++; + } } /* @@ -6017,7 +5981,7 @@ int Table_map_log_event::exec_event(st_relay_log_info *rli) #ifndef MYSQL_CLIENT bool Table_map_log_event::write_data_header(IO_CACHE *file) { - DBUG_ASSERT(m_table_id != ULONG_MAX); + DBUG_ASSERT(m_table_id != ~0UL); byte buf[TABLE_MAP_HEADER_LEN]; DBUG_EXECUTE_IF("old_row_based_repl_4_byte_map_id_master", { @@ -6062,12 +6026,17 @@ bool Table_map_log_event::write_data_body(IO_CACHE *file) field. */ +#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) void Table_map_log_event::pack_info(Protocol *protocol) { char buf[256]; - my_size_t bytes= my_snprintf(buf, sizeof(buf), "%s.%s", m_dbnam, m_tblnam); + my_size_t bytes= snprintf(buf, sizeof(buf), + "table_id: %lu (%s.%s)", + m_table_id, m_dbnam, m_tblnam); protocol->store(buf, bytes, &my_charset_bin); } +#endif + #endif @@ -6422,7 +6391,9 @@ static int find_and_fetch_row(TABLE *table, byte *key) just set the necessary bits on the bytes and don't set the filler bits correctly. */ - table->record[1][table->s->null_bytes - 1]= 0xFF; + my_ptrdiff_t const pos= + table->s->null_bytes > 0 ? table->s->null_bytes - 1 : 0; + table->record[1][pos]= 0xFF; if ((error= table->file->index_read_idx(table->record[1], 0, key, table->key_info->key_length, HA_READ_KEY_EXACT))) @@ -6457,7 +6428,9 @@ static int find_and_fetch_row(TABLE *table, byte *key) just set the necessary bits on the bytes and don't set the filler bits correctly. */ - table->record[1][table->s->null_bytes - 1]= 0xFF; + my_ptrdiff_t const pos= + table->s->null_bytes > 0 ? table->s->null_bytes - 1 : 0; + table->record[1][pos]= 0xFF; if ((error= table->file->index_next(table->record[1]))) { table->file->print_error(error, MYF(0)); @@ -6478,7 +6451,9 @@ static int find_and_fetch_row(TABLE *table, byte *key) just set the necessary bits on the bytes and don't set the filler bits correctly. */ - table->record[1][table->s->null_bytes - 1]= 0xFF; + my_ptrdiff_t const pos= + table->s->null_bytes > 0 ? table->s->null_bytes - 1 : 0; + table->record[1][pos]= 0xFF; error= table->file->rnd_next(table->record[1]); switch (error) { diff --git a/sql/log_event.h b/sql/log_event.h index dd68e969ff1..d6ce354fbdf 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -650,11 +650,16 @@ public: { return (void*) my_malloc((uint)size, MYF(MY_WME|MY_FAE)); } + static void operator delete(void *ptr, size_t size) { my_free((gptr) ptr, MYF(MY_WME|MY_ALLOW_ZERO_PTR)); } + /* Placement version of the above operators */ + static void *operator new(size_t, void* ptr) { return ptr; } + static void operator delete(void*, void*) { } + #ifndef MYSQL_CLIENT bool write_header(IO_CACHE* file, ulong data_length); virtual bool write(IO_CACHE* file) @@ -1788,10 +1793,8 @@ public: #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) virtual int exec_event(struct st_relay_log_info *rli); -#ifdef DBUG_RBR virtual void pack_info(Protocol *protocol); #endif -#endif #ifdef MYSQL_CLIENT /* not for direct call, each derived has its own ::print() */ @@ -1830,33 +1833,7 @@ public: return m_rows_buf && m_cols.bitmap; } - /* - If there is no table map active for the event, write one to the - binary log. - - LOCK_log has to be aquired before calling this function. - - PARAMETERS - thd - Thread to use when writing the table map - - RETURN VALUE - Error code, or zero if write succeeded. - */ -#if !defined(MYSQL_CLIENT) && defined(HAVE_ROW_BASED_REPLICATION) - int maybe_write_table_map(THD *thd, IO_CACHE *file, MYSQL_LOG *log) const - { - /* - N.B., get_cache_stmt() returns the value of 'using_trans' that - was provided to the constructor, i.e., get_cache_stmt() == true - if and only if the table is transactional. - */ - - int result= 0; - if (!log->is_table_mapped(m_table)) - result= log->write_table_map(thd, file, m_table, get_cache_stmt()); - return result; - } -#endif + uint m_row_count; /* The number of rows added to the event */ protected: /* diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index b1c293d3c77..2eea891d51f 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -770,7 +770,8 @@ TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info, List<create_field> *extra_fields, List<Key> *keys, List<Item> *items, - MYSQL_LOCK **lock); + MYSQL_LOCK **lock, + TABLEOP_HOOKS *hooks); bool mysql_alter_table(THD *thd, char *new_db, char *new_name, HA_CREATE_INFO *create_info, TABLE_LIST *table_list, diff --git a/sql/opt_range.cc b/sql/opt_range.cc index e42be40be81..06ca4958d2c 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -878,7 +878,7 @@ QUICK_RANGE_SELECT::~QUICK_RANGE_SELECT() DBUG_PRINT("info", ("Freeing separate handler %p (free=%d)", file, free_file)); file->ha_reset(); - file->external_lock(current_thd, F_UNLCK); + file->ha_external_lock(current_thd, F_UNLCK); file->close(); delete file; } @@ -1042,14 +1042,14 @@ int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler) /* Caller will free the memory */ goto failure; } - if (file->external_lock(thd, F_RDLCK)) + if (file->ha_external_lock(thd, F_RDLCK)) goto failure; if (file->extra(HA_EXTRA_KEYREAD) || file->ha_retrieve_all_pk() || init() || reset()) { - file->external_lock(thd, F_UNLCK); + file->ha_external_lock(thd, F_UNLCK); file->close(); goto failure; } diff --git a/sql/rpl_injector.cc b/sql/rpl_injector.cc index a69dea9a158..a69cfc2b75f 100644 --- a/sql/rpl_injector.cc +++ b/sql/rpl_injector.cc @@ -26,7 +26,7 @@ /* inline since it's called below */ inline injector::transaction::transaction(MYSQL_LOG *log, THD *thd) - : m_thd(thd) + : m_state(START_STATE), m_thd(thd) { /* Default initialization of m_start_pos (which initializes it to garbage). @@ -64,12 +64,31 @@ int injector::transaction::commit() DBUG_RETURN(0); } +int injector::transaction::use_table(server_id_type sid, table tbl) +{ + DBUG_ENTER("injector::transaction::use_table"); + + int error; + + if ((error= check_state(TABLE_STATE))) + DBUG_RETURN(error); + + m_thd->set_server_id(sid); + error= m_thd->binlog_write_table_map(tbl.get_table(), + tbl.is_transactional()); + DBUG_RETURN(error); +} + int injector::transaction::write_row (server_id_type sid, table tbl, MY_BITMAP const* cols, size_t colcnt, record_type record) { DBUG_ENTER("injector::transaction::write_row(...)"); + + if (int error= check_state(ROW_STATE)) + DBUG_RETURN(error); + m_thd->set_server_id(sid); m_thd->binlog_write_row(tbl.get_table(), tbl.is_transactional(), cols, colcnt, record); @@ -82,6 +101,10 @@ int injector::transaction::delete_row(server_id_type sid, table tbl, record_type record) { DBUG_ENTER("injector::transaction::delete_row(...)"); + + if (int error= check_state(ROW_STATE)) + DBUG_RETURN(error); + m_thd->set_server_id(sid); m_thd->binlog_delete_row(tbl.get_table(), tbl.is_transactional(), cols, colcnt, record); @@ -94,6 +117,10 @@ int injector::transaction::update_row(server_id_type sid, table tbl, record_type before, record_type after) { DBUG_ENTER("injector::transaction::update_row(...)"); + + if (int error= check_state(ROW_STATE)) + DBUG_RETURN(error); + m_thd->set_server_id(sid); m_thd->binlog_update_row(tbl.get_table(), tbl.is_transactional(), cols, colcnt, before, after); diff --git a/sql/rpl_injector.h b/sql/rpl_injector.h index 32d3fdd1a78..50a0a56dd9b 100644 --- a/sql/rpl_injector.h +++ b/sql/rpl_injector.h @@ -160,6 +160,24 @@ public: } /* + + DESCRIPTION + + Register table for use within the transaction. All tables + that are going to be used need to be registered before being + used below. The member function will fail with an error if + use_table() is called after any *_row() function has been + called for the transaction. + + RETURN VALUE + + 0 All OK + >0 Failure + + */ + int use_table(server_id_type sid, table tbl); + + /* Add a 'write row' entry to the transaction. */ int write_row (server_id_type sid, table tbl, @@ -219,6 +237,62 @@ public: } } + enum enum_state + { + START_STATE, /* Start state */ + TABLE_STATE, /* At least one table has been registered */ + ROW_STATE, /* At least one row has been registered */ + STATE_COUNT /* State count and sink state */ + } m_state; + + /* + Check and update the state. + + PARAMETER(S) + + target_state + The state we are moving to: TABLE_STATE if we are + writing a table and ROW_STATE if we are writing a row. + + DESCRIPTION + + The internal state will be updated to the target state if + and only if it is a legal move. The only legal moves are: + + START_STATE -> START_STATE + START_STATE -> TABLE_STATE + TABLE_STATE -> TABLE_STATE + TABLE_STATE -> ROW_STATE + + That is: + - It is not possible to write any row before having written at + least one table + - It is not possible to write a table after at least one row + has been written + + RETURN VALUE + + 0 All OK + -1 Incorrect call sequence + */ + int check_state(enum_state const target_state) + { + static char const *state_name[] = { + "START_STATE", "TABLE_STATE", "ROW_STATE", "STATE_COUNT" + }; + + DBUG_ASSERT(0 <= target_state && target_state <= STATE_COUNT); + DBUG_PRINT("info", ("In state %s", state_name[m_state])); + + if (m_state <= target_state && target_state <= m_state + 1 && + m_state < STATE_COUNT) + m_state= target_state; + else + m_state= STATE_COUNT; + return m_state == STATE_COUNT ? 1 : 0; + } + + binlog_pos m_start_pos; THD *m_thd; }; diff --git a/sql/rpl_rli.h b/sql/rpl_rli.h index 5500fdf1f64..cacae1aa4c2 100644 --- a/sql/rpl_rli.h +++ b/sql/rpl_rli.h @@ -276,7 +276,9 @@ typedef struct st_relay_log_info group_relay_log_pos); } - table_mapping m_table_map; + TABLE_LIST *tables_to_lock; /* RBR: Tables to lock */ + uint tables_to_lock_count; /* RBR: Count of tables to lock */ + table_mapping m_table_map; /* RBR: Mapping table-id to table */ /* Last charset (6 bytes) seen by slave SQL thread is cached here; it helps @@ -306,6 +308,18 @@ typedef struct st_relay_log_info void transaction_end(THD*); void cleanup_context(THD *, bool); + void clear_tables_to_lock() { + TABLE_LIST *ptr= tables_to_lock; + while (ptr) + { + char *to_free= reinterpret_cast<char*>(ptr); + ptr= ptr->next_global; + my_free(to_free, MYF(MY_WME)); + } + tables_to_lock= 0; + tables_to_lock_count= 0; + } + time_t unsafe_to_stop_at; } RELAY_LOG_INFO; diff --git a/sql/slave.cc b/sql/slave.cc index 68c4757b735..484d669de62 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -1444,6 +1444,8 @@ static int init_relay_log_info(RELAY_LOG_INFO* rli, rli->abort_pos_wait=0; rli->log_space_limit= relay_log_space_limit; rli->log_space_total= 0; + rli->tables_to_lock= 0; + rli->tables_to_lock_count= 0; /* The relay log will now be opened, as a SEQ_READ_APPEND IO_CACHE. @@ -2306,7 +2308,9 @@ st_relay_log_info::st_relay_log_info() ignore_log_space_limit(0), last_master_timestamp(0), slave_skip_counter(0), abort_pos_wait(0), slave_run_id(0), sql_thd(0), last_slave_errno(0), inited(0), abort_slave(0), slave_running(0), until_condition(UNTIL_NONE), - until_log_pos(0), retried_trans(0), m_reload_flags(RELOAD_NONE_F), + until_log_pos(0), retried_trans(0), + tables_to_lock(0), tables_to_lock_count(0), + m_reload_flags(RELOAD_NONE_F), unsafe_to_stop_at(0) { group_relay_log_name[0]= event_relay_log_name[0]= @@ -4969,6 +4973,7 @@ void st_relay_log_info::cleanup_context(THD *thd, bool error) } m_table_map.clear_tables(); close_thread_tables(thd); + clear_tables_to_lock(); unsafe_to_stop_at= 0; } #endif diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index a47a9b03435..f6da9fc588a 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -3271,16 +3271,6 @@ bool mysql_routine_grant(THD *thd, TABLE_LIST *table_list, bool is_proc, } grant_option=TRUE; thd->mem_root= old_root; - /* - This flush is here only becuase there is code that writes rows to - system tables after executing a binlog_query(). - - TODO: Ensure that no writes are executed after a binlog_query() by - moving the writes to before calling binlog_query(). Then remove - this line (and add an assert inside send_ok() that checks that - everything is in a consistent state). - */ - thd->binlog_flush_pending_rows_event(true); rw_unlock(&LOCK_grant); if (!result && !no_error) send_ok(thd); diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 54cc2eae1e6..6c2ca06164f 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -1058,21 +1058,18 @@ void close_thread_tables(THD *thd, bool lock_in_use, bool skip_derived) /* Fallthrough */ } - /* - For RBR: before calling close_thread_tables(), storage engines - should autocommit. Hence if there is a a pending event, it belongs - to a non-transactional engine, which writes directly to the table, - and should therefore be flushed before unlocking and closing the - tables. The test above for locked tables will not be triggered - since RBR locks and unlocks tables on a per-event basis. - - TODO (WL#3023): Change the semantics so that RBR does not lock and - unlock tables on a per-event basis. - */ - thd->binlog_flush_pending_rows_event(true); - if (thd->lock) { + /* + For RBR we flush the pending event just before we unlock all the + tables. This means that we are at the end of a topmost + statement, so we ensure that the STMT_END_F flag is set on the + pending event. For statements that are *inside* stored + functions, the pending event will not be flushed: that will be + handled either before writing a query log event (inside + binlog_query()) or when preparing a pending event. + */ + thd->binlog_flush_pending_rows_event(true); mysql_unlock_tables(thd, thd->lock); thd->lock=0; } @@ -1084,7 +1081,8 @@ void close_thread_tables(THD *thd, bool lock_in_use, bool skip_derived) saves some work in 2pc too) see also sql_parse.cc - dispatch_command() */ - bzero(&thd->transaction.stmt, sizeof(thd->transaction.stmt)); + if (!(thd->state_flags & Open_tables_state::BACKUPS_AVAIL)) + bzero(&thd->transaction.stmt, sizeof(thd->transaction.stmt)); if (!thd->active_transaction()) thd->transaction.xid_state.xid.null(); @@ -2311,7 +2309,7 @@ bool table_is_used(TABLE *table, bool wait_for_name_lock) (search->locked_by_name && wait_for_name_lock || search->locked_by_flush || (search->db_stat && search->s->version < refresh_version))) - return 1; + DBUG_RETURN(1); } } while ((table=table->next)); DBUG_RETURN(0); @@ -2433,11 +2431,11 @@ void abort_locked_tables(THD *thd,const char *db, const char *table_name) reused is on wrap-around, which means more than 4 billion table shares open at the same time). - share->table_map_id is not ULONG_MAX. + share->table_map_id is not ~0UL. */ void assign_new_table_id(TABLE_SHARE *share) { - static ulong last_table_id= ULONG_MAX; + static ulong last_table_id= ~0UL; DBUG_ENTER("assign_new_table_id"); @@ -2450,13 +2448,13 @@ void assign_new_table_id(TABLE_SHARE *share) There is one reserved number that cannot be used. Remember to change this when 6-byte global table id's are introduced. */ - if (unlikely(tid == ULONG_MAX)) + if (unlikely(tid == ~0UL)) tid= ++last_table_id; share->table_map_id= tid; DBUG_PRINT("info", ("table_id=%lu", tid)); /* Post conditions */ - DBUG_ASSERT(share->table_map_id != ULONG_MAX); + DBUG_ASSERT(share->table_map_id != ~0UL); DBUG_VOID_RETURN; } diff --git a/sql/sql_class.cc b/sql/sql_class.cc index d391584a3be..f656f03ddc2 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -162,7 +162,7 @@ bool foreign_key_prefix(Key *a, Key *b) ****************************************************************************/ Open_tables_state::Open_tables_state(ulong version_arg) - :version(version_arg) + :version(version_arg), state_flags(0U) { reset_open_tables_state(); } @@ -197,7 +197,8 @@ THD::THD() :Statement(CONVENTIONAL_EXECUTION, 0, ALLOC_ROOT_MIN_BLOCK_SIZE, 0), Open_tables_state(refresh_version), rli_fake(0), lock_id(&main_lock_id), - user_time(0), in_sub_stmt(0), global_read_lock(0), is_fatal_error(0), + user_time(0), in_sub_stmt(0), binlog_table_maps(0), + global_read_lock(0), is_fatal_error(0), rand_used(0), time_zone_used(0), last_insert_id_used(0), insert_id_used(0), clear_next_insert_id(0), in_lock_tables(0), bootstrap(0), derived_tables_processing(FALSE), @@ -1945,6 +1946,7 @@ void THD::reset_n_backup_open_tables_state(Open_tables_state *backup) DBUG_ENTER("reset_n_backup_open_tables_state"); backup->set_open_tables_state(this); reset_open_tables_state(); + state_flags|= Open_tables_state::BACKUPS_AVAIL; DBUG_VOID_RETURN; } @@ -2011,25 +2013,6 @@ void THD::reset_sub_statement_state(Sub_statement_state *backup, backup->client_capabilities= client_capabilities; backup->savepoints= transaction.savepoints; -#ifdef HAVE_ROW_BASED_REPLICATION - /* - For row-based replication and before executing a function/trigger, - the pending rows event has to be flushed. The function/trigger - might execute statement that require the pending event to be - flushed. A simple example: - - CREATE FUNCTION foo() RETURNS INT - BEGIN - SAVEPOINT x; - RETURN 0; - END - - INSERT INTO t1 VALUES (1), (foo()), (2); - */ - if (current_stmt_binlog_row_based) - binlog_flush_pending_rows_event(false); -#endif /* HAVE_ROW_BASED_REPLICATION */ - if ((!lex->requires_prelocking() || is_update_query(lex->sql_command)) && !current_stmt_binlog_row_based) options&= ~OPTION_BIN_LOG; @@ -2209,8 +2192,9 @@ THD::binlog_prepare_pending_rows_event(TABLE* table, uint32 serv_id, bool is_transactional, RowsEventT *hint __attribute__((unused))) { + DBUG_ENTER("binlog_prepare_pending_rows_event"); /* Pre-conditions */ - DBUG_ASSERT(table->s->table_map_id != ULONG_MAX); + DBUG_ASSERT(table->s->table_map_id != ~0UL); /* Fetch the type code for the RowsEventT template parameter */ int const type_code= RowsEventT::TYPE_CODE; @@ -2220,12 +2204,12 @@ THD::binlog_prepare_pending_rows_event(TABLE* table, uint32 serv_id, have to do it here. */ if (binlog_setup_trx_data()) - return NULL; + DBUG_RETURN(NULL); Rows_log_event* pending= binlog_get_pending_rows_event(); if (unlikely(pending && !pending->is_valid())) - return NULL; + DBUG_RETURN(NULL); /* Check if the current event is non-NULL and a write-rows @@ -2250,7 +2234,7 @@ THD::binlog_prepare_pending_rows_event(TABLE* table, uint32 serv_id, ev= new RowsEventT(this, table, table->s->table_map_id, cols, is_transactional); if (unlikely(!ev)) - return NULL; + DBUG_RETURN(NULL); ev->server_id= serv_id; // I don't like this, it's too easy to forget. /* flush the pending event and replace it with the newly created @@ -2259,17 +2243,17 @@ THD::binlog_prepare_pending_rows_event(TABLE* table, uint32 serv_id, if (unlikely(mysql_bin_log.flush_and_set_pending_rows_event(this, ev))) { delete ev; - return NULL; + DBUG_RETURN(NULL); } - return ev; /* This is the new pending event */ + DBUG_RETURN(ev); /* This is the new pending event */ } - return pending; /* This is the current pending event */ + DBUG_RETURN(pending); /* This is the current pending event */ } #ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION /* - Instansiate the versions we need, we have -fno-implicit-template as + Instantiate the versions we need, we have -fno-implicit-template as compiling option. */ template Rows_log_event* @@ -2534,14 +2518,35 @@ int THD::binlog_flush_pending_rows_event(bool stmt_end) { pending->set_flags(Rows_log_event::STMT_END_F); pending->flags|= LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F; + binlog_table_maps= 0; } + error= mysql_bin_log.flush_and_set_pending_rows_event(this, 0); + } + else if (stmt_end && binlog_table_maps > 0) + { /* there is no pending event at this point */ /* - We only bother to set the pending event if it is non-NULL. This - is essential for correctness, since there is not necessarily a - trx_data created for the thread if the pending event is NULL. + If pending is null and we are going to end the statement, we + have to write an extra, empty, binrow event so that the slave + knows to discard the tables it has received. Otherwise, the + table maps written this far will be included in the table maps + for the following statement. + + TODO: Remove the need for a dummy event altogether. It can be + fixed if we can write table maps to a memory buffer before + writing the first binrow event. We can then flush and clear the + memory buffer with table map events before writing the first + binrow event. In the event of a crash, nothing is lost since + the table maps are only needed if there are binrow events. */ + + Rows_log_event *ev= + new Write_rows_log_event(this, 0, ~0UL, 0, FALSE); + ev->set_flags(Rows_log_event::STMT_END_F); + binlog_set_pending_rows_event(ev); + error= mysql_bin_log.flush_and_set_pending_rows_event(this, 0); + binlog_table_maps= 0; } DBUG_RETURN(error); @@ -2568,6 +2573,17 @@ void THD::binlog_delete_pending_rows_event() functions have been issued, but before tables are unlocked and closed. + OBSERVE + There shall be no writes to any system table after calling + binlog_query(), so these writes has to be moved to before the call + of binlog_query() for correct functioning. + + This is necessesary not only for RBR, but the master might crash + after binlogging the query but before changing the system tables. + This means that the slave and the master are not in the same state + (after the master has restarted), so therefore we have to + eliminate this problem. + RETURN VALUE Error code, or 0 if no error. */ @@ -2577,7 +2593,7 @@ int THD::binlog_query(THD::enum_binlog_query_type qtype, { DBUG_ENTER("THD::binlog_query"); DBUG_ASSERT(query && mysql_bin_log.is_open()); - int error= binlog_flush_pending_rows_event(true); + switch (qtype) { case THD::MYSQL_QUERY_TYPE: @@ -2591,19 +2607,41 @@ int THD::binlog_query(THD::enum_binlog_query_type qtype, */ case THD::ROW_QUERY_TYPE: if (current_stmt_binlog_row_based) - DBUG_RETURN(binlog_flush_pending_rows_event(true)); + { + /* + If thd->lock is set, then we are not inside a stored function. + In that case, mysql_unlock_tables() will be called after this + binlog_query(), so we have to flush the pending rows event + with the STMT_END_F set to unlock all tables at the slave side + as well. + + We will not flush the pending event, if thd->lock is NULL. + This means that we are inside a stored function or trigger, so + the flushing will be done inside the top-most + close_thread_tables(). + */ + if (this->lock) + DBUG_RETURN(binlog_flush_pending_rows_event(TRUE)); + DBUG_RETURN(0); + } /* Otherwise, we fall through */ case THD::STMT_QUERY_TYPE: /* - Most callers of binlog_query() ignore the error code, assuming - that the statement will always be written to the binlog. In - case of error above, we therefore just continue and write the - statement to the binary log. + The MYSQL_LOG::write() function will set the STMT_END_F flag and + flush the pending rows event if necessary. */ { Query_log_event qinfo(this, query, query_len, is_trans, suppress_use); qinfo.flags|= LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F; - DBUG_RETURN(mysql_bin_log.write(&qinfo)); + /* + Binlog table maps will be irrelevant after a Query_log_event + (they are just removed on the slave side) so after the query + log event is written to the binary log, we pretend that no + table maps were written. + */ + int error= mysql_bin_log.write(&qinfo); + binlog_table_maps= 0; + DBUG_RETURN(error); } break; diff --git a/sql/sql_class.h b/sql/sql_class.h index e987b8867b9..4745fcfdc35 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -742,11 +742,20 @@ public: ulong version; uint current_tablenr; + enum enum_flags { + BACKUPS_AVAIL = (1U << 0) /* There are backups available */ + }; + + /* + Flags with information about the open tables state. + */ + uint state_flags; + /* This constructor serves for creation of Open_tables_state instances which are used as backup storage. */ - Open_tables_state() {}; + Open_tables_state() : state_flags(0U) { } Open_tables_state(ulong version_arg); @@ -760,6 +769,7 @@ public: open_tables= temporary_tables= handler_tables= derived_tables= 0; lock= locked_tables= 0; prelocked_mode= NON_PRELOCKED; + state_flags= 0U; } }; @@ -910,8 +920,9 @@ public: #ifndef MYSQL_CLIENT /* - Public interface to write rows to the binlog + Public interface to write RBR events to the binlog */ + int binlog_write_table_map(TABLE *table, bool is_transactional); int binlog_write_row(TABLE* table, bool is_transactional, MY_BITMAP const* cols, my_size_t colcnt, const byte *buf); @@ -955,6 +966,11 @@ public: int binlog_flush_pending_rows_event(bool stmt_end); void binlog_delete_pending_rows_event(); +private: + uint binlog_table_maps; // Number of table maps currently in the binlog + +public: + #endif #endif /* HAVE_ROW_BASED_REPLICATION */ #ifndef MYSQL_CLIENT @@ -1575,7 +1591,6 @@ class select_create: public select_insert { HA_CREATE_INFO *create_info; MYSQL_LOCK *lock; Field **field; - bool create_table_written; public: select_create (TABLE_LIST *table, HA_CREATE_INFO *create_info_par, @@ -1584,11 +1599,11 @@ public: List<Item> &select_fields,enum_duplicates duplic, bool ignore) :select_insert (NULL, NULL, &select_fields, 0, 0, duplic, ignore), create_table(table), extra_fields(&fields_par),keys(&keys_par), create_info(create_info_par), - lock(0), create_table_written(FALSE) + lock(0) {} int prepare(List<Item> &list, SELECT_LEX_UNIT *u); - void binlog_show_create_table(); + void binlog_show_create_table(TABLE **tables, uint count); void store_values(List<Item> &values); void send_error(uint errcode,const char *err); bool send_eof(); diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index bd7be110b88..48bd2c57d9e 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -1711,7 +1711,7 @@ pthread_handler_t handle_delayed_insert(void *arg) { thd->fatal_error(); strmov(thd->net.last_error,ER(thd->net.last_errno=ER_OUT_OF_RESOURCES)); - goto end; + goto err; } #if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__) sigset_t set; @@ -1724,13 +1724,13 @@ pthread_handler_t handle_delayed_insert(void *arg) if (!(di->table=open_ltable(thd,&di->table_list,TL_WRITE_DELAYED))) { thd->fatal_error(); // Abort waiting inserts - goto end; + goto err; } if (!(di->table->file->table_flags() & HA_CAN_INSERT_DELAYED)) { thd->fatal_error(); my_error(ER_ILLEGAL_HA, MYF(0), di->table_list.table_name); - goto end; + goto err; } di->table->copy_blobs=1; @@ -1859,6 +1859,16 @@ pthread_handler_t handle_delayed_insert(void *arg) pthread_cond_broadcast(&di->cond_client); // If waiting clients } +err: + /* + mysql_lock_tables() can potentially start a transaction and write + a table map. In the event of an error, that transaction has to be + rolled back. We only need to roll back a potential statement + transaction, since real transactions are rolled back in + close_thread_tables(). + */ + ha_rollback_stmt(thd); + end: /* di should be unlinked from the thread handler list and have no active @@ -2493,9 +2503,25 @@ select_create::prepare(List<Item> &values, SELECT_LEX_UNIT *u) { DBUG_ENTER("select_create::prepare"); + class MY_HOOKS : public TABLEOP_HOOKS { + public: + MY_HOOKS(select_create *x) : ptr(x) { } + virtual void do_prelock(TABLE **tables, uint count) + { + if (ptr->thd->current_stmt_binlog_row_based) + ptr->binlog_show_create_table(tables, count); + } + + private: + select_create *ptr; + }; + + MY_HOOKS hooks(this); + unit= u; table= create_table_from_items(thd, create_info, create_table, - extra_fields, keys, &values, &lock); + extra_fields, keys, &values, &lock, + &hooks); if (!table) DBUG_RETURN(-1); // abort() deletes table @@ -2533,7 +2559,7 @@ select_create::prepare(List<Item> &values, SELECT_LEX_UNIT *u) void -select_create::binlog_show_create_table() +select_create::binlog_show_create_table(TABLE **tables, uint count) { /* Note 1: In RBR mode, we generate a CREATE TABLE statement for the @@ -2556,18 +2582,19 @@ select_create::binlog_show_create_table() on rollback, we clear the OPTION_STATUS_NO_TRANS_UPDATE bit of thd->options. */ - DBUG_ASSERT(thd->current_stmt_binlog_row_based && !create_table_written); + DBUG_ASSERT(thd->current_stmt_binlog_row_based); + DBUG_ASSERT(tables && *tables && count > 0); thd->options&= ~OPTION_STATUS_NO_TRANS_UPDATE; char buf[2048]; String query(buf, sizeof(buf), system_charset_info); query.length(0); // Have to zero it since constructor doesn't - TABLE_LIST tables; - memset(&tables, 0, sizeof(tables)); - tables.table = table; + TABLE_LIST table_list; + memset(&table_list, 0, sizeof(table_list)); + table_list.table = *tables; - int result= store_create_info(thd, &tables, &query, create_info); + int result= store_create_info(thd, &table_list, &query, create_info); DBUG_ASSERT(result == 0); /* store_create_info() always return 0 */ thd->binlog_query(THD::STMT_QUERY_TYPE, query.ptr(), query.length(), @@ -2578,16 +2605,6 @@ select_create::binlog_show_create_table() void select_create::store_values(List<Item> &values) { - /* - Before writing the first row, we write the CREATE TABLE statement - to the binlog. - */ - if (thd->current_stmt_binlog_row_based && !create_table_written) - { - binlog_show_create_table(); - create_table_written= TRUE; - } - fill_record_n_invoke_before_triggers(thd, field, values, 1, table->triggers, TRG_EVENT_INSERT); } @@ -2607,16 +2624,6 @@ void select_create::send_error(uint errcode,const char *err) bool select_create::send_eof() { - /* - If no rows where written to the binary log, we write the CREATE - TABLE statement to the binlog. - */ - if (thd->current_stmt_binlog_row_based && !create_table_written) - { - binlog_show_create_table(); - create_table_written= TRUE; - } - bool tmp=select_insert::send_eof(); if (tmp) abort(); diff --git a/sql/sql_load.cc b/sql/sql_load.cc index 30d83370255..9fcdc969597 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -417,19 +417,6 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, #ifndef EMBEDDED_LIBRARY if (mysql_bin_log.is_open()) { -#ifdef HAVE_ROW_BASED_REPLICATION - /* - We need to do the job that is normally done inside - binlog_query() here, which is to ensure that the pending event - is written before tables are unlocked and before any other - events are written. We also need to update the table map - version for the binary log to mark that table maps are invalid - after this point. - */ - if (thd->current_stmt_binlog_row_based) - thd->binlog_flush_pending_rows_event(true); - else -#endif { /* Make sure last block (the one which caused the error) gets diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 9513f7ba48f..a046da6b0a5 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -2370,7 +2370,8 @@ TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info, List<create_field> *extra_fields, List<Key> *keys, List<Item> *items, - MYSQL_LOCK **lock) + MYSQL_LOCK **lock, + TABLEOP_HOOKS *hooks) { TABLE tmp_table; // Used during 'create_field()' TABLE_SHARE share; @@ -2449,6 +2450,7 @@ TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info, save us from that ? */ table->reginfo.lock_type=TL_WRITE; + hooks->prelock(&table, 1); // Call prelock hooks if (! ((*lock)= mysql_lock_tables(thd, &table, 1, MYSQL_LOCK_IGNORE_FLUSH, ¬_used))) { @@ -5143,7 +5145,7 @@ copy_data_between_tables(TABLE *from,TABLE *to, if (!(copy= new Copy_field[to->s->fields])) DBUG_RETURN(-1); /* purecov: inspected */ - if (to->file->external_lock(thd, F_WRLCK)) + if (to->file->ha_external_lock(thd, F_WRLCK)) DBUG_RETURN(-1); /* We can abort alter table for any table type */ @@ -5283,7 +5285,7 @@ copy_data_between_tables(TABLE *from,TABLE *to, free_io_cache(from); *copied= found_count; *deleted=delete_count; - if (to->file->external_lock(thd,F_UNLCK)) + if (to->file->ha_external_lock(thd,F_UNLCK)) error=1; DBUG_RETURN(error > 0 ? -1 : 0); } diff --git a/sql/table.cc b/sql/table.cc index b13fb347ee8..b7b235dc180 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -145,7 +145,7 @@ TABLE_SHARE *alloc_table_share(TABLE_LIST *table_list, char *key, elsewhere, and then assign a table map id inside open_table() under the protection of the LOCK_open mutex. */ - share->table_map_id= ULONG_MAX; + share->table_map_id= ~0UL; #endif memcpy((char*) &share->mem_root, (char*) &mem_root, sizeof(mem_root)); @@ -204,7 +204,7 @@ void init_tmp_table_share(TABLE_SHARE *share, const char *key, anyway to be able to catch errors. */ share->table_map_version= ~(ulonglong)0; - share->table_map_id= ULONG_MAX; + share->table_map_id= ~0UL; #endif DBUG_VOID_RETURN; diff --git a/sql/table.h b/sql/table.h index 930777d1993..688154dd8fc 100644 --- a/sql/table.h +++ b/sql/table.h @@ -547,7 +547,8 @@ typedef struct st_table_list struct st_table_list *next_name_resolution_table; /* Index names in a "... JOIN ... USE/IGNORE INDEX ..." clause. */ List<String> *use_index, *ignore_index; - TABLE *table; /* opened table */ + TABLE *table; /* opened table */ + uint table_id; /* table id (from binlog) for opened table */ /* select_result for derived table to pass it from table creation to table filling procedure |