summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2016-02-10 15:38:25 +0100
committerSergei Golubchik <serg@mariadb.org>2016-02-15 13:02:21 +0100
commit9b9522a8b5952c2ce9138f13112cc4fd3efac930 (patch)
tree31eedd3d440e02a7484e65c5561fb57682eddfb1 /sql
parent1fc6e297f26756038c173eb7a1ea722d3a828c42 (diff)
downloadmariadb-git-9b9522a8b5952c2ce9138f13112cc4fd3efac930.tar.gz
MDEV-8133 ALTER TABLE can perform the operation but escape the binary log
fix a few cases where a successful ALTER was not binlogged: * on errors after the completed ALTER, binlog it, then return an error * don't let thd->killed abort open_table() after completed online ALTER.
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_table.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 1e7d4f5e3c6..1bb42c36893 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -6889,7 +6889,7 @@ static bool mysql_inplace_alter_table(THD *thd,
MDL_request *target_mdl_request,
Alter_table_ctx *alter_ctx)
{
- Open_table_context ot_ctx(thd, MYSQL_OPEN_REOPEN);
+ Open_table_context ot_ctx(thd, MYSQL_OPEN_REOPEN | MYSQL_OPEN_IGNORE_KILLED);
handlerton *db_type= table->s->db_type();
MDL_ticket *mdl_ticket= table->mdl_ticket;
HA_CREATE_INFO *create_info= ha_alter_info->create_info;
@@ -9094,13 +9094,13 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
error, but still worth reporting as it might indicate serious
problem with server.
*/
- goto err_with_mdl;
+ goto err_with_mdl_after_alter;
}
end_inplace:
if (thd->locked_tables_list.reopen_tables(thd))
- goto err_with_mdl;
+ goto err_with_mdl_after_alter;
THD_STAGE_INFO(thd, stage_end);
@@ -9199,6 +9199,10 @@ err_new_table_cleanup:
DBUG_RETURN(true);
+err_with_mdl_after_alter:
+ /* the table was altered. binlog the operation */
+ write_bin_log(thd, true, thd->query(), thd->query_length());
+
err_with_mdl:
/*
An error happened while we were holding exclusive name metadata lock