Commit 33964984 authored by Monty's avatar Monty

MDEV-34522 Index for (specific) Aria table is created as corrupted

The issue was that when repairing an Aria table of row format PAGE and
the data file was bigger the 4G, the data file length was cut short
because of wrong parameters to MY_ALIGN().

The effect was that ALTER TABLE, OPTIMIZE TABLE or REPAIR TABLE would fail
on these tables, possibly corrupting them.
The MDEV also exposed a bug where error state was not propagated properly
to the upper level if the number of rows in the table changed.
parent cbc1898e
......@@ -1778,6 +1778,11 @@ int ha_maria::repair(THD *thd, HA_CHECK *param, bool do_optimize)
_ma_check_print_warning(param, "Number of rows changed from %s to %s",
llstr(rows, llbuff),
llstr(file->state->records, llbuff2));
/*
ma_check_print_warning() may generate an error in case of creating keys
for ALTER TABLE. In this case we should signal an error.
*/
error= thd->is_error();
}
}
else
......
......@@ -2507,7 +2507,7 @@ static int initialize_variables_for_repair(HA_CHECK *param,
*info->state= info->s->state.state;
if (share->data_file_type == BLOCK_RECORD)
share->state.state.data_file_length= MY_ALIGN(sort_info->filelength,
share->block_size);
(my_off_t) share->block_size);
else
share->state.state.data_file_length= sort_info->filelength;
return 0;
......
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