Fix for BUG#37288 "Maria - zerofill corrupts table". Testcase is running ma_test_recovery.pl on Windows.
storage/maria/ma_blockrec.c: comment storage/maria/ma_check.c: When zerofilling the data file, _ma_compact_block_page() may increase free space in a page so bitmap page needs to be corrected.
This commit is contained in:
parent
fdebe2788f
commit
2425763869
@ -1345,21 +1345,22 @@ static void calc_record_size(MARIA_HA *info, const uchar *record,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/**
|
||||||
Compact page by removing all space between rows
|
Compact page by removing all space between rows
|
||||||
|
|
||||||
IMPLEMENTATION
|
Moves up all rows to start of page. Moves blocks that are directly after
|
||||||
Move up all rows to start of page.
|
each other with one memmove.
|
||||||
Move blocks that are directly after each other with one memmove.
|
|
||||||
|
|
||||||
SYNOPSIS
|
@note if rownr is the last row in the page, and extend_block is false,
|
||||||
_ma_compact_block_page()
|
caller has to make sure to update bitmap page afterwards to reflect freed
|
||||||
buff Page to compact
|
space.
|
||||||
block_size Size of page
|
|
||||||
rownr Put empty data after this row
|
@param buff Page to compact
|
||||||
extend_block If 1, extend the block at 'rownr' to cover the
|
@param block_size Size of page
|
||||||
|
@param rownr Put empty data after this row
|
||||||
|
@param extend_block If 1, extend the block at 'rownr' to cover the
|
||||||
whole block.
|
whole block.
|
||||||
min_read_from If <> 0, remove all trid's that are less than this
|
@param min_read_from If <> 0, remove all trid's that are less than this
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void _ma_compact_block_page(uchar *buff, uint block_size, uint rownr,
|
void _ma_compact_block_page(uchar *buff, uint block_size, uint rownr,
|
||||||
|
@ -3308,11 +3308,16 @@ static my_bool maria_zerofill_data(HA_CHECK *param, MARIA_HA *info,
|
|||||||
bzero(buff, LSN_SIZE);
|
bzero(buff, LSN_SIZE);
|
||||||
if (max_entry != 0)
|
if (max_entry != 0)
|
||||||
{
|
{
|
||||||
|
my_bool is_head_page= (page_type == HEAD_PAGE);
|
||||||
dir= dir_entry_pos(buff, block_size, max_entry - 1);
|
dir= dir_entry_pos(buff, block_size, max_entry - 1);
|
||||||
_ma_compact_block_page(buff, block_size, max_entry -1, 0,
|
_ma_compact_block_page(buff, block_size, max_entry -1, 0,
|
||||||
page_type == HEAD_PAGE ? ~(TrID) 0 : 0,
|
is_head_page ? ~(TrID) 0 : 0,
|
||||||
page_type == HEAD_PAGE ?
|
is_head_page ?
|
||||||
share->base.min_block_length : 0);
|
share->base.min_block_length : 0);
|
||||||
|
/* compactation may have increased free space */
|
||||||
|
if (_ma_bitmap_set(info, page, is_head_page,
|
||||||
|
uint2korr(buff + EMPTY_SPACE_OFFSET)))
|
||||||
|
goto err;
|
||||||
|
|
||||||
/* Zerofill the not used part */
|
/* Zerofill the not used part */
|
||||||
offset= uint2korr(dir) + uint2korr(dir+2);
|
offset= uint2korr(dir) + uint2korr(dir+2);
|
||||||
@ -3334,10 +3339,9 @@ static my_bool maria_zerofill_data(HA_CHECK *param, MARIA_HA *info,
|
|||||||
PAGECACHE_UNPIN, LSN_IMPOSSIBLE,
|
PAGECACHE_UNPIN, LSN_IMPOSSIBLE,
|
||||||
LSN_IMPOSSIBLE, 1);
|
LSN_IMPOSSIBLE, 1);
|
||||||
}
|
}
|
||||||
if (flush_pagecache_blocks(share->pagecache, &info->dfile,
|
DBUG_RETURN(_ma_bitmap_flush(share) ||
|
||||||
FLUSH_FORCE_WRITE))
|
flush_pagecache_blocks(share->pagecache, &info->dfile,
|
||||||
DBUG_RETURN(1);
|
FLUSH_FORCE_WRITE));
|
||||||
DBUG_RETURN(0);
|
|
||||||
|
|
||||||
err:
|
err:
|
||||||
pagecache_unlock_by_link(share->pagecache, page_link.link,
|
pagecache_unlock_by_link(share->pagecache, page_link.link,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user