summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHe Zhenxing <zhenxing.he@sun.com>2009-03-06 17:38:14 +0800
committerHe Zhenxing <zhenxing.he@sun.com>2009-03-06 17:38:14 +0800
commit5229ef4ac8d187760b2ed2c7a8108e03e3185da7 (patch)
tree2f87ecb15bf2110f5197c10da49c1cf6db1420e1
parent583390388916e21b9008fdc3871df9f1304bf8c2 (diff)
parent37068efd819cbb8f564609ebca46ae47872b3864 (diff)
downloadmariadb-git-5229ef4ac8d187760b2ed2c7a8108e03e3185da7.tar.gz
Merge BUG#22082 from 5.0-bugteam to 5.1-bugteam
-rw-r--r--include/my_sys.h1
-rw-r--r--mysys/errors.c16
-rw-r--r--mysys/my_fstream.c6
-rw-r--r--mysys/my_pread.c6
-rw-r--r--mysys/my_write.c6
5 files changed, 22 insertions, 13 deletions
diff --git a/include/my_sys.h b/include/my_sys.h
index 5335b65822f..8fda6178f6b 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -637,6 +637,7 @@ extern int nt_share_delete(const char *name,myf MyFlags);
extern void TERMINATE(FILE *file, uint flag);
#endif
extern void init_glob_errs(void);
+extern void wait_for_free_space(const char *filename, int errors);
extern FILE *my_fopen(const char *FileName,int Flags,myf MyFlags);
extern FILE *my_fdopen(File Filedes,const char *name, int Flags,myf MyFlags);
extern int my_fclose(FILE *fd,myf MyFlags);
diff --git a/mysys/errors.c b/mysys/errors.c
index 537a75c6ef3..8d3303cac9f 100644
--- a/mysys/errors.c
+++ b/mysys/errors.c
@@ -39,7 +39,7 @@ const char * NEAR globerrs[GLOBERRS]=
"Can't change dir to '%s' (Errcode: %d)",
"Warning: '%s' had %d links",
"Warning: %d files and %d streams is left open\n",
- "Disk is full writing '%s' (Errcode: %d). Waiting for someone to free space... Retry in %d secs",
+ "Disk is full writing '%s' (Errcode: %d). Waiting for someone to free space... (Expect up to %d secs delay for server to continue after freeing disk space)",
"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)",
@@ -92,3 +92,17 @@ void init_glob_errs()
EE(EE_FILE_NOT_CLOSED) = "File '%s' (fileno: %d) was not closed";
}
#endif
+
+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_WAIT_FOR_USER_TO_FIX_PANIC,
+ MY_WAIT_GIVE_USER_A_MESSAGE * MY_WAIT_FOR_USER_TO_FIX_PANIC );
+ VOID(sleep(MY_WAIT_FOR_USER_TO_FIX_PANIC));
+}
diff --git a/mysys/my_fstream.c b/mysys/my_fstream.c
index f5fe862937c..f3b5418b906 100644
--- a/mysys/my_fstream.c
+++ b/mysys/my_fstream.c
@@ -131,10 +131,8 @@ size_t my_fwrite(FILE *stream, const uchar *Buffer, size_t Count, myf MyFlags)
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),
- "[stream]",my_errno,MY_WAIT_FOR_USER_TO_FIX_PANIC);
- VOID(sleep(MY_WAIT_FOR_USER_TO_FIX_PANIC));
+ wait_for_free_space("[stream]", errors);
+ errors++;
VOID(my_fseek(stream,seekptr,MY_SEEK_SET,MYF(0)));
continue;
}
diff --git a/mysys/my_pread.c b/mysys/my_pread.c
index de7a2b611ed..156862ec414 100644
--- a/mysys/my_pread.c
+++ b/mysys/my_pread.c
@@ -161,10 +161,8 @@ size_t my_pwrite(int Filedes, const uchar *Buffer, size_t Count,
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_errno,MY_WAIT_FOR_USER_TO_FIX_PANIC);
- VOID(sleep(MY_WAIT_FOR_USER_TO_FIX_PANIC));
+ wait_for_free_space(my_filename(Filedes), errors);
+ errors++;
continue;
}
if ((writenbytes && writenbytes != (size_t) -1) || my_errno == EINTR)
diff --git a/mysys/my_write.c b/mysys/my_write.c
index c67b1d8f3f2..d7eb390bdd2 100644
--- a/mysys/my_write.c
+++ b/mysys/my_write.c
@@ -54,10 +54,8 @@ size_t my_write(int Filedes, const uchar *Buffer, size_t Count, myf MyFlags)
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_errno,MY_WAIT_FOR_USER_TO_FIX_PANIC);
- VOID(sleep(MY_WAIT_FOR_USER_TO_FIX_PANIC));
+ wait_for_free_space(my_filename(Filedes), errors);
+ errors++;
continue;
}