MySQL 8.0.39
Source Code Documentation
locking_service.cc File Reference
#include "sql/locking_service.h"
#include <string.h>
#include <sys/types.h>
#include "my_inttypes.h"
#include "my_macros.h"
#include "my_sys.h"
#include "mysql/service_parser.h"
#include "mysqld_error.h"
#include "sql/current_thd.h"
#include "sql/error_handler.h"
#include "sql/mdl.h"
#include "sql/sql_class.h"
#include "sql/sql_error.h"

Classes

class  Locking_service_deadlock_error_handler
 We want to convert ER_LOCK_DEADLOCK error to ER_LOCK_SERVICE_DEADLOCK error. More...
 
class  Release_all_locking_service_locks
 
class  Release_locking_service_locks
 

Functions

static bool check_lock_name (const char *name)
 Check if the given name has valid length. More...
 
int acquire_locking_service_locks (MYSQL_THD opaque_thd, const char *lock_namespace, const char **lock_names, size_t lock_num, enum_locking_service_lock_type lock_type, Timeout_type lock_timeout)
 Acquire locking service locks. More...
 
int release_locking_service_locks (MYSQL_THD opaque_thd, const char *lock_namespace)
 Release all lock service locks taken by the given connection in the given namespace. More...
 
void release_all_locking_service_locks (THD *thd)
 Release all locking service locks taken by the given connection in all namespaces. More...
 
int mysql_acquire_locking_service_locks (MYSQL_THD opaque_thd, const char *lock_namespace, const char **lock_names, size_t lock_num, enum_locking_service_lock_type lock_type, Timeout_type lock_timeout)
 
int mysql_release_locking_service_locks (MYSQL_THD opaque_thd, const char *lock_namespace)
 

Variables

static const size_t MAX_LOCKING_SERVICE_LOCK_NAME_LENGTH = 64
 

Function Documentation

◆ acquire_locking_service_locks()

int acquire_locking_service_locks ( MYSQL_THD  opaque_thd,
const char *  lock_namespace,
const char **  lock_names,
size_t  lock_num,
enum enum_locking_service_lock_type  lock_type,
Timeout_type  lock_timeout 
)

Acquire locking service locks.

Parameters
opaque_thdThread handle. If NULL, current_thd will be used.
lock_namespaceNamespace of the locks to acquire.
lock_namesArray of names of the locks to acquire.
lock_numNumber of elements in 'lock_names'.
lock_typeLock type to acquire. LOCKING_SERVICE_READ or _WRITE.
lock_timeoutNumber of seconds to wait before giving up.
Return values
1Acquisition failed, error has been reported.
0Acquisition successful, all locks acquired.
Note
both lock_namespace and lock_names are limited to 64 characters max. Names are compared using binary comparison.

◆ check_lock_name()

static bool check_lock_name ( const char *  name)
inlinestatic

Check if the given name has valid length.

Parameters
nameName to check (namespace or lock)
Return values
trueif invalid, false otherwise.

◆ mysql_acquire_locking_service_locks()

int mysql_acquire_locking_service_locks ( MYSQL_THD  opaque_thd,
const char *  lock_namespace,
const char **  lock_names,
size_t  lock_num,
enum_locking_service_lock_type  lock_type,
Timeout_type  lock_timeout 
)

◆ mysql_release_locking_service_locks()

int mysql_release_locking_service_locks ( MYSQL_THD  opaque_thd,
const char *  lock_namespace 
)

◆ release_all_locking_service_locks()

void release_all_locking_service_locks ( THD thd)

Release all locking service locks taken by the given connection in all namespaces.

Parameters
thdThread handle.

◆ release_locking_service_locks()

int release_locking_service_locks ( MYSQL_THD  opaque_thd,
const char *  lock_namespace 
)

Release all lock service locks taken by the given connection in the given namespace.

Parameters
opaque_thdThread handle. If NULL, current_thd will be used.
lock_namespaceNamespace of the locks to release.
Return values
1Release failed, error has been reported.
0Release successful, all locks acquired.

Variable Documentation

◆ MAX_LOCKING_SERVICE_LOCK_NAME_LENGTH

const size_t MAX_LOCKING_SERVICE_LOCK_NAME_LENGTH = 64
static