diff options
Diffstat (limited to 'sql/handler.cc')
-rw-r--r-- | sql/handler.cc | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/sql/handler.cc b/sql/handler.cc index 2f29e9c4181..b44c799f499 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -62,7 +62,9 @@ static const LEX_STRING sys_table_aliases[]= }; const char *ha_row_type[] = { - "", "FIXED", "DYNAMIC", "COMPRESSED", "REDUNDANT", "COMPACT", "PAGE", "?","?","?" + "", "FIXED", "DYNAMIC", "COMPRESSED", "REDUNDANT", "COMPACT", + /* Reserved to be "PAGE" in future versions */ "?", + "?","?","?" }; const char *tx_isolation_names[] = @@ -342,6 +344,7 @@ int ha_init_errors(void) SETMSG(HA_ERR_TABLE_READONLY, ER(ER_OPEN_AS_READONLY)); 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)); /* Register the error messages for use with my_error(). */ return my_error_register(errmsgs, HA_ERR_FIRST, HA_ERR_LAST); @@ -2747,6 +2750,9 @@ void handler::print_error(int error, myf errflag) case HA_ERR_AUTOINC_ERANGE: textno= ER_WARN_DATA_OUT_OF_RANGE; break; + case HA_ERR_TOO_MANY_CONCURRENT_TRXS: + textno= ER_TOO_MANY_CONCURRENT_TRXS; + break; default: { /* The error was "unknown" to this function. @@ -2973,6 +2979,7 @@ uint handler::get_dup_key(int error) */ int handler::delete_table(const char *name) { + int saved_error= 0; int error= 0; int enoent_or_zero= ENOENT; // Error if no file was deleted char buff[FN_REFLEN]; @@ -2982,21 +2989,31 @@ int handler::delete_table(const char *name) fn_format(buff, name, "", *ext, MY_UNPACK_FILENAME|MY_APPEND_EXT); if (my_delete_with_symlink(buff, MYF(0))) { - if ((error= my_errno) != ENOENT) - break; + if (my_errno != ENOENT) + { + /* + If error on the first existing file, return the error. + Otherwise delete as much as possible. + */ + if (enoent_or_zero) + return my_errno; + saved_error= my_errno; + } } else enoent_or_zero= 0; // No error for ENOENT error= enoent_or_zero; } - return error; + return saved_error ? saved_error : error; } int handler::rename_table(const char * from, const char * to) { int error= 0; - for (const char **ext= bas_ext(); *ext ; ext++) + const char **ext, **start_ext; + start_ext= bas_ext(); + for (ext= start_ext; *ext ; ext++) { if (rename_file_ext(from, to, *ext)) { @@ -3005,6 +3022,12 @@ int handler::rename_table(const char * from, const char * to) error= 0; } } + if (error) + { + /* Try to revert the rename. Ignore errors. */ + for (; ext >= start_ext; ext--) + rename_file_ext(to, from, *ext); + } return error; } |