MySQL 9.0.0
Source Code Documentation
sync0debug.h File Reference

Debug checks for latches, header file. More...

#include "sync0types.h"
#include <string>
#include <vector>

Go to the source code of this file.

Classes

class  Sync_point
 For handling sync points in child threads spawned by a foreground thread. More...
 

Functions

void sync_check_init (size_t max_threads)
 Initializes the synchronization data structures. More...
 
void sync_check_close ()
 Frees the resources in synchronization data structures. More...
 
void sync_check_enable ()
 Enable sync order checking. More...
 
void sync_check_lock_validate (const latch_t *latch)
 Check if it is OK to acquire the latch. More...
 
void sync_check_lock_granted (const latch_t *latch)
 Note that the lock has been granted. More...
 
void sync_check_lock (const latch_t *latch, latch_level_t level)
 Check if it is OK to acquire the latch. More...
 
void sync_check_relock (const latch_t *latch)
 Check if it is OK to re-acquire the lock. More...
 
void sync_check_unlock (const latch_t *latch)
 Removes a latch from the thread level array if it is found there. More...
 
const latch_tsync_check_find (latch_level_t level)
 Checks if the level array for the current thread contains a mutex or rw-latch at the specified level. More...
 
bool sync_check_iterate (sync_check_functor_t &functor)
 Checks that the level array for the current thread is empty. More...
 
void rw_lock_debug_mutex_enter ()
 Acquires the debug mutex. More...
 
void rw_lock_debug_mutex_exit ()
 Releases the debug mutex. More...
 

Detailed Description

Debug checks for latches, header file.

Created 2012-08-21 Sunny Bains

Function Documentation

◆ rw_lock_debug_mutex_enter()

void rw_lock_debug_mutex_enter ( )

Acquires the debug mutex.

We cannot use the mutex defined in sync0sync, because the debug mutex is also acquired in sync0arr while holding the OS mutex protecting the sync array, and the ordinary mutex_enter might recursively call routines in sync0arr, leading to a deadlock on the OS mutex.

◆ rw_lock_debug_mutex_exit()

void rw_lock_debug_mutex_exit ( )

Releases the debug mutex.

◆ sync_check_close()

void sync_check_close ( )

Frees the resources in synchronization data structures.

Frees the resources in synchronization data structures.

Use os_sync_free() after calling this.

◆ sync_check_enable()

void sync_check_enable ( )

Enable sync order checking.

Note: We don't enforce any synchronisation checks. The caller must ensure that no races can occur

◆ sync_check_find()

const latch_t * sync_check_find ( latch_level_t  level)

Checks if the level array for the current thread contains a mutex or rw-latch at the specified level.

Parameters
[in]levelto find
Returns
a matching latch, or NULL if not found

◆ sync_check_init()

void sync_check_init ( size_t  max_threads)

Initializes the synchronization data structures.

Parameters
[in]max_threadsMaximum threads that can be created.

For collecting latch statistic - SHOW ... MUTEX

For trcking mutex creation location

◆ sync_check_iterate()

bool sync_check_iterate ( sync_check_functor_t functor)

Checks that the level array for the current thread is empty.

Terminate iteration if the functor returns true.

Parameters
[in,out]functorcalled for each element.
Returns
true if the functor returns true

◆ sync_check_lock()

void sync_check_lock ( const latch_t latch,
latch_level_t  level 
)

Check if it is OK to acquire the latch.

Parameters
[in]latchlatch type
[in]levelthe level of the mutex

◆ sync_check_lock_granted()

void sync_check_lock_granted ( const latch_t latch)

Note that the lock has been granted.

Parameters
[in]latchlatch type

◆ sync_check_lock_validate()

void sync_check_lock_validate ( const latch_t latch)

Check if it is OK to acquire the latch.

Parameters
[in]latchlatch type

◆ sync_check_relock()

void sync_check_relock ( const latch_t latch)

Check if it is OK to re-acquire the lock.

Parameters
[in]latchRW-LOCK to relock (recursive X locks)

◆ sync_check_unlock()

void sync_check_unlock ( const latch_t latch)

Removes a latch from the thread level array if it is found there.

Parameters
[in]latchThe latch to unlock