Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-17309

BACKUP LOCK: DDL locking of tables during backup

    Details

      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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                monty Michael Widenius
                Reporter:
                serg Sergei Golubchik
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: