1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Bug #47459 Assertion in Diagnostics_area::set_eof_status on OPTIMIZE TABLE

This assertion could be triggered during execution of OPTIMIZE TABLE for
InnoDB tables. As part of optimize for InnoDB tables, the table is recreated
and then opened again. If the reopen failed for any reason, the assertion
would be triggered. This could for example be caused by a concurrent DROP
TABLE executed by a different connection. The reason for the assertion was
that any failures during reopening were ignored.

This patch fixes the problem by making sure that the result of reopening the
table is checked and that any error messages are sent to the client.

Test case added to innodb_mysql_sync.test.
This commit is contained in:
Jon Olav Hauglid
2010-04-15 18:53:57 +02:00
parent b6f0c3a157
commit 1a1a96e7af
3 changed files with 72 additions and 5 deletions

View File

@ -5016,11 +5016,17 @@ send_result_message:
{
/* Clear the ticket released in close_thread_tables(). */
table->mdl_request.ticket= NULL;
if ((table->table= open_ltable(thd, table, lock_type, 0)) &&
((result_code= table->table->file->ha_analyze(thd, check_opt)) > 0))
result_code= 0; // analyze went ok
if (result_code) // analyze failed
table->table->file->print_error(result_code, MYF(0));
DEBUG_SYNC(thd, "ha_admin_open_ltable");
if (table->table= open_ltable(thd, table, lock_type, 0))
{
result_code= table->table->file->ha_analyze(thd, check_opt);
if (result_code == HA_ADMIN_ALREADY_DONE)
result_code= HA_ADMIN_OK;
else if (result_code) // analyze failed
table->table->file->print_error(result_code, MYF(0));
}
else
result_code= -1; // open failed
}
/* Start a new row for the final status row */
protocol->prepare_for_resend();