summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2021-05-19 22:26:02 +0200
committerSergei Golubchik <serg@mariadb.org>2021-05-19 22:58:34 +0200
commit1fff2398ef3dda1a7e8404f18e4e165823bd4e0a (patch)
tree54707fde18945f2253e8bf207253d2ea3c4466a2
parent16d8763b872ba69c03e4b6adecc60a8d158867f5 (diff)
downloadmariadb-git-1fff2398ef3dda1a7e8404f18e4e165823bd4e0a.tar.gz
MDEV-22530 Aborting OPTIMIZE TABLE still logs in binary log and replicates to the Slave server
Followup. If the KILL happens - report it as a failure, don't eat it up silently. Note that this has to be done after `table_name` is populated, so that the error message could show it.
-rw-r--r--sql/sql_admin.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc
index c7d83676cc4..65985be3bd6 100644
--- a/sql/sql_admin.cc
+++ b/sql/sql_admin.cc
@@ -588,8 +588,6 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
DBUG_PRINT("admin", ("table: '%s'.'%s'", db, table->table_name.str));
DEBUG_SYNC(thd, "admin_command_kill_before_modify");
- if (thd->is_killed())
- break;
table_name.length= strxmov(table_name_buff, db, ".", table->table_name.str,
NullS) - table_name_buff;
thd->open_options|= extra_open_options;
@@ -605,6 +603,13 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
: lock_type >= TL_FIRST_WRITE
? MDL_SHARED_WRITE : MDL_SHARED_READ);
+ if (thd->check_killed())
+ {
+ fatal_error= true;
+ result_code= HA_ADMIN_FAILED;
+ goto send_result;
+ }
+
/* open only one table from local list of command */
while (1)
{