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

Wrong ID's generated with Galera using insert containing multiple rows.

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Not a Bug
    • 5.5.39-galera
    • 5.5.41-galera
    • Galera
    • Debian 7, fully patched, MariaDB 5.5.39 Galera build (from your repo)

    Description

      If you do an insert with multiple values, auto increment ID generation is not replicated properly. It seems to go by the local galera auto_id offset values instead of those given by the master.

      Master not running Galera but 5.5.39:

      MariaDB [accounts]> create table test ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `text` text, PRIMARY KEY (`id`) ) ENGINE=InnoDB;
      Query OK, 0 rows affected (0.00 sec)
       
      MariaDB [accounts]> show create table test\G
      *************************** 1. row ***************************
             Table: test
      Create Table: CREATE TABLE `test` (
        `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
        `text` text,
        PRIMARY KEY (`id`)
      ) ENGINE=InnoDB DEFAULT CHARSET=latin1
      1 row in set (0.00 sec)
       
      MariaDB [accounts]>  insert into test (text) VALUES ("one"),("two");
      Query OK, 2 rows affected (0.00 sec)
      Records: 2  Duplicates: 0  Warnings: 0
       
      MariaDB [accounts]> show table status like 'test'\G
      *************************** 1. row ***************************
                 Name: test
               Engine: InnoDB
              Version: 10
           Row_format: Compact
                 Rows: 2
       Avg_row_length: 8192
          Data_length: 16384
      Max_data_length: 0
         Index_length: 0
            Data_free: 0
       Auto_increment: 3 <------
          Create_time: 2014-08-30 00:55:42
          Update_time: NULL
           Check_time: NULL
            Collation: latin1_swedish_ci
             Checksum: NULL
       Create_options: 
              Comment: 
      1 row in set (0.00 sec)
       
      MariaDB [accounts]> select * from test;
      +----+------+
      | id | text |
      +----+------+
      |  1 | one  |
      |  2 | two  |
      +----+------+
      2 rows in set (0.00 sec)

      Galera slave:

      MariaDB [accounts]> show table status like 'test'\G
      *************************** 1. row ***************************
                 Name: test
               Engine: InnoDB
              Version: 10
           Row_format: Compact
                 Rows: 2
       Avg_row_length: 8192
          Data_length: 16384
      Max_data_length: 0
         Index_length: 0
            Data_free: 0
       Auto_increment: 9  <-----
          Create_time: 2014-08-30 00:55:11
          Update_time: NULL
           Check_time: NULL
            Collation: latin1_swedish_ci
             Checksum: NULL
       Create_options: 
              Comment: 
      1 row in set (0.00 sec)
       
      MariaDB [accounts]> select * from test;
      +----+------+
      | id | text |
      +----+------+
      |  3 | one  |
      |  6 | two  |
      +----+------+
      2 rows in set (0.01 sec)

      Attachments

        Activity

          People

            nirbhay_c Nirbhay Choubey (Inactive)
            sophomeric Eric Webster
            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.