Commit cfdd9890 authored by unknown's avatar unknown

Merge bk-internal.mysql.com:/home/bk/mysql-4.0

into narttu.mysql.fi:/my/mysql-4.0

parents 65cf37d3 bfc155f0
......@@ -200,21 +200,33 @@ int chk_del(MI_CHECK *param, register MI_INFO *info, uint test_flag)
empty+=info->s->base.pack_reclength;
}
}
if (test_flag & T_VERBOSE)
puts("\n");
if (empty != info->state->empty)
{
if (test_flag & T_VERBOSE) puts("");
mi_check_print_warning(param,
"Not used space is supposed to be: %s but is: %s",
llstr(info->state->empty,buff),
llstr(empty,buff2));
info->state->empty=empty;
"Found %s deleted space in delete link chain. Should be %s",
llstr(empty,buff2),
llstr(info->state->empty,buff));
}
if (i != 0 || next_link != HA_OFFSET_ERROR)
if (next_link != HA_OFFSET_ERROR)
{
mi_check_print_error(param,
"Found more than the expected %s deleted rows in delete link chain",
llstr(info->state->del, buff));
goto wrong;
if (test_flag & T_VERBOSE) puts("\n");
}
if (i != 0)
{
mi_check_print_error(param,
"Found %s deleted rows in delete link chain. Should be %s",
llstr(info->state->del - i, buff2),
llstr(info->state->del, buff));
goto wrong;
}
}
DBUG_RETURN(0);
wrong:
param->testflag|=T_RETRY_WITHOUT_QUICK;
if (test_flag & T_VERBOSE) puts("");
......@@ -1040,6 +1052,13 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend)
}
}
if (del_length != info->state->empty)
{
mi_check_print_warning(param,
"Found %s deleted space. Should be %s",
llstr(del_length,llbuff2),
llstr(info->state->empty,llbuff));
}
if (used+empty+del_length != info->state->data_file_length)
{
mi_check_print_warning(param,
......
......@@ -167,7 +167,6 @@ static int _mi_find_writepos(MI_INFO *info,
if (info->s->state.dellink != HA_OFFSET_ERROR)
{
/* Deleted blocks exists; Get last used block */
*filepos=info->s->state.dellink;
block_info.second_read=0;
info->rec_cache.seek_not_done=1;
......@@ -211,7 +210,11 @@ static int _mi_find_writepos(MI_INFO *info,
/* Remove a deleted block from the deleted list */
/*
Unlink a deleted block from the deleted list.
This block will be combined with the preceding or next block to form
a big block.
*/
static bool unlink_deleted_block(MI_INFO *info, MI_BLOCK_INFO *block_info)
{
......@@ -225,6 +228,7 @@ static bool unlink_deleted_block(MI_INFO *info, MI_BLOCK_INFO *block_info)
{
MI_BLOCK_INFO tmp;
tmp.second_read=0;
/* Unlink block from the previous block */
if (!(_mi_get_block_info(&tmp,info->dfile,block_info->prev_filepos)
& BLOCK_DELETED))
DBUG_RETURN(1); /* Something is wrong */
......@@ -232,6 +236,7 @@ static bool unlink_deleted_block(MI_INFO *info, MI_BLOCK_INFO *block_info)
if (my_pwrite(info->dfile,(char*) tmp.header+4,8,
block_info->prev_filepos+4, MYF(MY_NABP)))
DBUG_RETURN(1);
/* Unlink block from next block */
if (block_info->next_filepos != HA_OFFSET_ERROR)
{
if (!(_mi_get_block_info(&tmp,info->dfile,block_info->next_filepos)
......@@ -244,11 +249,16 @@ static bool unlink_deleted_block(MI_INFO *info, MI_BLOCK_INFO *block_info)
DBUG_RETURN(1);
}
}
/* We now have one less deleted block */
info->state->del--;
info->state->empty-= block_info->block_len;
info->s->state.split--;
/* Removing block that we are using through mi_rrnd */
/*
If this was a block that we where accessing through table scan
(mi_rrnd() or mi_scan(), then ensure that we skip over this block
when doing next mi_rrnd() or mi_scan().
*/
if (info->nextpos == block_info->filepos)
info->nextpos+=block_info->block_len;
DBUG_RETURN(0);
......@@ -325,7 +335,7 @@ static int delete_dynamic_record(MI_INFO *info, my_off_t filepos,
info->state->empty+=length;
filepos=block_info.next_filepos;
/* Now it's safe to unlink the block */
/* Now it's safe to unlink the deleted block directly after this one */
if (remove_next_block && unlink_deleted_block(info,&del_block))
error=1;
} while (!(b_type & BLOCK_LAST));
......
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