-
Libing Song authored
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 cases: - Binlog file doesn't include any data related events. e.g. master-bin.1 only includes: Format_description_log_event Rotate_log_event and mysqlbinlog master-bin.1 master-bin.2 will output: BINLOG '... Format_description_log_event of master-bin.1...' ROLLBACK BINLOG '... Format_description_log_event of master-bin.2...' - 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' When applying a Format_description_log_event, gtid_next's status will be changed to NOT_YET_DETERMINDED_GROUP, so gtid_next will be decided by the following event. If it is an Gtid_log_event, then it will be set to gtid_next, otherwise ANONYMOUS is set. For above two cases, It will set gtid_next to ANONYMOUS when applying ROLLBACK, but gtid_mode is on, so it throws an error. The fix has two parts: - ROLLBACK is not printed out if there is no uncomplete transaction at the end of the binlog. SET @SESSION.GTID_NEXT = 'AUTOMATIC' is always printed at the end of each binlog, even the binlog is empty. It fixes the first case. - Format_description_log_event of relay log is not output as a 'BINLOG'. it fixes the second case.
Libing Song authored1782 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 cases: - Binlog file doesn't include any data related events. e.g. master-bin.1 only includes: Format_description_log_event Rotate_log_event and mysqlbinlog master-bin.1 master-bin.2 will output: BINLOG '... Format_description_log_event of master-bin.1...' ROLLBACK BINLOG '... Format_description_log_event of master-bin.2...' - 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' When applying a Format_description_log_event, gtid_next's status will be changed to NOT_YET_DETERMINDED_GROUP, so gtid_next will be decided by the following event. If it is an Gtid_log_event, then it will be set to gtid_next, otherwise ANONYMOUS is set. For above two cases, It will set gtid_next to ANONYMOUS when applying ROLLBACK, but gtid_mode is on, so it throws an error. The fix has two parts: - ROLLBACK is not printed out if there is no uncomplete transaction at the end of the binlog. SET @SESSION.GTID_NEXT = 'AUTOMATIC' is always printed at the end of each binlog, even the binlog is empty. It fixes the first case. - Format_description_log_event of relay log is not output as a 'BINLOG'. it fixes the second case.
Loading