From 2a67a3a7f5ec9339fd0c31aa7071f32e3b8a75de Mon Sep 17 00:00:00 2001 From: Mattias Jonsson Date: Fri, 1 Oct 2010 13:22:11 +0200 Subject: Bug#56172: Server crashes in ha_partition::reset on REBUILD PARTITION under LOCK TABLE Collapsed patch including updates from the reviews. In case of failure in ALTER ... PARTITION under LOCK TABLE the server could crash, due to it had modified the locked table object, which was not reverted in case of failure, resulting in a bad table definition used after the failed command. Solved by instead of altering the locked table object and its partition_info struct, creating an internal temporary intermediate table object used for altering, just like the non partitioned mysql_alter_table. So if an error occur before the alter operation is complete, the original table is not modified at all. But if the alter operation have succeeded so far that it must be completed as whole, the table is properly closed and reopened. (The completion on failure is done by the ddl_log.) --- sql/sql_partition.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'sql/sql_partition.h') diff --git a/sql/sql_partition.h b/sql/sql_partition.h index c644e63794c..9a9a0bd56fa 100644 --- a/sql/sql_partition.h +++ b/sql/sql_partition.h @@ -54,6 +54,7 @@ typedef struct st_lock_param_type HA_CREATE_INFO *create_info; Alter_info *alter_info; TABLE *table; + TABLE *old_table; KEY *key_info_buffer; const char *db; const char *table_name; @@ -252,14 +253,17 @@ uint fast_alter_partition_table(THD *thd, TABLE *table, TABLE_LIST *table_list, char *db, const char *table_name, - uint fast_alter_partition); + TABLE *fast_alter_table); uint set_part_state(Alter_info *alter_info, partition_info *tab_part_info, enum partition_state part_state); uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info, HA_CREATE_INFO *create_info, handlerton *old_db_type, bool *partition_changed, - uint *fast_alter_partition); + char *db, + const char *table_name, + const char *path, + TABLE **fast_alter_table); char *generate_partition_syntax(partition_info *part_info, uint *buf_length, bool use_sql_alloc, bool show_partition_options, -- cgit v1.2.1