Skip to content

Commit

Permalink
MDEV-22530 Aborting OPTIMIZE TABLE still logs in binary log and repli…
Browse files Browse the repository at this point in the history
…cates 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.
  • Loading branch information
vuvova committed May 19, 2021
1 parent 16d8763 commit 1fff239
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions sql/sql_admin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)
{
Expand Down

0 comments on commit 1fff239

Please sign in to comment.