Browse Source

MDEV-34388 Alpine Stack Overflow - reduce Grant_tables::open_and_lock

The stacksize was still too large. Back port from the 10.11 merge
commit 1c7209e828
pull/4061/head
Marko Mäkelä 5 months ago
committed by Daniel Black
parent
commit
5012402330
  1. 27
      sql/sql_acl.cc

27
sql/sql_acl.cc

@ -2012,13 +2012,25 @@ class Grant_tables
{
DBUG_ENTER("Grant_tables::open_and_lock");
TABLE_LIST tables[USER_TABLE+1], *first= NULL;
TABLE_LIST *first= nullptr, *tables=
static_cast<TABLE_LIST*>(my_malloc(PSI_NOT_INSTRUMENTED,
(USER_TABLE + 1) * sizeof *tables,
MYF(MY_WME)));
int res= -1;
if (!tables)
{
func_exit:
my_free(tables);
DBUG_RETURN(res);
}
if (build_table_list(thd, &first, which_tables, lock_type, tables))
DBUG_RETURN(-1);
goto func_exit;
uint counter;
int res= really_open(thd, first, &counter);
res= really_open(thd, first, &counter);
/* if User_table_json wasn't found, let's try User_table_tabular */
if (!res && (which_tables & Table_user) && !tables[USER_TABLE].table)
@ -2044,12 +2056,15 @@ class Grant_tables
}
}
if (res)
DBUG_RETURN(res);
goto func_exit;
if (lock_tables(thd, first, counter,
MYSQL_LOCK_IGNORE_TIMEOUT |
MYSQL_OPEN_IGNORE_LOGGING_FORMAT))
DBUG_RETURN(-1);
{
res= -1;
goto func_exit;
}
p_user_table->set_table(tables[USER_TABLE].table);
m_db_table.set_table(tables[DB_TABLE].table);
@ -2059,7 +2074,7 @@ class Grant_tables
m_procs_priv_table.set_table(tables[PROCS_PRIV_TABLE].table);
m_proxies_priv_table.set_table(tables[PROXIES_PRIV_TABLE].table);
m_roles_mapping_table.set_table(tables[ROLES_MAPPING_TABLE].table);
DBUG_RETURN(0);
goto func_exit;
}
inline const User_table& user_table() const

Loading…
Cancel
Save