diff --git a/mysql-test/std_data/pitrbug-masterbin.000001 b/mysql-test/std_data/pitrbug-masterbin.000001 new file mode 100644 index 0000000000000000000000000000000000000000..41537878b4fa7496724165cbe008b0a6d5702961 GIT binary patch literal 1678 zcmbVMYe-XZ6hC(}S;Mzt(8K=HYZ_D6Q;eXgSJBoCHw%$S#oHJ*(gS=;zTp(IeJ%`CH04Os7-24E<9iemCjXo%dOZpHFR= z?Cqa;e3a5;gwLi2Qm3vJE>DRLAC&rYCAfX@nU&y7lrBZzfd>o3MS8#tuqJYp1YD5m z7;O$|bx|`wpQITGXhF!Ai%Z;9Zz{V9DVdP+(Odb(v($sknW->QQ$pI|P;*mLPzi?jun z0yXs%!Cw?Sq6PysnrKmj^;!Gn2d@Y`fiQ{INd|w7C$fZxkGd{lnrYpK0VfkD&81bR zllh`XJy1GOAS12!iBx4^xRk)SD1=2fxk@J$Hz1o@k(Px>jgg2YNc>0@Xh?E0aHybM zc6w#ub>_Qdp*e)jFG}2AxmYgG=-HK#ZOl(=VMgiD=FT69;@JA!dZ4qmkme7s;G%mKH_~$~hB^#spK!-GU4Z7vtQw=V@y4XlD+u$XHl4 zFnYX*sTp8uHg^_{5*&+5)cCP(Y19n8?A>laokXZFeC1zzLW_zfEwm^9*o*4cw)Sda zvkFn|uNMABO%%#S&I*@TxGP*PYliT6o#kHPEqA&-&H`^qnLF-l{C66I6>{Kp>C5m7 z2I90f`bE>JW7p5(T;A_x~>F+qC{2r45NjI6ZHBBTLLCM-r@3Q-?m^pg;`)nU)dpnf literal 0 HcmV?d00001 diff --git a/mysql-test/suite/rpl_gtid/r/rpl_mysqlbinlog_gtid_on_replica_binlog_off.result b/mysql-test/suite/rpl_gtid/r/rpl_mysqlbinlog_gtid_on_replica_binlog_off.result new file mode 100644 index 0000000..9277cb6 --- /dev/null +++ b/mysql-test/suite/rpl_gtid/r/rpl_mysqlbinlog_gtid_on_replica_binlog_off.result @@ -0,0 +1,30 @@ +include/master-slave.inc +Warnings: +Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. +Note #### Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information. +[connection master] +CALL mtr.add_suppression("You need to use --log-bin to make --binlog-format work."); +include/rpl_restart_server.inc [server_number=2 parameters: --skip-log-bin] +include/stop_slave.inc +Warnings: +Note 3084 Replication thread(s) for channel '' are already stopped. +) START TRANSACTION +==== FULL FILE ==== +SELECT * FROM t1; +i +1 +2 +3 +SELECT * FROM xyz; +i +1 +2 +3 +4 +5 +6 +DROP TABLE t1; +DROP TABLE xyz; +include/rpl_end.inc +Warnings: +Note 3084 Replication thread(s) for channel '' are already stopped. diff --git a/mysql-test/suite/rpl_gtid/t/rpl_mysqlbinlog_gtid_on_replica_binlog_off.test b/mysql-test/suite/rpl_gtid/t/rpl_mysqlbinlog_gtid_on_replica_binlog_off.test new file mode 100644 index 0000000..4bcd168 --- /dev/null +++ b/mysql-test/suite/rpl_gtid/t/rpl_mysqlbinlog_gtid_on_replica_binlog_off.test @@ -0,0 +1,38 @@ +--source include/master-slave.inc +--source include/have_binlog_format_row.inc + +CALL mtr.add_suppression("You need to use --log-bin to make --binlog-format work."); +### restart slave server with binlog disabled but gtid enabled +--let $rpl_server_number = 2 +--let $rpl_server_parameters = --skip-log-bin +--source include/rpl_restart_server.inc + +--connection slave +--source include/stop_slave.inc + +# binary log is generated before the fix with the following commands +# which will be used to reply with mysqlbinlog tool with fix. +#CREATE TABLE t1 (i INTEGER); +#INSERT INTO t1 VALUES (1),(2),(3); +#CREATE TABLE xyz (i INTEGER) SELECT i FROM t1; +#INSERT INTO xyz VALUES (4), (5), (6); +#--let $server_uuid= `SELECT @@GLOBAL.SERVER_UUID` +#--let $datadir= `SELECT @@datadir` +#--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1) + +# Prove that the binlog contains problematic START TRANSACTION. +--exec $MYSQL_BINLOG $MYSQL_TEST_DIR/std_data/pitrbug-masterbin.000001 | grep START + +--echo ==== FULL FILE ==== +--exec $MYSQL_BINLOG $MYSQL_TEST_DIR/std_data/pitrbug-masterbin.000001 | $MYSQL --user=root --host=127.0.0.1 --port=$SLAVE_MYPORT + +# Make sure we have data from the binary logs. +SELECT * FROM t1; +SELECT * FROM xyz; + +#cleanup +--connection slave +DROP TABLE t1; +DROP TABLE xyz; +--let $rpl_skip_sync = 1 +--source include/rpl_end.inc diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 7c7d03b..5089e5d 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -3377,7 +3377,7 @@ int mysql_execute_command(THD *thd, bool first_level) { Disable binlog so that the BEGIN is not logged in binlog. */ if (lex->create_info && lex->create_info->m_transactional_ddl && - !thd->slave_thread) { + !(thd->slave_thread || thd->is_binlog_applier())) { Disable_binlog_guard binlog_guard(thd); if (trans_begin(thd, MYSQL_START_TRANS_OPT_READ_WRITE)) return true; }