@ -690,7 +690,8 @@ btr_root_block_get(
zip_size = dict_table_zip_size ( index - > table ) ;
zip_size = dict_table_zip_size ( index - > table ) ;
root_page_no = dict_index_get_page ( index ) ;
root_page_no = dict_index_get_page ( index ) ;
block = btr_block_get ( space , zip_size , root_page_no , RW_X_LATCH , mtr ) ;
block = btr_block_get ( space , zip_size , root_page_no , RW_X_LATCH ,
index , mtr ) ;
ut_a ( ( ibool ) ! ! page_is_comp ( buf_block_get_frame ( block ) )
ut_a ( ( ibool ) ! ! page_is_comp ( buf_block_get_frame ( block ) )
= = dict_table_is_comp ( index - > table ) ) ;
= = dict_table_is_comp ( index - > table ) ) ;
# ifdef UNIV_BTR_DEBUG
# ifdef UNIV_BTR_DEBUG
@ -891,7 +892,7 @@ btr_page_alloc_for_ibuf(
dict_table_zip_size ( index - > table ) ,
dict_table_zip_size ( index - > table ) ,
node_addr . page , RW_X_LATCH , mtr ) ;
node_addr . page , RW_X_LATCH , mtr ) ;
new_page = buf_block_get_frame ( new_block ) ;
new_page = buf_block_get_frame ( new_block ) ;
buf_block_dbg_add_level ( new_block , SYNC_TREE_NODE_NEW ) ;
buf_block_dbg_add_level ( new_block , SYNC_IBUF_ TREE_NODE_NEW ) ;
flst_remove ( root + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST ,
flst_remove ( root + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST ,
new_page + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST_NODE ,
new_page + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST_NODE ,
@ -1139,7 +1140,7 @@ btr_node_ptr_get_child(
page_no = btr_node_ptr_get_child_page_no ( node_ptr , offsets ) ;
page_no = btr_node_ptr_get_child_page_no ( node_ptr , offsets ) ;
return ( btr_block_get ( space , dict_table_zip_size ( index - > table ) ,
return ( btr_block_get ( space , dict_table_zip_size ( index - > table ) ,
page_no , RW_X_LATCH , mtr ) ) ;
page_no , RW_X_LATCH , index , mtr ) ) ;
}
}
/************************************************************/ /**
/************************************************************/ /**
@ -1311,7 +1312,8 @@ btr_create(
space , 0 ,
space , 0 ,
IBUF_HEADER + IBUF_TREE_SEG_HEADER , mtr ) ;
IBUF_HEADER + IBUF_TREE_SEG_HEADER , mtr ) ;
buf_block_dbg_add_level ( ibuf_hdr_block , SYNC_TREE_NODE_NEW ) ;
buf_block_dbg_add_level (
ibuf_hdr_block , SYNC_IBUF_TREE_NODE_NEW ) ;
ut_ad ( buf_block_get_page_no ( ibuf_hdr_block )
ut_ad ( buf_block_get_page_no ( ibuf_hdr_block )
= = IBUF_HEADER_PAGE_NO ) ;
= = IBUF_HEADER_PAGE_NO ) ;
@ -1348,10 +1350,9 @@ btr_create(
page_no = buf_block_get_page_no ( block ) ;
page_no = buf_block_get_page_no ( block ) ;
frame = buf_block_get_frame ( block ) ;
frame = buf_block_get_frame ( block ) ;
buf_block_dbg_add_level ( block , SYNC_TREE_NODE_NEW ) ;
if ( type & DICT_IBUF ) {
if ( type & DICT_IBUF ) {
/* It is an insert buffer tree: initialize the free list */
/* It is an insert buffer tree: initialize the free list */
buf_block_dbg_add_level ( block , SYNC_IBUF_TREE_NODE_NEW ) ;
ut_ad ( page_no = = IBUF_TREE_ROOT_PAGE_NO ) ;
ut_ad ( page_no = = IBUF_TREE_ROOT_PAGE_NO ) ;
@ -1359,6 +1360,8 @@ btr_create(
} else {
} else {
/* It is a non-ibuf tree: create a file segment for leaf
/* It is a non-ibuf tree: create a file segment for leaf
pages */
pages */
buf_block_dbg_add_level ( block , SYNC_TREE_NODE_NEW ) ;
if ( ! fseg_create ( space , page_no ,
if ( ! fseg_create ( space , page_no ,
PAGE_HEADER + PAGE_BTR_SEG_LEAF , mtr ) ) {
PAGE_HEADER + PAGE_BTR_SEG_LEAF , mtr ) ) {
/* Not enough space for new segment, free root
/* Not enough space for new segment, free root
@ -1430,7 +1433,8 @@ btr_free_but_not_root(
leaf_loop :
leaf_loop :
mtr_start ( & mtr ) ;
mtr_start ( & mtr ) ;
root = btr_page_get ( space , zip_size , root_page_no , RW_X_LATCH , & mtr ) ;
root = btr_page_get ( space , zip_size , root_page_no , RW_X_LATCH ,
NULL , & mtr ) ;
# ifdef UNIV_BTR_DEBUG
# ifdef UNIV_BTR_DEBUG
ut_a ( btr_root_fseg_validate ( FIL_PAGE_DATA + PAGE_BTR_SEG_LEAF
ut_a ( btr_root_fseg_validate ( FIL_PAGE_DATA + PAGE_BTR_SEG_LEAF
+ root , space ) ) ;
+ root , space ) ) ;
@ -1452,7 +1456,8 @@ leaf_loop:
top_loop :
top_loop :
mtr_start ( & mtr ) ;
mtr_start ( & mtr ) ;
root = btr_page_get ( space , zip_size , root_page_no , RW_X_LATCH , & mtr ) ;
root = btr_page_get ( space , zip_size , root_page_no , RW_X_LATCH ,
NULL , & mtr ) ;
# ifdef UNIV_BTR_DEBUG
# ifdef UNIV_BTR_DEBUG
ut_a ( btr_root_fseg_validate ( FIL_PAGE_DATA + PAGE_BTR_SEG_TOP
ut_a ( btr_root_fseg_validate ( FIL_PAGE_DATA + PAGE_BTR_SEG_TOP
+ root , space ) ) ;
+ root , space ) ) ;
@ -1478,13 +1483,13 @@ btr_free_root(
ulint zip_size , /*!< in: compressed page size in bytes
ulint zip_size , /*!< in: compressed page size in bytes
or 0 for uncompressed pages */
or 0 for uncompressed pages */
ulint root_page_no , /*!< in: root page number */
ulint root_page_no , /*!< in: root page number */
mtr_t * mtr ) /*!< in: a mini-transaction which has already
been started */
mtr_t * mtr ) /*!< in/out: mini-transaction */
{
{
buf_block_t * block ;
buf_block_t * block ;
fseg_header_t * header ;
fseg_header_t * header ;
block = btr_block_get ( space , zip_size , root_page_no , RW_X_LATCH , mtr ) ;
block = btr_block_get ( space , zip_size , root_page_no , RW_X_LATCH ,
NULL , mtr ) ;
btr_search_drop_page_hash_index ( block ) ;
btr_search_drop_page_hash_index ( block ) ;
@ -2362,9 +2367,8 @@ btr_attach_half_pages(
/* Update page links of the level */
/* Update page links of the level */
if ( prev_page_no ! = FIL_NULL ) {
if ( prev_page_no ! = FIL_NULL ) {
buf_block_t * prev_block = btr_block_get ( space , zip_size ,
prev_page_no ,
RW_X_LATCH , mtr ) ;
buf_block_t * prev_block = btr_block_get (
space , zip_size , prev_page_no , RW_X_LATCH , index , mtr ) ;
# ifdef UNIV_BTR_DEBUG
# ifdef UNIV_BTR_DEBUG
ut_a ( page_is_comp ( prev_block - > frame ) = = page_is_comp ( page ) ) ;
ut_a ( page_is_comp ( prev_block - > frame ) = = page_is_comp ( page ) ) ;
ut_a ( btr_page_get_next ( prev_block - > frame , mtr )
ut_a ( btr_page_get_next ( prev_block - > frame , mtr )
@ -2377,9 +2381,8 @@ btr_attach_half_pages(
}
}
if ( next_page_no ! = FIL_NULL ) {
if ( next_page_no ! = FIL_NULL ) {
buf_block_t * next_block = btr_block_get ( space , zip_size ,
next_page_no ,
RW_X_LATCH , mtr ) ;
buf_block_t * next_block = btr_block_get (
space , zip_size , next_page_no , RW_X_LATCH , index , mtr ) ;
# ifdef UNIV_BTR_DEBUG
# ifdef UNIV_BTR_DEBUG
ut_a ( page_is_comp ( next_block - > frame ) = = page_is_comp ( page ) ) ;
ut_a ( page_is_comp ( next_block - > frame ) = = page_is_comp ( page ) ) ;
ut_a ( btr_page_get_prev ( next_block - > frame , mtr )
ut_a ( btr_page_get_prev ( next_block - > frame , mtr )
@ -2801,17 +2804,42 @@ func_exit:
return ( rec ) ;
return ( rec ) ;
}
}
# ifdef UNIV_SYNC_DEBUG
/*************************************************************/ /**
Removes a page from the level list of pages .
@ param space in : space where removed
@ param zip_size in : compressed page size in bytes , or 0 for uncompressed
@ param page in / out : page to remove
@ param index in : index tree
@ param mtr in / out : mini - transaction */
# define btr_level_list_remove(space,zip_size,page,index,mtr) \
btr_level_list_remove_func ( space , zip_size , page , index , mtr )
# else /* UNIV_SYNC_DEBUG */
/*************************************************************/ /**
Removes a page from the level list of pages .
@ param space in : space where removed
@ param zip_size in : compressed page size in bytes , or 0 for uncompressed
@ param page in / out : page to remove
@ param index in : index tree
@ param mtr in / out : mini - transaction */
# define btr_level_list_remove(space,zip_size,page,index,mtr) \
btr_level_list_remove_func ( space , zip_size , page , mtr )
# endif /* UNIV_SYNC_DEBUG */
/*************************************************************/ /**
/*************************************************************/ /**
Removes a page from the level list of pages . */
Removes a page from the level list of pages . */
static
static __attribute__ ( ( nonnull ) )
void
void
btr_level_list_remove (
/*==================*/
ulint space , /*!< in: space where removed */
ulint zip_size , /*!< in: compressed page size in bytes
or 0 for uncompressed pages */
page_t * page , /*!< in: page to remove */
mtr_t * mtr ) /*!< in: mtr */
btr_level_list_remove_func (
/*=======================*/
ulint space , /*!< in: space where removed */
ulint zip_size , /*!< in: compressed page size in bytes
or 0 for uncompressed pages */
page_t * page , /*!< in/out: page to remove */
# ifdef UNIV_SYNC_DEBUG
const dict_index_t * index , /*!< in: index tree */
# endif /* UNIV_SYNC_DEBUG */
mtr_t * mtr ) /*!< in/out: mini-transaction */
{
{
ulint prev_page_no ;
ulint prev_page_no ;
ulint next_page_no ;
ulint next_page_no ;
@ -2829,7 +2857,7 @@ btr_level_list_remove(
if ( prev_page_no ! = FIL_NULL ) {
if ( prev_page_no ! = FIL_NULL ) {
buf_block_t * prev_block
buf_block_t * prev_block
= btr_block_get ( space , zip_size , prev_page_no ,
= btr_block_get ( space , zip_size , prev_page_no ,
RW_X_LATCH , mtr ) ;
RW_X_LATCH , index , mtr ) ;
page_t * prev_page
page_t * prev_page
= buf_block_get_frame ( prev_block ) ;
= buf_block_get_frame ( prev_block ) ;
# ifdef UNIV_BTR_DEBUG
# ifdef UNIV_BTR_DEBUG
@ -2846,7 +2874,7 @@ btr_level_list_remove(
if ( next_page_no ! = FIL_NULL ) {
if ( next_page_no ! = FIL_NULL ) {
buf_block_t * next_block
buf_block_t * next_block
= btr_block_get ( space , zip_size , next_page_no ,
= btr_block_get ( space , zip_size , next_page_no ,
RW_X_LATCH , mtr ) ;
RW_X_LATCH , index , mtr ) ;
page_t * next_page
page_t * next_page
= buf_block_get_frame ( next_block ) ;
= buf_block_get_frame ( next_block ) ;
# ifdef UNIV_BTR_DEBUG
# ifdef UNIV_BTR_DEBUG
@ -3172,7 +3200,7 @@ btr_compress(
if ( is_left ) {
if ( is_left ) {
merge_block = btr_block_get ( space , zip_size , left_page_no ,
merge_block = btr_block_get ( space , zip_size , left_page_no ,
RW_X_LATCH , mtr ) ;
RW_X_LATCH , index , mtr ) ;
merge_page = buf_block_get_frame ( merge_block ) ;
merge_page = buf_block_get_frame ( merge_block ) ;
# ifdef UNIV_BTR_DEBUG
# ifdef UNIV_BTR_DEBUG
ut_a ( btr_page_get_next ( merge_page , mtr )
ut_a ( btr_page_get_next ( merge_page , mtr )
@ -3181,7 +3209,7 @@ btr_compress(
} else if ( right_page_no ! = FIL_NULL ) {
} else if ( right_page_no ! = FIL_NULL ) {
merge_block = btr_block_get ( space , zip_size , right_page_no ,
merge_block = btr_block_get ( space , zip_size , right_page_no ,
RW_X_LATCH , mtr ) ;
RW_X_LATCH , index , mtr ) ;
merge_page = buf_block_get_frame ( merge_block ) ;
merge_page = buf_block_get_frame ( merge_block ) ;
# ifdef UNIV_BTR_DEBUG
# ifdef UNIV_BTR_DEBUG
ut_a ( btr_page_get_prev ( merge_page , mtr )
ut_a ( btr_page_get_prev ( merge_page , mtr )
@ -3270,7 +3298,7 @@ err_exit:
btr_search_drop_page_hash_index ( block ) ;
btr_search_drop_page_hash_index ( block ) ;
/* Remove the page from the level list */
/* Remove the page from the level list */
btr_level_list_remove ( space , zip_size , page , mtr ) ;
btr_level_list_remove ( space , zip_size , page , index , mtr ) ;
btr_node_ptr_delete ( index , block , mtr ) ;
btr_node_ptr_delete ( index , block , mtr ) ;
lock_update_merge_left ( merge_block , orig_pred , block ) ;
lock_update_merge_left ( merge_block , orig_pred , block ) ;
@ -3327,7 +3355,7 @@ err_exit:
# endif /* UNIV_BTR_DEBUG */
# endif /* UNIV_BTR_DEBUG */
/* Remove the page from the level list */
/* Remove the page from the level list */
btr_level_list_remove ( space , zip_size , page , mtr ) ;
btr_level_list_remove ( space , zip_size , page , index , mtr ) ;
/* Replace the address of the old child node (= page) with the
/* Replace the address of the old child node (= page) with the
address of the merge page to the right */
address of the merge page to the right */
@ -3519,7 +3547,7 @@ btr_discard_page(
if ( left_page_no ! = FIL_NULL ) {
if ( left_page_no ! = FIL_NULL ) {
merge_block = btr_block_get ( space , zip_size , left_page_no ,
merge_block = btr_block_get ( space , zip_size , left_page_no ,
RW_X_LATCH , mtr ) ;
RW_X_LATCH , index , mtr ) ;
merge_page = buf_block_get_frame ( merge_block ) ;
merge_page = buf_block_get_frame ( merge_block ) ;
# ifdef UNIV_BTR_DEBUG
# ifdef UNIV_BTR_DEBUG
ut_a ( btr_page_get_next ( merge_page , mtr )
ut_a ( btr_page_get_next ( merge_page , mtr )
@ -3527,7 +3555,7 @@ btr_discard_page(
# endif /* UNIV_BTR_DEBUG */
# endif /* UNIV_BTR_DEBUG */
} else if ( right_page_no ! = FIL_NULL ) {
} else if ( right_page_no ! = FIL_NULL ) {
merge_block = btr_block_get ( space , zip_size , right_page_no ,
merge_block = btr_block_get ( space , zip_size , right_page_no ,
RW_X_LATCH , mtr ) ;
RW_X_LATCH , index , mtr ) ;
merge_page = buf_block_get_frame ( merge_block ) ;
merge_page = buf_block_get_frame ( merge_block ) ;
# ifdef UNIV_BTR_DEBUG
# ifdef UNIV_BTR_DEBUG
ut_a ( btr_page_get_prev ( merge_page , mtr )
ut_a ( btr_page_get_prev ( merge_page , mtr )
@ -3562,7 +3590,7 @@ btr_discard_page(
btr_node_ptr_delete ( index , block , mtr ) ;
btr_node_ptr_delete ( index , block , mtr ) ;
/* Remove the page from the level list */
/* Remove the page from the level list */
btr_level_list_remove ( space , zip_size , page , mtr ) ;
btr_level_list_remove ( space , zip_size , page , index , mtr ) ;
# ifdef UNIV_ZIP_DEBUG
# ifdef UNIV_ZIP_DEBUG
{
{
page_zip_des_t * merge_page_zip
page_zip_des_t * merge_page_zip
@ -4080,7 +4108,7 @@ loop:
if ( right_page_no ! = FIL_NULL ) {
if ( right_page_no ! = FIL_NULL ) {
const rec_t * right_rec ;
const rec_t * right_rec ;
right_block = btr_block_get ( space , zip_size , right_page_no ,
right_block = btr_block_get ( space , zip_size , right_page_no ,
RW_X_LATCH , & mtr ) ;
RW_X_LATCH , index , & mtr ) ;
right_page = buf_block_get_frame ( right_block ) ;
right_page = buf_block_get_frame ( right_block ) ;
if ( UNIV_UNLIKELY ( btr_page_get_prev ( right_page , & mtr )
if ( UNIV_UNLIKELY ( btr_page_get_prev ( right_page , & mtr )
! = page_get_page_no ( page ) ) ) {
! = page_get_page_no ( page ) ) ) {
@ -4306,7 +4334,7 @@ node_ptr_fails:
mtr_start ( & mtr ) ;
mtr_start ( & mtr ) ;
block = btr_block_get ( space , zip_size , right_page_no ,
block = btr_block_get ( space , zip_size , right_page_no ,
RW_X_LATCH , & mtr ) ;
RW_X_LATCH , index , & mtr ) ;
page = buf_block_get_frame ( block ) ;
page = buf_block_get_frame ( block ) ;
goto loop ;
goto loop ;