Skip to content

Commit 1fff239

Browse files
committed
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.
1 parent 16d8763 commit 1fff239

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

sql/sql_admin.cc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -588,8 +588,6 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
588588
DBUG_PRINT("admin", ("table: '%s'.'%s'", db, table->table_name.str));
589589
DEBUG_SYNC(thd, "admin_command_kill_before_modify");
590590

591-
if (thd->is_killed())
592-
break;
593591
table_name.length= strxmov(table_name_buff, db, ".", table->table_name.str,
594592
NullS) - table_name_buff;
595593
thd->open_options|= extra_open_options;
@@ -605,6 +603,13 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
605603
: lock_type >= TL_FIRST_WRITE
606604
? MDL_SHARED_WRITE : MDL_SHARED_READ);
607605

606+
if (thd->check_killed())
607+
{
608+
fatal_error= true;
609+
result_code= HA_ADMIN_FAILED;
610+
goto send_result;
611+
}
612+
608613
/* open only one table from local list of command */
609614
while (1)
610615
{

0 commit comments

Comments
 (0)