Commit ba7b1a7e authored by aelkin/andrei@mysql1000.(none)'s avatar aelkin/andrei@mysql1000.(none)
Browse files

Bug #35675 reset master finds assert if a binlog file can not be deleted

If a binlog file is manually replaced with a namesake directory the internal purging did
not handle the error of deleting the file so that eventually
a post-execution guards fires an assert.

Fixed with reusing a snippet of code for bug@18199 to tolerate lack of the file but no other error 
at an attempt to delete it.
The same applied to the index file deletion.

The cset carries pieces of manual merging.
parent d3d0a006
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@ master-bin.000003 #
master-bin.000004	#
purge binary logs TO 'master-bin.000004';
Warnings:
Warning	1476	Being purged log MYSQLTEST_VARDIR/log/master-bin.000001 was not found
Warning	1611	Being purged log MYSQLTEST_VARDIR/log/master-bin.000001 was not found
*** must show a list starting from the 'TO' argument of PURGE ***
show binary logs;
Log_name	File_size
@@ -20,7 +20,7 @@ flush logs;
flush logs;
*** must be a warning master-bin.000001 was not found ***
Warnings:
Warning	1476	Being purged log MYSQLTEST_VARDIR/log/master-bin.000001 was not found
Warning	1611	Being purged log MYSQLTEST_VARDIR/log/master-bin.000001 was not found
*** must show one record, of the active binlog, left in the index file after PURGE ***
show binary logs;
Log_name	File_size
+2 −2
Original line number Diff line number Diff line
@@ -78,8 +78,8 @@ level smallint unsigned);
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `name` varchar(10) default NULL,
  `level` smallint(5) unsigned default NULL
  `name` varchar(10) DEFAULT NULL,
  `level` smallint(5) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=big5
insert into t1 values ('string',1);
select concat(name,space(level)), concat(name, repeat(' ',level)) from t1;
+1 −0
Original line number Diff line number Diff line
@@ -36,3 +36,4 @@ DROP PROCEDURE IF EXISTS p1;
DROP PROCEDURE IF EXISTS p2;
DROP FUNCTION IF EXISTS f1;
DROP TRIGGER IF EXISTS tr1;
stop slave sql_thread;
+7 −0
Original line number Diff line number Diff line
@@ -172,6 +172,7 @@ master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(1)
master-bin.000001	#	Query	#	#	use `test`; COMMIT
drop table if exists t1;
reset master;
create table t1 (a int auto_increment, primary key (a)) engine=blackhole;
insert into t1 values (11), (NULL), (NULL), (NULL);
set insert_id= 3;
@@ -181,10 +182,16 @@ insert into t1 values (55), (NULL);
show binlog events from <binlog_start>;
Log_name	Pos	Event_type	Server_id	End_log_pos	Info
master-bin.000001	#	Query	1	#	use `test`; create table t1 (a int auto_increment, primary key (a)) engine=blackhole
master-bin.000001	#	Query	1	#	use `test`; BEGIN
master-bin.000001	#	Intvar	1	#	INSERT_ID=1
master-bin.000001	#	Query	1	#	use `test`; insert into t1 values (11), (NULL), (NULL), (NULL)
master-bin.000001	#	Query	1	#	use `test`; COMMIT
master-bin.000001	#	Query	1	#	use `test`; BEGIN
master-bin.000001	#	Intvar	1	#	INSERT_ID=3
master-bin.000001	#	Query	1	#	use `test`; insert into t1 values (NULL), (33), (NULL)
master-bin.000001	#	Query	1	#	use `test`; COMMIT
master-bin.000001	#	Query	1	#	use `test`; BEGIN
master-bin.000001	#	Intvar	1	#	INSERT_ID=5
master-bin.000001	#	Query	1	#	use `test`; insert into t1 values (55), (NULL)
master-bin.000001	#	Query	1	#	use `test`; COMMIT
drop table t1;
+7 −0
Original line number Diff line number Diff line
@@ -45,3 +45,10 @@ DROP PROCEDURE IF EXISTS p2;
DROP FUNCTION IF EXISTS f1;
DROP TRIGGER IF EXISTS tr1;
enable_warnings;

remove_file $MYSQLTEST_VARDIR/master-data/slave-relay-bin.000001;
remove_file $MYSQLTEST_VARDIR/master-data/slave-relay-bin.index;
stop slave sql_thread;
let $keep_connection=1;
source include/wait_for_slave_sql_to_stop.inc;
Loading