Commit 32c1790b authored by Luis Soares's avatar Luis Soares

BUG#38826

Merge from 5.0-bugteam. Additional fix for unused ret variable warning.
parents 54f65ef1 ac27e637
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
stop slave;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (id INT);
start slave;
SET GLOBAL debug= "+d,crash_before_purge_logs";
FLUSH LOGS;
ERROR HY000: Lost connection to MySQL server during query
start slave;
--source include/master-slave.inc
--source include/have_debug.inc
--disable_reconnect
# We have to sync with master, to ensure slave had time to start properly
# # before we stop it. If not, we get errors about UNIX_TIMESTAMP() in the
# log.
sync_slave_with_master;
stop slave;
--source include/wait_for_slave_to_stop.inc
# ON MASTER
connection master;
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
CREATE TABLE t1 (id INT);
let $1=100;
disable_query_log;
begin;
while ($1)
{
eval INSERT INTO t1 VALUES( $1 );
dec $1;
}
DROP TABLE t1;
save_master_pos;
enable_query_log;
## ON SLAVE
connection slave;
start slave;
--source include/wait_for_slave_to_start.inc
sync_with_master 0;
connection master;
save_master_pos;
connection slave;
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/slave0.expect
SET GLOBAL debug= "+d,crash_before_purge_logs";
--error 2013
# try to rotate logs
FLUSH LOGS;
--enable_reconnect
--source include/wait_until_connected_again.inc
start slave;
--source include/wait_for_slave_to_start.inc
sync_with_master 0;
...@@ -2978,7 +2978,7 @@ int MYSQL_BIN_LOG::purge_first_log(Relay_log_info* rli, bool included) ...@@ -2978,7 +2978,7 @@ int MYSQL_BIN_LOG::purge_first_log(Relay_log_info* rli, bool included)
* Need to update the log pos because purge logs has been called * Need to update the log pos because purge logs has been called
* after fetching initially the log pos at the begining of the method. * after fetching initially the log pos at the begining of the method.
*/ */
if(error=find_log_pos(&rli->linfo, rli->event_relay_log_name, 0)) if((error=find_log_pos(&rli->linfo, rli->event_relay_log_name, 0)))
{ {
char buff[22]; char buff[22];
sql_print_error("next log error: %d offset: %s log: %s included: %d", sql_print_error("next log error: %d offset: %s log: %s included: %d",
...@@ -3044,7 +3044,6 @@ int MYSQL_BIN_LOG::purge_logs(const char *to_log, ...@@ -3044,7 +3044,6 @@ int MYSQL_BIN_LOG::purge_logs(const char *to_log,
ulonglong *decrease_log_space) ulonglong *decrease_log_space)
{ {
int error; int error;
int ret = 0;
bool exit_loop= 0; bool exit_loop= 0;
LOG_INFO log_info; LOG_INFO log_info;
THD *thd= current_thd; THD *thd= current_thd;
...@@ -3067,8 +3066,8 @@ int MYSQL_BIN_LOG::purge_logs(const char *to_log, ...@@ -3067,8 +3066,8 @@ int MYSQL_BIN_LOG::purge_logs(const char *to_log,
*/ */
if (!my_b_inited(&purge_temp)) if (!my_b_inited(&purge_temp))
{ {
if (error=open_cached_file(&purge_temp, mysql_tmpdir, TEMP_PREFIX, if ((error=open_cached_file(&purge_temp, mysql_tmpdir, TEMP_PREFIX,
DISK_BUFFER_SIZE, MYF(MY_WME))) DISK_BUFFER_SIZE, MYF(MY_WME))))
{ {
sql_print_error("MYSQL_LOG::purge_logs failed to open purge_temp"); sql_print_error("MYSQL_LOG::purge_logs failed to open purge_temp");
goto err; goto err;
...@@ -3076,7 +3075,7 @@ int MYSQL_BIN_LOG::purge_logs(const char *to_log, ...@@ -3076,7 +3075,7 @@ int MYSQL_BIN_LOG::purge_logs(const char *to_log,
} }
else else
{ {
if (error=reinit_io_cache(&purge_temp, WRITE_CACHE, 0, 0, 1)) if ((error=reinit_io_cache(&purge_temp, WRITE_CACHE, 0, 0, 1)))
{ {
sql_print_error("MYSQL_LOG::purge_logs failed to reinit purge_temp " sql_print_error("MYSQL_LOG::purge_logs failed to reinit purge_temp "
"for write"); "for write");
...@@ -3107,7 +3106,7 @@ int MYSQL_BIN_LOG::purge_logs(const char *to_log, ...@@ -3107,7 +3106,7 @@ int MYSQL_BIN_LOG::purge_logs(const char *to_log,
} }
/* We know how many files to delete. Update index file. */ /* We know how many files to delete. Update index file. */
if (error=update_log_index(&log_info, need_update_threads)) if ((error=update_log_index(&log_info, need_update_threads)))
{ {
sql_print_error("MSYQL_LOG::purge_logs failed to update the index file"); sql_print_error("MSYQL_LOG::purge_logs failed to update the index file");
goto err; goto err;
...@@ -3116,7 +3115,7 @@ int MYSQL_BIN_LOG::purge_logs(const char *to_log, ...@@ -3116,7 +3115,7 @@ int MYSQL_BIN_LOG::purge_logs(const char *to_log,
DBUG_EXECUTE_IF("crash_after_update_index", abort();); DBUG_EXECUTE_IF("crash_after_update_index", abort(););
/* Switch purge_temp for read. */ /* Switch purge_temp for read. */
if (error=reinit_io_cache(&purge_temp, READ_CACHE, 0, 0, 0)) if ((error=reinit_io_cache(&purge_temp, READ_CACHE, 0, 0, 0)))
{ {
sql_print_error("MSYQL_LOG::purge_logs failed to reinit purge_temp " sql_print_error("MSYQL_LOG::purge_logs failed to reinit purge_temp "
"for read"); "for read");
...@@ -3251,6 +3250,7 @@ int MYSQL_BIN_LOG::purge_logs(const char *to_log, ...@@ -3251,6 +3250,7 @@ int MYSQL_BIN_LOG::purge_logs(const char *to_log,
} }
err: err:
close_cached_file(&purge_temp);
if (need_mutex) if (need_mutex)
pthread_mutex_unlock(&LOCK_index); pthread_mutex_unlock(&LOCK_index);
DBUG_RETURN(error); DBUG_RETURN(error);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment