MySQL  8.0.18
Source Code Documentation
sql_backup_lock.h File Reference
#include <sys/types.h>
#include "my_sqlcommand.h"
#include "sql_cmd.h"

Go to the source code of this file.

Classes

class  Sql_cmd_lock_instance
 Sql_cmd_lock_instance represents statement LOCK INSTANCE FOR BACKUP. More...
 
class  Sql_cmd_unlock_instance
 Sql_cmd_unlock_instance represents statement UNLOCK INSTANCE. More...
 

Enumerations

enum  Is_instance_backup_locked_result { Is_instance_backup_locked_result::NOT_LOCKED = 0, Is_instance_backup_locked_result::LOCKED = 1, Is_instance_backup_locked_result::OOM = 2 }
 There are three possible results while checking if the instance is locked for backup. More...
 

Functions

bool acquire_exclusive_backup_lock (THD *thd, unsigned long lock_wait_timeout, bool for_trx)
 Acquire exclusive Backup Lock. More...
 
bool acquire_shared_backup_lock (THD *thd, unsigned long lock_wait_timeout, bool for_trx=true)
 Acquire shared Backup Lock. More...
 
void release_backup_lock (THD *thd)
 Release Backup Lock if it was acquired. More...
 
Is_instance_backup_locked_result is_instance_backup_locked (THD *thd)
 Check if this server instance is locked with Backup Lock. More...
 

Enumeration Type Documentation

◆ Is_instance_backup_locked_result

There are three possible results while checking if the instance is locked for backup.

Enumerator
NOT_LOCKED 
LOCKED 
OOM 

Function Documentation

◆ acquire_exclusive_backup_lock()

bool acquire_exclusive_backup_lock ( THD thd,
unsigned long  lock_wait_timeout,
bool  for_trx 
)

Acquire exclusive Backup Lock.

Parameters
[in]thdCurrent thread context
[in]lock_wait_timeoutHow many seconds to wait before timeout.
[in]for_trxtrue if MDL duration is MDL_TRANSACTION false if MDL duration is MDL_EXPLICIT
Returns
Operation status.
Return values
falseSuccess
trueFailure

◆ acquire_shared_backup_lock()

bool acquire_shared_backup_lock ( THD thd,
unsigned long  lock_wait_timeout,
bool  for_trx = true 
)

Acquire shared Backup Lock.

Parameters
[in]thdCurrent thread context
[in]lock_wait_timeoutHow many seconds to wait before timeout.
[in]for_trxtrue if MDL duration is MDL_TRANSACTION false if MDL duration is MDL_EXPLICIT
Returns
Operation status.
Return values
falseSuccess
trueFailure

◆ 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