From ec2c3bf2c1c27e4401c767a6cdcb3172453ff42c Mon Sep 17 00:00:00 2001 From: Konstantin Osipov Date: Tue, 27 Jul 2010 14:25:53 +0400 Subject: A pre-requisite patch for the fix for Bug#52044. This patch also fixes Bug#55452 "SET PASSWORD is replicated twice in RBR mode". The goal of this patch is to remove the release of metadata locks from close_thread_tables(). This is necessary to not mistakenly release the locks in the course of a multi-step operation that involves multiple close_thread_tables() or close_tables_for_reopen(). On the same token, move statement commit outside close_thread_tables(). Other cleanups: Cleanup COM_FIELD_LIST. Don't call close_thread_tables() in COM_SHUTDOWN -- there are no open tables there that can be closed (we leave the locked tables mode in THD destructor, and this close_thread_tables() won't leave it anyway). Make open_and_lock_tables() and open_and_lock_tables_derived() call close_thread_tables() upon failure. Remove the calls to close_thread_tables() that are now unnecessary. Simplify the back off condition in Open_table_context. Streamline metadata lock handling in LOCK TABLES implementation. Add asserts to ensure correct life cycle of statement transaction in a session. Remove a piece of dead code that has also become redundant after the fix for Bug 37521. --- sql/sql_cursor.cc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sql/sql_cursor.cc') diff --git a/sql/sql_cursor.cc b/sql/sql_cursor.cc index ca724ec262f..28d2bd8b4de 100644 --- a/sql/sql_cursor.cc +++ b/sql/sql_cursor.cc @@ -22,6 +22,7 @@ #include "sql_select.h" #include "probes_mysql.h" #include "sql_parse.h" // mysql_execute_command +#include "sql_base.h" /**************************************************************************** Declarations. @@ -523,6 +524,7 @@ Sensitive_cursor::close() thd->derived_tables= derived_tables; thd->lock= lock; + close_thread_tables(thd); /* Is expected to at least close tables and empty thd->change_list */ stmt_arena->cleanup_stmt(); -- cgit v1.2.1