summaryrefslogtreecommitdiff
path: root/myisam
diff options
context:
space:
mode:
authorunknown <monty@narttu.mysql.fi>2003-10-07 15:42:26 +0300
committerunknown <monty@narttu.mysql.fi>2003-10-07 15:42:26 +0300
commitf16887c59c7e896c6504008f6cbea337a5cb3fff (patch)
treed89c080ef636608e316f1166b1628cd1d902deec /myisam
parentdf02cd390d461b50ab5bdf3492aae1071db7da05 (diff)
parentbc4a57f01ace40255de2f8d7307254fd1d1d5bfa (diff)
downloadmariadb-git-f16887c59c7e896c6504008f6cbea337a5cb3fff.tar.gz
Merge with 4.0.16
BitKeeper/etc/ignore: auto-union BitKeeper/etc/logging_ok: auto-union BitKeeper/deleted/.del-mysqldump.result: Delete: mysql-test/r/mysqldump.result BitKeeper/deleted/.del-mysqldump.test: Delete: mysql-test/t/mysqldump.test BitKeeper/deleted/.del-compile-netware-max: Delete: netware/BUILD/compile-netware-max BitKeeper/deleted/.del-compile-netware-max-debug: Delete: netware/BUILD/compile-netware-max-debug BitKeeper/deleted/.del-compile-netware-src: Delete: netware/BUILD/compile-netware-src BitKeeper/deleted/.del-knetware.imp: Delete: netware/BUILD/knetware.imp BUILD/compile-pentium-valgrind-max: Auto merged BitKeeper/deleted/.del-mini_client.cc~8677895ec8169183: Auto merged BitKeeper/deleted/.del-mysql_fix_privilege_tables.sql: Auto merged BitKeeper/deleted/.del-openssl.imp: Delete: netware/BUILD/openssl.imp acinclude.m4: Auto merged SSL/cacert.pem: Auto merged SSL/client-cert.pem: Auto merged SSL/server-cert.pem: Auto merged client/mysqlbinlog.cc: Auto merged extra/resolveip.c: Auto merged heap/hp_test2.c: Auto merged include/my_global.h: Auto merged innobase/row/row0mysql.c: Auto merged innobase/row/row0sel.c: Auto merged libmysql/libmysql.def: Auto merged libmysqld/examples/Makefile.am: Auto merged myisam/mi_check.c: Auto merged myisam/mi_test2.c: Auto merged myisam/myisamdef.h: Auto merged mysql-test/r/fulltext_multi.result: Auto merged mysql-test/r/fulltext_order_by.result: Auto merged mysql-test/r/select.result: Auto merged mysql-test/r/user_var.result: Auto merged mysql-test/std_data/rpl_loaddata2.dat: Auto merged mysql-test/t/rpl_loaddata.test: Auto merged mysql-test/t/select.test: Auto merged mysql-test/t/user_var.test: Auto merged mysys/mf_dirname.c: Auto merged scripts/make_win_src_distribution.sh: Auto merged sql/des_key_file.cc: Auto merged sql/log.cc: Auto merged sql/mysqld.cc: Auto merged sql/repl_failsafe.cc: Auto merged sql/slave.h: Auto merged sql-bench/crash-me.sh: Auto merged sql-bench/server-cfg.sh: Auto merged sql-bench/test-insert.sh: Auto merged sql-bench/test-transactions.sh: Auto merged sql/sql_base.cc: Auto merged sql/sql_load.cc: Auto merged sql/sql_parse.cc: Auto merged sql/sql_select.cc: Auto merged support-files/mysql.server.sh: Auto merged client/mysqltest.c: Merge with 4.0.16 Changed version number to '2.0' to avoid confusion with version numbering in 3.23 mysql-test/r/distinct.result: Updated results for merge mysql-test/r/insert.result: Updated results for merge mysql-test/r/insert_select.result: Updated results for merge mysql-test/r/join_outer.result: Updated results for merge mysql-test/r/mix_innodb_myisam_binlog.result: Updated results for merge mysql-test/r/order_by.result: Updated results for merge mysql-test/r/rpl000009.result: Updated results for merge mysql-test/r/rpl_loaddata.result: Updated results for merge mysql-test/r/rpl_log.result: Updated results for merge mysql-test/r/select_safe.result: Updated results for merge scripts/mysql_install_db.sh: Change -eq to = BitKeeper/deleted/.del-ins000001.test~2428ee5c9b1bc483: dummy
Diffstat (limited to 'myisam')
-rw-r--r--myisam/mi_check.c35
-rw-r--r--myisam/mi_dynrec.c18
-rw-r--r--myisam/mi_packrec.c4
-rw-r--r--myisam/mi_test2.c4
-rw-r--r--myisam/myisamdef.h2
5 files changed, 47 insertions, 16 deletions
diff --git a/myisam/mi_check.c b/myisam/mi_check.c
index cb2b56d93de..ceac8f6356c 100644
--- a/myisam/mi_check.c
+++ b/myisam/mi_check.c
@@ -185,21 +185,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("");
@@ -1025,6 +1037,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));
diff --git a/myisam/mi_packrec.c b/myisam/mi_packrec.c
index 1bd39aa900b..b21bf0b2163 100644
--- a/myisam/mi_packrec.c
+++ b/myisam/mi_packrec.c
@@ -743,7 +743,7 @@ static void uf_blob(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff,
{
ulong length=get_bits(bit_buff,rec->space_length_bits);
uint pack_length=(uint) (end-to)-mi_portable_sizeof_char_ptr;
- if (bit_buff->blob_pos+length > bit_buff->end)
+ if (bit_buff->blob_pos+length > bit_buff->blob_end)
{
bit_buff->error=1;
bzero((byte*) to,(end-to));
@@ -1067,6 +1067,7 @@ uint _mi_pack_get_block_info(MI_INFO *myisam, MI_BLOCK_INFO *info, File file,
&myisam->rec_buff)))
return BLOCK_FATAL_ERROR; /* not enough memory */
myisam->bit_buff.blob_pos=(uchar*) myisam->rec_buff+info->rec_len;
+ myisam->bit_buff.blob_end= myisam->bit_buff.blob_pos+info->blob_len;
myisam->blob_length=info->blob_len;
}
info->filepos=filepos+head_length;
@@ -1243,6 +1244,7 @@ static uchar *_mi_mempack_get_block_info(MI_INFO *myisam,MI_BLOCK_INFO *info,
&myisam->rec_buff)))
return 0; /* not enough memory */
myisam->bit_buff.blob_pos=(uchar*) myisam->rec_buff;
+ myisam->bit_buff.blob_end= (uchar*) myisam->rec_buff + info->blob_len;
}
return header;
}
diff --git a/myisam/mi_test2.c b/myisam/mi_test2.c
index 8dc279b6d97..5c066075e49 100644
--- a/myisam/mi_test2.c
+++ b/myisam/mi_test2.c
@@ -335,12 +335,12 @@ int main(int argc, char *argv[])
{
if (my_errno != HA_ERR_FOUND_DUPP_KEY || key3[n3] == 0)
{
- printf("error: %d; can't uppdate:\nFrom: \"%s\"\nTo: \"%s\"\n",
+ printf("error: %d; can't update:\nFrom: \"%s\"\nTo: \"%s\"\n",
my_errno,read_record,record2);
goto err;
}
if (verbose)
- printf("Double key when tryed to uppdate:\nFrom: \"%s\"\nTo: \"%s\"\n",record,record2);
+ printf("Double key when tried to update:\nFrom: \"%s\"\nTo: \"%s\"\n",record,record2);
}
else
{
diff --git a/myisam/myisamdef.h b/myisam/myisamdef.h
index 83e28a42797..9844bb7b36d 100644
--- a/myisam/myisamdef.h
+++ b/myisam/myisamdef.h
@@ -212,7 +212,7 @@ typedef uint mi_bit_type;
typedef struct st_mi_bit_buff { /* Used for packing of record */
mi_bit_type current_byte;
uint bits;
- uchar *pos,*end,*blob_pos;
+ uchar *pos,*end,*blob_pos,*blob_end;
uint error;
} MI_BIT_BUFF;