diff --git a/mysql-test/suite/innodb/r/insert_into_empty_notembedded.result b/mysql-test/suite/innodb/r/insert_into_empty_notembedded.result index 789c17dfb20..585a2e6c725 100644 --- a/mysql-test/suite/innodb/r/insert_into_empty_notembedded.result +++ b/mysql-test/suite/innodb/r/insert_into_empty_notembedded.result @@ -28,6 +28,7 @@ DROP DATABASE db1; # # End of 10.6 tests # +SET foreign_key_checks=0, unique_checks=0; # # MDEV-30796 Auto_increment values not updated after bulk # insert operation @@ -35,7 +36,21 @@ DROP DATABASE db1; CREATE TABLE t1(f1 INT NOT NULL AUTO_INCREMENT, f2 INT NOT NULL, PRIMARY KEY(f1))ENGINE=InnoDB; INSERT INTO t1 VALUES(1, 2), (25, 3), (2, 4); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL AUTO_INCREMENT, + `f2` int(11) NOT NULL, + PRIMARY KEY (`f1`) +) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # restart +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL AUTO_INCREMENT, + `f2` int(11) NOT NULL, + PRIMARY KEY (`f1`) +) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1(f2) VALUES(5); SELECT max(f1) FROM t1; max(f1) diff --git a/mysql-test/suite/innodb/t/insert_into_empty_notembedded.test b/mysql-test/suite/innodb/t/insert_into_empty_notembedded.test index 0caeea59aae..078ca0205bd 100644 --- a/mysql-test/suite/innodb/t/insert_into_empty_notembedded.test +++ b/mysql-test/suite/innodb/t/insert_into_empty_notembedded.test @@ -42,6 +42,7 @@ DROP DATABASE db1; --echo # End of 10.6 tests --echo # +SET foreign_key_checks=0, unique_checks=0; --echo # --echo # MDEV-30796 Auto_increment values not updated after bulk --echo # insert operation @@ -49,7 +50,9 @@ DROP DATABASE db1; CREATE TABLE t1(f1 INT NOT NULL AUTO_INCREMENT, f2 INT NOT NULL, PRIMARY KEY(f1))ENGINE=InnoDB; INSERT INTO t1 VALUES(1, 2), (25, 3), (2, 4); +SHOW CREATE TABLE t1; --source include/restart_mysqld.inc +SHOW CREATE TABLE t1; INSERT INTO t1(f2) VALUES(5); SELECT max(f1) FROM t1; DROP TABLE t1; diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc index abfa79a59d9..b6c3feb786f 100644 --- a/storage/innobase/row/row0merge.cc +++ b/storage/innobase/row/row0merge.cc @@ -5344,7 +5344,7 @@ func_exit: if (err != DB_SUCCESS) trx->error_info= index; else if (index->is_primary() && table->persistent_autoinc) - btr_write_autoinc(index, table->autoinc); + btr_write_autoinc(index, table->autoinc - 1); err= btr_bulk.finish(err); return err; }