-
Sergey Vojtovich authored
CRASHES SERVER Flushing of MERGE table or one of its child tables, which was locked by flushing thread using LOCK TABLES, might have caused crashes or assertion failures if the thread failed to reopen child or parent table. Particularly, this might have happened when another connection killed this FLUSH TABLE statement/connection. Also this problem might have occurred when we failed to reopen MERGE table or one of its children when executing DDL statement under LOCK TABLES. The problem was caused by the fact that reopen_tables() might have failed to reopen child table but still tried to reopen, reattach children for and re-lock its parent. Vice versa it might have failed to reopen parent but kept references from children to parent around. Since reopen_tables() closes table it has failed to reopen and therefore frees all associated memory such dangling references led to crashes when followed. This patch solves this problem by ensuring that we always close parent table and all its children if we fail to reopen this table or one of its children. Same happens if we fail to reattach children to parent. Affects 5.1 only.
06fa1ef4