MySQL  8.0.27
Source Code Documentation
MDL_context_owner Class Referenceabstract

An interface to separate the MDL module from the THD, and the rest of the server code. More...

#include <mdl.h>

Inheritance diagram for MDL_context_owner:
MDL_context_backup_manager::MDL_context_backup THD

Public Member Functions

virtual ~MDL_context_owner ()=default
 
virtual void enter_cond (mysql_cond_t *cond, mysql_mutex_t *mutex, const PSI_stage_info *stage, PSI_stage_info *old_stage, const char *src_function, const char *src_file, int src_line)=0
 Enter a condition wait. More...
 
virtual void exit_cond (const PSI_stage_info *stage, const char *src_function, const char *src_file, int src_line)=0
 End a wait on a condition. More...
 
virtual int is_killed () const =0
 Has the owner thread been killed? More...
 
virtual bool is_connected ()=0
 Does the owner still have connection to the client? More...
 
virtual bool might_have_commit_order_waiters () const =0
 Indicates that owner thread might have some commit order (non-MDL) waits for it which are still taken into account by MDL deadlock detection, even in cases when it doesn't have any MDL locks acquired and therefore can't have any MDL waiters. More...
 
virtual THDget_thd ()=0
 Within MDL subsystem this one is only used for DEBUG_SYNC. More...
 
virtual void notify_shared_lock (MDL_context_owner *in_use, bool needs_thr_lock_abort)=0
 
virtual bool notify_hton_pre_acquire_exclusive (const MDL_key *mdl_key, bool *victimized)=0
 Notify/get permission from interested storage engines before acquiring exclusive lock for the key. More...
 
virtual void notify_hton_post_release_exclusive (const MDL_key *mdl_key)=0
 Notify interested storage engines that we have just released exclusive lock for the key. More...
 
virtual uint get_rand_seed () const =0
 Get random seed specific to this THD to be used for initialization of PRNG for the MDL_context. More...
 

Detailed Description

An interface to separate the MDL module from the THD, and the rest of the server code.

Constructor & Destructor Documentation

◆ ~MDL_context_owner()

virtual MDL_context_owner::~MDL_context_owner ( )
virtualdefault

Member Function Documentation

◆ enter_cond()

virtual void MDL_context_owner::enter_cond ( mysql_cond_t cond,
mysql_mutex_t mutex,
const PSI_stage_info stage,
PSI_stage_info old_stage,
const char *  src_function,
const char *  src_file,
int  src_line 
)
pure virtual

Enter a condition wait.

For enter_cond() / exit_cond() to work the mutex must be held before enter_cond(); this mutex must then be released before exit_cond(). Usage must be: lock mutex; enter_cond(); your code; unlock mutex; exit_cond().

Parameters
condthe condition to wait on
mutexthe associated mutex
[in]stagethe stage to enter, or NULL
[out]old_stagethe previous stage, or NULL
src_functionfunction name of the caller
src_filefile name of the caller
src_lineline number of the caller
See also
ENTER_COND(), THD::enter_cond()
EXIT_COND(), THD::exit_cond()

Implemented in THD, and MDL_context_backup_manager::MDL_context_backup.

◆ exit_cond()

virtual void MDL_context_owner::exit_cond ( const PSI_stage_info stage,
const char *  src_function,
const char *  src_file,
int  src_line 
)
pure virtual

End a wait on a condition.

Parameters
[in]stagethe new stage to enter
src_functionfunction name of the caller
src_filefile name of the caller
src_lineline number of the caller
See also
ENTER_COND(), THD::enter_cond()
EXIT_COND(), THD::exit_cond()

Implemented in THD, and MDL_context_backup_manager::MDL_context_backup.

◆ get_rand_seed()

virtual uint MDL_context_owner::get_rand_seed ( ) const
pure virtual

Get random seed specific to this THD to be used for initialization of PRNG for the MDL_context.

Implemented in THD, and MDL_context_backup_manager::MDL_context_backup.

◆ get_thd()

virtual THD* MDL_context_owner::get_thd ( )
pure virtual

Within MDL subsystem this one is only used for DEBUG_SYNC.

Do not use it to peek/poke into other parts of THD from MDL. However it is OK to use this method in callbacks provided by SQL-layer to MDL subsystem (since SQL-layer has full access to THD anyway).

Warning
For some derived classes implementation of this method can return nullptr. Calling side must be ready to handle this case.

Implemented in THD, and MDL_context_backup_manager::MDL_context_backup.

◆ is_connected()

virtual bool MDL_context_owner::is_connected ( )
pure virtual

Does the owner still have connection to the client?

Implemented in MDL_context_backup_manager::MDL_context_backup, and THD.

◆ is_killed()

virtual int MDL_context_owner::is_killed ( ) const
pure virtual

Has the owner thread been killed?

Implemented in MDL_context_backup_manager::MDL_context_backup, and THD.

◆ might_have_commit_order_waiters()

virtual bool MDL_context_owner::might_have_commit_order_waiters ( ) const
pure virtual

Indicates that owner thread might have some commit order (non-MDL) waits for it which are still taken into account by MDL deadlock detection, even in cases when it doesn't have any MDL locks acquired and therefore can't have any MDL waiters.

Note
It is important for this check to be non-racy and quick (perhaps at expense of being pretty pessimistic), so it can be used to make decisions reliably about whether we can skip deadlock detection in some cases.

Implemented in THD, and MDL_context_backup_manager::MDL_context_backup.

◆ notify_hton_post_release_exclusive()

virtual void MDL_context_owner::notify_hton_post_release_exclusive ( const MDL_key mdl_key)
pure virtual

Notify interested storage engines that we have just released exclusive lock for the key.

Implemented in THD, and MDL_context_backup_manager::MDL_context_backup.

◆ notify_hton_pre_acquire_exclusive()

virtual bool MDL_context_owner::notify_hton_pre_acquire_exclusive ( const MDL_key mdl_key,
bool *  victimized 
)
pure virtual

Notify/get permission from interested storage engines before acquiring exclusive lock for the key.

The returned argument 'victimized' specify reason for lock not granted. If 'true', lock was refused in an attempt to resolve a possible MDL->GSL deadlock. Locking may then be retried.

Returns
False if notification was successful and it is OK to acquire lock, True if one of SEs asks to abort lock acquisition.

Implemented in THD, and MDL_context_backup_manager::MDL_context_backup.

◆ notify_shared_lock()

virtual void MDL_context_owner::notify_shared_lock ( MDL_context_owner in_use,
bool  needs_thr_lock_abort 
)
pure virtual
See also
THD::notify_shared_lock()

Implemented in THD, and MDL_context_backup_manager::MDL_context_backup.


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