mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
Merge 10.2 into 10.3
This commit is contained in:
@ -484,7 +484,7 @@ err_with_reopen:
|
||||
old locks. This should always succeed (unless some external process
|
||||
has removed the tables)
|
||||
*/
|
||||
if (thd->locked_tables_list.reopen_tables(thd))
|
||||
if (thd->locked_tables_list.reopen_tables(thd, false))
|
||||
result= true;
|
||||
/*
|
||||
Since downgrade_lock() won't do anything with shared
|
||||
@ -811,7 +811,10 @@ void close_thread_tables(THD *thd)
|
||||
we will exit this function a few lines below.
|
||||
*/
|
||||
if (! thd->lex->requires_prelocking())
|
||||
{
|
||||
thd->locked_tables_list.reopen_tables(thd, true);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
/*
|
||||
We are in the top-level statement of a prelocked statement,
|
||||
@ -2298,7 +2301,8 @@ void Locked_tables_list::unlink_from_list(THD *thd,
|
||||
If mode is not LTM_LOCK_TABLES, we needn't do anything. Moreover,
|
||||
outside this mode pos_in_locked_tables value is not trustworthy.
|
||||
*/
|
||||
if (thd->locked_tables_mode != LTM_LOCK_TABLES)
|
||||
if (thd->locked_tables_mode != LTM_LOCK_TABLES &&
|
||||
thd->locked_tables_mode != LTM_PRELOCKED_UNDER_LOCK_TABLES)
|
||||
return;
|
||||
|
||||
/*
|
||||
@ -2402,7 +2406,7 @@ unlink_all_closed_tables(THD *thd, MYSQL_LOCK *lock, size_t reopen_count)
|
||||
*/
|
||||
|
||||
bool
|
||||
Locked_tables_list::reopen_tables(THD *thd)
|
||||
Locked_tables_list::reopen_tables(THD *thd, bool need_reopen)
|
||||
{
|
||||
Open_table_context ot_ctx(thd, MYSQL_OPEN_REOPEN);
|
||||
uint reopen_count= 0;
|
||||
@ -2413,8 +2417,20 @@ Locked_tables_list::reopen_tables(THD *thd)
|
||||
for (TABLE_LIST *table_list= m_locked_tables;
|
||||
table_list; table_list= table_list->next_global)
|
||||
{
|
||||
if (table_list->table) /* The table was not closed */
|
||||
continue;
|
||||
if (need_reopen)
|
||||
{
|
||||
if (!table_list->table || !table_list->table->needs_reopen())
|
||||
continue;
|
||||
/* no need to remove the table from the TDC here, thus (TABLE*)1 */
|
||||
close_all_tables_for_name(thd, table_list->table->s,
|
||||
HA_EXTRA_NOT_USED, (TABLE*)1);
|
||||
DBUG_ASSERT(table_list->table == NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (table_list->table) /* The table was not closed */
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Links into thd->open_tables upon success */
|
||||
if (open_table(thd, table_list, &ot_ctx))
|
||||
@ -7253,7 +7269,7 @@ bool setup_fields(THD *thd, Ref_ptr_array ref_pointer_array,
|
||||
List<Item> *sum_func_list, List<Item> *pre_fix,
|
||||
bool allow_sum_func)
|
||||
{
|
||||
reg2 Item *item;
|
||||
Item *item;
|
||||
enum_column_usage saved_column_usage= thd->column_usage;
|
||||
nesting_map save_allow_sum_func= thd->lex->allow_sum_func;
|
||||
List_iterator<Item> it(fields);
|
||||
|
Reference in New Issue
Block a user