summaryrefslogtreecommitdiff
path: root/sql/sql_plugin.cc
diff options
context:
space:
mode:
authorJon Olav Hauglid <jon.hauglid@oracle.com>2010-08-19 11:33:37 +0200
committerJon Olav Hauglid <jon.hauglid@oracle.com>2010-08-19 11:33:37 +0200
commitb02f5dd8bc3ff5cdc67c2e6c3024141f4eb58986 (patch)
tree4a3551908e155c4899060a18d6a50d7503684f41 /sql/sql_plugin.cc
parent8f36eaa11e27a2d06669f2f2f967a5359f53bc88 (diff)
downloadmariadb-git-b02f5dd8bc3ff5cdc67c2e6c3024141f4eb58986.tar.gz
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.
Diffstat (limited to 'sql/sql_plugin.cc')
-rw-r--r--sql/sql_plugin.cc16
1 files changed, 11 insertions, 5 deletions
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index e3323260373..0020741b78f 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -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 "