mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
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.
This commit is contained in:
@ -298,13 +298,6 @@ static void run_query(THD *thd, char *buf, char *end,
|
||||
thd_ndb->m_error_code,
|
||||
(int) thd->is_error(), thd->is_slave_error);
|
||||
}
|
||||
|
||||
/*
|
||||
After executing statement we should unlock and close tables open
|
||||
by it as well as release meta-data locks obtained by it.
|
||||
*/
|
||||
close_thread_tables(thd);
|
||||
|
||||
/*
|
||||
XXX: this code is broken. mysql_parse()/mysql_reset_thd_for_next_command()
|
||||
can not be called from within a statement, and
|
||||
@ -2422,7 +2415,11 @@ int ndb_add_ndb_binlog_index(THD *thd, void *_row)
|
||||
}
|
||||
|
||||
add_ndb_binlog_index_err:
|
||||
thd->stmt_da->can_overwrite_status= TRUE;
|
||||
thd->is_error() ? trans_rollback_stmt(thd) : trans_commit_stmt(thd);
|
||||
thd->stmt_da->can_overwrite_status= FALSE;
|
||||
close_thread_tables(thd);
|
||||
thd->mdl_context.release_transactional_locks();
|
||||
ndb_binlog_index= 0;
|
||||
thd->variables.option_bits= saved_options;
|
||||
return error;
|
||||
@ -3969,7 +3966,9 @@ restart:
|
||||
{
|
||||
if (ndb_binlog_index->s->needs_reopen())
|
||||
{
|
||||
trans_commit_stmt(thd);
|
||||
close_thread_tables(thd);
|
||||
thd->mdl_context.release_transactional_locks();
|
||||
ndb_binlog_index= 0;
|
||||
}
|
||||
}
|
||||
@ -4280,7 +4279,9 @@ restart:
|
||||
if (do_ndbcluster_binlog_close_connection == BCCC_restart)
|
||||
{
|
||||
ndb_binlog_tables_inited= FALSE;
|
||||
trans_commit_stmt(thd);
|
||||
close_thread_tables(thd);
|
||||
thd->mdl_context.release_transactional_locks();
|
||||
ndb_binlog_index= 0;
|
||||
goto restart;
|
||||
}
|
||||
@ -4288,7 +4289,11 @@ err:
|
||||
sql_print_information("Stopping Cluster Binlog");
|
||||
DBUG_PRINT("info",("Shutting down cluster binlog thread"));
|
||||
thd->proc_info= "Shutting down";
|
||||
thd->stmt_da->can_overwrite_status= TRUE;
|
||||
thd->is_error() ? trans_rollback_stmt(thd) : trans_commit_stmt(thd);
|
||||
thd->stmt_da->can_overwrite_status= FALSE;
|
||||
close_thread_tables(thd);
|
||||
thd->mdl_context.release_transactional_locks();
|
||||
mysql_mutex_lock(&injector_mutex);
|
||||
/* don't mess with the injector_ndb anymore from other threads */
|
||||
injector_thd= 0;
|
||||
|
Reference in New Issue
Block a user