Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-4201 LevelDB Storage Engine MS2
  3. MDEV-4375

LevelDB: Auto-increment value is not initialized correctly on non-empty tables

    XMLWordPrintable

Details

    • Technical task
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Won't Fix
    • None
    • None
    • None

    Description

      Auto-increment value is not initialized correctly on non-empty LevelDB tables, e.g
      after server restart (output of test case 1):

      CREATE TABLE t1 (pk INT AUTO_INCREMENT PRIMARY KEY) ENGINE=LevelDB;
      INSERT INTO t1 VALUES (NULL),(NULL);
      # Restart server
      SHOW CREATE TABLE t1;
      Table	Create Table
      t1	CREATE TABLE `t1` (
        `pk` int(11) NOT NULL AUTO_INCREMENT,
        PRIMARY KEY (`pk`)
      ) ENGINE=LEVELDB DEFAULT CHARSET=latin1
      INSERT INTO t1 VALUES (NULL);
      ERROR 23000: Duplicate entry '1' for key 'PRIMARY'

      after ALTER TABLE adding auto-increment (output of test case 2):

      CREATE TABLE t2 (pk INT PRIMARY KEY) ENGINE=LevelDB;
      INSERT INTO t2 VALUES (1),(2);
      ALTER TABLE t2 MODIFY COLUMN pk INT AUTO_INCREMENT;
      SHOW CREATE TABLE t2;
      Table	Create Table
      t2	CREATE TABLE `t2` (
        `pk` int(11) NOT NULL AUTO_INCREMENT,
        PRIMARY KEY (`pk`)
      ) ENGINE=LEVELDB DEFAULT CHARSET=latin1
      INSERT INTO t2 VALUES (NULL);
      ERROR 23000: Duplicate entry '1' for key 'PRIMARY'

      Also, auto-increment doesn't change when an explicit value is inserted into the column (output of test case 3):

      CREATE TABLE t3 (pk INT AUTO_INCREMENT PRIMARY KEY) ENGINE=LevelDB;
      INSERT INTO t3 VALUES (1),(2);
      SHOW CREATE TABLE t3;
      Table	Create Table
      t3	CREATE TABLE `t3` (
        `pk` int(11) NOT NULL AUTO_INCREMENT,
        PRIMARY KEY (`pk`)
      ) ENGINE=LEVELDB DEFAULT CHARSET=latin1
      INSERT INTO t3 VALUES (NULL);
      ERROR 23000: Duplicate entry '1' for key 'PRIMARY'

      Test case #1

      CREATE TABLE t1 (pk INT AUTO_INCREMENT PRIMARY KEY) ENGINE=LevelDB;
      INSERT INTO t1 VALUES (NULL),(NULL);
       
      --echo # Restart server
      --write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
      wait
      EOF
      --shutdown_server
      --append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
      restart
      EOF
      --enable_reconnect
      --source include/wait_until_connected_again.inc
       
      #--connect (con1,localhost,root,,)
      SHOW CREATE TABLE t1;
      INSERT INTO t1 VALUES (NULL);

      Test case #2

      CREATE TABLE t2 (pk INT PRIMARY KEY) ENGINE=LevelDB;
      INSERT INTO t2 VALUES (1),(2);
      ALTER TABLE t2 MODIFY COLUMN pk INT AUTO_INCREMENT;
      SHOW CREATE TABLE t2;
      INSERT INTO t2 VALUES (NULL); 

      Test case #3

      CREATE TABLE t3 (pk INT AUTO_INCREMENT PRIMARY KEY) ENGINE=LevelDB;
      INSERT INTO t3 VALUES (1),(2);
      SHOW CREATE TABLE t3;
      INSERT INTO t3 VALUES (NULL); 

      revision-id: psergey@askmonty.org-20130406172740-fid7u9tkz5ahlc4c
      revno: 4823
      branch-nick: mysql-5.6-leveldb

      Attachments

        Activity

          People

            psergei Sergei Petrunia
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            1 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.