summaryrefslogtreecommitdiff
path: root/sql/sql_table.cc
diff options
context:
space:
mode:
authorJon Olav Hauglid <jon.hauglid@sun.com>2010-04-15 18:53:57 +0200
committerJon Olav Hauglid <jon.hauglid@sun.com>2010-04-15 18:53:57 +0200
commitcf8df9ca442200d9ea01d4480cb7bf70675ca188 (patch)
tree31450b004e38edf1aa92dae265ace5bc77f189cd /sql/sql_table.cc
parent4347e302a8f3410cecb159c1d90ac6bb00f00d1c (diff)
downloadmariadb-git-cf8df9ca442200d9ea01d4480cb7bf70675ca188.tar.gz
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.
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r--sql/sql_table.cc16
1 files changed, 11 insertions, 5 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 2a9e01daf18..5b957cccabd 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -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();