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

mariadb-dump --lock-tables doesn't work with tables that are using sequences.

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.5(EOL)
    • 10.6
    • None
    • None

    Description

      mariadb-dump --lock-tables doesn't work with tables that uses sequences.

      Here is an example of a dump that one cannot restore:

      --
      -- Sequence structure for `seq_audittrail`
      --
       
      DROP SEQUENCE IF EXISTS `seq_audittrail`;
      CREATE SEQUENCE `seq_audittrail` start with 0 minvalue 0 maxvalue 9223372036854775806 increment by 1 cache 1 nocycle ENGINE=InnoDB;
      SELECT SETVAL(`seq_audittrail`, 3, 0);
       
      --
      -- Table structure for table `audittrail`
      --
       
      DROP TABLE IF EXISTS `audittrail`;
      /*!40101 SET @saved_cs_client     = @@character_set_client */;
      /*!40101 SET character_set_client = utf8 */;
      CREATE TABLE `audittrail` (
        `audittrail_key` bigint(20) unsigned NOT NULL DEFAULT nextval(`foo`.`seq_audittrail`),
        `message` text DEFAULT NULL,
        PRIMARY KEY (`audittrail_key`)
      ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
      /*!40101 SET character_set_client = @saved_cs_client */;
       
      --
      -- Dumping data for table `audittrail`
      --
       
      LOCK TABLES `audittrail` WRITE;
      /*!40000 ALTER TABLE `audittrail` DISABLE KEYS */;
      INSERT INTO `audittrail` VALUES
      (0,'FOO'),
      (1,'BAR'),
      (2,'BAZ');
      /*!40000 ALTER TABLE `audittrail` ENABLE KEYS */;
      UNLOCK TABLES;
      

      The fix is to also add any used sequences to the LOCK TABLE

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              monty Michael Widenius
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

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