summaryrefslogtreecommitdiff
path: root/sql/sql_base.h
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
commit41caa7f4835bbcf45e4cdc6f5f0b17f1c8b088a2 (patch)
tree4a3551908e155c4899060a18d6a50d7503684f41 /sql/sql_base.h
parentf2123f34e3c0b9315626406786293a5fafa2fc13 (diff)
downloadmariadb-git-41caa7f4835bbcf45e4cdc6f5f0b17f1c8b088a2.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. 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().
Diffstat (limited to 'sql/sql_base.h')
-rw-r--r--sql/sql_base.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/sql/sql_base.h b/sql/sql_base.h
index 7a6f18545ad..ab11e939a50 100644
--- a/sql/sql_base.h
+++ b/sql/sql_base.h
@@ -526,4 +526,34 @@ private:
};
+/**
+ This internal handler is used to trap ER_NO_SUCH_TABLE.
+*/
+
+class No_such_table_error_handler : public Internal_error_handler
+{
+public:
+ No_such_table_error_handler()
+ : m_handled_errors(0), m_unhandled_errors(0)
+ {}
+
+ bool handle_condition(THD *thd,
+ uint sql_errno,
+ const char* sqlstate,
+ MYSQL_ERROR::enum_warning_level level,
+ const char* msg,
+ MYSQL_ERROR ** cond_hdl);
+
+ /**
+ Returns TRUE if one or more ER_NO_SUCH_TABLE errors have been
+ trapped and no other errors have been seen. FALSE otherwise.
+ */
+ bool safely_trapped_errors();
+
+private:
+ int m_handled_errors;
+ int m_unhandled_errors;
+};
+
+
#endif /* SQL_BASE_INCLUDED */