~jlukas79/+junk/mysql-server

« back to all changes in this revision

Viewing changes to storage/myisam/mi_delete_all.c

manual merge 6.0-main --> 6.0-bka-review

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
  for (i=0 ; i < share->base.keys ; i++)
48
48
    state->key_root[i]= HA_OFFSET_ERROR;
49
49
 
50
 
  myisam_log_command(MI_LOG_DELETE_ALL,info,(uchar*) 0,0,0);
 
50
  myisam_log_command_logical(MI_LOG_DELETE_ALL, info, (uchar*) 0, 0, 0);
51
51
  /*
52
52
    If we are using delayed keys or if the user has done changes to the tables
53
53
    since it was locked then there may be key blocks in the key cache
54
54
  */
55
55
  flush_key_blocks(share->key_cache, share->kfile, FLUSH_IGNORE_CHANGED);
 
56
#ifdef HAVE_MMAP
 
57
  if (share->file_map)
 
58
    _mi_unmap_file(info);
 
59
#endif
56
60
  if (my_chsize(info->dfile, 0, 0, MYF(MY_WME)) ||
57
61
      my_chsize(share->kfile, share->base.keystart, 0, MYF(MY_WME))  )
58
62
    goto err;
59
 
  VOID(_mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE));
 
63
  if (unlikely(mi_get_physical_logging_state(info->s)))
 
64
    _myisam_log_command(&myisam_physical_log, MI_LOG_DELETE_ALL, share,
 
65
                        NULL, 0, 0);
 
66
  (void) _mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE);
60
67
#ifdef HAVE_MMAP
61
 
  /* Resize mmaped area */
62
 
  rw_wrlock(&info->s->mmap_lock);
63
 
  mi_remap_file(info, (my_off_t)0);
64
 
  rw_unlock(&info->s->mmap_lock);
 
68
  /* Map again */
 
69
  if (share->file_map)
 
70
    mi_dynmap_file(info, (my_off_t) 0);
65
71
#endif
66
72
  allow_break();                        /* Allow SIGHUP & SIGINT */
67
73
  DBUG_RETURN(0);
69
75
err:
70
76
  {
71
77
    int save_errno=my_errno;
72
 
    VOID(_mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE));
 
78
    (void) _mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE);
73
79
    info->update|=HA_STATE_WRITTEN;     /* Buffer changed */
74
80
    allow_break();                      /* Allow SIGHUP & SIGINT */
75
81
    DBUG_RETURN(my_errno=save_errno);