[MDEV-17309] BACKUP LOCK: DDL locking of tables during backup Created: 2018-09-27  Updated: 2020-05-29  Resolved: 2019-02-04

Status: Closed
Project: MariaDB Server
Component/s: Backup, Locking
Fix Version/s: 10.4.2

Type: Task Priority: Major
Reporter: Sergei Golubchik Assignee: Michael Widenius
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Blocks
blocks MDEV-17308 BACKUP: mariabackup support Closed
PartOf
is part of MDEV-5336 Implement BACKUP STAGE for safe exter... Closed
Relates

 Description   

Implement BACKUP LOCK [database.]table_name and BACKUP UNLOCK

These commands are needed for external backup tools, like mariabackup, to ensure that all files for a table are from the same generation (ie, was created by the same CREATE, RENAME or ALTER TABLE statement).

The typical usage of this by a backup tools is to do the following when copying a table:

  • BACKUP LOCK [database.]table_name
  • Open all files related to a table (for example, test.frm, test.MYI and test.MYD)
  • BACKUP UNLOCK
  • Copy data
  • Close files

The idea is that the BACKUP LOCK should be hold as short time as possible.
The time to take an uncontested lock is very short; While testing on a laptop from a perl program, I was able to do more than 50,000 LOCK + UNLOCK per second.

Other things:

  • Internally BACKUP LOCK is implemented by taking a MDLSHARED_HIGH_PRIO on the table object, which protects the table from any DDL operations.
  • One should use different connections for BACKUP STAGE ... and BACKUP LOCK commands as one should be able to do BACKUP LOCK commands while waiting to get the new BACKUP STAGE lock.


 Comments   
Comment by Michael Widenius [ 2019-02-04 ]

The hours are for Documentation.
Development work was logged in MDEV-5336

Generated at Thu Feb 08 08:35:29 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.