Skip to content

Commit 43c393f

Browse files
committed
MDEV-16682 Assertion `(buff[7] & 7) == HEAD_PAGE' failed
Missed one file in last push...
1 parent 796d54d commit 43c393f

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

storage/maria/ma_blockrec.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@
5353
Page header:
5454
5555
LSN 7 bytes Log position for last page change
56-
PAGE_TYPE 1 uchar 1 for head / 2 for tail / 3 for blob
56+
PAGE_TYPE 1 uchar 0 unalloced / 1 for head / 2 for tail / 3 for blob
5757
DIR_COUNT 1 uchar Number of row/tail entries on page
5858
FREE_DIR_LINK 1 uchar Pointer to first free director entry or 255 if no
59-
empty space 2 bytes Empty space on page
59+
empty space 2 bytes Bytes of empty space on page
6060
6161
The most significant bit in PAGE_TYPE is set to 1 if the data on the page
6262
can be compacted to get more space. (PAGE_CAN_BE_COMPACTED)
@@ -5122,11 +5122,19 @@ int _ma_read_block_record(MARIA_HA *info, uchar *record,
51225122
info->buff, share->page_type,
51235123
PAGECACHE_LOCK_LEFT_UNLOCKED, 0)))
51245124
DBUG_RETURN(my_errno);
5125-
DBUG_ASSERT((buff[PAGE_TYPE_OFFSET] & PAGE_TYPE_MASK) == HEAD_PAGE);
5126-
if (!(data= get_record_position(buff, block_size, offset, &end_of_data)))
5125+
5126+
/*
5127+
Unallocated page access can happen if this is an access to a page where
5128+
all rows where deleted as part of this statement.
5129+
*/
5130+
DBUG_ASSERT((buff[PAGE_TYPE_OFFSET] & PAGE_TYPE_MASK) == HEAD_PAGE ||
5131+
(buff[PAGE_TYPE_OFFSET] & PAGE_TYPE_MASK) == UNALLOCATED_PAGE);
5132+
5133+
if (((buff[PAGE_TYPE_OFFSET] & PAGE_TYPE_MASK) == UNALLOCATED_PAGE) ||
5134+
!(data= get_record_position(buff, block_size, offset, &end_of_data)))
51275135
{
51285136
DBUG_ASSERT(!maria_assert_if_crashed_table);
5129-
DBUG_PRINT("error", ("Wrong directory entry in data block"));
5137+
DBUG_PRINT("warning", ("Wrong directory entry in data block"));
51305138
my_errno= HA_ERR_RECORD_DELETED; /* File crashed */
51315139
DBUG_RETURN(HA_ERR_RECORD_DELETED);
51325140
}

0 commit comments

Comments
 (0)