MySQL  8.0.27
Source Code Documentation
sql_backup_lock.cc File Reference
#include "sql_backup_lock.h"
#include <utility>
#include "m_string.h"
#include "my_dbug.h"
#include "my_inttypes.h"
#include "my_sys.h"
#include "mysqld_error.h"
#include "sql/auth/sql_security_ctx.h"
#include "sql/mdl.h"
#include "sql/system_variables.h"
#include "sql_class.h"

Classes

class  Release_all_backup_locks
 MDL_release_locks_visitor subclass to release MDL for BACKUP_LOCK. More...
 

Functions

static bool check_backup_admin_privilege (THD *thd)
 Check if a current user has the privilege BACKUP_ADMIN required to run the statement LOCK INSTANCE FOR BACKUP. More...
 
static bool acquire_mdl_for_backup (THD *thd, enum_mdl_type mdl_type, enum_mdl_duration mdl_duration, ulong lock_wait_timeout)
 Acquire either exclusive or shared Backup Lock. More...
 
void release_backup_lock (THD *thd)
 Release Backup Lock if it was acquired. More...
 
bool acquire_exclusive_backup_lock (THD *thd, ulong lock_wait_timeout, bool for_trx)
 
bool acquire_shared_backup_lock (THD *thd, ulong lock_wait_timeout, bool for_trx)
 
Is_instance_backup_locked_result is_instance_backup_locked (THD *thd)
 Check if this server instance is locked with Backup Lock. More...
 

Function Documentation

◆ acquire_exclusive_backup_lock()

bool acquire_exclusive_backup_lock ( THD thd,
ulong  lock_wait_timeout,
bool  for_trx 
)

◆ acquire_mdl_for_backup()

static bool acquire_mdl_for_backup ( THD thd,
enum_mdl_type  mdl_type,
enum_mdl_duration  mdl_duration,
ulong  lock_wait_timeout 
)
static

Acquire either exclusive or shared Backup Lock.

Parameters
[in]thdCurrent thread context
[in]mdl_typeType of metadata lock to acquire for backup
[in]mdl_durationDuration of metadata lock
[in]lock_wait_timeoutHow many seconds to wait before timeout.
Returns
Operation status.
Return values
falseSuccess
trueFailure

◆ acquire_shared_backup_lock()

bool acquire_shared_backup_lock ( THD thd,
ulong  lock_wait_timeout,
bool  for_trx 
)

◆ check_backup_admin_privilege()

static bool check_backup_admin_privilege ( THD thd)
static

Check if a current user has the privilege BACKUP_ADMIN required to run the statement LOCK INSTANCE FOR BACKUP.

Parameters
thdCurrent thread
Return values
falseA user has the privilege BACKUP_ADMIN
trueA user doesn't have the privilege BACKUP_ADMIN

◆ is_instance_backup_locked()

Is_instance_backup_locked_result is_instance_backup_locked ( THD thd)

Check if this server instance is locked with Backup Lock.

In fact, it checks if any thread owns BACKUP_LOCK.

Parameters
[in]thdCurrent thread context
Return values
NOT_LOCKEDBackup Lock is not acquired by any thread.
LOCKEDBackup Lock is acquired by a thread.
OOMError occurred (OOM) when checking lock ownership.

◆ release_backup_lock()

void release_backup_lock ( THD thd)

Release Backup Lock if it was acquired.

Parameters
[in]thdCurrent thread context