diff options
Diffstat (limited to 'innobase/fsp/fsp0fsp.c')
-rw-r--r-- | innobase/fsp/fsp0fsp.c | 40 |
1 files changed, 33 insertions, 7 deletions
diff --git a/innobase/fsp/fsp0fsp.c b/innobase/fsp/fsp0fsp.c index 095ca497ee2..101fb5f3ba0 100644 --- a/innobase/fsp/fsp0fsp.c +++ b/innobase/fsp/fsp0fsp.c @@ -127,11 +127,9 @@ typedef byte fseg_inode_t; page number within space, FIL_NULL means that the slot is not in use */ /*-------------------------------------*/ -#define FSEG_INODE_SIZE (16 + 3 * FLST_BASE_NODE_SIZE +\ - FSEG_FRAG_ARR_N_SLOTS * FSEG_FRAG_SLOT_SIZE) +#define FSEG_INODE_SIZE (16 + 3 * FLST_BASE_NODE_SIZE + FSEG_FRAG_ARR_N_SLOTS * FSEG_FRAG_SLOT_SIZE) -#define FSP_SEG_INODES_PER_PAGE ((UNIV_PAGE_SIZE - FSEG_ARR_OFFSET - 10)\ - / FSEG_INODE_SIZE) +#define FSP_SEG_INODES_PER_PAGE ((UNIV_PAGE_SIZE - FSEG_ARR_OFFSET - 10) / FSEG_INODE_SIZE) /* Number of segment inodes which fit on a single page */ @@ -198,8 +196,7 @@ the extent are free and which contain old tuple version to clean. */ /* File extent data structure size in bytes. The "+ 7 ) / 8" part in the definition rounds the number of bytes upward. */ -#define XDES_SIZE (XDES_BITMAP +\ - (FSP_EXTENT_SIZE * XDES_BITS_PER_PAGE + 7) / 8) +#define XDES_SIZE (XDES_BITMAP + (FSP_EXTENT_SIZE * XDES_BITS_PER_PAGE + 7) / 8) /* Offset of the descriptor array on a descriptor page */ #define XDES_ARR_OFFSET (FSP_HEADER_OFFSET + FSP_HEADER_SIZE) @@ -2539,6 +2536,10 @@ fseg_free_page( seg_inode = fseg_inode_get(seg_header, mtr); fseg_free_page_low(seg_inode, space, page, mtr); + +#ifdef UNIV_DEBUG_FILE_ACCESSES + buf_page_set_file_page_was_freed(space, page); +#endif } /************************************************************************** @@ -2602,6 +2603,14 @@ fseg_free_extent( } fsp_free_extent(space, page, mtr); + +#ifdef UNIV_DEBUG_FILE_ACCESSES + for (i = 0; i < FSP_EXTENT_SIZE; i++) { + + buf_page_set_file_page_was_freed(space, + first_page_in_extent + i); + } +#endif } /************************************************************************** @@ -2633,6 +2642,14 @@ fseg_free_step( MTR_MEMO_X_LOCK)); mtr_x_lock(fil_space_get_latch(space), mtr); + descr = xdes_get_descriptor(space, buf_frame_get_page_no(header), mtr); + + /* Check that the header resides on a page which has not been + freed yet */ + + ut_a(descr); + ut_a(xdes_get_bit(descr, XDES_FREE_BIT, buf_frame_get_page_no(header) + % FSP_EXTENT_SIZE, mtr) == FALSE); inode = fseg_inode_get(header, mtr); descr = fseg_get_first_extent(inode, mtr); @@ -2647,7 +2664,6 @@ fseg_free_step( } /* Free a frag page */ - n = fseg_find_last_used_frag_page_slot(inode, mtr); if (n == ULINT_UNDEFINED) { @@ -2659,6 +2675,16 @@ fseg_free_step( fseg_free_page_low(inode, space, fseg_get_nth_frag_page_no(inode, n, mtr), mtr); + + n = fseg_find_last_used_frag_page_slot(inode, mtr); + + if (n == ULINT_UNDEFINED) { + /* Freeing completed: free the segment inode */ + fsp_free_seg_inode(space, inode, mtr); + + return(TRUE); + } + return(FALSE); } |