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

LP:997397 - TRUNCATE on a partitioned Aria table does not reset AUTO_INCREMENT

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 5.3.9
    • Fix Version/s: 5.3.13, 5.2.15, 5.1.73, 5.5
    • Component/s: None
    • Labels:

      Description

      TRUNCATE TABLE on an Aria table does not reset auto-increment value as it does for other engines, including MyISAM and InnoDB.
      (see http://kb.askmonty.org/en/truncate-table or http://dev.mysql.com/doc/refman/5.5/en/truncate-table.html)

      Reproducible on current MariaDB 5.1 - 5.5.

      Test case:

      CREATE TABLE t ( i INT NOT NULL AUTO_INCREMENT, KEY(i) )
        ENGINE=Aria
        PARTITION BY HASH(i) PARTITIONS 2;
      INSERT INTO t VALUES (NULL),(NULL),(NULL);
      
      SHOW CREATE TABLE t;
      SELECT * FROM t;
      TRUNCATE TABLE t;
      SHOW CREATE TABLE t;
      INSERT INTO t VALUES (NULL),(NULL);
      SELECT * FROM t;
      
      DROP TABLE t;
      
      

      Expected output (after truncate):

      TRUNCATE TABLE t;
      SHOW CREATE TABLE t;
      Table	Create Table
      t	CREATE TABLE `t` (
        `i` int(11) NOT NULL AUTO_INCREMENT,
        KEY `i` (`i`)
      ) ENGINE=Aria DEFAULT CHARSET=latin1
      /*!50100 PARTITION BY HASH (i)
      PARTITIONS 2 */
      INSERT INTO t VALUES (NULL),(NULL);
      SELECT * FROM t;
      i
      1
      2
      

      Actual output (after truncate):

      TRUNCATE TABLE t;
      SHOW CREATE TABLE t;
      Table	Create Table
      t	CREATE TABLE `t` (
        `i` int(11) NOT NULL AUTO_INCREMENT,
        KEY `i` (`i`)
      ) ENGINE=Aria AUTO_INCREMENT=4 DEFAULT CHARSET=latin1
      /*!50100 PARTITION BY HASH (i)
      PARTITIONS 2 */
      INSERT INTO t VALUES (NULL),(NULL);
      SELECT * FROM t;
      i
      4
      5
      

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            ratzpo Rasmus Johansson added a comment -

            Launchpad bug id: 997397

            Show
            ratzpo Rasmus Johansson added a comment - Launchpad bug id: 997397

              People

              • Assignee:
                monty Michael Widenius
                Reporter:
                elenst Elena Stepanova
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: