diff options
Diffstat (limited to 'storage/innobase/ibuf/ibuf0ibuf.cc')
-rw-r--r-- | storage/innobase/ibuf/ibuf0ibuf.cc | 123 |
1 files changed, 44 insertions, 79 deletions
diff --git a/storage/innobase/ibuf/ibuf0ibuf.cc b/storage/innobase/ibuf/ibuf0ibuf.cc index 7068dab77a4..ee6fd235d5e 100644 --- a/storage/innobase/ibuf/ibuf0ibuf.cc +++ b/storage/innobase/ibuf/ibuf0ibuf.cc @@ -4384,16 +4384,12 @@ exist entries for such a page if the page belonged to an index which subsequently was dropped. @param[in,out] block if page has been read from disk, pointer to the page x-latched, else NULL -@param[in] page_id page id of the index page -@param[in] update_ibuf_bitmap normally this is set to TRUE, but -if we have deleted or are deleting the tablespace, then we naturally do not -want to update a non-existent bitmap page */ +@param[in] page_id page id of the index page */ void ibuf_merge_or_delete_for_page( buf_block_t* block, const page_id_t page_id, - const page_size_t* page_size, - ibool update_ibuf_bitmap) + const page_size_t& page_size) { btr_pcur_t pcur; #ifdef UNIV_IBUF_DEBUG @@ -4417,81 +4413,50 @@ ibuf_merge_or_delete_for_page( return; } - /* We cannot refer to page_size in the following, because it is passed - as NULL (it is unknown) when buf_read_ibuf_merge_pages() is merging - (discarding) changes for a dropped tablespace. When block != NULL or - update_ibuf_bitmap is specified, then page_size must be known. - That is why we will repeat the check below, with page_size in - place of univ_page_size. Passing univ_page_size assumes that the - uncompressed page size always is a power-of-2 multiple of the - compressed page size. */ - - if (ibuf_fixed_addr_page(page_id, univ_page_size) - || fsp_descr_page(page_id, univ_page_size)) { + if (ibuf_fixed_addr_page(page_id, page_size) + || fsp_descr_page(page_id, page_size)) { return; } - fil_space_t* space; - - if (update_ibuf_bitmap) { - - ut_ad(page_size != NULL); - - if (ibuf_fixed_addr_page(page_id, *page_size) - || fsp_descr_page(page_id, *page_size)) { - return; - } + fil_space_t* space = fil_space_acquire_silent(page_id.space()); - space = fil_space_acquire_silent(page_id.space()); - - if (UNIV_UNLIKELY(!space)) { - /* Do not try to read the bitmap page from the - non-existent tablespace, delete the ibuf records */ - block = NULL; - update_ibuf_bitmap = FALSE; - } else { - page_t* bitmap_page = NULL; - ulint bitmap_bits = 0; + if (UNIV_UNLIKELY(!space)) { + block = NULL; + } else { + page_t* bitmap_page = NULL; + ulint bitmap_bits = 0; - ibuf_mtr_start(&mtr); + ibuf_mtr_start(&mtr); - bitmap_page = ibuf_bitmap_get_map_page( - page_id, *page_size, &mtr); + bitmap_page = ibuf_bitmap_get_map_page( + page_id, page_size, &mtr); - if (bitmap_page && - fil_page_get_type(bitmap_page) != FIL_PAGE_TYPE_ALLOCATED) { - bitmap_bits = ibuf_bitmap_page_get_bits( - bitmap_page, page_id, *page_size, - IBUF_BITMAP_BUFFERED, &mtr); - } + if (bitmap_page && + fil_page_get_type(bitmap_page) != FIL_PAGE_TYPE_ALLOCATED) { + bitmap_bits = ibuf_bitmap_page_get_bits( + bitmap_page, page_id, page_size, + IBUF_BITMAP_BUFFERED, &mtr); + } - ibuf_mtr_commit(&mtr); + ibuf_mtr_commit(&mtr); - if (!bitmap_bits) { - /* No changes are buffered for this page. */ - - fil_space_release(space); - if (UNIV_UNLIKELY(srv_shutdown_state) - && !srv_fast_shutdown - && (!block - || btr_page_get_index_id(block->frame) - != DICT_IBUF_ID_MIN + IBUF_SPACE_ID)) { - /* Prevent an infinite loop on slow - shutdown, in case the bitmap bits are - wrongly clear even though buffered - changes exist. */ - ibuf_delete_recs(page_id); - } - return; + if (!bitmap_bits) { + /* No changes are buffered for this page. */ + + fil_space_release(space); + if (UNIV_UNLIKELY(srv_shutdown_state) + && !srv_fast_shutdown + && (!block + || btr_page_get_index_id(block->frame) + != DICT_IBUF_ID_MIN + IBUF_SPACE_ID)) { + /* Prevent an infinite loop on slow + shutdown, in case the bitmap bits are + wrongly clear even though buffered + changes exist. */ + ibuf_delete_recs(page_id); } + return; } - } else if (block != NULL - && (ibuf_fixed_addr_page(page_id, *page_size) - || fsp_descr_page(page_id, *page_size))) { - - return; - } else { - space = NULL; } mem_heap_t* heap = mem_heap_create(512); @@ -4541,7 +4506,7 @@ loop: if (block != NULL) { ibool success; - mtr.set_named_space(page_id.space()); + mtr.set_named_space(space); success = buf_page_get_known_nowait( RW_X_LATCH, block, @@ -4556,8 +4521,8 @@ loop: the block is io-fixed. Other threads must not try to latch an io-fixed block. */ buf_block_dbg_add_level(block, SYNC_IBUF_TREE_NODE); - } else if (update_ibuf_bitmap) { - mtr.set_named_space(page_id.space()); + } else if (space) { + mtr.set_named_space(space); } if (!btr_pcur_is_on_user_rec(&pcur)) { @@ -4658,7 +4623,7 @@ loop: ibuf_btr_pcur_commit_specify_mtr(&pcur, &mtr); ibuf_mtr_start(&mtr); - mtr.set_named_space(page_id.space()); + mtr.set_named_space(space); success = buf_page_get_known_nowait( RW_X_LATCH, block, @@ -4714,26 +4679,26 @@ loop: } reset_bit: - if (update_ibuf_bitmap) { + if (space) { page_t* bitmap_page; - bitmap_page = ibuf_bitmap_get_map_page(page_id, *page_size, + bitmap_page = ibuf_bitmap_get_map_page(page_id, page_size, &mtr); ibuf_bitmap_page_set_bits( - bitmap_page, page_id, *page_size, + bitmap_page, page_id, page_size, IBUF_BITMAP_BUFFERED, FALSE, &mtr); if (block != NULL) { ulint old_bits = ibuf_bitmap_page_get_bits( - bitmap_page, page_id, *page_size, + bitmap_page, page_id, page_size, IBUF_BITMAP_FREE, &mtr); ulint new_bits = ibuf_index_page_calc_free(block); if (old_bits != new_bits) { ibuf_bitmap_page_set_bits( - bitmap_page, page_id, *page_size, + bitmap_page, page_id, page_size, IBUF_BITMAP_FREE, new_bits, &mtr); } } |