24#ifndef DD__SDI_UTILS_INCLUDED
25#define DD__SDI_UTILS_INCLUDED
36#define ENTITY_FMT "(%s, %llu)"
37#define ENTITY_VAL(obj) (obj).name().c_str(), (obj).id()
102template <
typename CONDITION_HANDLER_CLOS>
107 const char *msg)
override {
108 return m_ch(sql_errno, sqlstate, level, msg);
129template <
typename CH_CLOS,
typename ACTION_CLOS>
138template <
typename P_TYPE,
typename CLOS_TYPE>
139std::unique_ptr<P_TYPE, CLOS_TYPE>
make_guard(P_TYPE *
p, CLOS_TYPE &&clos) {
140 return std::unique_ptr<P_TYPE, CLOS_TYPE>(
p, std::forward<CLOS_TYPE>(clos));
This class represents the interface for internal error handlers.
Definition: error_handler.h:47
bool acquire_lock(MDL_request *mdl_request, Timeout_type lock_wait_timeout)
Acquire one lock with waiting for conflicting locks to go away if needed.
Definition: mdl.cc:3361
A pending metadata lock request.
Definition: mdl.h:802
enum_severity_level
Enumeration value describing the severity of the condition.
Definition: sql_error.h:63
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
MDL_context mdl_context
Definition: sql_class.h:966
bool is_error() const
true if there is an error in the error stack.
Definition: sql_class.h:3281
bool is_system_thread() const
Definition: sql_class.h:2540
Internal_error_handler * pop_internal_handler()
Remove the error handler last pushed.
Definition: sql_class.cc:932
void push_internal_handler(Internal_error_handler *handler)
Add an internal error handler to the thread execution context.
Definition: sql_class.cc:911
System_variables variables
Definition: sql_lexer_thd.h:64
std::atomic< killed_state > killed
Definition: sql_class.h:2721
Class template which derives from Internal_error_handler and overrides handle_condition with the COND...
Definition: sdi_utils.h:103
Closure_error_handler(CONDITION_HANDLER_CLOS &&ch)
Definition: sdi_utils.h:114
bool handle_condition(THD *, uint sql_errno, const char *sqlstate, Sql_condition::enum_severity_level *level, const char *msg) override
Handle a sql condition.
Definition: sdi_utils.h:105
CONDITION_HANDLER_CLOS m_ch
Definition: sdi_utils.h:104
const char * p
Definition: ctype-mb.cc:1235
thread_local THD * current_thd
Definition: current_thd.cc:26
#define MDL_REQUEST_INIT(R, P1, P2, P3, P4, P5)
Definition: mdl.h:906
enum_mdl_duration
Duration of metadata lock.
Definition: mdl.h:333
@ MDL_TRANSACTION
Locks with transaction duration are automatically released at the end of transaction.
Definition: mdl.h:343
bool handle_errors(THD *thd, CH_CLOS &&chc, ACTION_CLOS &&ac)
Set up a custom error handler to use for errors from the execution of a closure.
Definition: sdi_utils.h:130
const T & ptr_as_cref(const T *p)
Definition: sdi_utils.h:92
std::unique_ptr< P_TYPE, CLOS_TYPE > make_guard(P_TYPE *p, CLOS_TYPE &&clos)
Definition: sdi_utils.h:139
bool mdl_lock(THD *thd, MDL_key::enum_mdl_namespace ns, const String_type &schema_name, const String_type &object_name, enum_mdl_type mt=MDL_EXCLUSIVE, enum_mdl_duration md=MDL_TRANSACTION)
Convenience function for obtaining MDL.
Definition: sdi_utils.h:79
bool checked_return(bool ret)
In debug mode, check that a true argument is paired with thd->is_error() or thd->killed being set.
Definition: sdi_utils.h:59
MDL_request * mdl_request(const Import_target &t, MEM_ROOT *mem_root)
Creates an MDL_request for exclusive MDL on the table being imported.
Definition: sdi_api.cc:247
The version of the current data dictionary table definitions.
Definition: dictionary_client.h:43
Char_string_template< String_type_allocator > String_type
Definition: string_type.h:51
Definition: gcs_xcom_synode.h:64
const mysql_service_registry_t * r
Definition: pfs_example_plugin_employee.cc:86
enum_mdl_type
Type of metadata lock request.
Definition: sql_lexer_yacc_state.h:106
@ MDL_EXCLUSIVE
Definition: sql_lexer_yacc_state.h:236
enum_mdl_namespace
Object namespaces.
Definition: mdl.h:400