diff options
Diffstat (limited to 'innobase/dict/dict0load.c')
-rw-r--r-- | innobase/dict/dict0load.c | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/innobase/dict/dict0load.c b/innobase/dict/dict0load.c index 12ceba38815..f835d1b949a 100644 --- a/innobase/dict/dict0load.c +++ b/innobase/dict/dict0load.c @@ -207,12 +207,14 @@ loop: In a crash recovery we already have all the tablespace objects created. This function compares the space id information in the InnoDB data dictionary to what we already read with fil_load_single_table_tablespaces(). -In a normal startup we just scan the biggest space id, and store it to -fil_system. */ + +In a normal startup, we create the tablespace objects for every table in +InnoDB's data dictionary, if the corresponding .ibd file exists. +We also scan the biggest space id, and store it to fil_system. */ void -dict_check_tablespaces_or_store_max_id( -/*===================================*/ +dict_check_tablespaces_and_store_max_id( +/*====================================*/ ibool in_crash_recovery) /* in: are we doing a crash recovery */ { dict_table_t* sys_tables; @@ -283,6 +285,14 @@ loop: FALSE, TRUE, TRUE); } + if (space_id != 0 && !in_crash_recovery) { + /* It is a normal database startup: create the space + object and check that the .ibd file exists. */ + + fil_open_single_table_tablespace(FALSE, space_id, + name); + } + mem_free(name); if (space_id > max_space_id) { @@ -797,8 +807,18 @@ dict_load_table( /* Ok; (if we did a crash recovery then the tablespace can already be in the memory cache) */ } else { + /* In >= 4.1.9, InnoDB scans the data dictionary also + at a normal mysqld startup. It is an error if the + space object does not exist in memory. */ + + ut_print_timestamp(stderr); + fprintf(stderr, +" InnoDB: error: space object of table %s,\n" +"InnoDB: space id %lu did not exist in memory. Retrying an open.\n", + name, (ulong)space); /* Try to open the tablespace */ - if (!fil_open_single_table_tablespace(space, name)) { + if (!fil_open_single_table_tablespace(TRUE, + space, name)) { /* We failed to find a sensible tablespace file */ |