~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

Viewing changes to sql/sql_partition.cc

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2010-06-21 15:31:05 UTC
  • mfrom: (1.1.3 upstream)
  • mto: This revision was merged to the branch mainline in revision 6.
  • Revision ID: james.westby@ubuntu.com-20100621153105-pbbz3t6nyrf9t2zq
Tags: upstream-5.1.48
ImportĀ upstreamĀ versionĀ 5.1.48

Show diffs side-by-side

added added

removed removed

Lines of Context:
5955
5955
  }
5956
5956
}
5957
5957
 
5958
 
/*
5959
 
  Unlock and close table before renaming and dropping partitions
5960
 
  SYNOPSIS
5961
 
    alter_close_tables()
5962
 
    lpt                        Struct carrying parameters
5963
 
  RETURN VALUES
5964
 
    0
5965
 
*/
5966
 
 
5967
 
static int alter_close_tables(ALTER_PARTITION_PARAM_TYPE *lpt)
5968
 
{
5969
 
  THD *thd= lpt->thd;
5970
 
  const char *db= lpt->db;
5971
 
  const char *table_name= lpt->table_name;
5972
 
  DBUG_ENTER("alter_close_tables");
5973
 
  /*
5974
 
    We need to also unlock tables and close all handlers.
5975
 
    We set lock to zero to ensure we don't do this twice
5976
 
    and we set db_stat to zero to ensure we don't close twice.
5977
 
  */
5978
 
  pthread_mutex_lock(&LOCK_open);
5979
 
  close_data_files_and_morph_locks(thd, db, table_name);
5980
 
  pthread_mutex_unlock(&LOCK_open);
5981
 
  DBUG_RETURN(0);
5982
 
}
5983
 
 
5984
5958
 
5985
5959
/*
5986
5960
  Handle errors for ALTER TABLE for partitioning
6278
6252
        write_log_drop_partition(lpt) ||
6279
6253
        ERROR_INJECT_CRASH("crash_drop_partition_3") ||
6280
6254
        (not_completed= FALSE) ||
6281
 
        abort_and_upgrade_lock(lpt) || /* Always returns 0 */
6282
 
        ERROR_INJECT_CRASH("crash_drop_partition_4") ||
6283
 
        alter_close_tables(lpt) ||
 
6255
        abort_and_upgrade_lock_and_close_table(lpt) ||
6284
6256
        ERROR_INJECT_CRASH("crash_drop_partition_5") ||
6285
6257
        ((!thd->lex->no_write_to_binlog) &&
6286
6258
         (write_bin_log(thd, FALSE,
6345
6317
        ERROR_INJECT_CRASH("crash_add_partition_2") ||
6346
6318
        mysql_change_partitions(lpt) ||
6347
6319
        ERROR_INJECT_CRASH("crash_add_partition_3") ||
6348
 
        abort_and_upgrade_lock(lpt) || /* Always returns 0 */
6349
 
        ERROR_INJECT_CRASH("crash_add_partition_4") ||
6350
 
        alter_close_tables(lpt) ||
 
6320
        abort_and_upgrade_lock_and_close_table(lpt) ||
6351
6321
        ERROR_INJECT_CRASH("crash_add_partition_5") ||
6352
6322
        ((!thd->lex->no_write_to_binlog) &&
6353
6323
         (write_bin_log(thd, FALSE,
6435
6405
        write_log_final_change_partition(lpt) ||
6436
6406
        ERROR_INJECT_CRASH("crash_change_partition_4") ||
6437
6407
        (not_completed= FALSE) ||
6438
 
        abort_and_upgrade_lock(lpt) || /* Always returns 0 */
6439
 
        ERROR_INJECT_CRASH("crash_change_partition_5") ||
6440
 
        alter_close_tables(lpt) ||
 
6408
        abort_and_upgrade_lock_and_close_table(lpt) ||
6441
6409
        ERROR_INJECT_CRASH("crash_change_partition_6") ||
6442
6410
        ((!thd->lex->no_write_to_binlog) &&
6443
6411
         (write_bin_log(thd, FALSE,