-
Marko Mäkelä authored
discarded in buf_page_create() This bug turned out to be a false alarm, a bug in the UNIV_SYNC_DEBUG diagnostic code. Because of this, the patch was not backported to the built-in InnoDB in MySQL 5.1. Furthermore, there is no test case for InnoDB Plugin in MySQL 5.1, because the delete buffering in MySQL 5.5 makes triggering the failure much easier. When a freed page for which there exist orphaned buffered changes is allocated and reused for something else, buf_page_create() will discard the buffered changes by invoking ibuf_merge_or_delete_for_page(). This would violate the InnoDB latching order. Tweak the latching order as follows. Move SYNC_IBUF_MUTEX below SYNC_FSP_PAGE, where it logically belongs, and assign new latching levels for the ibuf->index->lock and the insert buffer B-tree pages: #define SYNC_IBUF_MUTEX 370 /* ibuf_mutex */ #define SYNC_IBUF_INDEX_TREE 360 #define SYNC_IBUF_TREE_NODE_NEW 359 #define SYNC_IBUF_TREE_NODE 358 btr_block_get(), btr_page_get(): In UNIV_SYNC_DEBUG, add the parameter "index" for determining the appropriate latching order (SYNC_IBUF_TREE_NODE or SYNC_TREE_NODE). btr_page_alloc_for_ibuf(), btr_create(): Use SYNC_IBUF_TREE_NODE_NEW instead of SYNC_TREE_NODE_NEW for insert buffer pages. btr_cur_search_to_nth_level(), btr_pcur_restore_position_func(): Use SYNC_IBUF_TREE_NODE instead of SYNC_TREE_NODE for insert buffer pages. btr_search_guess_on_hash(): Assert that the index is not an insert buffer tree. dict_index_add_to_cache(): Use SYNC_IBUF_INDEX_TREE for the insert buffer tree (ibuf->index->lock). ibuf0ibuf.c: Use SYNC_IBUF_TREE_NODE or SYNC_IBUF_TREE_NODE_NEW for all B-tree pages. ibuf_merge_or_delete_for_page(): Assert that the user page is BUF_IO_READ fixed. Only in this way it is OK to latch it as SYNC_IBUF_TREE_NODE instead of the proper SYNC_TREE_NODE (which would violate the changed latching order). sync_thread_add_level(): Remove the special tweak for SYNC_IBUF_MUTEX. Add rules for the added latching levels. rb:591 approved by Jimmy Yang
d5c36400