1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Merge branch '10.4' into 10.5

This commit is contained in:
Dmitry Shulga
2023-09-05 12:41:49 +07:00
9 changed files with 210 additions and 22 deletions

View File

@ -4902,7 +4902,8 @@ try_acquire_high_prio_shared_mdl_lock(THD *thd, TABLE_LIST *table,
open_tables function for this table
*/
static int fill_schema_table_from_frm(THD *thd, TABLE *table,
static int fill_schema_table_from_frm(THD *thd, MEM_ROOT *mem_root,
TABLE *table,
ST_SCHEMA_TABLE *schema_table,
LEX_CSTRING *db_name,
LEX_CSTRING *table_name,
@ -4914,6 +4915,9 @@ static int fill_schema_table_from_frm(THD *thd, TABLE *table,
TABLE_LIST table_list;
uint res= 0;
char db_name_buff[NAME_LEN + 1], table_name_buff[NAME_LEN + 1];
Query_arena i_s_arena(mem_root, Query_arena::STMT_CONVENTIONAL_EXECUTION);
Query_arena backup_arena, *old_arena;
bool i_s_arena_active= false;
bzero((char*) &table_list, sizeof(TABLE_LIST));
bzero((char*) &tbl, sizeof(TABLE));
@ -4988,6 +4992,11 @@ static int fill_schema_table_from_frm(THD *thd, TABLE *table,
goto end;
}
old_arena= thd->stmt_arena;
thd->stmt_arena= &i_s_arena;
thd->set_n_backup_active_arena(&i_s_arena, &backup_arena);
i_s_arena_active= true;
share= tdc_acquire_share(thd, &table_list, GTS_TABLE | GTS_VIEW);
if (!share)
{
@ -5069,7 +5078,16 @@ end:
savepoint is safe.
*/
DBUG_ASSERT(thd->open_tables == NULL);
thd->mdl_context.rollback_to_savepoint(open_tables_state_backup->mdl_system_tables_svp);
if (i_s_arena_active)
{
thd->stmt_arena= old_arena;
thd->restore_active_arena(&i_s_arena, &backup_arena);
i_s_arena.free_items();
}
if (!thd->is_fatal_error)
thd->clear_error();
return res;
@ -5298,7 +5316,8 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
if (!(table_open_method & ~OPEN_FRM_ONLY) &&
db_name != &INFORMATION_SCHEMA_NAME)
{
if (!fill_schema_table_from_frm(thd, table, schema_table,
if (!fill_schema_table_from_frm(thd, &tmp_mem_root,
table, schema_table,
db_name, table_name,
&open_tables_state_backup,
can_deadlock))