summaryrefslogtreecommitdiff
path: root/sql/sql_admin.cc
diff options
context:
space:
mode:
authorMattias Jonsson <mattias.jonsson@oracle.com>2012-02-02 12:47:17 +0100
committerMattias Jonsson <mattias.jonsson@oracle.com>2012-02-02 12:47:17 +0100
commit7ebeb1433e567dece2601651d306448408656da8 (patch)
tree2954bdaac8f88095fc3a3d0ebf2b9980bf022cda /sql/sql_admin.cc
parent225f0cd53d547927dc6d528a4e78c1be5e07cbc6 (diff)
downloadmariadb-git-7ebeb1433e567dece2601651d306448408656da8.tar.gz
Bug#13593865 - 64037: CRASH IN HA_PARTITION::CREATE_HANDLERS ON
ALTER TABLE AFTER DROP PARTITION Bug#13608188 - 64038: CRASH IN HANDLER::HA_THD ON ALTER TABLE AFTER REPAIR NON-EXISTING PARTITION Backport of bug#13357766 from -trunk to -5.5. The state of some partitions was not reset on failure, leading to invalid states of partitions in consequent statements. Fixed by reverting back to original state for all partitions if not all partition names was resolved. Also adding extra security by forcing tables to be reopened in case of error in mysql_alter_table. (There is also removal of \r at the end of some lines.)
Diffstat (limited to 'sql/sql_admin.cc')
-rw-r--r--sql/sql_admin.cc10
1 files changed, 4 insertions, 6 deletions
diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc
index 5bb777437b0..8f1b24741f6 100644
--- a/sql/sql_admin.cc
+++ b/sql/sql_admin.cc
@@ -406,12 +406,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
my_error(ER_PARTITION_MGMT_ON_NONPARTITIONED, MYF(0));
DBUG_RETURN(TRUE);
}
- uint num_parts_found;
- uint num_parts_opt= alter_info->partition_names.elements;
- num_parts_found= set_part_state(alter_info, table->table->part_info,
- PART_ADMIN);
- if (num_parts_found != num_parts_opt &&
- (!(alter_info->flags & ALTER_ALL_PARTITION)))
+ if (set_part_state(alter_info, table->table->part_info, PART_ADMIN))
{
char buff[FN_REFLEN + MYSQL_ERRMSG_SIZE];
size_t length;
@@ -872,6 +867,9 @@ send_result_message:
DBUG_RETURN(FALSE);
err:
+ /* Make sure this table instance is not reused after the failure. */
+ if (table && table->table)
+ table->table->m_needs_reopen= true;
trans_rollback_stmt(thd);
trans_rollback(thd);
close_thread_tables(thd); // Shouldn't be needed