PURGE BINARY LOGS Does Not Show Error Messages When It Fails In Overload Situation (Doc ID 2063009.1)

Last updated on JULY 24, 2017

Applies to:

MySQL Cluster - Version 7.1 and later
MySQL Server - Version 5.1 and later
Information in this document applies to any platform.

Symptoms

In heavy load situation on the Master MySQL server the purge command fails when the Slave is reading one of the binlogs that should be purged but it seems as if it has run correctly. After several tries purge can really remove the binlogs but sometimes the Replication brakes after this. No error messages are shown and no error/warning entries are written to log.

Test example, where the slave can't catch a prescribed error, which indicates a previous PURGE BINARY LOGS TO on the master did not remove the first binlog file.
Having the file in place unexpectedly makes the slave to resume replication.

--source include/master-slave.inc
call mtr.add_suppression("Got fatal error 1236 from master when reading data
from binary log: 'Could not find first log file name in binary log index
file'");

--echo ######## Initialize ########

CREATE TABLE t1 (a INT) ENGINE = InnoDB;
--sync_slave_with_master
--source include/stop_slave.inc

--connection master
INSERT INTO t1 VALUES (1);
FLUSH LOGS;
--let $master_file= query_get_value(SHOW MASTER STATUS, File, 1)
--let $master_pos= query_get_value(SHOW MASTER STATUS, Position, 1)
INSERT INTO t1 VALUES (2);
--save_master_pos
eval PURGE BINARY LOGS TO '$master_file';

--connection slave

START SLAVE;

--let $slave_io_errno= 1236 # ER_MASTER_FATAL_ERROR_READING_BINLOG
--source include/wait_for_slave_io_error.inc
--source include/stop_slave_sql.inc

--connection master
RESET MASTER;

--connection slave
RESET SLAVE;
--source include/start_slave.inc

--echo ######## Clean up ########
--connection master
DROP TABLE t1;

--connection slave
--source include/rpl_end.inc

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms