MySQL 8.0.39
Source Code Documentation
MDL_lock::MDL_lock_strategy Struct Reference

Helper struct which defines how different types of locks are handled for a specific MDL_lock. More...

Public Attributes

bitmap_t m_granted_incompatible [MDL_TYPE_END]
 Compatibility (or rather "incompatibility") matrices for lock types. More...
 
bitmap_t m_waiting_incompatible [4][MDL_TYPE_END]
 Arrays of bitmaps which elements specify which waiting locks are incompatible with the type of lock being requested. More...
 
fast_path_state_t m_unobtrusive_lock_increment [MDL_TYPE_END]
 Array of increments for "unobtrusive" types of lock requests for locks. More...
 
bool m_is_affected_by_max_write_lock_count
 Indicates that locks of this type are affected by the max_write_lock_count limit. More...
 
bool legal_type [MDL_TYPE_END]
 Indicate that a type is legal with this strategy. More...
 
bool(* m_needs_notification )(const MDL_ticket *ticket)
 Pointer to a static method which determines if the type of lock requested requires notification of conflicting locks. More...
 
void(* m_notify_conflicting_locks )(MDL_context *ctx, MDL_lock *lock)
 Pointer to a static method which allows notification of owners of conflicting locks about the fact that a type of lock requiring notification was requested. More...
 
bitmap_t(* m_fast_path_granted_bitmap )(const MDL_lock &lock)
 Pointer to a static method which converts information about locks granted using "fast" path from fast_path_state_t representation to bitmap of lock types. More...
 
bool(* m_needs_connection_check )(const MDL_lock *lock)
 Pointer to a static method which determines if waiting for the lock should be aborted when when connection is lost. More...
 

Detailed Description

Helper struct which defines how different types of locks are handled for a specific MDL_lock.

In practice we use only two strategies: "scoped" lock strategy for locks in GLOBAL, COMMIT, TABLESPACE and SCHEMA namespaces and "object" lock strategy for all other namespaces.

Member Data Documentation

◆ legal_type

bool MDL_lock::MDL_lock_strategy::legal_type[MDL_TYPE_END]

Indicate that a type is legal with this strategy.

Only for asserts and debug-only checks.

◆ m_fast_path_granted_bitmap

bitmap_t(* MDL_lock::MDL_lock_strategy::m_fast_path_granted_bitmap) (const MDL_lock &lock)

Pointer to a static method which converts information about locks granted using "fast" path from fast_path_state_t representation to bitmap of lock types.

◆ m_granted_incompatible

bitmap_t MDL_lock::MDL_lock_strategy::m_granted_incompatible[MDL_TYPE_END]

Compatibility (or rather "incompatibility") matrices for lock types.

Array of bitmaps which elements specify which granted locks are incompatible with the type of lock being requested.

◆ m_is_affected_by_max_write_lock_count

bool MDL_lock::MDL_lock_strategy::m_is_affected_by_max_write_lock_count

Indicates that locks of this type are affected by the max_write_lock_count limit.

◆ m_needs_connection_check

bool(* MDL_lock::MDL_lock_strategy::m_needs_connection_check) (const MDL_lock *lock)

Pointer to a static method which determines if waiting for the lock should be aborted when when connection is lost.

NULL if locks of this type don't require such aborts.

◆ m_needs_notification

bool(* MDL_lock::MDL_lock_strategy::m_needs_notification) (const MDL_ticket *ticket)

Pointer to a static method which determines if the type of lock requested requires notification of conflicting locks.

NULL if there are no lock types requiring notification.

◆ m_notify_conflicting_locks

void(* MDL_lock::MDL_lock_strategy::m_notify_conflicting_locks) (MDL_context *ctx, MDL_lock *lock)

Pointer to a static method which allows notification of owners of conflicting locks about the fact that a type of lock requiring notification was requested.

◆ m_unobtrusive_lock_increment

fast_path_state_t MDL_lock::MDL_lock_strategy::m_unobtrusive_lock_increment[MDL_TYPE_END]

Array of increments for "unobtrusive" types of lock requests for locks.

See also
MDL_lock::get_unobtrusive_lock_increment().

◆ m_waiting_incompatible

bitmap_t MDL_lock::MDL_lock_strategy::m_waiting_incompatible[4][MDL_TYPE_END]

Arrays of bitmaps which elements specify which waiting locks are incompatible with the type of lock being requested.

Basically, each array defines priorities between lock types. We need 4 separate arrays since in order to prevent starvation for some of lock request types, we use different priority matrices: 0) in "normal" situation. 1) in situation when the number of successively granted "piglet" requests exceeds the max_write_lock_count limit. 2) in situation when the number of successively granted "hog" requests exceeds the max_write_lock_count limit. 3) in situation when both "piglet" and "hog" counters exceed limit.


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