summaryrefslogtreecommitdiff
path: root/sql/sql_admin.cc
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@mariadb.org>2016-08-04 15:43:52 +0400
committerSergey Vojtovich <svoj@mariadb.org>2016-08-17 11:12:05 +0400
commit723488bba162109f241bc764b6e33c6f3d8b39d6 (patch)
treef7e24a5fd1b51224c1b171e77263d47b7ab7cc43 /sql/sql_admin.cc
parent09cb64682bda8648b0cdad606b169b4d592f839d (diff)
downloadmariadb-git-723488bba162109f241bc764b6e33c6f3d8b39d6.tar.gz
MDEV-10424 - Assertion `ticket == __null' failed in MDL_request::set_type
Reexecution of prepared "ANALYZE TABLE merge_table, table" may miss to reinitialize "table" for subsequent execution and trigger assertion failure. This happens because MERGE engine may adjust table->next_global chain, which gets cleared by close_thread_tables()/ha_myisammrg::detach_children() later. Since reinitilization iterates next_global chain, it won't see tables following merge table. Fixed by appending saved next_global chain after merge children.
Diffstat (limited to 'sql/sql_admin.cc')
-rw-r--r--sql/sql_admin.cc14
1 files changed, 13 insertions, 1 deletions
diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc
index 12a59fa6ee8..55effcd7002 100644
--- a/sql/sql_admin.cc
+++ b/sql/sql_admin.cc
@@ -441,7 +441,19 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
}
thd->prepare_derived_at_open= FALSE;
- table->next_global= save_next_global;
+ /*
+ MERGE engine may adjust table->next_global chain, thus we have to
+ append save_next_global after merge children.
+ */
+ if (save_next_global)
+ {
+ TABLE_LIST *table_list_iterator= table;
+ while (table_list_iterator->next_global)
+ table_list_iterator= table_list_iterator->next_global;
+ table_list_iterator->next_global= save_next_global;
+ save_next_global->prev_global= &table_list_iterator->next_global;
+ }
+
table->next_local= save_next_local;
thd->open_options&= ~extra_open_options;