Skip to content

Commit e50996c

Browse files
author
Aditya A
committed
Bug#17287443 ERROR(1030): GOT ERROR -1 FROM STORAGE ENGINE
PROBLEM ------- When we try to do DML operations in innodb force recovery mode.we get a cryptic error message. ERROR(1030): GOT ERROR -1 FROM STORAGE ENGINE FIX --- Introduced a new error ER_INNODB_FORCE_RECOVERY which will print proper error message. [Approved by Kevin and Krunal #rb4095 and rb#4137]
1 parent 06002eb commit e50996c

7 files changed

Lines changed: 25 additions & 6 deletions

File tree

include/my_base.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,8 @@ is the global server default. */
482482
#define HA_ERR_INNODB_READ_ONLY 187 /* InnoDB is in read only mode. */
483483
#define HA_ERR_FTS_EXCEED_RESULT_CACHE_LIMIT 188 /* FTS query exceeds result cache limit */
484484
#define HA_ERR_TEMP_FILE_WRITE_FAILURE 189 /* Temporary file write failure */
485-
#define HA_ERR_LAST 189 /* Copy of last error nr */
485+
#define HA_ERR_INNODB_FORCED_RECOVERY 190 /* Innodb is in force recovery mode */
486+
#define HA_ERR_LAST 190 /* Copy of last error nr */
486487

487488
/* Number of different errors */
488489
#define HA_ERR_ERRORS (HA_ERR_LAST - HA_ERR_FIRST + 1)

mysys/my_handler_errors.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ static const char *handler_error_messages[]=
9292
"Row in wrong partition",
9393
"InnoDB is in read only mode",
9494
"FTS query exceeds result cache memory limit",
95-
"Temporary file write failure"
95+
"Temporary file write failure",
96+
"Operation not allowed when innodb_forced_recovery > 0"
9697
};
9798

9899
extern void my_handler_error_register(void);

sql/handler.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ int ha_init_errors(void)
556556
SETMSG(HA_ERR_TABLESPACE_EXISTS, "Tablespace already exists");
557557
SETMSG(HA_ERR_FTS_EXCEED_RESULT_CACHE_LIMIT, "FTS query exceeds result cache limit");
558558
SETMSG(HA_ERR_TEMP_FILE_WRITE_FAILURE, ER_DEFAULT(ER_TEMP_FILE_WRITE_FAILURE));
559-
559+
SETMSG(HA_ERR_INNODB_FORCED_RECOVERY, ER_DEFAULT(ER_INNODB_FORCED_RECOVERY));
560560
/* Register the error messages for use with my_error(). */
561561
return my_error_register(get_handler_errmsgs, HA_ERR_FIRST, HA_ERR_LAST);
562562
}
@@ -3721,6 +3721,9 @@ void handler::print_error(int error, myf errflag)
37213721
case HA_ERR_TEMP_FILE_WRITE_FAILURE:
37223722
textno= ER_TEMP_FILE_WRITE_FAILURE;
37233723
break;
3724+
case HA_ERR_INNODB_FORCED_RECOVERY:
3725+
textno= ER_INNODB_FORCED_RECOVERY;
3726+
break;
37243727
default:
37253728
{
37263729
/* The error was "unknown" to this function.

sql/share/errmsg-utf8.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7094,6 +7094,8 @@ ER_INNODB_FT_AUX_NOT_HEX_ID
70947094
ER_OLD_TEMPORALS_UPGRADED
70957095
eng "TIME/TIMESTAMP/DATETIME columns of old format have been upgraded to the new format."
70967096

7097+
ER_INNODB_FORCED_RECOVERY
7098+
eng "Operation not allowed when innodb_forced_recovery > 0."
70977099
#
70987100
# End of 5.6 error messages.
70997101
#

storage/innobase/handler/ha_innodb.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1387,6 +1387,9 @@ convert_error_code_to_mysql(
13871387
return(HA_ERR_FOUND_DUPP_KEY);
13881388

13891389
case DB_READ_ONLY:
1390+
if(srv_force_recovery) {
1391+
return(HA_ERR_INNODB_FORCED_RECOVERY);
1392+
}
13901393
return(HA_ERR_TABLE_READONLY);
13911394

13921395
case DB_FOREIGN_DUPLICATE_KEY:

storage/innobase/handler/handler0alter.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,9 @@ ha_innobase::check_if_supported_inplace_alter(
237237
innobase_get_err_msg(ER_READ_ONLY_MODE);
238238
DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
239239
} else if (srv_created_new_raw || srv_force_recovery) {
240-
ha_alter_info->unsupported_reason =
240+
241+
ha_alter_info->unsupported_reason =(srv_force_recovery)?
242+
innobase_get_err_msg(ER_INNODB_FORCED_RECOVERY):
241243
innobase_get_err_msg(ER_READ_ONLY_MODE);
242244
DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
243245
}

storage/innobase/row/row0mysql.cc

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1277,7 +1277,9 @@ row_insert_for_mysql(
12771277
" newraw is replaced\n"
12781278
"InnoDB: with raw, and innodb_force_... is removed.\n",
12791279
stderr);
1280-
1280+
if(srv_force_recovery) {
1281+
return(DB_READ_ONLY);
1282+
}
12811283
return(DB_ERROR);
12821284
}
12831285

@@ -1662,7 +1664,9 @@ row_update_for_mysql(
16621664
" is replaced\n"
16631665
"InnoDB: with raw, and innodb_force_... is removed.\n",
16641666
stderr);
1665-
1667+
if(srv_force_recovery) {
1668+
return(DB_READ_ONLY);
1669+
}
16661670
return(DB_ERROR);
16671671
}
16681672

@@ -4727,6 +4731,9 @@ row_rename_table_for_mysql(
47274731
" is replaced\n"
47284732
"InnoDB: with raw, and innodb_force_... is removed.\n",
47294733
stderr);
4734+
if(srv_force_recovery) {
4735+
err = DB_READ_ONLY;
4736+
}
47304737

47314738
goto funct_exit;
47324739
} else if (row_mysql_is_system_table(new_name)) {

0 commit comments

Comments
 (0)