Commit 77102d8d authored by serg@serg.mysql.com's avatar serg@serg.mysql.com
Browse files

truncate both MYI and MYD files on DELETE FROM table; to avoid warnings on CHECK TABLE

parent 893cc550
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -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);