~ubuntu-branches/ubuntu/maverick/mysql-5.1/maverick-proposed

« back to all changes in this revision

Viewing changes to sql/sql_db.cc

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2012-02-22 14:16:05 UTC
  • mto: This revision was merged to the branch mainline in revision 20.
  • Revision ID: package-import@ubuntu.com-20120222141605-nxlu9yzc6attylc2
Tags: upstream-5.1.61
ImportĀ upstreamĀ versionĀ 5.1.61

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (C) 2000-2003 MySQL AB
 
1
/*
 
2
   Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
2
3
 
3
4
   This program is free software; you can redistribute it and/or modify
4
5
   it under the terms of the GNU General Public License as published by
11
12
 
12
13
   You should have received a copy of the GNU General Public License
13
14
   along with this program; if not, write to the Free Software
14
 
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
15
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
 
16
*/
15
17
 
16
18
 
17
19
/* create and drop of databases */
26
28
#ifdef __WIN__
27
29
#include <direct.h>
28
30
#endif
 
31
#include "debug_sync.h"
29
32
 
30
33
#define MAX_DROP_TABLE_Q_LEN      1024
31
34
 
948
951
    remove_db_from_cache(db);
949
952
    pthread_mutex_unlock(&LOCK_open);
950
953
 
951
 
    Drop_table_error_handler err_handler(thd->get_internal_handler());
952
 
    thd->push_internal_handler(&err_handler);
953
 
 
954
954
    error= -1;
955
955
    /*
956
956
      We temporarily disable the binary log while dropping the objects
983
983
      error = 0;
984
984
      reenable_binlog(thd);
985
985
    }
986
 
    thd->pop_internal_handler();
987
986
  }
 
987
 
988
988
  if (!silent && deleted>=0)
989
989
  {
990
990
    const char *query;
1197
1197
      VOID(filename_to_tablename(file->name, table_list->table_name,
1198
1198
                                 MYSQL50_TABLE_NAME_PREFIX_LENGTH +
1199
1199
                                 strlen(file->name) + 1));
 
1200
 
 
1201
      /* To be able to correctly look up the table in the table cache. */
 
1202
      if (lower_case_table_names)
 
1203
        table_list->table_name_length= my_casedn_str(files_charset_info,
 
1204
                                                     table_list->table_name);
 
1205
 
1200
1206
      table_list->alias= table_list->table_name;        // If lower_case_table_names=2
1201
1207
      table_list->internal_tmp_table= is_prefix(file->name, tmp_file_prefix);
1202
1208
      /* Link into list */
1207
1213
    else
1208
1214
    {
1209
1215
      strxmov(filePath, org_path, "/", file->name, NullS);
1210
 
      if (my_delete_with_symlink(filePath,MYF(MY_WME)))
 
1216
      /*
 
1217
        We ignore ENOENT error in order to skip files that was deleted
 
1218
        by concurrently running statement like REAPIR TABLE ...
 
1219
      */
 
1220
      if (my_delete_with_symlink(filePath, MYF(0)) &&
 
1221
          my_errno != ENOENT)
1211
1222
      {
1212
 
        goto err;
 
1223
        my_error(EE_DELETE, MYF(0), filePath, my_errno);
 
1224
        goto err;
1213
1225
      }
1214
1226
    }
1215
1227
  }
1216
 
  if (thd->killed ||
1217
 
      (tot_list && mysql_rm_table_part2(thd, tot_list, 1, 0, 1, 1)))
 
1228
 
 
1229
  if (thd->killed)
1218
1230
    goto err;
1219
1231
 
 
1232
  if (tot_list)
 
1233
  {
 
1234
    int res= 0;
 
1235
    Drop_table_error_handler err_handler(thd->get_internal_handler());
 
1236
 
 
1237
    thd->push_internal_handler(&err_handler);
 
1238
    res= mysql_rm_table_part2(thd, tot_list, 1, 0, 1, 1);
 
1239
    thd->pop_internal_handler();
 
1240
    if (res)
 
1241
      goto err;
 
1242
  }
 
1243
 
1220
1244
  /* Remove RAID directories */
1221
1245
  {
1222
1246
    List_iterator<String> it(raid_dirs);
1681
1705
  }
1682
1706
#endif
1683
1707
 
 
1708
  DEBUG_SYNC(thd, "before_db_dir_check");
 
1709
 
1684
1710
  if (check_db_dir_existence(new_db_file_name.str))
1685
1711
  {
1686
1712
    if (force_switch)