Commit 4834a0d1 authored by Monty's avatar Monty

Fixed bug in Aria read cache when doing check/repair

Reading the last page of table with "dynamic page" format would generate
an error when reading after the last row. This was never noticed as
when using Aria as a handler any error messages generated by
_ma_set_fatal_error() was ignored.
parent 54e501cf
...@@ -44,6 +44,9 @@ my_bool _ma_read_cache(MARIA_HA *handler, IO_CACHE *info, uchar *buff, ...@@ -44,6 +44,9 @@ my_bool _ma_read_cache(MARIA_HA *handler, IO_CACHE *info, uchar *buff,
DBUG_ENTER("_ma_read_cache"); DBUG_ENTER("_ma_read_cache");
DBUG_ASSERT(!(info->myflags & MY_ENCRYPT)); DBUG_ASSERT(!(info->myflags & MY_ENCRYPT));
if (unlikely(pos >= info->end_of_file) && (flag & READING_HEADER))
DBUG_RETURN(-1);
if (pos < info->pos_in_file) if (pos < info->pos_in_file)
{ {
read_length=length; read_length=length;
...@@ -95,14 +98,17 @@ my_bool _ma_read_cache(MARIA_HA *handler, IO_CACHE *info, uchar *buff, ...@@ -95,14 +98,17 @@ my_bool _ma_read_cache(MARIA_HA *handler, IO_CACHE *info, uchar *buff,
if (!(flag & READING_HEADER) || (int) read_length == -1 || if (!(flag & READING_HEADER) || (int) read_length == -1 ||
read_length+in_buff_length < 3) read_length+in_buff_length < 3)
{ {
if ((flag & READING_HEADER) && read_length + in_buff_length == 0)
DBUG_RETURN(-1); /* End of file */
DBUG_PRINT("error", DBUG_PRINT("error",
("Error %d reading next-multi-part block (Got %d bytes)", ("Error %d reading next-multi-part block (Got %d of %d bytes)",
my_errno, (int) read_length)); my_errno, (int) read_length, (int) length));
if (!my_errno || my_errno == HA_ERR_FILE_TOO_SHORT) if (!my_errno || my_errno == HA_ERR_FILE_TOO_SHORT)
{ {
if (!handler->in_check_table) if (!handler->in_check_table)
_ma_set_fatal_error(handler->s, HA_ERR_WRONG_IN_RECORD); _ma_set_fatal_error(handler->s, HA_ERR_FILE_TOO_SHORT);
else if (!my_errno)
my_errno= HA_ERR_WRONG_IN_RECORD; my_errno= HA_ERR_WRONG_IN_RECORD;
} }
DBUG_RETURN(1); DBUG_RETURN(1);
......
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