From 483bd10de84a653038266c860d356d3dc0020fca Mon Sep 17 00:00:00 2001 From: "ramil/ram@mysql.com/ramil.myoffice.izhnet.ru" <> Date: Thu, 5 Jul 2007 13:09:56 +0500 Subject: [PATCH] Fix for bug #29420: crash with show and purge binlogs Problem: in case of failed 'show binlog events...' we don't inform that the log is not in use anymore. That may confuse following 'purge logs...' command as it takes into account logs in use. Fix: always notify that the log is not in use anymore. --- mysql-test/r/rpl_rotate_logs.result | 8 ++++++++ mysql-test/t/rpl_rotate_logs.test | 14 +++++++++++++- sql/sql_repl.cc | 6 ++---- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/mysql-test/r/rpl_rotate_logs.result b/mysql-test/r/rpl_rotate_logs.result index df42e76a0c8..8a5ae6c8983 100644 --- a/mysql-test/r/rpl_rotate_logs.result +++ b/mysql-test/r/rpl_rotate_logs.result @@ -95,3 +95,11 @@ count(*) 100 unlock tables; drop table if exists t1,t2,t3,t4; +End of 4.1 tests +show binlog events in 'non existing_binlog_file'; +ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log +purge master logs before now(); +show binlog events in ''; +ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log +purge master logs before now(); +End of 5.0 tests diff --git a/mysql-test/t/rpl_rotate_logs.test b/mysql-test/t/rpl_rotate_logs.test index 69614b45693..0b7efb81f61 100644 --- a/mysql-test/t/rpl_rotate_logs.test +++ b/mysql-test/t/rpl_rotate_logs.test @@ -169,4 +169,16 @@ connection master; drop table if exists t1,t2,t3,t4; sync_slave_with_master; -# End of 4.1 tests +--echo End of 4.1 tests + +# +# Bug #29420: crash with show and purge binlogs +# +--error 1220 +show binlog events in 'non existing_binlog_file'; +purge master logs before now(); +--error 1220 +show binlog events in ''; +purge master logs before now(); + +--echo End of 5.0 tests diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 86ededd5587..9cc0ba7c29a 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -1420,13 +1420,11 @@ err: } if (errmsg) - { my_error(ER_ERROR_WHEN_EXECUTING_COMMAND, MYF(0), "SHOW BINLOG EVENTS", errmsg); - DBUG_RETURN(TRUE); - } + else + send_eof(thd); - send_eof(thd); pthread_mutex_lock(&LOCK_thread_count); thd->current_linfo = 0; pthread_mutex_unlock(&LOCK_thread_count);