mirror of
https://github.com/MariaDB/server.git
synced 2026-05-05 06:35:33 +02:00
Bug #56085 Embedded server tests fails with assert in
check_if_table_exists() This assert was triggered when the server tried to load plugins while running in embedded server mode. In embedded server mode, check_if_table_exists() was used to check if mysql.plugin existed so that ER_NO_SUCH_TABLE could be silently ignored. The problem was that this check was done without acquiring a metadata lock on mysql.plugin first. This triggered the assert. This patch fixes the problem by removing the call to check_if_table_exists() from plugin_load(). Instead an error handler which traps ER_NO_SUCH_TABLE is installed before trying to open mysql.plugin when running in embedded server mode. No test coverage added since this assert was triggered by existing tests running in embedded server mode. sql/sql_base.cc: Renamed Prelock_error_handler to No_such_table_error_handler and moved the declaration to sql_base.h to make it usable in plugin_load(). sql/sql_base.h: Renamed Prelock_error_handler to No_such_table_error_handler and moved the declaration to sql_base.h to make it usable in plugin_load(). sql/sql_plugin.cc: Removed call to check_if_table_exists() used to check for mysql.plugin in plugin_load() for embedded server. Instead install error handler which traps ER_NO_SUCH_TABLE during open_and_lock_tables().
This commit is contained in:
parent
f2123f34e3
commit
41caa7f483
3 changed files with 51 additions and 44 deletions
|
|
@ -1393,8 +1393,9 @@ static void plugin_load(MEM_ROOT *tmp_root, int *argc, char **argv)
|
|||
READ_RECORD read_record_info;
|
||||
int error;
|
||||
THD *new_thd= &thd;
|
||||
bool result;
|
||||
#ifdef EMBEDDED_LIBRARY
|
||||
bool table_exists;
|
||||
No_such_table_error_handler error_handler;
|
||||
#endif /* EMBEDDED_LIBRARY */
|
||||
DBUG_ENTER("plugin_load");
|
||||
|
||||
|
|
@ -1410,13 +1411,18 @@ static void plugin_load(MEM_ROOT *tmp_root, int *argc, char **argv)
|
|||
When building an embedded library, if the mysql.plugin table
|
||||
does not exist, we silently ignore the missing table
|
||||
*/
|
||||
if (check_if_table_exists(new_thd, &tables, &table_exists))
|
||||
table_exists= FALSE;
|
||||
if (!table_exists)
|
||||
new_thd->push_internal_handler(&error_handler);
|
||||
#endif /* EMBEDDED_LIBRARY */
|
||||
|
||||
result= open_and_lock_tables(new_thd, &tables, FALSE, MYSQL_LOCK_IGNORE_TIMEOUT);
|
||||
|
||||
#ifdef EMBEDDED_LIBRARY
|
||||
new_thd->pop_internal_handler();
|
||||
if (error_handler.safely_trapped_errors())
|
||||
goto end;
|
||||
#endif /* EMBEDDED_LIBRARY */
|
||||
|
||||
if (open_and_lock_tables(new_thd, &tables, FALSE, MYSQL_LOCK_IGNORE_TIMEOUT))
|
||||
if (result)
|
||||
{
|
||||
DBUG_PRINT("error",("Can't open plugin table"));
|
||||
sql_print_error("Can't open the mysql.plugin table. Please "
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue