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

            serg Sergei Golubchik created issue -
            serg Sergei Golubchik made changes -
            Field Original Value New Value
            serg Sergei Golubchik made changes -
            serg Sergei Golubchik made changes -
            Assignee Michael Widenius [ monty ]
            monty Michael Widenius made changes -
            Summary BACKUP: fine-grained locking BACKUP LOCK: fine-grained DDL locking
            monty Michael Widenius made changes -
            Description {{BACKUP ...}} syntax and fine grained locking specific to each stage as described in MDEV-5336. 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.

            Internally BACKUP LOCK is implemented by taking a MDLSHARED_HIGH_PRIO on the table object, which protects the table from any DDL operations.
            monty Michael Widenius made changes -
            Summary BACKUP LOCK: fine-grained DDL locking BACKUP LOCK: DDL locking of tables during backup
            monty Michael Widenius added a comment - - edited

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

            monty Michael Widenius added a comment - - edited The hours are for Documentation. Development work was logged in MDEV-5336
            monty Michael Widenius made changes -
            issue.field.resolutiondate 2019-02-04 10:12:28.0 2019-02-04 10:12:28.829
            monty Michael Widenius made changes -
            Fix Version/s 10.4.2 [ 23229 ]
            Fix Version/s 10.4 [ 22408 ]
            Resolution Fixed [ 1 ]
            Status Open [ 1 ] Closed [ 6 ]
            monty Michael Widenius made changes -
            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.

            Internally BACKUP LOCK is implemented by taking a MDLSHARED_HIGH_PRIO on the table object, which protects the table from any DDL operations.
            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.
            GeoffMontee Geoff Montee (Inactive) made changes -
            GeoffMontee Geoff Montee (Inactive) made changes -
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 89794 ] MariaDB v4 [ 133698 ]

            People

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

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.