Skip to content

Commit

Permalink
MDEV-16682 Assertion `(buff[7] & 7) == HEAD_PAGE' failed
Browse files Browse the repository at this point in the history
Missed one file in last push...
  • Loading branch information
montywi committed Sep 3, 2018
1 parent 796d54d commit 43c393f
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions storage/maria/ma_blockrec.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@
Page header:
LSN 7 bytes Log position for last page change
PAGE_TYPE 1 uchar 1 for head / 2 for tail / 3 for blob
PAGE_TYPE 1 uchar 0 unalloced / 1 for head / 2 for tail / 3 for blob
DIR_COUNT 1 uchar Number of row/tail entries on page
FREE_DIR_LINK 1 uchar Pointer to first free director entry or 255 if no
empty space 2 bytes Empty space on page
empty space 2 bytes Bytes of empty space on page
The most significant bit in PAGE_TYPE is set to 1 if the data on the page
can be compacted to get more space. (PAGE_CAN_BE_COMPACTED)
Expand Down Expand Up @@ -5122,11 +5122,19 @@ int _ma_read_block_record(MARIA_HA *info, uchar *record,
info->buff, share->page_type,
PAGECACHE_LOCK_LEFT_UNLOCKED, 0)))
DBUG_RETURN(my_errno);
DBUG_ASSERT((buff[PAGE_TYPE_OFFSET] & PAGE_TYPE_MASK) == HEAD_PAGE);
if (!(data= get_record_position(buff, block_size, offset, &end_of_data)))

/*
Unallocated page access can happen if this is an access to a page where
all rows where deleted as part of this statement.
*/
DBUG_ASSERT((buff[PAGE_TYPE_OFFSET] & PAGE_TYPE_MASK) == HEAD_PAGE ||
(buff[PAGE_TYPE_OFFSET] & PAGE_TYPE_MASK) == UNALLOCATED_PAGE);

if (((buff[PAGE_TYPE_OFFSET] & PAGE_TYPE_MASK) == UNALLOCATED_PAGE) ||
!(data= get_record_position(buff, block_size, offset, &end_of_data)))
{
DBUG_ASSERT(!maria_assert_if_crashed_table);
DBUG_PRINT("error", ("Wrong directory entry in data block"));
DBUG_PRINT("warning", ("Wrong directory entry in data block"));
my_errno= HA_ERR_RECORD_DELETED; /* File crashed */
DBUG_RETURN(HA_ERR_RECORD_DELETED);
}
Expand Down

0 comments on commit 43c393f

Please sign in to comment.