Commit 39cbba19 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-12266: dict_recreate_index_tree(): Keep the fil_space_t

parent c577192d
...@@ -1032,26 +1032,27 @@ dict_recreate_index_tree( ...@@ -1032,26 +1032,27 @@ dict_recreate_index_tree(
ut_a(!dict_table_is_comp(dict_sys->sys_indexes)); ut_a(!dict_table_is_comp(dict_sys->sys_indexes));
ulint len; ulint len;
rec_t* rec = btr_pcur_get_rec(pcur); const rec_t* rec = btr_pcur_get_rec(pcur);
const byte* ptr = rec_get_nth_field_old( const byte* ptr = rec_get_nth_field_old(
rec, DICT_FLD__SYS_INDEXES__PAGE_NO, &len); rec, DICT_FLD__SYS_INDEXES__PAGE_NO, &len);
ut_ad(len == 4); ut_ad(len == 4);
ulint root_page_no = mtr_read_ulint(ptr, MLOG_4BYTES, mtr);
ptr = rec_get_nth_field_old(rec, DICT_FLD__SYS_INDEXES__SPACE, &len); ptr = rec_get_nth_field_old(rec, DICT_FLD__SYS_INDEXES__SPACE, &len);
ut_ad(len == 4); ut_ad(len == 4);
ut_a(table->space == mtr_read_ulint(ptr, MLOG_4BYTES, mtr)); ut_a(table->space == mtr_read_ulint(ptr, MLOG_4BYTES, mtr));
ulint space = table->space; mutex_enter(&fil_system.mutex);
bool found; fil_space_t* space = fil_space_get_by_id(table->space);
const page_size_t page_size(fil_space_get_page_size(space, /* TRUNCATE TABLE is protected by an exclusive table lock.
&found)); The table cannot be dropped or the tablespace discarded
while we are holding the transactional table lock. Thus,
there is no need to invoke fil_space_acquire(). */
mutex_exit(&fil_system.mutex);
if (!found) { if (!space) {
/* It is a single table tablespae and the .ibd file is /* It is a single table tablespae and the .ibd file is
missing: do nothing. */ missing: do nothing. */
...@@ -1085,15 +1086,13 @@ dict_recreate_index_tree( ...@@ -1085,15 +1086,13 @@ dict_recreate_index_tree(
index != NULL; index != NULL;
index = UT_LIST_GET_NEXT(indexes, index)) { index = UT_LIST_GET_NEXT(indexes, index)) {
if (index->id == index_id) { if (index->id == index_id) {
if (index->type & DICT_FTS) { ulint root_page_no = (index->type & DICT_FTS)
return(FIL_NULL); ? FIL_NULL
} else { : btr_create(type, space->id,
root_page_no = btr_create( page_size_t(space->flags),
type, space, page_size, index_id, index_id, index, NULL, mtr);
index, NULL, mtr); index->page = unsigned(root_page_no);
index->page = (unsigned int) root_page_no; return root_page_no;
return(root_page_no);
}
} }
} }
......
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