MySQL 8.0.39
Source Code Documentation
Info_schema_error_handler Class Reference

Error handler class to convert ER_LOCK_DEADLOCK error to ER_WARN_I_S_SKIPPED_TABLE/TABLESPACE error. More...

#include <error_handler.h>

Inheritance diagram for Info_schema_error_handler:
[legend]

Public Member Functions

 Info_schema_error_handler (THD *thd, const String *schema_name, const String *table_name)
 Following are implementation of error handler to convert ER_LOCK_DEADLOCK error when executing I_S.TABLES and I_S.FILES system view. More...
 
 Info_schema_error_handler (THD *thd, const String *tablespace_name)
 
bool handle_condition (THD *, uint sql_errno, const char *, Sql_condition::enum_severity_level *, const char *) override
 Handle a sql condition. More...
 
bool is_error_handled () const
 

Private Types

enum class  Mdl_object_type { TABLE , TABLESPACE }
 

Private Attributes

bool m_can_deadlock
 
const Stringm_schema_name
 
const Stringm_table_name
 
const Stringm_tablespace_name
 
Mdl_object_type m_object_type
 
bool m_error_handled = false
 

Additional Inherited Members

- Protected Member Functions inherited from Internal_error_handler
 Internal_error_handler ()
 
Internal_error_handlerprev_internal_handler () const
 
virtual ~Internal_error_handler ()=default
 

Detailed Description

Error handler class to convert ER_LOCK_DEADLOCK error to ER_WARN_I_S_SKIPPED_TABLE/TABLESPACE error.

Handler is pushed for opening a table or acquiring a MDL lock on tables for INFORMATION_SCHEMA views (system views) operations.

Member Enumeration Documentation

◆ Mdl_object_type

Enumerator
TABLE 
TABLESPACE 

Constructor & Destructor Documentation

◆ Info_schema_error_handler() [1/2]

Info_schema_error_handler::Info_schema_error_handler ( THD thd,
const String schema_name,
const String table_name 
)

Following are implementation of error handler to convert ER_LOCK_DEADLOCK error when executing I_S.TABLES and I_S.FILES system view.

◆ Info_schema_error_handler() [2/2]

Info_schema_error_handler::Info_schema_error_handler ( THD thd,
const String tablespace_name 
)

Member Function Documentation

◆ handle_condition()

bool Info_schema_error_handler::handle_condition ( THD thd,
uint  sql_errno,
const char *  sqlstate,
Sql_condition::enum_severity_level level,
const char *  msg 
)
overridevirtual

Handle a sql condition.

This method can be implemented by a subclass to achieve any of the following:

  • mask a warning/error internally, prevent exposing it to the user,
  • mask a warning/error and throw another one instead. When this method returns true, the sql condition is considered 'handled', and will not be propagated to upper layers. It is the responsibility of the code installing an internal handler to then check for trapped conditions, and implement logic to recover from the anticipated conditions trapped during runtime.

This mechanism is similar to C++ try/throw/catch:

  • 'try' correspond to THD::push_internal_handler(),
  • 'throw' correspond to my_error(), which invokes my_message_sql(),
  • 'catch' correspond to checking how/if an internal handler was invoked, before removing it from the exception stack with THD::pop_internal_handler().
Parameters
thdthe calling thread
sql_errnothe error number for the condition raised.
sqlstatethe SQLSTATE for the condition raised.
levelthe severity level for the condition raised.
msgthe error message for the condition raised.
Returns
true if the condition is handled

Implements Internal_error_handler.

◆ is_error_handled()

bool Info_schema_error_handler::is_error_handled ( ) const
inline

Member Data Documentation

◆ m_can_deadlock

bool Info_schema_error_handler::m_can_deadlock
private

◆ m_error_handled

bool Info_schema_error_handler::m_error_handled = false
private

◆ m_object_type

Mdl_object_type Info_schema_error_handler::m_object_type
private

◆ m_schema_name

const String* Info_schema_error_handler::m_schema_name
private

◆ m_table_name

const String* Info_schema_error_handler::m_table_name
private

◆ m_tablespace_name

const String* Info_schema_error_handler::m_tablespace_name
private

The documentation for this class was generated from the following files: