mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
Merge 10.11 into 11.0
This commit is contained in:
@@ -814,8 +814,10 @@ int close_thread_tables(THD *thd)
|
||||
{
|
||||
TABLE *table;
|
||||
int error= 0;
|
||||
PSI_stage_info org_stage;
|
||||
DBUG_ENTER("close_thread_tables");
|
||||
|
||||
thd->backup_stage(&org_stage);
|
||||
THD_STAGE_INFO(thd, stage_closing_tables);
|
||||
|
||||
#ifdef EXTRA_DEBUG
|
||||
@@ -931,7 +933,10 @@ int close_thread_tables(THD *thd)
|
||||
we will exit this function a few lines below.
|
||||
*/
|
||||
if (! thd->lex->requires_prelocking())
|
||||
DBUG_RETURN(0);
|
||||
{
|
||||
error= 0;
|
||||
goto end;
|
||||
}
|
||||
|
||||
/*
|
||||
We are in the top-level statement of a prelocked statement,
|
||||
@@ -942,7 +947,10 @@ int close_thread_tables(THD *thd)
|
||||
thd->locked_tables_mode= LTM_LOCK_TABLES;
|
||||
|
||||
if (thd->locked_tables_mode == LTM_LOCK_TABLES)
|
||||
DBUG_RETURN(0);
|
||||
{
|
||||
error= 0;
|
||||
goto end;
|
||||
}
|
||||
|
||||
thd->leave_locked_tables_mode();
|
||||
|
||||
@@ -971,6 +979,8 @@ int close_thread_tables(THD *thd)
|
||||
while (thd->open_tables)
|
||||
(void) close_thread_table(thd, &thd->open_tables);
|
||||
|
||||
end:
|
||||
THD_STAGE_INFO(thd, org_stage);
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
|
||||
@@ -5006,6 +5016,9 @@ prepare_fk_prelocking_list(THD *thd, Query_tables_list *prelocking_ctx,
|
||||
Query_arena *arena, backup;
|
||||
TABLE *table= table_list->table;
|
||||
|
||||
if (!table->file->referenced_by_foreign_key())
|
||||
DBUG_RETURN(FALSE);
|
||||
|
||||
arena= thd->activate_stmt_arena_if_needed(&backup);
|
||||
|
||||
table->file->get_parent_foreign_key_list(thd, &fk_list);
|
||||
@@ -5091,16 +5104,12 @@ bool DML_prelocking_strategy::handle_table(THD *thd,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (table->file->referenced_by_foreign_key())
|
||||
{
|
||||
if (prepare_fk_prelocking_list(thd, prelocking_ctx, table_list,
|
||||
need_prelocking,
|
||||
table_list->trg_event_map))
|
||||
return TRUE;
|
||||
}
|
||||
if (prepare_fk_prelocking_list(thd, prelocking_ctx, table_list,
|
||||
need_prelocking,
|
||||
table_list->trg_event_map))
|
||||
return TRUE;
|
||||
}
|
||||
else if (table_list->slave_fk_event_map &&
|
||||
table->file->referenced_by_foreign_key())
|
||||
else if (table_list->slave_fk_event_map)
|
||||
{
|
||||
if (prepare_fk_prelocking_list(thd, prelocking_ctx, table_list,
|
||||
need_prelocking,
|
||||
|
Reference in New Issue
Block a user