summaryrefslogtreecommitdiff
path: root/myisam
diff options
context:
space:
mode:
authorunknown <serg@serg.mysql.com>2002-10-22 15:16:16 +0000
committerunknown <serg@serg.mysql.com>2002-10-22 15:16:16 +0000
commit78d524b37e3d99504df0b3d02523849d75ae2634 (patch)
tree7acd8e166baeef6186b72d30fabbfd013cf9cd96 /myisam
parent14cbecdc8b53b60dcaf101368bd3df3ae5a7c75e (diff)
downloadmariadb-git-78d524b37e3d99504df0b3d02523849d75ae2634.tar.gz
truncate both MYI and MYD files on DELETE FROM table; to avoid warnings on CHECK TABLE
myisam/mi_delete_all.c: truncate both MYI and MYD files to avoid warnings on CHECK TABLE
Diffstat (limited to 'myisam')
-rw-r--r--myisam/mi_delete_all.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/myisam/mi_delete_all.c b/myisam/mi_delete_all.c
index 7e4239bc7d1..45e56626d59 100644
--- a/myisam/mi_delete_all.c
+++ b/myisam/mi_delete_all.c
@@ -15,7 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* Remove all rows from a MyISAM table */
-/* This only clears the status information and truncates the data file */
+/* This clears the status information and truncates files */
#include "myisamdef.h"
@@ -49,14 +49,15 @@ int mi_delete_all_rows(MI_INFO *info)
state->key_root[i]= HA_OFFSET_ERROR;
myisam_log_command(MI_LOG_DELETE_ALL,info,(byte*) 0,0,0);
- VOID(_mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE));
- if (my_chsize(info->dfile, 0, 0, MYF(MY_WME)))
- goto err;
/*
If we are using delayed keys or if the user has done changes to the tables
since it was locked then there may be key blocks in the key cache
*/
flush_key_blocks(share->kfile, FLUSH_IGNORE_CHANGED);
+ if (my_chsize(info->dfile, 0, 0, MYF(MY_WME)) ||
+ my_chsize(share->kfile, share->base.keystart, 0, MYF(MY_WME)) )
+ goto err;
+ VOID(_mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE));
allow_break(); /* Allow SIGHUP & SIGINT */
DBUG_RETURN(0);