Commit 10c9c12b authored by Marko Mäkelä's avatar Marko Mäkelä

Bug #54658: InnoDB: Warning: allocated tablespace %lu, old maximum was 0

dict_check_tablespaces_and_store_max_id(): Initialize max_space_id
and fil_system->max_assigned_id from DICT_HDR_MAX_SPACE_ID.

fil_space_create(): Suppress the warning unless !recv_recovery_on
(do not complain while applying the redo log).
parent 644692fe
...@@ -316,7 +316,7 @@ dict_check_tablespaces_and_store_max_id( ...@@ -316,7 +316,7 @@ dict_check_tablespaces_and_store_max_id(
dict_index_t* sys_index; dict_index_t* sys_index;
btr_pcur_t pcur; btr_pcur_t pcur;
const rec_t* rec; const rec_t* rec;
ulint max_space_id = 0; ulint max_space_id;
mtr_t mtr; mtr_t mtr;
mutex_enter(&(dict_sys->mutex)); mutex_enter(&(dict_sys->mutex));
...@@ -327,6 +327,11 @@ dict_check_tablespaces_and_store_max_id( ...@@ -327,6 +327,11 @@ dict_check_tablespaces_and_store_max_id(
sys_index = UT_LIST_GET_FIRST(sys_tables->indexes); sys_index = UT_LIST_GET_FIRST(sys_tables->indexes);
ut_a(!dict_table_is_comp(sys_tables)); ut_a(!dict_table_is_comp(sys_tables));
max_space_id = mtr_read_ulint(dict_hdr_get(&mtr)
+ DICT_HDR_MAX_SPACE_ID,
MLOG_4BYTES, &mtr);
fil_set_max_space_id_if_bigger(max_space_id);
btr_pcur_open_at_index_side(TRUE, sys_index, BTR_SEARCH_LEAF, &pcur, btr_pcur_open_at_index_side(TRUE, sys_index, BTR_SEARCH_LEAF, &pcur,
TRUE, &mtr); TRUE, &mtr);
loop: loop:
......
...@@ -1197,7 +1197,7 @@ fil_space_create( ...@@ -1197,7 +1197,7 @@ fil_space_create(
space->tablespace_version = fil_system->tablespace_version; space->tablespace_version = fil_system->tablespace_version;
space->mark = FALSE; space->mark = FALSE;
if (UNIV_LIKELY(purpose == FIL_TABLESPACE) if (UNIV_LIKELY(purpose == FIL_TABLESPACE && !recv_recovery_on)
&& UNIV_UNLIKELY(id > fil_system->max_assigned_id)) { && UNIV_UNLIKELY(id > fil_system->max_assigned_id)) {
if (!fil_system->space_id_reuse_warned) { if (!fil_system->space_id_reuse_warned) {
fil_system->space_id_reuse_warned = TRUE; fil_system->space_id_reuse_warned = TRUE;
......
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