summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <monty@narttu.mysql.fi>2003-09-17 12:23:15 +0300
committerunknown <monty@narttu.mysql.fi>2003-09-17 12:23:15 +0300
commitcfdd9890988ae75598874995a9960aa7641f9837 (patch)
tree7399f80bc6e465ec12e6ec7304068bed9da3e7c7
parent65cf37d3fb29560badceeb980a8d825b8253ed64 (diff)
parentbfc155f01a64c023a0dff2cf553a3120073019ab (diff)
downloadmariadb-git-cfdd9890988ae75598874995a9960aa7641f9837.tar.gz
Merge bk-internal.mysql.com:/home/bk/mysql-4.0
into narttu.mysql.fi:/my/mysql-4.0
-rw-r--r--myisam/mi_check.c35
-rw-r--r--myisam/mi_dynrec.c18
2 files changed, 41 insertions, 12 deletions
diff --git a/myisam/mi_check.c b/myisam/mi_check.c
index f5b0a1aabaa..a4ae7b25dbb 100644
--- a/myisam/mi_check.c
+++ b/myisam/mi_check.c
@@ -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,
diff --git a/myisam/mi_dynrec.c b/myisam/mi_dynrec.c
index 86d648a5af0..e1bfe4c3ac5 100644
--- a/myisam/mi_dynrec.c
+++ b/myisam/mi_dynrec.c
@@ -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));