diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2020-12-03 14:17:22 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2020-12-03 15:27:50 +0200 |
commit | ac028ec5d853a4f797e5c48c348959618c773d62 (patch) | |
tree | 5d013c144b333cefedad8999e929dc97cf476b47 /storage | |
parent | 06efef4be39a415cc9c183066dfbe73ab5dc0866 (diff) | |
download | mariadb-git-ac028ec5d853a4f797e5c48c348959618c773d62.tar.gz |
MDEV-24142: Remove the LatchDebug interface to rw-locks
The latching order checks for rw-locks have not caught many bugs
in the past few years and they are greatly complicating the code.
Last time the debug checks were useful was in
commit 59caf2c3c1fe128d1d2c3a8df9fadd4d25ab7102 (MDEV-13485).
The B-tree hang MDEV-14637 was not caught by LatchDebug,
because the granularity of the checks is not sufficient
to distinguish the levels of non-leaf B-tree pages.
The interface was already made dead code by the grandparent
commit 03ca6495df31313c96e38834b9a235245e2ae2a8.
Diffstat (limited to 'storage')
31 files changed, 33 insertions, 561 deletions
diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc index e0fd7aaf1a9..0be3817ad2b 100644 --- a/storage/innobase/btr/btr0btr.cc +++ b/storage/innobase/btr/btr0btr.cc @@ -366,8 +366,6 @@ btr_root_adjust_on_import( goto func_exit; } - buf_block_dbg_add_level(block, SYNC_TREE_NODE); - page = buf_block_get_frame(block); page_zip = buf_block_get_page_zip(block); @@ -490,8 +488,6 @@ btr_page_alloc_for_ibuf( index->table->space->zip_size(), RW_X_LATCH, mtr); - buf_block_dbg_add_level(new_block, SYNC_IBUF_TREE_NODE_NEW); - flst_remove(root, PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST, new_block, PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST_NODE, mtr); @@ -557,21 +553,13 @@ btr_page_alloc( for x-latching and initializing the page */ { - buf_block_t* new_block; - if (dict_index_is_ibuf(index)) { return(btr_page_alloc_for_ibuf(index, mtr)); } - new_block = btr_page_alloc_low( + return btr_page_alloc_low( index, hint_page_no, file_direction, level, mtr, init_mtr); - - if (new_block) { - buf_block_dbg_add_level(new_block, SYNC_TREE_NODE_NEW); - } - - return(new_block); } /**************************************************************//** @@ -979,8 +967,6 @@ btr_free_root_check( page_id, zip_size, RW_X_LATCH, mtr); if (block) { - buf_block_dbg_add_level(block, SYNC_TREE_NODE); - if (fil_page_index_page_check(block->frame) && index_id == btr_page_get_index_id(block->frame)) { /* This should be a root page. @@ -1030,9 +1016,6 @@ btr_create( return(FIL_NULL); } - buf_block_dbg_add_level( - ibuf_hdr_block, SYNC_IBUF_TREE_NODE_NEW); - ut_ad(ibuf_hdr_block->page.id().page_no() == IBUF_HEADER_PAGE_NO); /* Allocate then the next page to the segment: it will be the @@ -1050,8 +1033,6 @@ btr_create( ut_ad(block->page.id() == page_id_t(0,IBUF_TREE_ROOT_PAGE_NO)); - buf_block_dbg_add_level(block, SYNC_IBUF_TREE_NODE_NEW); - flst_init(block, PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST, mtr); } else { block = fseg_create(space, PAGE_HEADER + PAGE_BTR_SEG_TOP, @@ -1061,8 +1042,6 @@ btr_create( return(FIL_NULL); } - buf_block_dbg_add_level(block, SYNC_TREE_NODE_NEW); - if (!fseg_create(space, PAGE_HEADER + PAGE_BTR_SEG_LEAF, mtr, false, block)) { /* Not enough space for new segment, free root @@ -1070,10 +1049,6 @@ btr_create( btr_free_root(block, mtr); return(FIL_NULL); } - - /* The fseg create acquires a second latch on the page, - therefore we must declare it: */ - buf_block_dbg_add_level(block, SYNC_TREE_NODE_NEW); } ut_ad(!page_has_siblings(block->frame)); diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index fb763592377..c95491a3e8c 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -556,7 +556,6 @@ incompatible: page_id_t(space->id, mach_read_from_4(ptr + BTR_EXTERN_PAGE_NO)), 0, RW_S_LATCH, mtr); - buf_block_dbg_add_level(block, SYNC_EXTERN_STORAGE); if (fil_page_get_type(block->frame) != FIL_PAGE_TYPE_BLOB || mach_read_from_4(&block->frame[FIL_PAGE_DATA + BTR_BLOB_HDR_NEXT_PAGE_NO]) @@ -1798,17 +1797,13 @@ retry_page_get: goto search_loop; } - if (rw_latch != RW_NO_LATCH) { #ifdef UNIV_ZIP_DEBUG + if (rw_latch != RW_NO_LATCH) { const page_zip_des_t* page_zip = buf_block_get_page_zip(block); ut_a(!page_zip || page_zip_validate(page_zip, page, index)); -#endif /* UNIV_ZIP_DEBUG */ - - buf_block_dbg_add_level( - block, dict_index_is_ibuf(index) - ? SYNC_IBUF_TREE_NODE : SYNC_TREE_NODE); } +#endif /* UNIV_ZIP_DEBUG */ ut_ad(fil_page_index_page_check(page)); ut_ad(index->id == btr_page_get_index_id(page)); @@ -4402,7 +4397,6 @@ static void btr_cur_trim_alter_metadata(dtuple_t* entry, page_id_t(index->table->space->id, mach_read_from_4(ptr + BTR_EXTERN_PAGE_NO)), 0, RW_S_LATCH, &mtr); - buf_block_dbg_add_level(block, SYNC_EXTERN_STORAGE); ut_ad(fil_page_get_type(block->frame) == FIL_PAGE_TYPE_BLOB); ut_ad(mach_read_from_4(&block->frame[FIL_PAGE_DATA + BTR_BLOB_HDR_NEXT_PAGE_NO]) @@ -7359,9 +7353,6 @@ btr_store_big_rec_extern_fields( rec_block->zip_size(), RW_X_LATCH, &mtr); - buf_block_dbg_add_level(prev_block, - SYNC_EXTERN_STORAGE); - if (page_zip) { mtr.write<4>(*prev_block, prev_block->frame @@ -7680,12 +7671,8 @@ btr_free_externally_stored_field( const page_id_t page_id(page_get_space_id(p), page_get_page_no(p)); -#if 0 - buf_block_t* rec_block = -#endif buf_page_get(page_id, rec_zip_size, RW_X_LATCH, &mtr); - buf_block_dbg_add_level(rec_block, SYNC_NO_ORDER_CHECK); page_no = mach_read_from_4(field_ref + BTR_EXTERN_PAGE_NO); if (/* There is no external storage data */ @@ -7712,7 +7699,6 @@ btr_free_externally_stored_field( page_id_t(space_id, page_no), ext_zip_size, RW_X_LATCH, &mtr); - buf_block_dbg_add_level(ext_block, SYNC_EXTERN_STORAGE); page = buf_block_get_frame(ext_block); if (ext_zip_size) { @@ -7882,7 +7868,6 @@ btr_copy_blob_prefix( mtr_start(&mtr); block = buf_page_get(id, 0, RW_S_LATCH, &mtr); - buf_block_dbg_add_level(block, SYNC_EXTERN_STORAGE); page = buf_block_get_frame(block); btr_check_blob_fil_page_type(*block, true); diff --git a/storage/innobase/btr/btr0pcur.cc b/storage/innobase/btr/btr0pcur.cc index ad254976973..caf48e58cd8 100644 --- a/storage/innobase/btr/btr0pcur.cc +++ b/storage/innobase/btr/btr0pcur.cc @@ -338,11 +338,6 @@ btr_pcur_restore_position_func( cursor->pos_state = BTR_PCUR_IS_POSITIONED; cursor->latch_mode = latch_mode; - buf_block_dbg_add_level( - btr_pcur_get_block(cursor), - dict_index_is_ibuf(index) - ? SYNC_IBUF_TREE_NODE : SYNC_TREE_NODE); - if (cursor->rel_pos == BTR_PCUR_ON) { #ifdef UNIV_DEBUG const rec_t* rec; diff --git a/storage/innobase/btr/btr0sea.cc b/storage/innobase/btr/btr0sea.cc index 681cf2b06b9..990646f1585 100644 --- a/storage/innobase/btr/btr0sea.cc +++ b/storage/innobase/btr/btr0sea.cc @@ -1120,7 +1120,6 @@ got_no_latch: part->latch.rd_unlock(); - buf_block_dbg_add_level(block, SYNC_TREE_NODE_FROM_HASH); if (UNIV_UNLIKELY(fail)) { goto fail_and_release_page; } @@ -1390,7 +1389,6 @@ void btr_search_drop_page_hash_when_freed(const page_id_t page_id) { buf_block_t* block; mtr_t mtr; - dberr_t err = DB_SUCCESS; mtr_start(&mtr); @@ -1402,18 +1400,14 @@ void btr_search_drop_page_hash_when_freed(const page_id_t page_id) block = buf_page_get_gen(page_id, 0, RW_X_LATCH, NULL, BUF_PEEK_IF_IN_POOL, __FILE__, __LINE__, - &mtr, &err); + &mtr); if (block) { - /* If AHI is still valid, page can't be in free state. AHI is dropped when page is freed. */ DBUG_ASSERT(block->page.status != buf_page_t::FREED); - buf_block_dbg_add_level(block, SYNC_TREE_NODE_FROM_HASH); - - dict_index_t* index = block->index; - if (index != NULL) { + if (block->index) { /* In all our callers, the table handle should be open, or we should be in the process of dropping the table (preventing eviction). */ diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index defe2033240..2e099b9ca4d 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -2505,7 +2505,6 @@ void buf_page_free(const page_id_t page_id, mtr_t *mtr) block->lock.x_lock(); block->page.status= buf_page_t::FREED; - buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK); hash_lock->read_unlock(); } @@ -3417,9 +3416,6 @@ buf_page_optimistic_get( } if (modify_clock != block->modify_clock) { - - buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK); - if (rw_latch == RW_S_LATCH) { block->lock.s_unlock(); } else { @@ -3494,7 +3490,6 @@ buf_page_try_get_func( ut_ad(bpage->buf_fix_count()); ut_ad(bpage->state() == BUF_BLOCK_FILE_PAGE); ut_ad(bpage->id() == page_id); - buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK); buf_pool.stat.n_page_gets++; return block; diff --git a/storage/innobase/buf/buf0dblwr.cc b/storage/innobase/buf/buf0dblwr.cc index f0866b36d17..261c5e67950 100644 --- a/storage/innobase/buf/buf0dblwr.cc +++ b/storage/innobase/buf/buf0dblwr.cc @@ -43,10 +43,8 @@ buf_dblwr_t buf_dblwr; /** @return the TRX_SYS page */ inline buf_block_t *buf_dblwr_trx_sys_get(mtr_t *mtr) { - buf_block_t *block= buf_page_get(page_id_t(TRX_SYS_SPACE, TRX_SYS_PAGE_NO), - 0, RW_X_LATCH, mtr); - buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK); - return block; + return buf_page_get(page_id_t(TRX_SYS_SPACE, TRX_SYS_PAGE_NO), + 0, RW_X_LATCH, mtr); } /** Initialize the doublewrite buffer data structure. @@ -121,10 +119,6 @@ too_small: the InnoDB system tablespace file in the first place. It could be located in separate optional file(s) in a user-specified location. */ - - /* fseg_create acquires a second latch on the page, - therefore we must declare it: */ - buf_block_dbg_add_level(b, SYNC_NO_ORDER_CHECK); } byte *fseg_header= TRX_SYS_DOUBLEWRITE + TRX_SYS_DOUBLEWRITE_FSEG + diff --git a/storage/innobase/dict/dict0boot.cc b/storage/innobase/dict/dict0boot.cc index f4f94e2ace9..cace5166ad9 100644 --- a/storage/innobase/dict/dict0boot.cc +++ b/storage/innobase/dict/dict0boot.cc @@ -35,15 +35,6 @@ Created 4/18/1996 Heikki Tuuri #include "log0recv.h" #include "os0file.h" -/** @return the DICT_HDR block, x-latched */ -buf_block_t *dict_hdr_get(mtr_t* mtr) -{ - buf_block_t *block= buf_page_get(page_id_t(DICT_HDR_SPACE, DICT_HDR_PAGE_NO), - 0, RW_X_LATCH, mtr); - buf_block_dbg_add_level(block, SYNC_DICT_HEADER); - return block; -} - /**********************************************************************//** Returns a new table, index, or space id. */ void diff --git a/storage/innobase/fsp/fsp0fsp.cc b/storage/innobase/fsp/fsp0fsp.cc index d3deda61b3b..818b83feded 100644 --- a/storage/innobase/fsp/fsp0fsp.cc +++ b/storage/innobase/fsp/fsp0fsp.cc @@ -129,7 +129,6 @@ inline buf_block_t *fsp_get_header(const fil_space_t *space, mtr_t *mtr) { buf_block_t *block= buf_page_get(page_id_t(space->id, 0), space->zip_size(), RW_SX_LATCH, mtr); - buf_block_dbg_add_level(block, SYNC_FSP_PAGE); ut_ad(space->id == mach_read_from_4(FSP_HEADER_OFFSET + FSP_SPACE_ID + block->frame)); return block; @@ -349,8 +348,6 @@ xdes_get_descriptor_with_space_hdr( block = buf_page_get( page_id_t(space->id, descr_page_no), zip_size, RW_SX_LATCH, mtr); - - buf_block_dbg_add_level(block, SYNC_FSP_PAGE); } if (desc_block != NULL) { @@ -379,7 +376,6 @@ static xdes_t* xdes_get_descriptor(const fil_space_t *space, page_no_t offset, { buf_block_t *block= buf_page_get(page_id_t(space->id, 0), space->zip_size(), RW_SX_LATCH, mtr); - buf_block_dbg_add_level(block, SYNC_FSP_PAGE); return xdes_get_descriptor_with_space_hdr(block, space, offset, xdes, mtr); } @@ -412,8 +408,6 @@ xdes_get_descriptor_const( if (buf_block_t* block = buf_page_get(page_id_t(space->id, page), zip_size, RW_S_LATCH, mtr)) { - buf_block_dbg_add_level(block, SYNC_FSP_PAGE); - ut_ad(page != 0 || space->free_limit == mach_read_from_4( FSP_FREE_LIMIT + FSP_HEADER_OFFSET + block->frame)); @@ -553,8 +547,6 @@ void fsp_header_init(fil_space_t* space, uint32_t size, mtr_t* mtr) buf_block_t* block = buf_page_create(space, 0, zip_size, mtr, free_block); - buf_block_dbg_add_level(block, SYNC_FSP_PAGE); - if (UNIV_UNLIKELY(block != free_block)) { buf_pool.free_block(free_block); } @@ -877,7 +869,6 @@ fsp_fill_free_list( block= buf_page_create( space, static_cast<uint32_t>(i), zip_size, mtr, f); - buf_block_dbg_add_level(block, SYNC_FSP_PAGE); if (UNIV_UNLIKELY(block != f)) { buf_pool.free_block(f); } @@ -894,7 +885,6 @@ fsp_fill_free_list( static_cast<uint32_t>( i + FSP_IBUF_BITMAP_OFFSET), zip_size, mtr, f); - buf_block_dbg_add_level(block, SYNC_FSP_PAGE); if (UNIV_UNLIKELY(block != f)) { buf_pool.free_block(f); } @@ -1357,7 +1347,6 @@ fsp_alloc_seg_inode_page(fil_space_t *space, buf_block_t *header, mtr_t *mtr) if (!block) return false; - buf_block_dbg_add_level(block, SYNC_FSP_PAGE); ut_ad(block->lock.not_recursive()); mtr->write<2>(*block, block->frame + FIL_PAGE_TYPE, FIL_PAGE_INODE); @@ -1401,7 +1390,6 @@ fsp_alloc_seg_inode(fil_space_t *space, buf_block_t *header, + header->frame).page); block = buf_page_get(page_id, space->zip_size(), RW_SX_LATCH, mtr); - buf_block_dbg_add_level(block, SYNC_FSP_PAGE); if (!space->full_crc32()) { fil_block_check_type(*block, FIL_PAGE_INODE, mtr); } diff --git a/storage/innobase/gis/gis0sea.cc b/storage/innobase/gis/gis0sea.cc index 6cc4b8ae139..59ad44dac1e 100644 --- a/storage/innobase/gis/gis0sea.cc +++ b/storage/innobase/gis/gis0sea.cc @@ -268,8 +268,6 @@ rtr_pcur_getnext_from_path( if (block == NULL) { continue; - } else if (rw_latch != RW_NO_LATCH) { - buf_block_dbg_add_level(block, SYNC_TREE_NODE); } rtr_info->tree_blocks[tree_idx] = block; diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index b37addd99ae..9e752655290 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -534,9 +534,6 @@ static PSI_mutex_info all_innodb_mutexes[] = { PSI_KEY(recv_sys_mutex), PSI_KEY(redo_rseg_mutex), PSI_KEY(noredo_rseg_mutex), -# ifdef UNIV_DEBUG - PSI_KEY(rw_lock_debug_mutex), -# endif /* UNIV_DEBUG */ PSI_KEY(srv_innodb_monitor_mutex), PSI_KEY(srv_misc_tmpfile_mutex), PSI_KEY(srv_monitor_file_mutex), diff --git a/storage/innobase/ibuf/ibuf0ibuf.cc b/storage/innobase/ibuf/ibuf0ibuf.cc index 5506a280b15..6adf8d5c262 100644 --- a/storage/innobase/ibuf/ibuf0ibuf.cc +++ b/storage/innobase/ibuf/ibuf0ibuf.cc @@ -315,21 +315,13 @@ ibuf_header_page_get( /*=================*/ mtr_t* mtr) /*!< in/out: mini-transaction */ { - buf_block_t* block; - ut_ad(!ibuf_inside(mtr)); - page_t* page = NULL; - block = buf_page_get( + buf_block_t* block = buf_page_get( page_id_t(IBUF_SPACE_ID, FSP_IBUF_HEADER_PAGE_NO), 0, RW_X_LATCH, mtr); - if (block) { - buf_block_dbg_add_level(block, SYNC_IBUF_HEADER); - page = buf_block_get_frame(block); - } - - return page; + return block ? block->frame : nullptr; } /** Acquire the change buffer root page. @@ -349,8 +341,6 @@ static buf_block_t *ibuf_tree_root_get(mtr_t *mtr) page_id_t(IBUF_SPACE_ID, FSP_IBUF_TREE_ROOT_PAGE_NO), 0, RW_SX_LATCH, mtr); - buf_block_dbg_add_level(block, SYNC_IBUF_TREE_NODE_NEW); - ut_ad(page_get_space_id(block->frame) == IBUF_SPACE_ID); ut_ad(page_get_page_no(block->frame) == FSP_IBUF_TREE_ROOT_PAGE_NO); ut_ad(ibuf.empty == page_is_empty(block->frame)); @@ -459,8 +449,6 @@ ibuf_init_at_db_start(void) page_id_t(IBUF_SPACE_ID, FSP_IBUF_TREE_ROOT_PAGE_NO), 0, RW_X_LATCH, &mtr); - buf_block_dbg_add_level(block, SYNC_IBUF_TREE_NODE); - root = buf_block_get_frame(block); } @@ -687,20 +675,9 @@ ibuf_bitmap_get_map_page_func( unsigned line, mtr_t* mtr) { - buf_block_t* block = NULL; - dberr_t err = DB_SUCCESS; - - block = buf_page_get_gen( + return buf_page_get_gen( ibuf_bitmap_page_no_calc(page_id, zip_size), - zip_size, RW_X_LATCH, NULL, BUF_GET, file, line, mtr, &err); - - if (err != DB_SUCCESS) { - return NULL; - } - - - buf_block_dbg_add_level(block, SYNC_IBUF_BITMAP); - return block; + zip_size, RW_X_LATCH, NULL, BUF_GET, file, line, mtr); } /** Gets the ibuf bitmap page where the bits describing a given file page are @@ -1859,8 +1836,6 @@ static bool ibuf_add_free_page() ibuf_enter(&mtr); mutex_enter(&ibuf_mutex); - buf_block_dbg_add_level(block, SYNC_IBUF_TREE_NODE_NEW); - mtr.write<2>(*block, block->frame + FIL_PAGE_TYPE, FIL_PAGE_IBUF_FREE_LIST); @@ -1963,7 +1938,6 @@ ibuf_remove_free_page(void) + root->frame).page); buf_block_t* block = buf_page_get(page_id, 0, RW_X_LATCH, &mtr); - buf_block_dbg_add_level(block, SYNC_IBUF_TREE_NODE); /* Remove the page from the free list and update the ibuf size data */ @@ -2843,8 +2817,6 @@ ibuf_get_volume_buffered( page_id_t(IBUF_SPACE_ID, prev_page_no), 0, RW_X_LATCH, mtr); - buf_block_dbg_add_level(block, SYNC_IBUF_TREE_NODE); - prev_page = buf_block_get_frame(block); ut_ad(page_validate(prev_page, ibuf.index)); } @@ -2918,8 +2890,6 @@ count_later: page_id_t(IBUF_SPACE_ID, next_page_no), 0, RW_X_LATCH, mtr); - buf_block_dbg_add_level(block, SYNC_IBUF_TREE_NODE); - next_page = buf_block_get_frame(block); ut_ad(page_validate(next_page, ibuf.index)); } @@ -4277,15 +4247,7 @@ loop: if (block) { buf_block_buf_fix_inc(block); block->lock.x_lock_recursive(); - mtr.memo_push(block, MTR_MEMO_PAGE_X_FIX); - /* This is a user page (secondary index leaf page), - but we pretend that it is a change buffer page in - order to obey the latching order. This should be OK, - because buffered changes are applied immediately while - 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); } if (space) { @@ -4397,13 +4359,6 @@ loop: block->lock.x_lock_recursive(); mtr.memo_push(block, MTR_MEMO_PAGE_X_FIX); - /* This is a user page (secondary - index leaf page), but it should be OK - to use too low latching order for it, - as the block is io-fixed. */ - buf_block_dbg_add_level( - block, SYNC_IBUF_TREE_NODE); - if (!ibuf_restore_pos(page_id, search_tuple, BTR_MODIFY_LEAF, &pcur, &mtr)) { diff --git a/storage/innobase/include/btr0btr.h b/storage/innobase/include/btr0btr.h index f08a2ba6257..a2059da5136 100644 --- a/storage/innobase/include/btr0btr.h +++ b/storage/innobase/include/btr0btr.h @@ -239,11 +239,6 @@ inline buf_block_t* btr_block_get_func(const dict_index_t& index, index.table->space->zip_size(), mode, NULL, BUF_GET, file, line, mtr, &err, merge && !index.is_clust())) { ut_ad(err == DB_SUCCESS); - if (mode != RW_NO_LATCH) { - buf_block_dbg_add_level(block, index.is_ibuf() - ? SYNC_IBUF_TREE_NODE - : SYNC_TREE_NODE); - } return block; } else { ut_ad(err != DB_SUCCESS); diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h index 1c8f3dbef99..cc04e6d649e 100644 --- a/storage/innobase/include/buf0buf.h +++ b/storage/innobase/include/buf0buf.h @@ -607,8 +607,6 @@ void buf_pool_invalidate(); --------------------------- LOWER LEVEL ROUTINES ------------------------- =========================================================================*/ -#define buf_block_dbg_add_level(block, level) do {} while (0) - #ifdef UNIV_DEBUG /*********************************************************************//** Gets a pointer to the memory frame of a block. diff --git a/storage/innobase/include/dict0boot.h b/storage/innobase/include/dict0boot.h index fb9d5b810e2..869905c6b97 100644 --- a/storage/innobase/include/dict0boot.h +++ b/storage/innobase/include/dict0boot.h @@ -34,7 +34,8 @@ Created 4/18/1996 Heikki Tuuri #include "dict0dict.h" /** @return the DICT_HDR block, x-latched */ -buf_block_t *dict_hdr_get(mtr_t* mtr); +#define dict_hdr_get(mtr) buf_page_get \ + (page_id_t(DICT_HDR_SPACE, DICT_HDR_PAGE_NO), 0, RW_X_LATCH, mtr) /**********************************************************************//** Returns a new table, index, or space id. */ void diff --git a/storage/innobase/include/fut0fut.h b/storage/innobase/include/fut0fut.h index a52fc256efa..72a94ef6d42 100644 --- a/storage/innobase/include/fut0fut.h +++ b/storage/innobase/include/fut0fut.h @@ -62,8 +62,6 @@ fut_get_ptr( ptr = buf_block_get_frame(block) + addr.boffset; - buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK); - if (ptr_block != NULL) { *ptr_block = block; } diff --git a/storage/innobase/include/log0log.ic b/storage/innobase/include/log0log.ic index 202ed5ecbf3..0cf7470682c 100644 --- a/storage/innobase/include/log0log.ic +++ b/storage/innobase/include/log0log.ic @@ -309,7 +309,6 @@ log_free_check(void) static const latch_level_t latches[] = { SYNC_DICT, /* dict_sys.mutex during commit_try_rebuild() */ - SYNC_INDEX_TREE /* index->lock */ }; #endif /* UNIV_DEBUG */ diff --git a/storage/innobase/include/sync0debug.h b/storage/innobase/include/sync0debug.h index 07e985465e0..1ccf95ea3a8 100644 --- a/storage/innobase/include/sync0debug.h +++ b/storage/innobase/include/sync0debug.h @@ -54,17 +54,6 @@ sync_check_lock_validate(const latch_t* latch); void sync_check_lock_granted(const latch_t* latch); -/** Check if it is OK to acquire the latch. -@param[in] latch latch type -@param[in] level the level of the mutex */ -void -sync_check_lock(const latch_t* latch, latch_level_t level); - -/** -Check if it is OK to re-acquire the lock. */ -void -sync_check_relock(const latch_t* latch); - /** Removes a latch from the thread level array if it is found there. @param[in] latch to unlock */ void @@ -84,18 +73,6 @@ Terminate iteration if the functor returns true. bool sync_check_iterate(const sync_check_functor_t& functor); -/** Acquires the debug mutex. We cannot use the mutex defined in sync0sync, -because the debug mutex is also acquired in sync0arr while holding the OS -mutex protecting the sync array, and the ordinary mutex_enter might -recursively call routines in sync0arr, leading to a deadlock on the OS -mutex. */ -void -rw_lock_debug_mutex_enter(); - -/** Releases the debug mutex. */ -void -rw_lock_debug_mutex_exit(); - #endif /* UNIV_DEBUG */ #endif /* !sync0debug_h */ diff --git a/storage/innobase/include/sync0sync.h b/storage/innobase/include/sync0sync.h index d1e727c4777..ab83e55f279 100644 --- a/storage/innobase/include/sync0sync.h +++ b/storage/innobase/include/sync0sync.h @@ -64,9 +64,6 @@ extern mysql_pfs_key_t rtr_path_mutex_key; extern mysql_pfs_key_t redo_rseg_mutex_key; extern mysql_pfs_key_t noredo_rseg_mutex_key; extern mysql_pfs_key_t page_zip_stat_per_index_mutex_key; -# ifdef UNIV_DEBUG -extern mysql_pfs_key_t rw_lock_debug_mutex_key; -# endif /* UNIV_DEBUG */ extern mysql_pfs_key_t srv_innodb_monitor_mutex_key; extern mysql_pfs_key_t srv_misc_tmpfile_mutex_key; extern mysql_pfs_key_t srv_monitor_file_mutex_key; diff --git a/storage/innobase/include/sync0types.h b/storage/innobase/include/sync0types.h index 258840fd96c..230ab09860c 100644 --- a/storage/innobase/include/sync0types.h +++ b/storage/innobase/include/sync0types.h @@ -197,7 +197,6 @@ enum latch_level_t { SYNC_FTS_OPTIMIZE, SYNC_RECV, SYNC_PURGE_QUEUE, - SYNC_TRX_SYS_HEADER, SYNC_TRX, SYNC_RW_TRX_HASH_ELEMENT, SYNC_READ_VIEW, @@ -207,38 +206,17 @@ enum latch_level_t { SYNC_INDEX_ONLINE_LOG, - SYNC_IBUF_BITMAP, SYNC_IBUF_BITMAP_MUTEX, - SYNC_IBUF_TREE_NODE, - SYNC_IBUF_TREE_NODE_NEW, - SYNC_IBUF_INDEX_TREE, SYNC_IBUF_MUTEX, - SYNC_FSP_PAGE, - SYNC_EXTERN_STORAGE, - SYNC_TRX_UNDO_PAGE, - SYNC_RSEG_HEADER, - SYNC_RSEG_HEADER_NEW, SYNC_NOREDO_RSEG, SYNC_REDO_RSEG, - SYNC_TREE_NODE, - SYNC_TREE_NODE_FROM_HASH, - SYNC_TREE_NODE_NEW, SYNC_IBUF_PESS_INSERT_MUTEX, - SYNC_INDEX_TREE, - SYNC_IBUF_HEADER, - SYNC_DICT_HEADER, SYNC_STATS_AUTO_RECALC, SYNC_DICT, - /** Level is varying. Only used with buffer pool page locks, which - do not have a fixed level, but instead have their level set after - the page is locked; see e.g. ibuf_bitmap_get_map_page(). */ - - SYNC_LEVEL_VARYING, - /** This can be used to suppress order checking. */ SYNC_NO_ORDER_CHECK, @@ -264,7 +242,6 @@ enum latch_id_t { LATCH_ID_RECV_SYS, LATCH_ID_REDO_RSEG, LATCH_ID_NOREDO_RSEG, - LATCH_ID_RW_LOCK_DEBUG, LATCH_ID_RTR_ACTIVE_MUTEX, LATCH_ID_RTR_MATCH_MUTEX, LATCH_ID_RTR_PATH_MUTEX, @@ -283,10 +260,6 @@ enum latch_id_t { LATCH_ID_ROW_DROP_LIST, LATCH_ID_INDEX_ONLINE_LOG, LATCH_ID_WORK_QUEUE, - LATCH_ID_BUF_BLOCK_LOCK, - LATCH_ID_BUF_BLOCK_DEBUG, - LATCH_ID_IBUF_INDEX_TREE, - LATCH_ID_INDEX_TREE, LATCH_ID_DICT_TABLE_STATS, LATCH_ID_DEFRAGMENT_MUTEX, LATCH_ID_BTR_DEFRAGMENT_MUTEX, @@ -880,9 +853,7 @@ struct latch_t { @param[in] id The latch ID */ explicit latch_t(latch_id_t id = LATCH_ID_NONE) UNIV_NOTHROW - : - m_id(id), - m_rw_lock() {} + : m_id(id) {} /** Destructor */ virtual ~latch_t() UNIV_NOTHROW { } @@ -893,13 +864,6 @@ struct latch_t { return(m_id); } - /** @return true if it is a rw-lock */ - bool is_rw_lock() const - UNIV_NOTHROW - { - return(m_rw_lock); - } - /** Print the latch context @return the string representation */ virtual std::string to_string() const = 0; @@ -924,10 +888,6 @@ struct latch_t { /** Latch ID */ latch_id_t m_id; - - /** true if it is a rw-lock. In debug mode, sux_lock derives from - this class and sets this variable. */ - bool m_rw_lock; }; /** Subclass this to iterate over a thread's acquired latch levels. */ diff --git a/storage/innobase/include/trx0rseg.ic b/storage/innobase/include/trx0rseg.ic index b293d9f1ae1..8805a4c8ac3 100644 --- a/storage/innobase/include/trx0rseg.ic +++ b/storage/innobase/include/trx0rseg.ic @@ -40,11 +40,8 @@ trx_rsegf_get(fil_space_t* space, uint32_t page_no, mtr_t* mtr) || srv_is_undo_tablespace(space->id) || !srv_was_started); - buf_block_t* block = buf_page_get(page_id_t(space->id, page_no), - 0, RW_X_LATCH, mtr); - - buf_block_dbg_add_level(block, SYNC_RSEG_HEADER); - return block; + return buf_page_get(page_id_t(space->id, page_no), + 0, RW_X_LATCH, mtr); } /** Gets a newly created rollback segment header. @@ -59,14 +56,9 @@ trx_rsegf_get_new( uint32_t page_no, mtr_t* mtr) { - buf_block_t* block; - ut_ad(space <= srv_undo_tablespaces_active || space == SRV_TMP_SPACE_ID || !srv_was_started); ut_ad(space <= TRX_SYS_MAX_UNDO_SPACES || space == SRV_TMP_SPACE_ID); - block = buf_page_get(page_id_t(space, page_no), 0, RW_X_LATCH, mtr); - - buf_block_dbg_add_level(block, SYNC_RSEG_HEADER_NEW); - return block; + return buf_page_get(page_id_t(space, page_no), 0, RW_X_LATCH, mtr); } diff --git a/storage/innobase/include/trx0sys.h b/storage/innobase/include/trx0sys.h index ba2e825f537..ef23f620c49 100644 --- a/storage/innobase/include/trx0sys.h +++ b/storage/innobase/include/trx0sys.h @@ -68,10 +68,8 @@ trx_sys_rseg_find_free(const buf_block_t* sys_header); @retval NULL if the page cannot be read */ inline buf_block_t *trx_sysf_get(mtr_t* mtr, bool rw= true) { - buf_block_t* block = buf_page_get(page_id_t(TRX_SYS_SPACE, TRX_SYS_PAGE_NO), - 0, rw ? RW_X_LATCH : RW_S_LATCH, mtr); - ut_d(if (block) buf_block_dbg_add_level(block, SYNC_TRX_SYS_HEADER);) - return block; + return buf_page_get(page_id_t(TRX_SYS_SPACE, TRX_SYS_PAGE_NO), + 0, rw ? RW_X_LATCH : RW_S_LATCH, mtr); } #ifdef UNIV_DEBUG diff --git a/storage/innobase/include/trx0undo.ic b/storage/innobase/include/trx0undo.ic index 43af932708e..91a260d66a0 100644 --- a/storage/innobase/include/trx0undo.ic +++ b/storage/innobase/include/trx0undo.ic @@ -103,10 +103,7 @@ UNIV_INLINE buf_block_t* trx_undo_page_get(const page_id_t page_id, mtr_t* mtr) { - buf_block_t* block = buf_page_get(page_id, 0, RW_X_LATCH, mtr); - - buf_block_dbg_add_level(block, SYNC_TRX_UNDO_PAGE); - return block; + return buf_page_get(page_id, 0, RW_X_LATCH, mtr); } /** Gets an undo log page and s-latches it. @@ -117,11 +114,7 @@ UNIV_INLINE buf_block_t* trx_undo_page_get_s_latched(const page_id_t page_id, mtr_t* mtr) { - buf_block_t* block = buf_page_get(page_id, 0, RW_S_LATCH, mtr); - - buf_block_dbg_add_level(block, SYNC_TRX_UNDO_PAGE); - - return block; + return buf_page_get(page_id, 0, RW_S_LATCH, mtr); } /** Determine the end offset of undo log records of an undo log page. diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc index 049cbd87b57..59d9a86c44d 100644 --- a/storage/innobase/lock/lock0lock.cc +++ b/storage/innobase/lock/lock0lock.cc @@ -4676,12 +4676,8 @@ static void lock_rec_block_validate(const page_id_t page_id) << page_id << " err " << err; } - if (block) { - buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK); - - ut_ad(lock_rec_validate_page(block, - space->is_latched())); - } + ut_ad(!block || lock_rec_validate_page(block, + space->is_latched())); mtr_commit(&mtr); diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index 2a245cbaaab..38acba580f7 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -2555,7 +2555,6 @@ inline buf_block_t *recv_sys_t::recover_low(const page_id_t page_id, { ut_ad(&recs == &recv_sys.pages.find(page_id)->second); i.created= true; - buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK); recv_recover_page(block, mtr, p, space, &i); ut_ad(mtr.has_committed()); recs.log.clear(); @@ -2676,7 +2675,6 @@ next_page: __FILE__, __LINE__, &mtr, nullptr, false)) { - buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK); recv_recover_page(block, mtr, p); ut_ad(mtr.has_committed()); } diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc index 52943fc2449..63f38d70bc7 100644 --- a/storage/innobase/row/row0merge.cc +++ b/storage/innobase/row/row0merge.cc @@ -3606,16 +3606,8 @@ row_merge_insert_index_tuples( dtuple, tuple_heap); } -#ifdef UNIV_DEBUG - static const latch_level_t latches[] = { - SYNC_INDEX_TREE, /* index->lock */ - SYNC_LEVEL_VARYING /* btr_bulk->m_page_bulks */ - }; -#endif /* UNIV_DEBUG */ - ut_ad(dtuple_validate(dtuple)); - ut_ad(!sync_check_iterate(sync_allowed_latches(latches, - latches + 2))); + ut_ad(!sync_check_iterate(sync_check())); error = btr_bulk->insert(dtuple); if (error != DB_SUCCESS) { diff --git a/storage/innobase/row/row0purge.cc b/storage/innobase/row/row0purge.cc index 1c84a7702c2..5ddca6a9d3a 100644 --- a/storage/innobase/row/row0purge.cc +++ b/storage/innobase/row/row0purge.cc @@ -832,8 +832,6 @@ skip_secondaries: page_id_t(rseg->space->id, page_no), 0, RW_X_LATCH, &mtr); - buf_block_dbg_add_level(block, SYNC_TRX_UNDO_PAGE); - data_field = buf_block_get_frame(block) + offset + internal_offset; diff --git a/storage/innobase/sync/sync0debug.cc b/storage/innobase/sync/sync0debug.cc index cc6b67147fc..e02a3c38f88 100644 --- a/storage/innobase/sync/sync0debug.cc +++ b/storage/innobase/sync/sync0debug.cc @@ -44,11 +44,6 @@ Created 2012-08-21 Sunny Bains my_bool srv_sync_debug; -/** The global mutex which protects debug info lists of all rw-locks. -To modify the debug info list of an rw-lock, this mutex has to be -acquired in addition to the mutex protecting the lock. */ -static SysMutex rw_lock_debug_mutex; - /** The latch held by a thread */ struct Latched { @@ -209,20 +204,13 @@ struct LatchDebug { { /* Ignore diagnostic latches, starting with '.' */ - if (*latch->get_name() != '.' - && latch->get_level() != SYNC_LEVEL_VARYING) { - - ut_ad(level != SYNC_LEVEL_VARYING); - + if (*latch->get_name() != '.') { Latches* latches = check_order(latch, level); ut_a(latches->empty() - || level == SYNC_LEVEL_VARYING || level == SYNC_NO_ORDER_CHECK || latches->back().get_level() == SYNC_NO_ORDER_CHECK - || latches->back().m_latch->get_level() - == SYNC_LEVEL_VARYING || latches->back().get_level() >= level); } } @@ -241,50 +229,8 @@ struct LatchDebug { { /* Ignore diagnostic latches, starting with '.' */ - if (*latch->get_name() != '.' - && latch->get_level() != SYNC_LEVEL_VARYING) { - - Latches* latches = thread_latches(true); - - latches->push_back(Latched(latch, level)); - } - } - - /** For recursive X rw-locks. - @param[in] latch The RW-Lock to relock */ - void relock(const latch_t* latch) - UNIV_NOTHROW - { - ut_a(latch->m_rw_lock); - - latch_level_t level = latch->get_level(); - - /* Ignore diagnostic latches, starting with '.' */ - - if (*latch->get_name() != '.' - && latch->get_level() != SYNC_LEVEL_VARYING) { - - Latches* latches = thread_latches(true); - - Latches::iterator it = std::find( - latches->begin(), latches->end(), - Latched(latch, level)); - - ut_a(latches->empty() - || level == SYNC_LEVEL_VARYING - || level == SYNC_NO_ORDER_CHECK - || latches->back().m_latch->get_level() - == SYNC_LEVEL_VARYING - || latches->back().m_latch->get_level() - == SYNC_NO_ORDER_CHECK - || latches->back().get_level() >= level - || it != latches->end()); - - if (it == latches->end()) { - latches->push_back(Latched(latch, level)); - } else { - latches->insert(it, Latched(latch, level)); - } + if (*latch->get_name() != '.') { + thread_latches(true)->push_back(Latched(latch, level)); } } @@ -328,10 +274,6 @@ struct LatchDebug { return(it->second); } - /** Initialise the debug data structures */ - static void init() - UNIV_NOTHROW; - /** Shutdown the latch debug checking */ static void shutdown() UNIV_NOTHROW; @@ -460,7 +402,6 @@ LatchDebug::LatchDebug() LEVEL_MAP_INSERT(SYNC_FTS_OPTIMIZE); LEVEL_MAP_INSERT(SYNC_RECV); LEVEL_MAP_INSERT(SYNC_PURGE_QUEUE); - LEVEL_MAP_INSERT(SYNC_TRX_SYS_HEADER); LEVEL_MAP_INSERT(SYNC_TRX); LEVEL_MAP_INSERT(SYNC_RW_TRX_HASH_ELEMENT); LEVEL_MAP_INSERT(SYNC_READ_VIEW); @@ -468,29 +409,13 @@ LatchDebug::LatchDebug() LEVEL_MAP_INSERT(SYNC_LOCK_SYS); LEVEL_MAP_INSERT(SYNC_LOCK_WAIT_SYS); LEVEL_MAP_INSERT(SYNC_INDEX_ONLINE_LOG); - LEVEL_MAP_INSERT(SYNC_IBUF_BITMAP); LEVEL_MAP_INSERT(SYNC_IBUF_BITMAP_MUTEX); - LEVEL_MAP_INSERT(SYNC_IBUF_TREE_NODE); - LEVEL_MAP_INSERT(SYNC_IBUF_TREE_NODE_NEW); - LEVEL_MAP_INSERT(SYNC_IBUF_INDEX_TREE); LEVEL_MAP_INSERT(SYNC_IBUF_MUTEX); - LEVEL_MAP_INSERT(SYNC_FSP_PAGE); - LEVEL_MAP_INSERT(SYNC_EXTERN_STORAGE); - LEVEL_MAP_INSERT(SYNC_TRX_UNDO_PAGE); - LEVEL_MAP_INSERT(SYNC_RSEG_HEADER); - LEVEL_MAP_INSERT(SYNC_RSEG_HEADER_NEW); LEVEL_MAP_INSERT(SYNC_NOREDO_RSEG); LEVEL_MAP_INSERT(SYNC_REDO_RSEG); - LEVEL_MAP_INSERT(SYNC_TREE_NODE); - LEVEL_MAP_INSERT(SYNC_TREE_NODE_FROM_HASH); - LEVEL_MAP_INSERT(SYNC_TREE_NODE_NEW); - LEVEL_MAP_INSERT(SYNC_INDEX_TREE); LEVEL_MAP_INSERT(SYNC_IBUF_PESS_INSERT_MUTEX); - LEVEL_MAP_INSERT(SYNC_IBUF_HEADER); - LEVEL_MAP_INSERT(SYNC_DICT_HEADER); LEVEL_MAP_INSERT(SYNC_STATS_AUTO_RECALC); LEVEL_MAP_INSERT(SYNC_DICT); - LEVEL_MAP_INSERT(SYNC_LEVEL_VARYING); LEVEL_MAP_INSERT(SYNC_NO_ORDER_CHECK); /* Enum count starts from 0 */ @@ -692,8 +617,6 @@ LatchDebug::check_order( latch_level_t level) UNIV_NOTHROW { - ut_ad(latch->get_level() != SYNC_LEVEL_VARYING); - Latches* latches = thread_latches(true); /* NOTE that there is a problem with _NODE and _LEAF levels: if the @@ -703,22 +626,8 @@ LatchDebug::check_order( switch (level) { case SYNC_NO_ORDER_CHECK: - case SYNC_EXTERN_STORAGE: - case SYNC_TREE_NODE_FROM_HASH: - /* Do no order checking */ break; - case SYNC_TRX_SYS_HEADER: - - if (srv_is_being_started) { - /* This is violated during trx_sys_create_rsegs() - when creating additional rollback segments when - upgrading in srv_start(). */ - break; - } - - /* Fall through */ - case SYNC_RECV: case SYNC_WORK_QUEUE: case SYNC_FTS_TOKENIZE: @@ -732,7 +641,6 @@ LatchDebug::check_order( case SYNC_REDO_RSEG: case SYNC_NOREDO_RSEG: case SYNC_PURGE_QUEUE: - case SYNC_DICT_HEADER: case SYNC_IBUF_MUTEX: case SYNC_INDEX_ONLINE_LOG: case SYNC_STATS_AUTO_RECALC: @@ -776,109 +684,16 @@ LatchDebug::check_order( } break; - case SYNC_IBUF_BITMAP: - - /* Either the thread must own the master mutex to all - the bitmap pages, or it is allowed to latch only ONE - bitmap page. */ - - if (find(latches, SYNC_IBUF_BITMAP_MUTEX) != 0) { - - basic_check(latches, level, SYNC_IBUF_BITMAP - 1); - - } else if (!srv_is_being_started) { - - /* This is violated during trx_sys_create_rsegs() - when creating additional rollback segments during - upgrade. */ - - basic_check(latches, level, SYNC_IBUF_BITMAP); - } - break; - - case SYNC_FSP_PAGE: - break; - - case SYNC_TRX_UNDO_PAGE: - - /* Purge is allowed to read in as many UNDO pages as it likes. - The purge thread can read the UNDO pages without any covering - mutex. */ - - ut_a(find(latches, SYNC_REDO_RSEG) != 0 - || find(latches, SYNC_NOREDO_RSEG) != 0 - || basic_check(latches, level, level - 1)); - break; - - case SYNC_RSEG_HEADER: - - ut_a(find(latches, SYNC_REDO_RSEG) != 0 - || find(latches, SYNC_NOREDO_RSEG) != 0); - break; - - case SYNC_RSEG_HEADER_NEW: - - ut_a(find(latches, SYNC_FSP_PAGE) != 0); - break; - - case SYNC_TREE_NODE: - ut_a(find(latches, SYNC_INDEX_TREE) - || basic_check(latches, level, SYNC_TREE_NODE - 1)); - break; - - case SYNC_TREE_NODE_NEW: - - ut_a(find(latches, SYNC_FSP_PAGE) != 0); - break; - - case SYNC_INDEX_TREE: - - basic_check(latches, level, SYNC_TREE_NODE - 1); - break; - - case SYNC_IBUF_TREE_NODE: - - ut_a(find(latches, SYNC_IBUF_INDEX_TREE) != 0 - || basic_check(latches, level, SYNC_IBUF_TREE_NODE - 1)); - break; - - case SYNC_IBUF_TREE_NODE_NEW: - - /* ibuf_add_free_page() allocates new pages for the change - buffer while only holding the tablespace x-latch. These - pre-allocated new pages may only be used while holding - ibuf_mutex, in btr_page_alloc_for_ibuf(). */ - - ut_ad(find(latches, SYNC_IBUF_MUTEX) != 0 - || fil_system.sys_space->is_owner()); - break; - - case SYNC_IBUF_INDEX_TREE: - if (fil_system.sys_space->is_owner()) { - basic_check(latches, level, level - 1); - } else { - basic_check(latches, level, SYNC_IBUF_TREE_NODE - 1); - } - break; - case SYNC_IBUF_PESS_INSERT_MUTEX: - basic_check(latches, level, SYNC_FSP_PAGE); ut_a(find(latches, SYNC_IBUF_MUTEX) == 0); break; - case SYNC_IBUF_HEADER: - basic_check(latches, level, SYNC_FSP_PAGE); - ut_a(find(latches, SYNC_IBUF_MUTEX) == NULL); - ut_a(find(latches, SYNC_IBUF_PESS_INSERT_MUTEX) == NULL); - break; - case SYNC_DICT: basic_check(latches, level, SYNC_DICT); break; case SYNC_MUTEX: case SYNC_UNKNOWN: - case SYNC_LEVEL_VARYING: case RW_LOCK_X: case RW_LOCK_X_WAIT: case RW_LOCK_S: @@ -902,11 +717,6 @@ void LatchDebug::unlock(const latch_t* latch) UNIV_NOTHROW { - if (latch->get_level() == SYNC_LEVEL_VARYING) { - // We don't have varying level mutexes - ut_ad(latch->m_rw_lock); - } - Latches* latches; if (*latch->get_name() == '.') { @@ -955,16 +765,14 @@ LatchDebug::unlock(const latch_t* latch) return; } - if (latch->get_level() != SYNC_LEVEL_VARYING) { - ib::error() - << "Couldn't find latch " - << sync_latch_get_name(latch->get_id()); + ib::error() + << "Couldn't find latch " + << sync_latch_get_name(latch->get_id()); - print_latches(latches); + print_latches(latches); - /** Must find the latch. */ - ut_error; - } + /** Must find the latch. */ + ut_error; } } @@ -1043,34 +851,6 @@ sync_check_lock_granted(const latch_t* latch) } } -/** Check if it is OK to acquire the latch. -@param[in] latch latch type -@param[in] level Latch level */ -void -sync_check_lock( - const latch_t* latch, - latch_level_t level) -{ - if (LatchDebug::instance() != NULL) { - - ut_ad(latch->get_level() == SYNC_LEVEL_VARYING); - ut_ad(latch->get_id() == LATCH_ID_BUF_BLOCK_LOCK); - - LatchDebug::instance()->lock_validate(latch, level); - LatchDebug::instance()->lock_granted(latch, level); - } -} - -/** Check if it is OK to re-acquire the lock. -@param[in] latch RW-LOCK to relock (recursive X locks) */ -void -sync_check_relock(const latch_t* latch) -{ - if (LatchDebug::instance() != NULL) { - LatchDebug::instance()->relock(latch); - } -} - /** Removes a latch from the thread level array if it is found there. @param[in] latch The latch to unlock */ void @@ -1124,14 +904,6 @@ static void sync_check_enable() LatchDebug::create_instance(); } -/** Initialise the debug data structures */ -void -LatchDebug::init() - UNIV_NOTHROW -{ - mutex_create(LATCH_ID_RW_LOCK_DEBUG, &rw_lock_debug_mutex); -} - /** Shutdown the latch debug checking Note: We don't enforce any synchronisation checks. The caller must ensure @@ -1140,8 +912,6 @@ void LatchDebug::shutdown() UNIV_NOTHROW { - mutex_free(&rw_lock_debug_mutex); - ut_a(s_initialized); s_initialized = false; @@ -1150,24 +920,6 @@ LatchDebug::shutdown() LatchDebug::s_instance = NULL; } - -/** Acquires the debug mutex. We cannot use the mutex defined in sync0sync, -because the debug mutex is also acquired in sync0arr while holding the OS -mutex protecting the sync array, and the ordinary mutex_enter might -recursively call routines in sync0arr, leading to a deadlock on the OS -mutex. */ -void -rw_lock_debug_mutex_enter() -{ - mutex_enter(&rw_lock_debug_mutex); -} - -/** Releases the debug mutex. */ -void -rw_lock_debug_mutex_exit() -{ - mutex_exit(&rw_lock_debug_mutex); -} #endif /* UNIV_DEBUG */ /* Meta data for all the InnoDB latches. If the latch is not in recorded @@ -1219,15 +971,6 @@ sync_latch_meta_init() LATCH_ADD_MUTEX(NOREDO_RSEG, SYNC_NOREDO_RSEG, noredo_rseg_mutex_key); -#ifdef UNIV_DEBUG - /* Mutex names starting with '.' are not tracked. They are assumed - to be diagnostic mutexes used in debugging. */ - latch_meta[LATCH_ID_RW_LOCK_DEBUG] = - LATCH_ADD_MUTEX(RW_LOCK_DEBUG, - SYNC_NO_ORDER_CHECK, - rw_lock_debug_mutex_key); -#endif /* UNIV_DEBUG */ - LATCH_ADD_MUTEX(RTR_ACTIVE_MUTEX, SYNC_ANY_LATCH, rtr_active_mutex_key); @@ -1274,20 +1017,6 @@ sync_latch_meta_init() LATCH_ADD_MUTEX(WORK_QUEUE, SYNC_WORK_QUEUE, PFS_NOT_INSTRUMENTED); - // Add the RW locks - LATCH_ADD_RWLOCK(BUF_BLOCK_LOCK, SYNC_LEVEL_VARYING, - PFS_NOT_INSTRUMENTED); - -#ifdef UNIV_DEBUG - LATCH_ADD_RWLOCK(BUF_BLOCK_DEBUG, SYNC_LEVEL_VARYING, - PFS_NOT_INSTRUMENTED); -#endif /* UNIV_DEBUG */ - - LATCH_ADD_RWLOCK(IBUF_INDEX_TREE, SYNC_IBUF_INDEX_TREE, - index_tree_rw_lock_key); - - LATCH_ADD_RWLOCK(INDEX_TREE, SYNC_INDEX_TREE, index_tree_rw_lock_key); - /* JAN: TODO: Add PFS instrumentation */ LATCH_ADD_MUTEX(DEFRAGMENT_MUTEX, SYNC_NO_ORDER_CHECK, PFS_NOT_INSTRUMENTED); @@ -1351,8 +1080,6 @@ sync_check_init() sync_latch_meta_init(); - ut_d(LatchDebug::init()); - sync_array_init(); ut_d(sync_check_enable()); diff --git a/storage/innobase/sync/sync0sync.cc b/storage/innobase/sync/sync0sync.cc index 332ddab7a1a..9c935b93f44 100644 --- a/storage/innobase/sync/sync0sync.cc +++ b/storage/innobase/sync/sync0sync.cc @@ -58,9 +58,6 @@ mysql_pfs_key_t recv_sys_mutex_key; mysql_pfs_key_t redo_rseg_mutex_key; mysql_pfs_key_t noredo_rseg_mutex_key; mysql_pfs_key_t page_zip_stat_per_index_mutex_key; -# ifdef UNIV_DEBUG -mysql_pfs_key_t rw_lock_debug_mutex_key; -# endif /* UNIV_DEBUG */ mysql_pfs_key_t rtr_active_mutex_key; mysql_pfs_key_t rtr_match_mutex_key; mysql_pfs_key_t rtr_path_mutex_key; diff --git a/storage/innobase/trx/trx0rseg.cc b/storage/innobase/trx/trx0rseg.cc index 4cb8ec5a5fd..76be716a3c0 100644 --- a/storage/innobase/trx/trx0rseg.cc +++ b/storage/innobase/trx/trx0rseg.cc @@ -323,8 +323,6 @@ trx_rseg_header_create( return block; } - buf_block_dbg_add_level(block, SYNC_RSEG_HEADER_NEW); - ut_ad(0 == mach_read_from_4(TRX_RSEG_FORMAT + TRX_RSEG + block->frame)); ut_ad(0 == mach_read_from_4(TRX_RSEG_HISTORY_SIZE + TRX_RSEG diff --git a/storage/innobase/trx/trx0sys.cc b/storage/innobase/trx/trx0sys.cc index ae0cebbe445..551ff4b9f3d 100644 --- a/storage/innobase/trx/trx0sys.cc +++ b/storage/innobase/trx/trx0sys.cc @@ -161,7 +161,6 @@ trx_sysf_create( block = fseg_create(fil_system.sys_space, TRX_SYS + TRX_SYS_FSEG_HEADER, mtr); - buf_block_dbg_add_level(block, SYNC_TRX_SYS_HEADER); ut_a(block->page.id() == page_id_t(0, TRX_SYS_PAGE_NO)); diff --git a/storage/innobase/trx/trx0undo.cc b/storage/innobase/trx/trx0undo.cc index 6880e10bcee..c7d37163af7 100644 --- a/storage/innobase/trx/trx0undo.cc +++ b/storage/innobase/trx/trx0undo.cc @@ -175,7 +175,6 @@ trx_undo_get_prev_rec_from_prev_page(buf_block_t *&block, uint16_t rec, block= buf_page_get(page_id_t(block->page.id().space(), prev_page_no), 0, shared ? RW_S_LATCH : RW_X_LATCH, mtr); - buf_block_dbg_add_level(block, SYNC_TRX_UNDO_PAGE); return trx_undo_page_get_last_rec(block, page_no, offset); } @@ -243,7 +242,6 @@ trx_undo_get_next_rec_from_next_page(buf_block_t *&block, uint32_t page_no, return NULL; block= buf_page_get(page_id_t(block->page.id().space(), next), 0, mode, mtr); - buf_block_dbg_add_level(block, SYNC_TRX_UNDO_PAGE); return trx_undo_page_get_first_rec(block, page_no, offset); } @@ -281,7 +279,6 @@ trx_undo_get_first_rec(const fil_space_t &space, uint32_t page_no, mtr_t *mtr) { block = buf_page_get(page_id_t(space.id, page_no), 0, mode, mtr); - buf_block_dbg_add_level(block, SYNC_TRX_UNDO_PAGE); if (trx_undo_rec_t *rec= trx_undo_page_get_first_rec(block, page_no, offset)) return rec; @@ -393,8 +390,6 @@ trx_undo_seg_create(fil_space_t *space, buf_block_t *rseg_hdr, ulint *id, return NULL; } - buf_block_dbg_add_level(block, SYNC_TRX_UNDO_PAGE); - mtr->undo_create(*block); trx_undo_page_init(*block); @@ -578,7 +573,6 @@ buf_block_t* trx_undo_add_page(trx_undo_t* undo, mtr_t* mtr) goto func_exit; } - buf_block_dbg_add_level(new_block, SYNC_TRX_UNDO_PAGE); undo->last_page_no = new_block->page.id().page_no(); mtr->undo_create(*new_block); @@ -1103,8 +1097,6 @@ trx_undo_reuse_cached(trx_t* trx, trx_rseg_t* rseg, trx_undo_t** pundo, return NULL; } - buf_block_dbg_add_level(block, SYNC_TRX_UNDO_PAGE); - UT_LIST_REMOVE(rseg->undo_cached, undo); MONITOR_DEC(MONITOR_NUM_UNDO_SLOT_CACHED); |