summaryrefslogtreecommitdiff
path: root/sql/sql_partition.cc
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2012-08-15 13:33:37 +0300
committerMichael Widenius <monty@askmonty.org>2012-08-15 13:33:37 +0300
commitfbe5ac4e24ceaa9f75f52fba62f8c53e172e5c11 (patch)
treecf433e814590fd67c635ac6d72f899311c694ee4 /sql/sql_partition.cc
parent9c1cc61caf5282747ed6e399e842957b9eee521f (diff)
downloadmariadb-git-fbe5ac4e24ceaa9f75f52fba62f8c53e172e5c11.tar.gz
Fixed MDEV-365 "Got assertion when doing alter table on a partition"
mysql-test/r/partition.result: Added test case mysql-test/t/partition.test: Added test case sql/sql_partition.cc: Do mysql_trans_prepare_alter_copy_data() after all original tables are locked. (We don't want to disable transactions for the original tables, that still may be in the cache) sql/sql_table.cc: Fixed two wrong DBUG_ENTER
Diffstat (limited to 'sql/sql_partition.cc')
-rw-r--r--sql/sql_partition.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
index a9c79589faa..2bec12e4f66 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -5500,10 +5500,12 @@ static bool mysql_change_partitions(ALTER_PARTITION_PARAM_TYPE *lpt)
build_table_filename(path, sizeof(path) - 1, lpt->db, lpt->table_name, "", 0);
- if(mysql_trans_prepare_alter_copy_data(thd))
+ /* First lock the original tables */
+ if (file->ha_external_lock(thd, F_WRLCK))
DBUG_RETURN(TRUE);
- if (file->ha_external_lock(thd, F_WRLCK))
+ /* Disable transactions for all new tables */
+ if (mysql_trans_prepare_alter_copy_data(thd))
DBUG_RETURN(TRUE);
/* TODO: test if bulk_insert would increase the performance */