mirror of
https://github.com/MariaDB/server.git
synced 2026-05-08 08:04:29 +02:00
Merge of changes in MyISAM since December 16 -> April 1
Fixes bugs: Bug#28837 MyISAM storage engine error (134) doing delete with self-join Bug#31277 myisamchk --unpack corrupts table Bug#4692 DISABLE/ENABLE KEYS waste a space Bug#31305 myisam tables crash when they are near capacity BitKeeper/etc/ignore: added unittest/tmp/* mysql-test/r/maria.result: Moved missing tests from myisam.test to maria.test mysql-test/t/maria.test: Moved missing tests from myisam.test to maria.test storage/maria/ha_maria.cc: Merge of changes in MyISAM since December 16 -> April 1 Fixes bug in self join (Bug#28837: MyISAM storage engine error (134) doing delete with self-join) storage/maria/ha_maria.h: Merge of changes in MyISAM since December 16 -> April 1 storage/maria/ma_blockrec.c: Merge of changes in MyISAM since December 16 -> April 1 Fixes bug in self join (Bug#28837: MyISAM storage engine error (134) doing delete with self-join) The problem is that we may be using a cached key page with old information. Versioning will fix this storage/maria/ma_check.c: Merge of changes in MyISAM since December 16 -> April 1 This fixes a problem with pack_reclength not beeing big enough (Bug #31277 myisamchk --unpack corrupts table) BUG#4692 - DISABLE/ENABLE KEYS waste a space storage/maria/ma_delete.c: Indentation fixes storage/maria/ma_dynrec.c: Merge of changes in MyISAM since December 16 -> April 1 Fixes Bug#31305 myisam tables crash when they are near capacity. (This uses a simpler fix than in MyISAM by remembering the length of the current row) storage/maria/ma_ft_boolean_search.c: Merge of all changes from myisam/ft_boolean_search.c (This file had not been kept up to date) storage/maria/ma_open.c: Merge of changes in MyISAM since December 16 -> April 1 Calculate default_rec_buff_size more exact to be sure it's always big enough storage/maria/ma_packrec.c: Merge of changes in MyISAM since December 16 -> April 1 Update default_rec_buff_size to be big enough to hold one packed row Related to Bug#31277 myisamchk --unpack corrupts table storage/maria/ma_rnext_same.c: Indentation fixes storage/maria/ma_rt_index.c: Merge of changes in MyISAM since December 16 -> April 1 storage/maria/ma_rt_mbr.c: Merge of changes in MyISAM since December 16 -> April 1 (Added comment) storage/maria/ma_search.c: Merge of changes in MyISAM since December 16 -> April 1 (Added comment) storage/maria/ma_sort.c: Merge of changes in MyISAM since December 16 -> April 1 storage/maria/ma_statrec.c: Indentation fixes storage/maria/ma_test2.c: Indentation fixes storage/maria/maria_chk.c: Indentation fixes storage/maria/maria_pack.c: Merge of changes in MyISAM since December 16 -> April 1
This commit is contained in:
parent
c63e18f43c
commit
3651e3285d
21 changed files with 499 additions and 124 deletions
|
|
@ -329,6 +329,29 @@ static my_bool write_dynamic_record(MARIA_HA *info, const uchar *record,
|
|||
DBUG_ENTER("write_dynamic_record");
|
||||
|
||||
flag=0;
|
||||
|
||||
/*
|
||||
Check if we have enough room for the new record.
|
||||
First we do simplified check to make usual case faster.
|
||||
Then we do more precise check for the space left.
|
||||
Though it still is not absolutely precise, as
|
||||
we always use MARIA_MAX_DYN_BLOCK_HEADER while it can be
|
||||
less in the most of the cases.
|
||||
*/
|
||||
|
||||
if (unlikely(info->s->base.max_data_file_length -
|
||||
info->state->data_file_length <
|
||||
reclength + MARIA_MAX_DYN_BLOCK_HEADER))
|
||||
{
|
||||
if (info->s->base.max_data_file_length - info->state->data_file_length +
|
||||
info->state->empty - info->state->del * MARIA_MAX_DYN_BLOCK_HEADER <
|
||||
reclength + MARIA_MAX_DYN_BLOCK_HEADER)
|
||||
{
|
||||
my_errno=HA_ERR_RECORD_FILE_FULL;
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
if (_ma_find_writepos(info,reclength,&filepos,&length))
|
||||
|
|
@ -771,6 +794,37 @@ static my_bool update_dynamic_record(MARIA_HA *info, MARIA_RECORD_POS filepos,
|
|||
DBUG_ENTER("update_dynamic_record");
|
||||
|
||||
flag=block_info.second_read=0;
|
||||
/*
|
||||
Check if we have enough room for the record.
|
||||
First we do simplified check to make usual case faster.
|
||||
Then we do more precise check for the space left.
|
||||
Though it still is not absolutely precise, as
|
||||
we always use MARIA_MAX_DYN_BLOCK_HEADER while it can be
|
||||
less in the most of the cases.
|
||||
*/
|
||||
|
||||
/*
|
||||
compare with just the reclength as we're going
|
||||
to get some space from the old replaced record
|
||||
*/
|
||||
if (unlikely(info->s->base.max_data_file_length -
|
||||
info->state->data_file_length < reclength))
|
||||
{
|
||||
/* If new record isn't longer, we can go on safely */
|
||||
if (info->cur_row.total_length < reclength)
|
||||
{
|
||||
if (info->s->base.max_data_file_length - info->state->data_file_length +
|
||||
info->state->empty - info->state->del * MARIA_MAX_DYN_BLOCK_HEADER <
|
||||
reclength - info->cur_row.total_length + MARIA_MAX_DYN_BLOCK_HEADER)
|
||||
{
|
||||
my_errno=HA_ERR_RECORD_FILE_FULL;
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Remember length for updated row if it's updated again */
|
||||
info->cur_row.total_length= reclength;
|
||||
|
||||
while (reclength > 0)
|
||||
{
|
||||
if (filepos != info->s->state.dellink)
|
||||
|
|
@ -876,6 +930,7 @@ static my_bool update_dynamic_record(MARIA_HA *info, MARIA_RECORD_POS filepos,
|
|||
if (block_info.next_filepos != HA_OFFSET_ERROR)
|
||||
if (delete_dynamic_record(info,block_info.next_filepos,1))
|
||||
goto err;
|
||||
|
||||
DBUG_RETURN(0);
|
||||
err:
|
||||
DBUG_RETURN(1);
|
||||
|
|
@ -1420,6 +1475,7 @@ int _ma_read_dynamic_record(MARIA_HA *info, uchar *buf,
|
|||
}
|
||||
if (block_of_record++ == 0) /* First block */
|
||||
{
|
||||
info->cur_row.total_length= block_info.rec_len;
|
||||
if (block_info.rec_len > (uint) info->s->base.max_pack_length)
|
||||
goto panic;
|
||||
if (info->s->base.blobs)
|
||||
|
|
@ -1752,6 +1808,7 @@ int _ma_read_rnd_dynamic_record(MARIA_HA *info,
|
|||
}
|
||||
if (block_of_record == 0) /* First block */
|
||||
{
|
||||
info->cur_row.total_length= block_info.rec_len;
|
||||
if (block_info.rec_len > (uint) share->base.max_pack_length)
|
||||
goto panic;
|
||||
info->cur_row.lastpos= filepos;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue