From 5c70f813f3d12974bf67d6ff98c0ff4b9ca71d7d Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Wed, 18 May 2011 13:36:12 +0300 Subject: [PATCH] Added HA_ERR_DISK_FULL handler error Original code by Zardosht Kasheff sql/handler.cc: Added HA_ERR_DISK_FULL and ENOSPC (for handler that uses normal errno). This sets 'fatal_error' to ensure that the error is logged to err file (which hopefully is on another disk...) --- include/my_base.h | 3 ++- mysys/my_handler_errors.h | 3 ++- sql/handler.cc | 6 ++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/include/my_base.h b/include/my_base.h index c17897670ba..0029d01d75e 100644 --- a/include/my_base.h +++ b/include/my_base.h @@ -446,7 +446,8 @@ enum ha_base_keytype { #define HA_ERR_ROW_NOT_VISIBLE 177 #define HA_ERR_TOO_MANY_CONCURRENT_TRXS 178 /*Too many active concurrent transactions */ #define HA_ERR_ABORTED_BY_USER 179 -#define HA_ERR_LAST 179 /* Copy of last error nr */ +#define HA_ERR_DISK_FULL 180 +#define HA_ERR_LAST 180 /* Copy of last error nr */ /* Number of different errors */ #define HA_ERR_ERRORS (HA_ERR_LAST - HA_ERR_FIRST + 1) diff --git a/mysys/my_handler_errors.h b/mysys/my_handler_errors.h index 19de02a00a8..6213ab188cc 100644 --- a/mysys/my_handler_errors.h +++ b/mysys/my_handler_errors.h @@ -64,5 +64,6 @@ static const char *handler_error_messages[]= "Read page with wrong checksum", "Too many active concurrent transactions", "Row is not visible by the current transaction", - "Operation was interrupted by end user (probably kill command?)" + "Operation was interrupted by end user (probably kill command?)", + "Disk full" }; diff --git a/sql/handler.cc b/sql/handler.cc index 895e7a65125..baa7ebfb44c 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -345,6 +345,7 @@ int ha_init_errors(void) SETMSG(HA_ERR_AUTOINC_READ_FAILED, ER(ER_AUTOINC_READ_FAILED)); SETMSG(HA_ERR_AUTOINC_ERANGE, ER(ER_WARN_DATA_OUT_OF_RANGE)); SETMSG(HA_ERR_TOO_MANY_CONCURRENT_TRXS, ER(ER_TOO_MANY_CONCURRENT_TRXS)); + SETMSG(HA_ERR_DISK_FULL, ER(ER_DISK_FULL)); /* Register the error messages for use with my_error(). */ return my_error_register(errmsgs, HA_ERR_FIRST, HA_ERR_LAST); @@ -2759,6 +2760,11 @@ void handler::print_error(int error, myf errflag) case ENOENT: textno=ER_FILE_NOT_FOUND; break; + case ENOSPC: + case HA_ERR_DISK_FULL: + textno= ER_DISK_FULL; + SET_FATAL_ERROR; // Ensure error is logged + break; case HA_ERR_KEY_NOT_FOUND: case HA_ERR_NO_ACTIVE_RECORD: case HA_ERR_END_OF_FILE: