diff options
author | Venkatesh Duggirala <venkatesh.duggirala@oracle.com> | 2013-01-02 18:32:38 +0530 |
---|---|---|
committer | Venkatesh Duggirala <venkatesh.duggirala@oracle.com> | 2013-01-02 18:32:38 +0530 |
commit | 8f9d59388294a502ddb089d953f72eb397bb518d (patch) | |
tree | 57ce0b9be34a77613b322607f3cc26983de6c0cc /mysys | |
parent | 7a846307655842090a30e47e118346485b7d5839 (diff) | |
parent | c72f687f21d6fb4750f3d05221be8b039ee11fdf (diff) | |
download | mariadb-git-8f9d59388294a502ddb089d953f72eb397bb518d.tar.gz |
BUG#11753923-SQL THREAD CRASHES ON DISK FULL
Merging fix from mysql-5.1
Diffstat (limited to 'mysys')
-rw-r--r-- | mysys/errors.c | 24 | ||||
-rw-r--r-- | mysys/my_error.c | 22 | ||||
-rw-r--r-- | mysys/my_write.c | 4 |
3 files changed, 44 insertions, 6 deletions
diff --git a/mysys/errors.c b/mysys/errors.c index b976578b26c..b518b442d6b 100644 --- a/mysys/errors.c +++ b/mysys/errors.c @@ -99,17 +99,29 @@ void init_glob_errs() } #endif +/* + We cannot call my_error/my_printf_error here in this function. + Those functions will set status variable in diagnostic area + and there is no provision to reset them back. + Here we are waiting for free space and will wait forever till + space is created. So just giving warning in the error file + should be enough. +*/ void wait_for_free_space(const char *filename, int errors) { - if (errors == 0) - my_error(EE_DISK_FULL,MYF(ME_BELL | ME_NOREFRESH), - filename,my_errno,MY_WAIT_FOR_USER_TO_FIX_PANIC); if (!(errors % MY_WAIT_GIVE_USER_A_MESSAGE)) - my_printf_error(EE_DISK_FULL, - "Retry in %d secs. Message reprinted in %d secs", - MYF(ME_BELL | ME_NOREFRESH), + { + my_printf_warning(EE(EE_DISK_FULL), + filename,my_errno,MY_WAIT_FOR_USER_TO_FIX_PANIC); + my_printf_warning("Retry in %d secs. Message reprinted in %d secs", MY_WAIT_FOR_USER_TO_FIX_PANIC, MY_WAIT_GIVE_USER_A_MESSAGE * MY_WAIT_FOR_USER_TO_FIX_PANIC ); + } + DBUG_EXECUTE_IF("simulate_file_write_error_once", + { + (void) sleep(1); + return; + }); (void) sleep(MY_WAIT_FOR_USER_TO_FIX_PANIC); } diff --git a/mysys/my_error.c b/mysys/my_error.c index a60292b0061..84198eb7d25 100644 --- a/mysys/my_error.c +++ b/mysys/my_error.c @@ -149,6 +149,28 @@ void my_printv_error(uint error, const char *format, myf MyFlags, va_list ap) } /* + Warning as printf + + SYNOPSIS + my_printf_warning() + format> Format string + ...> variable list +*/ +void(*sql_print_warning_hook)(const char *format,...); +void my_printf_warning(const char *format, ...) +{ + va_list args; + char wbuff[ERRMSGSIZE]; + DBUG_ENTER("my_printf_warning"); + DBUG_PRINT("my", ("Format: %s", format)); + va_start(args,format); + (void) my_vsnprintf (wbuff, sizeof(wbuff), format, args); + va_end(args); + (*sql_print_warning_hook)(wbuff); + DBUG_VOID_RETURN; +} + +/* Give message using error_handler_hook SYNOPSIS diff --git a/mysys/my_write.c b/mysys/my_write.c index 4b1ccb6fe41..c474b86c60e 100644 --- a/mysys/my_write.c +++ b/mysys/my_write.c @@ -33,6 +33,8 @@ size_t my_write(File Filedes, const uchar *Buffer, size_t Count, myf MyFlags) if (unlikely(!Count)) DBUG_RETURN(0); + DBUG_EXECUTE_IF ("simulate_file_write_error_once", + { DBUG_SET("+d,simulate_file_write_error");}); for (;;) { #ifdef _WIN32 @@ -65,6 +67,8 @@ size_t my_write(File Filedes, const uchar *Buffer, size_t Count, myf MyFlags) { wait_for_free_space(my_filename(Filedes), errors); errors++; + DBUG_EXECUTE_IF("simulate_file_write_error_once", + { DBUG_SET("-d,simulate_file_write_error");}); continue; } |