Commit 18b307a7 authored by Jan Lindström's avatar Jan Lindström

MDEV-6590: InnoDB recover ends in signal 11

Analysis: When database is migrated from 5.5 or earlier and
database needs crash recovery, there is possibility that
SYS_DATAFILES system table does not exists, but
crash recovery in function dict_check_tablespaces_and_store_max_id()
assumes that SYS_DATAFILES exists.

Fix: If SYS_DATAFILES does not exists, create it before
we end up to function dict_check_tablespaces_and_store_max_id()
on crash recovery.
parent 57a43b84
...@@ -1522,6 +1522,7 @@ innobase_start_or_create_for_mysql(void) ...@@ -1522,6 +1522,7 @@ innobase_start_or_create_for_mysql(void)
char logfilename[10000]; char logfilename[10000];
char* logfile0 = NULL; char* logfile0 = NULL;
size_t dirnamelen; size_t dirnamelen;
bool sys_datafiles_created = false;
if (srv_force_recovery > SRV_FORCE_NO_TRX_UNDO) { if (srv_force_recovery > SRV_FORCE_NO_TRX_UNDO) {
srv_read_only_mode = true; srv_read_only_mode = true;
...@@ -2448,6 +2449,15 @@ innobase_start_or_create_for_mysql(void) ...@@ -2448,6 +2449,15 @@ innobase_start_or_create_for_mysql(void)
dict_check = DICT_CHECK_NONE_LOADED; dict_check = DICT_CHECK_NONE_LOADED;
} }
/* Create the SYS_TABLESPACES and SYS_DATAFILES system table */
err = dict_create_or_check_sys_tablespace();
if (err != DB_SUCCESS) {
return(err);
}
sys_datafiles_created = true;
/* This function assumes that SYS_DATAFILES exists */
dict_check_tablespaces_and_store_max_id(dict_check); dict_check_tablespaces_and_store_max_id(dict_check);
} }
...@@ -2652,10 +2662,13 @@ innobase_start_or_create_for_mysql(void) ...@@ -2652,10 +2662,13 @@ innobase_start_or_create_for_mysql(void)
return(err); return(err);
} }
/* Create the SYS_TABLESPACES system table */ /* Create the SYS_TABLESPACES and SYS_DATAFILES system tables if we
err = dict_create_or_check_sys_tablespace(); have not done that already on crash recovery. */
if (err != DB_SUCCESS) { if (sys_datafiles_created == false) {
return(err); err = dict_create_or_check_sys_tablespace();
if (err != DB_SUCCESS) {
return(err);
}
} }
srv_is_being_started = FALSE; srv_is_being_started = FALSE;
......
...@@ -1566,6 +1566,7 @@ innobase_start_or_create_for_mysql(void) ...@@ -1566,6 +1566,7 @@ innobase_start_or_create_for_mysql(void)
char logfilename[10000]; char logfilename[10000];
char* logfile0 = NULL; char* logfile0 = NULL;
size_t dirnamelen; size_t dirnamelen;
bool sys_datafiles_created = false;
if (srv_force_recovery > SRV_FORCE_NO_TRX_UNDO) { if (srv_force_recovery > SRV_FORCE_NO_TRX_UNDO) {
srv_read_only_mode = true; srv_read_only_mode = true;
...@@ -2515,6 +2516,15 @@ innobase_start_or_create_for_mysql(void) ...@@ -2515,6 +2516,15 @@ innobase_start_or_create_for_mysql(void)
dict_check = DICT_CHECK_NONE_LOADED; dict_check = DICT_CHECK_NONE_LOADED;
} }
/* Create the SYS_TABLESPACES and SYS_DATAFILES system table */
err = dict_create_or_check_sys_tablespace();
if (err != DB_SUCCESS) {
return(err);
}
sys_datafiles_created = true;
/* This function assumes that SYS_DATAFILES exists */
dict_check_tablespaces_and_store_max_id(dict_check); dict_check_tablespaces_and_store_max_id(dict_check);
} }
...@@ -2727,10 +2737,13 @@ innobase_start_or_create_for_mysql(void) ...@@ -2727,10 +2737,13 @@ innobase_start_or_create_for_mysql(void)
return(err); return(err);
} }
/* Create the SYS_TABLESPACES system table */ /* Create the SYS_TABLESPACES and SYS_DATAFILES system tables if we
err = dict_create_or_check_sys_tablespace(); have not done that already on crash recovery. */
if (err != DB_SUCCESS) { if (sys_datafiles_created == false) {
return(err); err = dict_create_or_check_sys_tablespace();
if (err != DB_SUCCESS) {
return(err);
}
} }
srv_is_being_started = FALSE; srv_is_being_started = FALSE;
......
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