diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index db5250e806b..4ca9419038e 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -67,8 +67,6 @@ static void warning(const char *format, ...) using std::min; using std::max; -#define PROBE_HEADER_LEN (EVENT_LEN_OFFSET+4) - /* Map containing the names of databases to be rewritten, to a different one. @@ -390,8 +388,10 @@ static char *opt_include_gtids_str= NULL, static my_bool opt_skip_gtids= 0; static bool filter_based_on_gtids= false; +/* It is set to true when BEGIN is found, and false when the transaction ends. */ static bool in_transaction= false; -static bool seen_gtids= false; +/* It is set to true when GTID is found, and false when the transaction ends. */ +static bool seen_gtid= false; static Exit_status dump_local_log_entries(PRINT_EVENT_INFO *print_event_info, const char* logname); @@ -990,6 +990,161 @@ static bool shall_skip_gtids(Log_event* ev) return filtered; } +/** + Print auxiliary statements ending a binary log (or a logical binary log + within a sequence of relay logs; see below). + + There are two kinds of log files which can be printed by mysqlbinlog + binlog file - generated by mysql server when binlog is ON. + relaylog file - generated by slave IO thread. It just stores binlog + replicated from master with an extra header(FD event, + Previous_gtid_log_event) and a tail(rotate event). + when printing the events in relay logs, the purpose is to print + the events generated by master, but not slave. + + There are three types of FD events: + - Slave FD event: has F_RELAY_LOG set and end_log_pos > 0 + - Real master FD event: has F_RELAY_LOG cleared and end_log_pos > 0 + - Fake master FD event: has F_RELAY_LOG cleared and end_log_pos == 0 + + (Two remarks: + + - The server_id of a slave FD event is the slave's server_id, and + the server_id of a master FD event (real or fake) is the + master's server_id. But this does not help to distinguish the + types in case replicate-same-server-id is enabled. So to + determine the type of event we need to check the F_RELAY_LOG + flag. + + - A fake master FD event may be generated by master's dump + thread (then it takes the first event of the binlog and sets + end_log_pos=0), or by the slave (then it takes the last known + real FD event and sets end_log_pos=0.) There is no way to + distinguish master-generated fake master FD events from + slave-generated fake master FD events. + ) + + There are 8 cases where we rotate a relay log: + + R1. After FLUSH [RELAY] LOGS + R2. When mysqld receives SIGHUP + R3. When relay log size grows too big + R4. Immediately after START SLAVE + R5. When slave IO thread reconnects without user doing + START SLAVE/STOP SLAVE + R6. When master dump thread starts a new binlog + R7. CHANGE MASTER which deletes all relay logs + R8. RESET SLAVE + + (Remark: CHANGE MASTER which does not delete any relay log, + does not cause any rotation at all.) + + The 8 cases generate the three types of FD events as follows: + - In all cases, a slave FD event is generated. + - In cases R1 and R2, if the slave has been connected + previously, the slave client thread that issues + FLUSH (or the thread that handles the SIGHUP) generates a + fake master FD event. If the slave has not been connected + previously, there is no master FD event. + - In case R3, the slave IO thread generates a fake master FD + event. + - In cases R4 and R5, if AUTOPOSITION=0 and MASTER_LOG_POS>4, + the master dump thread generates a fake master FD event. + - In cases R4 and R5, if AUTOPOSITION=1 or MASTER_LOG_POS<=4, + the master dump thread generates a real master FD event. + - In case R6, the master dump thread generates a real master FD + event. + - In cases R7 and R8, the slave does not generate any master FD + event. + + We define the term 'logical binlog' as a sequence of events in + relay logs, such that a single logical binlog may span multiple + relay log files, and any two logical binlogs are separated by a + real master FD event. + + A transaction's events will never be divided into two binlog files or + two logical binlogs. But a transaction may span multiple relay logs, in which + case a faked FD will appear in the middle of the transaction. they may be + divided by fake master FD event and/or slave FD events. + + * Example 1 + + relay-log.1 + ... + GTID_NEXT=1 + BEGIN; + + relay-log.2 + ... + faked Format_description_event + INSERT ... + COMMIT; + + For above case, it has only one logical binlog. The events + in both relay-log.1 and relay-log.2 belong to the same logical binlog. + + * Example 2 + + relay-log.1 + ... + GTID_NEXT=1 + BEGIN; // It is a partial transaction at the end of logical binlog + + relay-log.2 + ... + real Format_description_event + GTID_NEXT=1 + BEGIN; + ... + + For above case, it has two logical binlogs. Events in relay-log.1 + and relay-log.2 belong to two different logical binlog. + + Logical binlog is handled in a similar way as a binlog file. At the end of a + binlog file, at the end of a logical binlog or at the end of mysqlbinlog it should + - rollback the last transaction if it is not complete + - rollback the last gtid if the last event is a gtid_log_event + - set gtid_next to AUTOMATIC + + This function is called two places: + - Before printing a real Format_description_log_event(excluding the + first Format_description_log_event), while mysqlbinlog is in the middle + of printing all log files(binlog or relaylog). + - At the end of mysqlbinlog, just after printing all log files(binlog or + relaylog). + + @param[in|out] print_event_info Context state determining how to print. +*/ +void end_binlog(PRINT_EVENT_INFO *print_event_info) +{ + if (in_transaction) + { + fprintf(result_file, "ROLLBACK /* added by mysqlbinlog */ %s\n", + print_event_info->delimiter); + } + else if (seen_gtid && !opt_skip_gtids) + { + /* + If we are here, then we have seen only GTID_LOG_EVENT + of a transaction and did not see even a BEGIN event + (in_transaction flag is false). So generate BEGIN event + also along with ROLLBACK event. + */ + fprintf(result_file, + "BEGIN /*added by mysqlbinlog */ %s\n" + "ROLLBACK /* added by mysqlbinlog */ %s\n", + print_event_info->delimiter, + print_event_info->delimiter); + } + + if (!opt_skip_gtids) + fprintf(result_file, "%sAUTOMATIC' /* added by mysqlbinlog */ %s\n", + Gtid_log_event::SET_STRING_PREFIX, print_event_info->delimiter); + + seen_gtid= false; + in_transaction= false; +} + /** Print the given event, and either delete it or delegate the deletion to someone else. @@ -1102,7 +1257,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, which causes a commit itself. */ - if (seen_gtids && !in_transaction && !starts_group && !ends_group) + if (seen_gtid && !in_transaction && !starts_group && !ends_group) { /* For DDLs, print the COMMIT right away. @@ -1110,6 +1265,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, fprintf(result_file, "COMMIT /* added by mysqlbinlog */%s\n", print_event_info->delimiter); print_event_info->skipped_event_in_transaction= false; in_transaction= false; + seen_gtid= false; } else print_event_info->skipped_event_in_transaction= true; @@ -1120,8 +1276,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, { in_transaction= false; print_event_info->skipped_event_in_transaction= false; - if (print_event_info->is_gtid_next_set) - print_event_info->is_gtid_next_valid= false; + seen_gtid= false; } else if (starts_group) in_transaction= true; @@ -1131,8 +1286,8 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, We are not in a transaction and are not seeing a BEGIN or COMMIT. So this is an implicitly committing DDL. */ - if (print_event_info->is_gtid_next_set && !in_transaction) - print_event_info->is_gtid_next_valid= false; + if (!in_transaction) + seen_gtid= false; } ev->print(result_file, print_event_info); @@ -1256,68 +1411,37 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, break; } case binary_log::FORMAT_DESCRIPTION_EVENT: + { delete glob_description_event; glob_description_event= (Format_description_log_event*) ev; - /* - The first FD event in log is always generated - from the local server. So if it is first FD event to be - processed (i.e., if server_id_from_fd_event is 0), - get server_id from the FD event and keep it in - server_id_from_fd_event to differentiate between FDs - (originated from local server vs another server). - */ - if (print_event_info->server_id_from_fd_event == 0) - print_event_info->server_id_from_fd_event= ev->server_id; - print_event_info->common_header_len= - glob_description_event->common_header_len; - ev->print(result_file, print_event_info); /* - At this point, if we are in transaction that means - we are reading a relay log file (transaction cannot - spawn across two binary log files, they are writen - at once in binlog). When AUTO_POSITION is enabled - and if IO thread stopped in between the GTID transaction, - upon IO thread restart, Master will send the GTID events - again from the begin of the transaction. Hence, we should - rollback the old transaction. - - If you are reading FD event that came from Master - (first FD event is from the server that owns the relaylog - and second one is from Master) and if it's log_pos is > 0 - then it represents the begin of a master's binary log - (any unfinished transaction will not be finished) or that - auto_position is enabled (any partial transaction left will - not be finished but will be fully retrieved again). On both - cases, the next transaction in the relay log will start from the - beginning and we must rollback any unfinished transaction + end_binlog is not called on faked fd and relay log's fd. + Faked FD's log_pos is always 0. + Faked FD happens in below cases: + - first FD sent from master to slave if dump request's position is + greater than 4(when using COM_BINLOG_DUMP, autoposition is 0). + - Slave fakes a master's FD when rotating relay log through + 'FLUSH LOGS | FLUSH RELAY LOGS', or get the signal SIGHUP. */ - if (ev->server_id !=0 && - ev->server_id != print_event_info->server_id_from_fd_event && - ev->common_header->log_pos > 0) + if (!ev->is_relay_log_event()) { - if (in_transaction) - { - my_b_printf(&print_event_info->head_cache, - "ROLLBACK /* added by mysqlbinlog */ %s\n", - print_event_info->delimiter); - } - else if (print_event_info->is_gtid_next_set && - print_event_info->is_gtid_next_valid) - { - /* - If we are here, then we have seen only GTID_LOG_EVENT - of a transaction and did not see even a BEGIN event - (in_transaction flag is false). So generate BEGIN event - also along with ROLLBACK event. - */ - my_b_printf(&print_event_info->head_cache, - "BEGIN /*added by mysqlbinlog */ %s\n" - "ROLLBACK /* added by mysqlbinlog */ %s\n", - print_event_info->delimiter, - print_event_info->delimiter); - } + static bool is_first_fd= true; + + /* + Before starting next binlog or logical binlog, it should end the + previous binlog first. For detail, see the comment of end_binlog(). + */ + if (ev->common_header->log_pos > 0 && !is_first_fd) + end_binlog(print_event_info); + + is_first_fd= false; } + + print_event_info->common_header_len= + glob_description_event->common_header_len; + ev->print(result_file, print_event_info); + if (head->error == -1) goto err; if (opt_remote_proto == BINLOG_LOCAL) @@ -1348,6 +1472,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, DBUG_RETURN(ERROR_STOP); } break; + } case binary_log::BEGIN_LOAD_QUERY_EVENT: ev->print(result_file, print_event_info); if (head->error == -1) @@ -1531,9 +1656,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, case binary_log::ANONYMOUS_GTID_LOG_EVENT: case binary_log::GTID_LOG_EVENT: { - seen_gtids= true; - print_event_info->is_gtid_next_set= true; - print_event_info->is_gtid_next_valid= true; + seen_gtid= true; if (print_event_info->skipped_event_in_transaction == true) fprintf(result_file, "COMMIT /* added by mysqlbinlog */%s\n", print_event_info->delimiter); print_event_info->skipped_event_in_transaction= false; @@ -1547,51 +1670,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, { in_transaction= false; print_event_info->skipped_event_in_transaction= false; - if (print_event_info->is_gtid_next_set) - print_event_info->is_gtid_next_valid= false; - ev->print(result_file, print_event_info); - if (head->error == -1) - goto err; - break; - } - case binary_log::ROTATE_EVENT: - { - Rotate_log_event *rev= (Rotate_log_event *) ev; - /* no transaction context, gtids seen and not a fake rotate */ - if (seen_gtids) - { - /* - Fake rotate events have 'when' set to zero. @c fake_rotate_event(...). - */ - bool is_fake= (rev->common_header->when.tv_sec == 0); - /* - 'in_transaction' flag is not set to true even after GTID_LOG_EVENT - of a transaction is seen. ('mysqlbinlog' tool assumes that there - is only one event per DDL transaction other than BEGIN and COMMIT - events. Using 'in_transaction' flag and 'starts_group', 'ends_group' - flags, DDL transaction generation is handled. Hence 'in_transaction' - cannot be set to true after seeing GTID_LOG_EVENT). So in order to - see if we are out of a transaction or not, we should check that - 'in_transaction' is false and we have not seen GTID_LOG_EVENT. - To see if a GTID_LOG_EVENT of a transaction is seen or not, - we should check is_gtid_next_valid flag is false. - */ - if (!is_fake && !in_transaction && - print_event_info->is_gtid_next_set && - !print_event_info->is_gtid_next_valid) - { - /* - If processing multiple files, we must reset this flag, - since there may be no gtids on the next one. - */ - seen_gtids= false; - fprintf(result_file, "%sAUTOMATIC' /* added by mysqlbinlog */ %s\n", - Gtid_log_event::SET_STRING_PREFIX, - print_event_info->delimiter); - print_event_info->is_gtid_next_set= false; - print_event_info->is_gtid_next_valid= true; - } - } + seen_gtid= false; ev->print(result_file, print_event_info); if (head->error == -1) goto err; @@ -2300,16 +2379,11 @@ static Exit_status dump_multiple_logs(int argc, char **argv) if (!raw_mode) { if (print_event_info.skipped_event_in_transaction) - fprintf(result_file, "COMMIT /* added by mysqlbinlog */%s\n", print_event_info.delimiter); - - if (!print_event_info.is_gtid_next_valid) - { - fprintf(result_file, "%sAUTOMATIC' /* added by mysqlbinlog */%s\n", - Gtid_log_event::SET_STRING_PREFIX, + fprintf(result_file, "COMMIT /* added by mysqlbinlog */%s\n", print_event_info.delimiter); - print_event_info.is_gtid_next_set= false; - print_event_info.is_gtid_next_valid= true; - } + + end_binlog(&print_event_info); + fprintf(result_file, "DELIMITER ;\n"); my_stpcpy(print_event_info.delimiter, ";"); } @@ -2810,7 +2884,7 @@ static Exit_status check_header(IO_CACHE* file, { DBUG_ENTER("check_header"); uchar header[BIN_LOG_HEADER_SIZE]; - uchar buf[PROBE_HEADER_LEN]; + uchar buf[LOG_EVENT_HEADER_LEN]; my_off_t tmp_pos, pos; MY_STAT my_file_stat; @@ -2943,6 +3017,12 @@ static Exit_status check_header(IO_CACHE* file, } DBUG_PRINT("info",("Setting description_event")); } + else if (buf[EVENT_TYPE_OFFSET] == binary_log::PREVIOUS_GTIDS_LOG_EVENT) + { + // seek to end of event + my_off_t end_pos= uint4korr(buf + EVENT_LEN_OFFSET); + my_b_seek(file, tmp_pos + end_pos); + } else if (buf[EVENT_TYPE_OFFSET] == binary_log::ROTATE_EVENT) { Log_event *ev; @@ -3337,13 +3417,10 @@ int main(int argc, char** argv) if (!raw_mode) { - /* - Issue a ROLLBACK in case the last printed binlog was crashed and had half - of transaction. - */ + fprintf(result_file, "# End of log file\n"); + fprintf(result_file, - "# End of log file\nROLLBACK /* added by mysqlbinlog */;\n" - "/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;\n"); + "/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;\n"); if (disable_log_bin) fprintf(result_file, "/*!32316 SET SQL_LOG_BIN=@OLD_SQL_LOG_BIN*/;\n"); 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 458aec5fb85..0c7b1eda840 100644 --- a/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test +++ b/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test @@ -351,8 +351,8 @@ if (`select @@binlog_format = 'STATEMENT' || @@binlog_format = 'MIXED'`) is not null; --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR eval select - @a like "%#%error_code=0%ROLLBACK\\n/*!*/;%ROLLBACK /* added by mysqlbinlog */;%" OR - @a like "%#%error_code=0%ROLLBACK\\r\\n/*!*/;%ROLLBACK /* added by mysqlbinlog */;%", + @a like "%#%error_code=0%ROLLBACK\\n/*!*/;%" OR + @a like "%#%error_code=0%ROLLBACK\\r\\n/*!*/;%", @a not like "%#%error_code=%error_code=%"; } drop table t1, t2; diff --git a/mysql-test/include/mysqlbinlog.inc b/mysql-test/include/mysqlbinlog.inc index f950b0baeb0..490f9baab5f 100644 --- a/mysql-test/include/mysqlbinlog.inc +++ b/mysql-test/include/mysqlbinlog.inc @@ -25,8 +25,15 @@ if ($rpl_debug) --echo $MYSQL_BINLOG $mysqlbinlog_parameters $mysqlbinlog_pipe } ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---replace_regex /TIMESTAMP=[0-9]*/TIMESTAMP=#/ /#[0-9]*[ ]*[0-9]*:[0-9]*:[0-9]* server id [0-9]*/# # server id #/ /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /last_committed=[0-9]*/last_committed=#/ /sequence_number=[0-9]*/sequence_number=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /Xid = [0-9]*/Xid = #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #/ /Start: binlog v [0-9]*/Start: binlog v #/ /created [0-9]*[ ]*[0-9]*:[0-9]*:[0-9]* at startup/created # at startup/ /(@[0-9]*=[0-9-]*[.][0-9]{1,3})[0-9e+-]*[^ ]*[ ]*(.*(FLOAT|DOUBLE).*[*].)/\1... \2/ /SET @@SESSION.GTID_NEXT= '.*'/SET @@SESSION.GTID_NEXT= '#'/ /CRC32 0x[0-9a-f]{8}/CRC32 #/ /# [a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}:/# #:/ +if ($mysqlbinlog_skip_replace) +{ + --echo DO_NOT_CHECK_IN_THIS_LINE: printing unfiltered mysqlbinlog output. This should only be used for debugging. Never check in a result file that contains unfiltered mysqlbinlog output. +} +if (!$mysqlbinlog_skip_replace) +{ + --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR + --replace_regex /TIMESTAMP=[0-9]*/TIMESTAMP=#/ /#[0-9]*[ ]*[0-9]*:[0-9]*:[0-9]* server id [0-9]*/# # server id #/ /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /last_committed=[0-9]*/last_committed=#/ /sequence_number=[0-9]*/sequence_number=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /Xid = [0-9]*/Xid = #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #/ /Start: binlog v [0-9]*/Start: binlog v #/ /created [0-9]*[ ]*[0-9]*:[0-9]*:[0-9]* at startup/created # at startup/ /(@[0-9]*=[0-9-]*[.][0-9]{1,3})[0-9e+-]*[^ ]*[ ]*(.*(FLOAT|DOUBLE).*[*].)/\1... \2/ /SET @@SESSION.GTID_NEXT= '.*'/SET @@SESSION.GTID_NEXT= '#'/ /CRC32 0x[0-9a-f]{8}/CRC32 #/ /# [a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}:/# #:/ +} --exec $MYSQL_BINLOG --ssl $mysqlbinlog_parameters $mysqlbinlog_pipe diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result index 2c884d1f358..5f3a3c2bfeb 100644 --- a/mysql-test/r/mysqlbinlog.result +++ b/mysql-test/r/mysqlbinlog.result @@ -95,7 +95,6 @@ COMMIT SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; --- Broken LOAD DATA -- @@ -146,7 +145,6 @@ COMMIT SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; --- --database -- @@ -208,7 +206,6 @@ COMMIT SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; --- --start-position -- @@ -238,7 +235,6 @@ COMMIT SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; --- Remote -- @@ -323,7 +319,6 @@ COMMIT SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; --- Broken LOAD DATA -- @@ -374,7 +369,6 @@ COMMIT SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; --- --database -- @@ -436,7 +430,6 @@ COMMIT SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; --- --start-position -- @@ -466,7 +459,6 @@ COMMIT SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; --- reading stdin -- @@ -486,9 +478,10 @@ BEGIN SET TIMESTAMP=#/*!*/; insert t1 values (1) /*!*/; +ROLLBACK /* added by mysqlbinlog */ /*!*/; +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; include/mysqlbinlog.inc @@ -506,9 +499,10 @@ BEGIN SET TIMESTAMP=#/*!*/; insert t1 values (1) /*!*/; +ROLLBACK /* added by mysqlbinlog */ /*!*/; +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; drop table t1,t2; @@ -577,7 +571,6 @@ end SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; call p1(); @@ -715,7 +708,6 @@ DROP TABLE `t1` /* generated by server */ SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; CREATE TABLE t1 (c1 CHAR(10)); @@ -854,9 +846,9 @@ insert into t5 (a) values (3) SET TIMESTAMP=#/*!*/; COMMIT /*!*/; +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; # @@ -890,9 +882,9 @@ BEGIN SET TIMESTAMP=#/*!*/; COMMIT /*!*/; +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; # @@ -901,6 +893,7 @@ include/mysqlbinlog.inc /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; SET TIMESTAMP=#/*!*/; SET @@session.pseudo_thread_id=#/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -935,9 +928,9 @@ SET TIMESTAMP=#/*!*/; INSERT INTO db1.t1 VALUES(50) /*!*/; COMMIT/*!*/; +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; # @@ -946,6 +939,7 @@ include/mysqlbinlog.inc /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; SET TIMESTAMP=#/*!*/; SET @@session.pseudo_thread_id=#/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -965,9 +959,9 @@ SET TIMESTAMP=#/*!*/; ROLLBACK TO mixed_cases /*!*/; COMMIT/*!*/; +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; End of 5.0 tests @@ -1027,9 +1021,9 @@ AAAAAAAAAAAAAAAAAAArki87 '/*!*/; # at # # # server id # end_log_pos # Stop +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; diff --git a/mysql-test/r/user_var-binlog.result b/mysql-test/r/user_var-binlog.result index 656db6e0bb5..4351229916c 100644 --- a/mysql-test/r/user_var-binlog.result +++ b/mysql-test/r/user_var-binlog.result @@ -59,7 +59,6 @@ COMMIT SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; drop table t1; diff --git a/mysql-test/suite/binlog/r/binlog_base64_flag.result b/mysql-test/suite/binlog/r/binlog_base64_flag.result index 6ad2febbd5e..17923eddbba 100644 --- a/mysql-test/suite/binlog/r/binlog_base64_flag.result +++ b/mysql-test/suite/binlog/r/binlog_base64_flag.result @@ -51,9 +51,10 @@ CREATE TABLE t1 (a int) engine = myisam BEGIN /*!*/; # at 305 -<#>DELIMITER ; +<#>ROLLBACK /* added by mysqlbinlog */ /*!*/; +SET @@SESSION.GTID_NEXT= 'AUTOMATIC' /* added by mysqlbinlog */ /*!*/; +DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; ==== Test non-matching FD event and Row event ==== diff --git a/mysql-test/suite/binlog/r/binlog_gtid_mysqlbinlog_row.result b/mysql-test/suite/binlog/r/binlog_gtid_mysqlbinlog_row.result index f1b27a81aac..61b395531a4 100644 --- a/mysql-test/suite/binlog/r/binlog_gtid_mysqlbinlog_row.result +++ b/mysql-test/suite/binlog/r/binlog_gtid_mysqlbinlog_row.result @@ -5029,11 +5029,10 @@ SET @@SESSION.GTID_NEXT= '#'/*!*/; SET TIMESTAMP=#/*!*/; DROP TABLE `t1`,`t2` /* generated by server */ /*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; # at # # # server id # end_log_pos # CRC32 # Rotate to master-bin.000002 pos: 4 +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; diff --git a/mysql-test/suite/binlog/r/binlog_gtid_mysqlbinlog_row_innodb.result b/mysql-test/suite/binlog/r/binlog_gtid_mysqlbinlog_row_innodb.result index 4de14e6f922..26acfae228c 100644 --- a/mysql-test/suite/binlog/r/binlog_gtid_mysqlbinlog_row_innodb.result +++ b/mysql-test/suite/binlog/r/binlog_gtid_mysqlbinlog_row_innodb.result @@ -3819,12 +3819,11 @@ BEGIN # at # # # server id # end_log_pos # CRC32 # Xid = # COMMIT/*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; # at # # # server id # end_log_pos # CRC32 # Rotate to master-bin.000002 pos: 4 +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; # @@ -4128,12 +4127,11 @@ BEGIN # at # # # server id # end_log_pos # CRC32 # Xid = # COMMIT/*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; # at # # # server id # end_log_pos # CRC32 # Rotate to master-bin.000002 pos: 4 +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; # @@ -4863,12 +4861,11 @@ BEGIN # at # # # server id # end_log_pos # CRC32 # Xid = # COMMIT/*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; # at # # # server id # end_log_pos # CRC32 # Rotate to master-bin.000002 pos: 4 +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; # @@ -4982,12 +4979,11 @@ BEGIN # at # # # server id # end_log_pos # CRC32 # Xid = # COMMIT/*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; # at # # # server id # end_log_pos # CRC32 # Rotate to master-bin.000002 pos: 4 +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; # diff --git a/mysql-test/suite/binlog/r/binlog_gtid_mysqlbinlog_row_myisam.result b/mysql-test/suite/binlog/r/binlog_gtid_mysqlbinlog_row_myisam.result index b343bac75bb..b4ff77ccadd 100644 --- a/mysql-test/suite/binlog/r/binlog_gtid_mysqlbinlog_row_myisam.result +++ b/mysql-test/suite/binlog/r/binlog_gtid_mysqlbinlog_row_myisam.result @@ -3841,12 +3841,11 @@ BEGIN SET TIMESTAMP=#/*!*/; COMMIT /*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; # at # # # server id # end_log_pos # CRC32 # Rotate to master-bin.000002 pos: 4 +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; # @@ -4156,12 +4155,11 @@ BEGIN SET TIMESTAMP=#/*!*/; COMMIT /*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; # at # # # server id # end_log_pos # CRC32 # Rotate to master-bin.000002 pos: 4 +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; # @@ -4901,12 +4899,11 @@ BEGIN SET TIMESTAMP=#/*!*/; COMMIT /*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; # at # # # server id # end_log_pos # CRC32 # Rotate to master-bin.000002 pos: 4 +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; # @@ -5022,12 +5019,11 @@ BEGIN SET TIMESTAMP=#/*!*/; COMMIT /*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; # at # # # server id # end_log_pos # CRC32 # Rotate to master-bin.000002 pos: 4 +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; # diff --git a/mysql-test/suite/binlog/r/binlog_gtid_mysqlbinlog_start_stop.result b/mysql-test/suite/binlog/r/binlog_gtid_mysqlbinlog_start_stop.result index 9ce74d7390d..8c60b6b76e8 100644 --- a/mysql-test/suite/binlog/r/binlog_gtid_mysqlbinlog_start_stop.result +++ b/mysql-test/suite/binlog/r/binlog_gtid_mysqlbinlog_start_stop.result @@ -58,7 +58,6 @@ COMMIT/*!*/; SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -104,7 +103,6 @@ COMMIT/*!*/; SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -142,7 +140,6 @@ COMMIT/*!*/; SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -178,10 +175,9 @@ SET TIMESTAMP=#/*!*/; INSERT INTO t1 VALUES(2) /*!*/; COMMIT/*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog *//*!*/; +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -208,10 +204,9 @@ SET TIMESTAMP=#/*!*/; INSERT INTO t1 VALUES(2) /*!*/; COMMIT/*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog *//*!*/; +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -257,7 +252,6 @@ COMMIT/*!*/; SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -285,10 +279,9 @@ SET TIMESTAMP=#/*!*/; INSERT INTO t1 VALUES(1) /*!*/; COMMIT/*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog *//*!*/; +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -315,10 +308,9 @@ SET TIMESTAMP=#/*!*/; INSERT INTO t1 VALUES(1) /*!*/; COMMIT/*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog *//*!*/; +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -385,7 +377,6 @@ COMMIT/*!*/; SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -449,7 +440,6 @@ COMMIT/*!*/; SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -505,7 +495,6 @@ COMMIT/*!*/; SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -559,10 +548,9 @@ SET TIMESTAMP=#/*!*/; INSERT INTO t1 VALUES(4) /*!*/; COMMIT/*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog *//*!*/; +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -607,10 +595,9 @@ SET TIMESTAMP=#/*!*/; INSERT INTO t1 VALUES(4) /*!*/; COMMIT/*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog *//*!*/; +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -674,7 +661,6 @@ COMMIT/*!*/; SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -728,10 +714,9 @@ SET TIMESTAMP=#/*!*/; INSERT INTO t1 VALUES(4) /*!*/; COMMIT/*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog *//*!*/; +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -784,10 +769,9 @@ SET TIMESTAMP=#/*!*/; INSERT INTO t1 VALUES(4) /*!*/; COMMIT/*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog *//*!*/; +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -836,7 +820,6 @@ COMMIT/*!*/; SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -882,7 +865,6 @@ COMMIT/*!*/; SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -919,7 +901,6 @@ COMMIT/*!*/; SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -955,10 +936,9 @@ SET TIMESTAMP=#/*!*/; INSERT INTO t1 VALUES(2) /*!*/; COMMIT/*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog *//*!*/; +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -984,10 +964,9 @@ SET TIMESTAMP=#/*!*/; INSERT INTO t1 VALUES(2) /*!*/; COMMIT/*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog *//*!*/; +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -1033,7 +1012,6 @@ COMMIT/*!*/; SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -1061,10 +1039,9 @@ SET TIMESTAMP=#/*!*/; INSERT INTO t1 VALUES(1) /*!*/; COMMIT/*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog *//*!*/; +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -1091,10 +1068,9 @@ SET TIMESTAMP=#/*!*/; INSERT INTO t1 VALUES(1) /*!*/; COMMIT/*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog *//*!*/; +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -1161,7 +1137,6 @@ COMMIT/*!*/; SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -1225,7 +1200,6 @@ COMMIT/*!*/; SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -1280,7 +1254,6 @@ COMMIT/*!*/; SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -1334,10 +1307,9 @@ SET TIMESTAMP=#/*!*/; INSERT INTO t1 VALUES(4) /*!*/; COMMIT/*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog *//*!*/; +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -1381,10 +1353,9 @@ SET TIMESTAMP=#/*!*/; INSERT INTO t1 VALUES(4) /*!*/; COMMIT/*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog *//*!*/; +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -1448,7 +1419,6 @@ COMMIT/*!*/; SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -1502,10 +1472,9 @@ SET TIMESTAMP=#/*!*/; INSERT INTO t1 VALUES(4) /*!*/; COMMIT/*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog *//*!*/; +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -1558,10 +1527,9 @@ SET TIMESTAMP=#/*!*/; INSERT INTO t1 VALUES(4) /*!*/; COMMIT/*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog *//*!*/; +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -1625,9 +1593,9 @@ INSERT INTO t1 VALUES(5) COMMIT/*!*/; SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; # #:1-5 +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; diff --git a/mysql-test/suite/binlog/r/binlog_gtid_row_ctype_ucs.result b/mysql-test/suite/binlog/r/binlog_gtid_row_ctype_ucs.result index f9fd9ab9975..ba75d0a081b 100644 --- a/mysql-test/suite/binlog/r/binlog_gtid_row_ctype_ucs.result +++ b/mysql-test/suite/binlog/r/binlog_gtid_row_ctype_ucs.result @@ -32,7 +32,6 @@ COMMIT/*!*/; SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; drop table t2; diff --git a/mysql-test/suite/binlog/r/binlog_gtid_stm_ctype_ucs.result b/mysql-test/suite/binlog/r/binlog_gtid_stm_ctype_ucs.result index 9e0d89de606..a6112d8cba5 100644 --- a/mysql-test/suite/binlog/r/binlog_gtid_stm_ctype_ucs.result +++ b/mysql-test/suite/binlog/r/binlog_gtid_stm_ctype_ucs.result @@ -37,7 +37,6 @@ COMMIT/*!*/; SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; drop table t2; diff --git a/mysql-test/suite/binlog/r/binlog_hexdump.result b/mysql-test/suite/binlog/r/binlog_hexdump.result index e0f1c180938..bec0b453b43 100644 --- a/mysql-test/suite/binlog/r/binlog_hexdump.result +++ b/mysql-test/suite/binlog/r/binlog_hexdump.result @@ -115,8 +115,8 @@ DROP TABLE IF EXISTS `t10123456789` /* generated by server */ # Position Timestamp Type Master ID Size Master Pos Flags # 2c6 99 2f c6 4e 03 01 00 00 00 13 00 00 00 d9 02 00 00 00 00 # Stop +SET @@SESSION.GTID_NEXT= 'AUTOMATIC' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result index 2a4ced1cc1c..aef5fcf6d81 100644 --- a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result +++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result @@ -5029,11 +5029,10 @@ SET @@SESSION.GTID_NEXT= '#'/*!*/; SET TIMESTAMP=#/*!*/; DROP TABLE `t1`,`t2` /* generated by server */ /*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; # at # # # server id # end_log_pos # CRC32 # Rotate to master-bin.000002 pos: 4 +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result index 495974ee1ca..074328b69a8 100644 --- a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result +++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result @@ -3819,12 +3819,11 @@ BEGIN # at # # # server id # end_log_pos # CRC32 # Xid = # COMMIT/*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; # at # # # server id # end_log_pos # CRC32 # Rotate to master-bin.000002 pos: 4 +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; # @@ -4128,12 +4127,11 @@ BEGIN # at # # # server id # end_log_pos # CRC32 # Xid = # COMMIT/*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; # at # # # server id # end_log_pos # CRC32 # Rotate to master-bin.000002 pos: 4 +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; # @@ -4863,12 +4861,11 @@ BEGIN # at # # # server id # end_log_pos # CRC32 # Xid = # COMMIT/*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; # at # # # server id # end_log_pos # CRC32 # Rotate to master-bin.000002 pos: 4 +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; # @@ -4982,12 +4979,11 @@ BEGIN # at # # # server id # end_log_pos # CRC32 # Xid = # COMMIT/*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; # at # # # server id # end_log_pos # CRC32 # Rotate to master-bin.000002 pos: 4 +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; # diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result index c283c75276b..ac2e9142e29 100644 --- a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result +++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result @@ -3841,12 +3841,11 @@ BEGIN SET TIMESTAMP=#/*!*/; COMMIT /*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; # at # # # server id # end_log_pos # CRC32 # Rotate to master-bin.000002 pos: 4 +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; # @@ -4156,12 +4155,11 @@ BEGIN SET TIMESTAMP=#/*!*/; COMMIT /*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; # at # # # server id # end_log_pos # CRC32 # Rotate to master-bin.000002 pos: 4 +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; # @@ -4901,12 +4899,11 @@ BEGIN SET TIMESTAMP=#/*!*/; COMMIT /*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; # at # # # server id # end_log_pos # CRC32 # Rotate to master-bin.000002 pos: 4 +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; # @@ -5022,12 +5019,11 @@ BEGIN SET TIMESTAMP=#/*!*/; COMMIT /*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; # at # # # server id # end_log_pos # CRC32 # Rotate to master-bin.000002 pos: 4 +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; # diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_trans.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_trans.result index 79044eda87a..7b6d12dca9d 100644 --- a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_trans.result +++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_trans.result @@ -509,12 +509,11 @@ SET @@SESSION.GTID_NEXT= '#'/*!*/; SET TIMESTAMP=#/*!*/; TRUNCATE TABLE t2 /*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; # at # # # server id # end_log_pos # CRC32 # Rotate to master-bin.000002 pos: 4 +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; # diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_start_stop.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_start_stop.result index 80998ac808b..be21b998481 100644 --- a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_start_stop.result +++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_start_stop.result @@ -58,7 +58,6 @@ COMMIT/*!*/; SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -104,7 +103,6 @@ COMMIT/*!*/; SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -142,7 +140,6 @@ COMMIT/*!*/; SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -178,10 +175,9 @@ SET TIMESTAMP=#/*!*/; INSERT INTO t1 VALUES(2) /*!*/; COMMIT/*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog *//*!*/; +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -208,10 +204,9 @@ SET TIMESTAMP=#/*!*/; INSERT INTO t1 VALUES(2) /*!*/; COMMIT/*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog *//*!*/; +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -257,7 +252,6 @@ COMMIT/*!*/; SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -285,10 +279,9 @@ SET TIMESTAMP=#/*!*/; INSERT INTO t1 VALUES(1) /*!*/; COMMIT/*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog *//*!*/; +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -315,10 +308,9 @@ SET TIMESTAMP=#/*!*/; INSERT INTO t1 VALUES(1) /*!*/; COMMIT/*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog *//*!*/; +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -385,7 +377,6 @@ COMMIT/*!*/; SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -449,7 +440,6 @@ COMMIT/*!*/; SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -505,7 +495,6 @@ COMMIT/*!*/; SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -559,10 +548,9 @@ SET TIMESTAMP=#/*!*/; INSERT INTO t1 VALUES(4) /*!*/; COMMIT/*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog *//*!*/; +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -607,10 +595,9 @@ SET TIMESTAMP=#/*!*/; INSERT INTO t1 VALUES(4) /*!*/; COMMIT/*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog *//*!*/; +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -674,7 +661,6 @@ COMMIT/*!*/; SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -728,10 +714,9 @@ SET TIMESTAMP=#/*!*/; INSERT INTO t1 VALUES(4) /*!*/; COMMIT/*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog *//*!*/; +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -784,10 +769,9 @@ SET TIMESTAMP=#/*!*/; INSERT INTO t1 VALUES(4) /*!*/; COMMIT/*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog *//*!*/; +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -836,7 +820,6 @@ COMMIT/*!*/; SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -882,7 +865,6 @@ COMMIT/*!*/; SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -919,7 +901,6 @@ COMMIT/*!*/; SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -955,10 +936,9 @@ SET TIMESTAMP=#/*!*/; INSERT INTO t1 VALUES(2) /*!*/; COMMIT/*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog *//*!*/; +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -984,10 +964,9 @@ SET TIMESTAMP=#/*!*/; INSERT INTO t1 VALUES(2) /*!*/; COMMIT/*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog *//*!*/; +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -1033,7 +1012,6 @@ COMMIT/*!*/; SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -1061,10 +1039,9 @@ SET TIMESTAMP=#/*!*/; INSERT INTO t1 VALUES(1) /*!*/; COMMIT/*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog *//*!*/; +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -1091,10 +1068,9 @@ SET TIMESTAMP=#/*!*/; INSERT INTO t1 VALUES(1) /*!*/; COMMIT/*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog *//*!*/; +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -1161,7 +1137,6 @@ COMMIT/*!*/; SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -1225,7 +1200,6 @@ COMMIT/*!*/; SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -1280,7 +1254,6 @@ COMMIT/*!*/; SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -1334,10 +1307,9 @@ SET TIMESTAMP=#/*!*/; INSERT INTO t1 VALUES(4) /*!*/; COMMIT/*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog *//*!*/; +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -1381,10 +1353,9 @@ SET TIMESTAMP=#/*!*/; INSERT INTO t1 VALUES(4) /*!*/; COMMIT/*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog *//*!*/; +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -1448,7 +1419,6 @@ COMMIT/*!*/; SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -1502,10 +1472,9 @@ SET TIMESTAMP=#/*!*/; INSERT INTO t1 VALUES(4) /*!*/; COMMIT/*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog *//*!*/; +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -1558,10 +1527,9 @@ SET TIMESTAMP=#/*!*/; INSERT INTO t1 VALUES(4) /*!*/; COMMIT/*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog *//*!*/; +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -1625,9 +1593,9 @@ INSERT INTO t1 VALUES(5) COMMIT/*!*/; SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; # [empty] +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_start_stop_slave_server_id.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_start_stop_slave_server_id.result index 5cea5e94751..3e300f96fd5 100644 --- a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_start_stop_slave_server_id.result +++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_start_stop_slave_server_id.result @@ -75,9 +75,9 @@ INSERT INTO t1 VALUES(5) COMMIT/*!*/; SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; # [empty] +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -143,9 +143,9 @@ INSERT INTO t1 VALUES(5) COMMIT/*!*/; SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; # [empty] +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; diff --git a/mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result b/mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result index f9fd9ab9975..ba75d0a081b 100644 --- a/mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result +++ b/mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result @@ -32,7 +32,6 @@ COMMIT/*!*/; SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; drop table t2; diff --git a/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result b/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result index 9e0d89de606..a6112d8cba5 100644 --- a/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result +++ b/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result @@ -37,7 +37,6 @@ COMMIT/*!*/; SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; drop table t2; diff --git a/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result b/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result index db8c47947a4..36c27512270 100644 --- a/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result +++ b/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result @@ -449,11 +449,11 @@ is not null; is not null 1 select -@a like "%#%error_code=0%ROLLBACK\n/*!*/;%ROLLBACK /* added by mysqlbinlog */;%" OR -@a like "%#%error_code=0%ROLLBACK\r\n/*!*/;%ROLLBACK /* added by mysqlbinlog */;%", +@a like "%#%error_code=0%ROLLBACK\n/*!*/;%" OR +@a like "%#%error_code=0%ROLLBACK\r\n/*!*/;%", @a not like "%#%error_code=%error_code=%"; -@a like "%#%error_code=0%ROLLBACK\n/*!*/;%ROLLBACK /* added by mysqlbinlog */;%" OR -@a like "%#%error_code=0%ROLLBACK\r\n/*!*/;%ROLLBACK /* added by mysqlbinlog */;%" @a not like "%#%error_code=%error_code=%" +@a like "%#%error_code=0%ROLLBACK\n/*!*/;%" OR +@a like "%#%error_code=0%ROLLBACK\r\n/*!*/;%" @a not like "%#%error_code=%error_code=%" 1 1 drop table t1, t2; create temporary table tt (a int unique); diff --git a/mysql-test/suite/binlog/t/binlog_old_versions.test b/mysql-test/suite/binlog/t/binlog_old_versions.test index 3e5b96c1011..77ab8f332f0 100644 --- a/mysql-test/suite/binlog/t/binlog_old_versions.test +++ b/mysql-test/suite/binlog/t/binlog_old_versions.test @@ -23,6 +23,13 @@ # Related bugs: BUG#27779, BUG#31581, BUG#31582, BUG#31583, BUG#32407 +# It is required to supress BUG#21816447. It should be removed +# after the bug is fixed. +--source include/have_binlog_format_row.inc + +# Applies a binlog that was generated with GTID_MODE=OFF +--source include/not_gtid_enabled.inc + source include/no_valgrind_without_big.inc; source include/not_embedded.inc; diff --git a/mysql-test/suite/rpl/r/rpl_binlog_json.result b/mysql-test/suite/rpl/r/rpl_binlog_json.result index a2ac8cefbbe..a70e2bb87f9 100644 --- a/mysql-test/suite/rpl/r/rpl_binlog_json.result +++ b/mysql-test/suite/rpl/r/rpl_binlog_json.result @@ -210,12 +210,11 @@ SET @@SESSION.GTID_NEXT= '#'/*!*/; SET TIMESTAMP=#/*!*/; DROP TABLE `tab1` /* generated by server */ /*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; # at # # # server id # end_log_pos # CRC32 # Rotate to master-bin.000002 pos: 4 +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_gtid_mysqlbinlog_rotate.result b/mysql-test/suite/rpl/r/rpl_gtid_mysqlbinlog_rotate.result new file mode 100644 index 00000000000..a851510128d --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_gtid_mysqlbinlog_rotate.result @@ -0,0 +1,15 @@ +# +# Verify Case2 works well +# +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 master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information. +[connection master] +[connection slave] +# +# Verify Case1 works well +# +[connection master] +FLUSH BINARY LOGS; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_mysqlbinlog_relay_start_position.result b/mysql-test/suite/rpl/r/rpl_mysqlbinlog_relay_start_position.result new file mode 100644 index 00000000000..45bacc9bf79 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_mysqlbinlog_relay_start_position.result @@ -0,0 +1,28 @@ +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 master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information. +[connection master] +==== Initialize ==== +CREATE TABLE t1 (a INT); +include/sync_slave_sql_with_master.inc +[connection master] +INSERT INTO t1 VALUES (1); +include/sync_slave_sql_with_master.inc +==== Generate mysqlbinlog output ==== +==== Test that mysqlbinlog output looks correct ==== +include/assert_grep.inc [One BINLOG statement printed after the '#at' for the last FD event] +==== Test that mysqlbinlog output is processed correctly ==== +include/stop_slave.inc +[connection master] +include/rpl_set_gtid_mode.inc [ON_PERMISSIVE on servers 1,2] +include/assert.inc [t1 should has two rows] +include/assert.inc [GTID_EXECUTED should not change] +==== Clean up ==== +[connection slave] +include/start_slave.inc +[connection master] +DROP TABLE t1; +include/sync_slave_sql_with_master.inc +# restore gtid_mode +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_ignorable_event.result b/mysql-test/suite/rpl/r/rpl_row_ignorable_event.result index 0f4dc9e9841..1e71bdd16b0 100644 --- a/mysql-test/suite/rpl/r/rpl_row_ignorable_event.result +++ b/mysql-test/suite/rpl/r/rpl_row_ignorable_event.result @@ -827,12 +827,11 @@ SET @@SESSION.GTID_NEXT= '#'/*!*/; SET TIMESTAMP=#/*!*/; DROP TABLE `t4`,`t5` /* generated by server */ /*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; # at # # # server id # end_log_pos # CRC32 # Rotate to master-bin.000002 pos: 4 +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; # Test the Rows_query log event can be applied diff --git a/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result b/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result index c7ff578efec..c170cdad296 100644 --- a/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result +++ b/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result @@ -173,10 +173,9 @@ SET @@session.collation_database=DEFAULT/*!*/; SET @@session.explicit_defaults_for_timestamp=0/*!*/; CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT) /*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog *//*!*/; +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -213,10 +212,9 @@ SET TIMESTAMP=#/*!*/; SET @@session.explicit_defaults_for_timestamp=0/*!*/; CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT) /*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog *//*!*/; +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -297,9 +295,9 @@ include/mysqlbinlog.inc /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -336,10 +334,9 @@ SET TIMESTAMP=#/*!*/; SET @@session.explicit_defaults_for_timestamp=0/*!*/; CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT) /*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog *//*!*/; +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; @@ -363,10 +360,9 @@ SET @@session.collation_database=DEFAULT/*!*/; SET @@session.explicit_defaults_for_timestamp=0/*!*/; CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT) /*!*/; -SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog *//*!*/; +SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; diff --git a/mysql-test/suite/rpl/r/rpl_sp_innodb.result b/mysql-test/suite/rpl/r/rpl_sp_innodb.result index 98a6809d0b5..e7ed81d755c 100644 --- a/mysql-test/suite/rpl/r/rpl_sp_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_sp_innodb.result @@ -1207,7 +1207,6 @@ end SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; use test; diff --git a/mysql-test/suite/rpl/r/rpl_sp_myisam.result b/mysql-test/suite/rpl/r/rpl_sp_myisam.result index 55ab13315eb..a282d9001ba 100644 --- a/mysql-test/suite/rpl/r/rpl_sp_myisam.result +++ b/mysql-test/suite/rpl/r/rpl_sp_myisam.result @@ -1293,7 +1293,6 @@ end SET @@SESSION.GTID_NEXT= '#' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file -ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; use test; diff --git a/mysql-test/suite/rpl/t/rpl_bug31076.test b/mysql-test/suite/rpl/t/rpl_bug31076.test index 00d9ff7c659..7b7e57a77e9 100644 --- a/mysql-test/suite/rpl/t/rpl_bug31076.test +++ b/mysql-test/suite/rpl/t/rpl_bug31076.test @@ -1,3 +1,5 @@ +# Applies BINLOG statements equivalent to a binlog generated with GTID_MODE=OFF +--source include/not_gtid_enabled.inc source include/have_binlog_format_mixed_or_row.inc; source include/master-slave.inc; diff --git a/mysql-test/suite/rpl/t/rpl_gtid_mysqlbinlog_rotate.test b/mysql-test/suite/rpl/t/rpl_gtid_mysqlbinlog_rotate.test new file mode 100644 index 00000000000..008932d5087 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_gtid_mysqlbinlog_rotate.test @@ -0,0 +1,68 @@ +################################################################################ +# BUG#20980932 MYSQLBINLOG GENERATES 'ROLLBACK' AFTER FD EVENT CAUSING 1782 +# ERRRO +# +# mysqlbinlog prints "ROLLBACK" at the end of binlog file. The ROLLBACK +# caused the error that "@@SESSION.GTID_NEXT cannot be set to ANONYMOUS +# when @@GLOBAL.GTID_MODE = ON." +# +# It happened in below two cases: +# - Case1. Binlog file doesn't include any data related events. +# e.g. The binlog only includes: +# Format_description_log_event +# Rotate_log_event +# +# and mysqlbinlog output: +# BINLOG '... the binary of Format_description_log_event ...' +# ROLLBACK +# +# - Case2. Relay log file includes a Format_description_log_event of master +# which is generated at starting server. +# e.g. the relay log includes: +# Format_description_log_event of relay log +# Format_description_log_event of master(generated when starting server) +# +# and mysqlbinlog output: +# BINLOG '... the binary of relay log's Format_description_log_event' +# ROLLBACK +# BINLOG '... the binary of master's Format_description_log_event' +# +# To fix it: +# - ROLLBACK is not printed if there is no uncomplete transaction at the end +# of a binlog. +# - Format_description_log_event of relay log is not output as a 'BINLOG'. +# - SET @@SESSION.GTID_NEXT = 'AUTOMATIC' is always printed out at the end of +# a binlog. It is after the 'ROLLBACK' if the last transaction is +# uncomplete. +# +# This test verify above two cases work well. +################################################################################ +--source include/have_gtid.inc +--source include/have_binlog_format_row.inc + +--echo # +--echo # Verify Case2 works well +--echo # +--source include/master-slave.inc +--let $master_file1 = query_get_value(SHOW MASTER STATUS, File, 1) +--let $MASTER_DATADIR=`select @@datadir` + +--source include/rpl_connection_slave.inc + +--let $SLAVE_DATADIR=`select @@datadir` +--let $relay_file1 = query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1) + +--exec $MYSQL_BINLOG --force-if-open $SLAVE_DATADIR/$relay_file1 | $MYSQL -uroot -S$MASTER_MYSOCK +--exec $MYSQL_BINLOG --force-if-open $SLAVE_DATADIR/$relay_file1 | $MYSQL -uroot -S$SLAVE_MYSOCK + +--echo # +--echo # Verify Case1 works well +--echo # +--source include/rpl_connection_master.inc +FLUSH BINARY LOGS; + +--let $master_file2 = query_get_value(SHOW MASTER STATUS, File, 1) + +--exec $MYSQL_BINLOG --force-if-open $MASTER_DATADIR/$master_file1 $MASTER_DATADIR/$master_file2 | $MYSQL -uroot -S$SLAVE_MYSOCK + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_mysqlbinlog_relay_start_position.test b/mysql-test/suite/rpl/t/rpl_mysqlbinlog_relay_start_position.test new file mode 100644 index 00000000000..47e16a62651 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_mysqlbinlog_relay_start_position.test @@ -0,0 +1,118 @@ +# ==== Purpose ==== +# +# When mysqlbinlog prints a relay log containing multiple FD events, +# it should print BINLOG statement for the last one (because that is +# the master FD event which may be needed to decode subsequent +# events), even when a --start-position specifies a position +# after this event. +# +# ==== Implementation ==== +# +# On master, generate a CREATE TABLE and a DML transaction. +# +# On slave, find the offset of the DML transaction and the offset of +# the last Format_description_log_event. Run mysqlbinlog using this +# offset with --start-position. Check that the output contains +# '#at ', followed by exactly one BINLOG +# statement. +# +# ==== Related Bugs ==== +# +# BUG#20980932: MYSQLBINLOG GENERATES 'ROLLBACK' AFTER FD EVENT CAUSING +# 1782 ERROR +# +# - Relay logs contain first a slave FD event, then a master FD event. +# Between these there is a Previous_gtids_log_event. +# When mysqlbinlog uses the --start-position flag, it prints the +# FD events appearing in the header. +# Before this bugfix, mysqlbinlog stopped printing such header events +# when it reached a Previous_gtids_log_event. Therefore, the master FD +# event was not printed. +# This bugfix ensures that mysqlbinlog does not stop after reaching a +# Previous_gtids_log_event. So therefore the master FD event is always +# printed. +# +# Test is binlog_format-agnostic. STATEMENT is simpler here since we +# are parsing mysqlbinlog output for BINLOG statements, so if we used +# binlog_format=ROW we might get confused by row events. +--source include/have_binlog_format_statement.inc +--source include/not_gtid_enabled.inc +--source include/master-slave.inc + +--echo ==== Initialize ==== + +CREATE TABLE t1 (a INT); +--source include/sync_slave_sql_with_master.inc + +# Record relay log's position, mysqlbinlog's start-position will be set this +# value. +--let $relay_log_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1) +--let $relay_log_pos= query_get_value(SHOW SLAVE STATUS, Relay_Log_Pos, 1) + +--source include/rpl_connection_master.inc +INSERT INTO t1 VALUES (1); +--source include/sync_slave_sql_with_master.inc + +--echo ==== Generate mysqlbinlog output ==== + +--let $mysqlbinlog_out= $MYSQLTEST_VARDIR/tmp/mysqlbinlog.out +--exec $MYSQL_BINLOG --start-position=$relay_log_pos $server_2_datadir/$relay_log_file > $mysqlbinlog_out + +--echo ==== Test that mysqlbinlog output looks correct ==== + +# master's FD is the 4th event. +--let $master_fd_offset= query_get_value("SHOW RELAYLOG EVENTS IN '$relay_log_file' LIMIT 3, 1", Pos, 1) +--let $assert_text= One BINLOG statement printed after the '#at' for the last FD event +--let $assert_file= $mysqlbinlog_out +--let $assert_select= ^BINLOG +--let $assert_only_after= ^# at $master_fd_offset +--let $assert_count= 1 +--source include/assert_grep.inc + +--echo ==== Test that mysqlbinlog output is processed correctly ==== + +# Execute the output using GTID_MODE=ON_PERMISSIVE. If the bug is +# there, no Format_description_log_event is printed, and therefore +# GTID_NEXT remains AUTOMATIC, so then a GTID is (wrongly) +# generated. After the bugfix the Format_description_log_event sets +# GTID_NEXT to NOT_YET_DETERMINED, which will switch to Anonymous. + +# If slave threads run while changing GTID_MODE, GTID_MODE causes +# binlog rotations which cause slave to rotate relay logs, which may +# cause slave to purge the relay log that we are going to process. So +# we stop slave threads while changing GTID_MODE and running +# mysqlbinlog. +--source include/stop_slave.inc + +--source include/rpl_connection_master.inc + +--let $gtid_executed_before= `SELECT @@GLOBAL.GTID_EXECUTED` +--let $rpl_gtid_mode= ON_PERMISSIVE +--let $rpl_skip_sync= 1 +--source include/rpl_set_gtid_mode.inc + +--exec $MYSQL_BINLOG --start-position=$relay_log_pos $server_2_datadir/$relay_log_file | $MYSQL +--let $assert_text= t1 should has two rows +--let $assert_cond= count(*) = 2 FROM t1 +--source include/assert.inc + +--let $gtid_executed_after= `SELECT @@GLOBAL.GTID_EXECUTED` +--let $assert_text= GTID_EXECUTED should not change +--let $assert_cond= "$gtid_executed_after" = "$gtid_executed_before" +--source include/assert.inc + +--echo ==== Clean up ==== + +--source include/rpl_connection_slave.inc +--source include/start_slave.inc +--source include/rpl_connection_master.inc +DROP TABLE t1; +--source include/sync_slave_sql_with_master.inc + +--echo # restore gtid_mode +--let $include_silent= 1 +--let $rpl_gtid_mode= $gtid_mode +--source include/rpl_set_gtid_mode.inc +--let $include_silent= 0 + +--source include/rpl_end.inc diff --git a/sql/log_event.cc b/sql/log_event.cc index 472ff8175f0..df0c0ace24c 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -4993,6 +4993,14 @@ void Start_log_event_v3::print(FILE* file, PRINT_EVENT_INFO* print_event_info) my_b_printf(head, "# Warning: this binlog is either in use or was not " "closed properly.\n"); } + + if (is_relay_log_event()) + { + my_b_printf(head, "# This Format_description_event appears in a relay log " + "and was generated by the slave thread.\n"); + DBUG_VOID_RETURN; + } + if (!is_artificial_event() && created) { #ifdef WHEN_WE_HAVE_THE_RESET_CONNECTION_SQL_COMMAND @@ -5005,19 +5013,8 @@ void Start_log_event_v3::print(FILE* file, PRINT_EVENT_INFO* print_event_info) my_b_printf(head,"RESET CONNECTION%s\n", print_event_info->delimiter); #else my_b_printf(head,"ROLLBACK%s\n", print_event_info->delimiter); - if (print_event_info->is_gtid_next_set) - print_event_info->is_gtid_next_valid= false; #endif } - // set gtid_next=automatic if we have previously set it to uuid:number - if (!print_event_info->is_gtid_next_valid) - { - my_b_printf(head, "%sAUTOMATIC'%s\n", - Gtid_log_event::SET_STRING_PREFIX, - print_event_info->delimiter); - print_event_info->is_gtid_next_set= false; - print_event_info->is_gtid_next_valid= true; - } if (temp_buf && print_event_info->base64_output_mode != BASE64_OUTPUT_NEVER && !print_event_info->short_form) @@ -5974,6 +5971,13 @@ int Load_log_event::do_apply_event(NET* net, Relay_log_info const *rli, thd->lex->local_file= local_fname; mysql_reset_thd_for_next_command(thd); + /* + It is possible that the thread does not hold anonymous GTID + ownership here, e.g. in case this is the first event of a relay + log. + */ + gtid_reacquire_ownership_if_anonymous(thd); + /* We test replicate_*_db rules. Note that we have already prepared the file to load, even if we are going to ignore and delete it @@ -13692,10 +13696,9 @@ st_print_event_info::st_print_event_info() auto_increment_increment(0),auto_increment_offset(0), charset_inited(0), lc_time_names_number(~0), charset_database_number(ILLEGAL_CHARSET_INFO_NUMBER), - thread_id(0), thread_id_printed(false),server_id_from_fd_event(0), + thread_id(0), thread_id_printed(false), base64_output_mode(BASE64_OUTPUT_UNSPEC), printed_fd_event(FALSE), - have_unflushed_events(false), skipped_event_in_transaction(false), - is_gtid_next_set(false), is_gtid_next_valid(true) + have_unflushed_events(false), skipped_event_in_transaction(false) { /* Currently we only use static PRINT_EVENT_INFO objects, so zeroed at diff --git a/sql/log_event.h b/sql/log_event.h index d9c9bfdd7ae..0a48fb16063 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -377,7 +377,6 @@ typedef struct st_print_event_info uint charset_database_number; my_thread_id thread_id; bool thread_id_printed; - uint32 server_id_from_fd_event; st_print_event_info(); @@ -436,22 +435,6 @@ typedef struct st_print_event_info */ bool skipped_event_in_transaction; - /* true if gtid_next is set with a value */ - bool is_gtid_next_set; - - /* - Determines if the current value of gtid_next needs to be restored - to AUTOMATIC if the binary log would end after the current event. - - If the log ends after a transaction, then this should be false. - If the log ends in the middle of a transaction, then this should - be true; this can happen for relay logs where transactions are - split over multiple logs. - - Set to true initially, and after a Gtid_log_event is processed. - Set to false if is_gtid_next_set is true. - */ - bool is_gtid_next_valid; } PRINT_EVENT_INFO; #endif diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc index 230be3603a5..3b3becfd67b 100644 --- a/sql/rpl_rli.cc +++ b/sql/rpl_rli.cc @@ -2552,19 +2552,8 @@ void Relay_log_info::set_rli_description_event(Format_description_log_event *fe) if (info_thd) { - /* - When the slave applier thread executes a - Format_description_log_event originating from a master - (corresponding to a new master binary log), set gtid_next to - NOT_YET_DETERMINED. This tells the slave thread that: - - If a Gtid_log_event is read subsequently, gtid_next will be - set to the given GTID (this is done in - Gtid_log_event::do_apply_event(). - - If a statement is executed before any Gtid_log_event, then - gtid_next is set to anonymous (this is done in - gtid_pre_statement_checks()). - */ - if (fe->server_id != ::server_id && + // See rpl_rli_pdb.h:Slave_worker::set_rli_description_event. + if (!is_in_group() && (info_thd->variables.gtid_next.type == AUTOMATIC_GROUP || info_thd->variables.gtid_next.type == UNDEFINED_GROUP)) { diff --git a/sql/rpl_rli_pdb.h b/sql/rpl_rli_pdb.h index 1be148e53e2..f6e3d1cbbfd 100644 --- a/sql/rpl_rli_pdb.h +++ b/sql/rpl_rli_pdb.h @@ -564,8 +564,20 @@ class Slave_worker : public Relay_log_info - If a statement is executed before any Gtid_log_event, then gtid_next is set to anonymous (this is done in Gtid_log_event::do_apply_event(). + + It is imporant to not set GTID_NEXT=NOT_YET_DETERMINED in the + middle of a transaction. If that would happen when + GTID_MODE=ON, the next statement would fail because it + implicitly sets GTID_NEXT=ANONYMOUS, which is disallowed when + GTID_MODE=ON. So then there would be no way to end the + transaction; any attempt to do so would result in this error. + (It is not possible for the slave threads to have + gtid_next.type==AUTOMATIC or UNDEFINED in the middle of a + transaction, but it is possible for a client thread to have + gtid_next.type==AUTOMATIC and issue a BINLOG statement + containing this Format_description_log_event.) */ - if (fdle->server_id != ::server_id && + if (!is_in_group() && (info_thd->variables.gtid_next.type == AUTOMATIC_GROUP || info_thd->variables.gtid_next.type == UNDEFINED_GROUP)) {