Commit cbb933cd authored by marko's avatar marko

branches/zip: fsp0fsp.c: Turn some ut_ad() assertions to ut_a() and

add some ut_a() assertions to track down file space header corruption
that is the probable cause of Mantis issue #63.
parent 79799395
......@@ -347,9 +347,9 @@ fsp_get_space_header(
header = FSP_HEADER_OFFSET + buf_block_get_frame(block);
buf_block_dbg_add_level(block, SYNC_FSP_PAGE);
ut_ad(id == mach_read_from_4(FSP_SPACE_ID + header));
ut_ad(zip_size == dict_table_flags_to_zip_size(
mach_read_from_4(FSP_SPACE_FLAGS + header)));
ut_a(id == mach_read_from_4(FSP_SPACE_ID + header));
ut_a(zip_size == dict_table_flags_to_zip_size(
mach_read_from_4(FSP_SPACE_FLAGS + header)));
return(header);
}
......@@ -699,6 +699,7 @@ xdes_get_descriptor_with_space_hdr(
MTR_MEMO_X_LOCK));
ut_ad(mtr_memo_contains_page(mtr, sp_header, MTR_MEMO_PAGE_S_FIX)
|| mtr_memo_contains_page(mtr, sp_header, MTR_MEMO_PAGE_X_FIX));
ut_a(page_offset(sp_header) == FSP_HEADER_OFFSET);
/* Read free limit and space size */
limit = mach_read_from_4(sp_header + FSP_FREE_LIMIT);
size = mach_read_from_4(sp_header + FSP_SIZE);
......@@ -1311,6 +1312,7 @@ fsp_fill_free_list(
mtr_t ibuf_mtr;
ut_ad(header && mtr);
ut_a(page_offset(header) == FSP_HEADER_OFFSET);
/* Check if we can fill free list from above the free list limit */
size = mtr_read_ulint(header + FSP_SIZE, MLOG_4BYTES, mtr);
......@@ -1860,6 +1862,8 @@ fsp_alloc_seg_inode_page(
ulint zip_size;
ulint i;
ut_a(page_offset(space_header) == FSP_HEADER_OFFSET);
space = page_get_space_id(page_align(space_header));
zip_size = dict_table_flags_to_zip_size(
mach_read_from_4(FSP_SPACE_FLAGS + space_header));
......@@ -1913,6 +1917,8 @@ fsp_alloc_seg_inode(
ulint zip_size;
ulint n;
ut_a(page_offset(space_header) == FSP_HEADER_OFFSET);
if (flst_get_len(space_header + FSP_SEG_INODES_FREE, mtr) == 0) {
/* Allocate a new segment inode page */
......@@ -1974,7 +1980,7 @@ fsp_free_seg_inode(
space_header = fsp_get_space_header(space, zip_size, mtr);
ut_ad(mach_read_from_4(inode + FSEG_MAGIC_N) == FSEG_MAGIC_N_VALUE);
ut_a(mach_read_from_4(inode + FSEG_MAGIC_N) == FSEG_MAGIC_N_VALUE);
if (ULINT_UNDEFINED
== fsp_seg_inode_page_find_free(page, 0, zip_size, mtr)) {
......@@ -2021,11 +2027,11 @@ fseg_inode_get(
inode_addr.page = mach_read_from_4(header + FSEG_HDR_PAGE_NO);
inode_addr.boffset = mach_read_from_2(header + FSEG_HDR_OFFSET);
ut_ad(space == mach_read_from_4(header + FSEG_HDR_SPACE));
ut_a(space == mach_read_from_4(header + FSEG_HDR_SPACE));
inode = fut_get_ptr(space, zip_size, inode_addr, RW_X_LATCH, mtr);
ut_ad(mach_read_from_4(inode + FSEG_MAGIC_N) == FSEG_MAGIC_N_VALUE);
ut_a(mach_read_from_4(inode + FSEG_MAGIC_N) == FSEG_MAGIC_N_VALUE);
return(inode);
}
......@@ -2392,6 +2398,7 @@ fseg_fill_free_list(
ulint used;
ut_ad(inode && mtr);
ut_a(!((page_offset(inode) - FSEG_ARR_OFFSET) % FSEG_INODE_SIZE));
reserved = fseg_n_reserved_pages_low(inode, &used, mtr);
......@@ -2452,6 +2459,8 @@ fseg_alloc_free_extent(
dulint seg_id;
fil_addr_t first;
ut_a(!((page_offset(inode) - FSEG_ARR_OFFSET) % FSEG_INODE_SIZE));
if (flst_get_len(inode + FSEG_FREE, mtr) > 0) {
/* Segment free list is not empty, allocate from it */
......@@ -2519,8 +2528,8 @@ fseg_alloc_free_page_low(
ut_ad(mtr);
ut_ad((direction >= FSP_UP) && (direction <= FSP_NO_DIR));
ut_ad(mach_read_from_4(seg_inode + FSEG_MAGIC_N)
== FSEG_MAGIC_N_VALUE);
ut_a(mach_read_from_4(seg_inode + FSEG_MAGIC_N) == FSEG_MAGIC_N_VALUE);
ut_a(!((page_offset(seg_inode) - FSEG_ARR_OFFSET) % FSEG_INODE_SIZE));
seg_id = mtr_read_dulint(seg_inode + FSEG_ID, mtr);
ut_ad(!ut_dulint_is_zero(seg_id));
......@@ -3110,11 +3119,12 @@ fseg_mark_page_used(
ulint not_full_n_used;
ut_ad(seg_inode && mtr);
ut_a(!((page_offset(seg_inode) - FSEG_ARR_OFFSET) % FSEG_INODE_SIZE));
descr = xdes_get_descriptor(space, zip_size, page, mtr);
ut_ad(mtr_read_ulint(seg_inode + FSEG_ID, MLOG_4BYTES, mtr)
== mtr_read_ulint(descr + XDES_ID, MLOG_4BYTES, mtr));
ut_a(mtr_read_ulint(seg_inode + FSEG_ID, MLOG_4BYTES, mtr)
== mtr_read_ulint(descr + XDES_ID, MLOG_4BYTES, mtr));
if (xdes_is_free(descr, mtr)) {
/* We move the extent from the free list to the
......@@ -3170,8 +3180,8 @@ fseg_free_page_low(
ulint i;
ut_ad(seg_inode && mtr);
ut_ad(mach_read_from_4(seg_inode + FSEG_MAGIC_N)
== FSEG_MAGIC_N_VALUE);
ut_a(mach_read_from_4(seg_inode + FSEG_MAGIC_N) == FSEG_MAGIC_N_VALUE);
ut_a(!((page_offset(seg_inode) - FSEG_ARR_OFFSET) % FSEG_INODE_SIZE));
/* Drop search system page hash index if the page is found in
the pool and is hashed */
......@@ -3646,7 +3656,7 @@ fseg_validate_low(
ulint n_used2 = 0;
ut_ad(mtr_memo_contains_page(mtr2, inode, MTR_MEMO_PAGE_X_FIX));
ut_ad(mach_read_from_4(inode + FSEG_MAGIC_N) == FSEG_MAGIC_N_VALUE);
ut_a(mach_read_from_4(inode + FSEG_MAGIC_N) == FSEG_MAGIC_N_VALUE);
space = page_get_space_id(page_align(inode));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment