Commit c8682133 authored by unknown's avatar unknown

Fix for BUG#3248 "Doc says MyISAM warns if disk full but it does not":

we force the message to the error log, and we make it more informative;
we treat EDQUOT like ENOSPC.


mysys/errors.c:
  more informative message
mysys/my_fstream.c:
  Treat EDQUOT like ENOSPC.
mysys/my_pread.c:
  Treat EDQUOT like ENOSPC.
mysys/my_write.c:
  Treat EDQUOT like ENOSPC.
mysys/mysys_priv.h:
  Define EDQUOT when it does not exist. Finally decided to put it here after discussion with Monty:
  as this constant is used only in 3 files only in mysys/, I don't make it visible everywhere
  (there currently is no file of choice for such defines; my_base.h does not contain any).
  Using a value which never happens avoids collisions.
sql/mysqld.cc:
  If ME_NOREFRESH, we write message to error log, even if it has been saved for client (because if operation
  is hanging, the message does not get to client now; example is MyISAM waiting for free disk space).
parent 9860a95a
......@@ -41,7 +41,7 @@ const char * NEAR globerrs[GLOBERRS]=
"Can't change dir to '%s' (Errcode: %d)",
"Warning: '%s' had %d links",
"%d files and %d streams is left open\n",
"Disk is full writing '%s'. Waiting for someone to free space...",
"Disk is full writing '%s' (Errcode: %d). Waiting for someone to free space... Retry in %d secs",
"Can't create directory '%s' (Errcode: %d)",
"Character set '%s' is not a compiled character set and is not specified in the '%s' file",
"Out of resources when opening file '%s' (Errcode: %d)",
......
......@@ -114,13 +114,15 @@ uint my_fwrite(FILE *stream, const byte *Buffer, uint Count, myf MyFlags)
if (my_thread_var->abort)
MyFlags&= ~ MY_WAIT_IF_FULL; /* End if aborted by user */
#endif
if (errno == ENOSPC && (MyFlags & MY_WAIT_IF_FULL))
if ((errno == ENOSPC || errno == EDQUOT) &&
(MyFlags & MY_WAIT_IF_FULL))
{
if (!(errors++ % MY_WAIT_GIVE_USER_A_MESSAGE))
my_error(EE_DISK_FULL,MYF(ME_BELL | ME_NOREFRESH));
sleep(MY_WAIT_FOR_USER_TO_FIX_PANIC);
VOID(my_fseek(stream,seekptr,MY_SEEK_SET,MYF(0)));
continue;
if (!(errors++ % MY_WAIT_GIVE_USER_A_MESSAGE))
my_error(EE_DISK_FULL,MYF(ME_BELL | ME_NOREFRESH),
"[stream]",my_errno,MY_WAIT_FOR_USER_TO_FIX_PANIC);
VOID(sleep(MY_WAIT_FOR_USER_TO_FIX_PANIC));
VOID(my_fseek(stream,seekptr,MY_SEEK_SET,MYF(0)));
continue;
}
#endif
if (ferror(stream) || (MyFlags & (MY_NABP | MY_FNABP)))
......
......@@ -115,11 +115,12 @@ uint my_pwrite(int Filedes, const byte *Buffer, uint Count, my_off_t offset,
if (my_thread_var->abort)
MyFlags&= ~ MY_WAIT_IF_FULL; /* End if aborted by user */
#endif
if (my_errno == ENOSPC && (MyFlags & MY_WAIT_IF_FULL))
if ((my_errno == ENOSPC || my_errno == EDQUOT) &&
(MyFlags & MY_WAIT_IF_FULL))
{
if (!(errors++ % MY_WAIT_GIVE_USER_A_MESSAGE))
my_error(EE_DISK_FULL,MYF(ME_BELL | ME_NOREFRESH),
my_filename(Filedes));
my_filename(Filedes),my_errno,MY_WAIT_FOR_USER_TO_FIX_PANIC);
VOID(sleep(MY_WAIT_FOR_USER_TO_FIX_PANIC));
continue;
}
......@@ -131,7 +132,7 @@ uint my_pwrite(int Filedes, const byte *Buffer, uint Count, my_off_t offset,
{
if (MyFlags & (MY_WME | MY_FAE | MY_FNABP))
{
my_error(EE_WRITE, MYF(ME_BELL+ME_WAITTANG),
my_error(EE_WRITE, MYF(ME_BELL | ME_WAITTANG),
my_filename(Filedes),my_errno);
}
DBUG_RETURN(MY_FILE_ERROR); /* Error on read */
......@@ -142,4 +143,4 @@ uint my_pwrite(int Filedes, const byte *Buffer, uint Count, my_off_t offset,
if (MyFlags & (MY_NABP | MY_FNABP))
DBUG_RETURN(0); /* Want only errors */
DBUG_RETURN(writenbytes+written); /* purecov: inspected */
} /* my_write */
} /* my_pwrite */
......@@ -48,12 +48,13 @@ uint my_write(int Filedes, const byte *Buffer, uint Count, myf MyFlags)
if (my_thread_var->abort)
MyFlags&= ~ MY_WAIT_IF_FULL; /* End if aborted by user */
#endif
if (my_errno == ENOSPC && (MyFlags & MY_WAIT_IF_FULL) &&
if ((my_errno == ENOSPC || my_errno == EDQUOT) &&
(MyFlags & MY_WAIT_IF_FULL) &&
(uint) writenbytes != (uint) -1)
{
if (!(errors++ % MY_WAIT_GIVE_USER_A_MESSAGE))
my_error(EE_DISK_FULL,MYF(ME_BELL | ME_NOREFRESH),
my_filename(Filedes));
my_filename(Filedes),my_errno,MY_WAIT_FOR_USER_TO_FIX_PANIC);
VOID(sleep(MY_WAIT_FOR_USER_TO_FIX_PANIC));
continue;
}
......
......@@ -29,3 +29,11 @@ extern pthread_mutex_t THR_LOCK_charset;
#else
#include <my_no_pthread.h>
#endif
/*
EDQUOT is used only in 3 C files only in mysys/. If it does not exist on
system, we set it to some value which can never happen.
*/
#ifndef EDQUOT
#define EDQUOT (-1)
#endif
......@@ -2080,8 +2080,7 @@ static void check_data_home(const char *path)
/* ARGSUSED */
extern "C" int my_message_sql(uint error, const char *str,
myf MyFlags __attribute__((unused)))
extern "C" int my_message_sql(uint error, const char *str, myf MyFlags)
{
NET *net;
DBUG_ENTER("my_message_sql");
......@@ -2094,7 +2093,7 @@ extern "C" int my_message_sql(uint error, const char *str,
net->last_errno=error ? error : ER_UNKNOWN_ERROR;
}
}
else
if (!net || MyFlags & ME_NOREFRESH)
sql_print_error("%s: %s",my_progname,str); /* purecov: inspected */
DBUG_RETURN(0);
}
......
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