diff options
author | Sergei Golubchik <serg@mariadb.org> | 2020-04-25 12:49:47 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2020-04-27 09:22:36 +0200 |
commit | 6dab094fbd31ef93a1d51b1b9c867188b2f958c3 (patch) | |
tree | bdecc2f8afe50c4c0e1c444e941c8a457efd47a8 /sql | |
parent | a58b2b3b2b564bff9a521c90ab23f850ee9888d3 (diff) | |
download | mariadb-git-6dab094fbd31ef93a1d51b1b9c867188b2f958c3.tar.gz |
MDEV-20257 Server crashes in Grant_table_base::init_read_record upon crash-upgrade
when opening the `user` table separately, reset `thd->open_tables`
for the duration of open, otherwise auto-repair fallback-and-retry
will close *all* tables (but reopen only `user`)
Diffstat (limited to 'sql')
-rw-r--r-- | sql/sql_acl.cc | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 6f403d9ade6..699bd4e3cbc 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -1847,10 +1847,13 @@ class Grant_tables int 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)) + if (!res && (which_tables & Table_user) && !tables[USER_TABLE].table) { uint unused; TABLE_LIST *tl= tables + USER_TABLE; + TABLE *backup_open_tables= thd->open_tables; + thd->set_open_tables(NULL); + tl->init_one_table(&MYSQL_SCHEMA_NAME, &MYSQL_TABLE_NAME_USER, NULL, lock_type); tl->open_type= OT_BASE_ONLY; @@ -1859,6 +1862,12 @@ class Grant_tables p_user_table= &m_user_table_tabular; counter++; res= really_open(thd, tl, &unused); + thd->set_open_tables(backup_open_tables); + if (tables[USER_TABLE].table) + { + tables[USER_TABLE].table->next= backup_open_tables; + thd->set_open_tables(tables[USER_TABLE].table); + } } if (res) DBUG_RETURN(res); |