From 78d524b37e3d99504df0b3d02523849d75ae2634 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 22 Oct 2002 15:16:16 +0000 Subject: 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 --- myisam/mi_delete_all.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'myisam/mi_delete_all.c') 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); -- cgit v1.2.1