mariadb/mysql-test/suite/innodb/r/insert_into_empty_notembedded.result
Thirunarayanan Balathandayuthapani cb384d0d04 MDEV-32008 auto_increment value on table increments by one after restart
- This issue caused by commit 4700f2ac70f8c79f2ac1968b6b59d18716f492bf(MDEV-30796)
During bulk insert operation, InnoDB wrongly stores the next autoincrement
value as current autoincrement value. So update the current autoincrement
value rather than next auto increment value.
2023-08-29 10:37:08 +05:30

59 lines
1.8 KiB
Text

#
# Start of 10.6 tests
#
#
# MDEV-27214 Import with disabled keys corrupts meta-data like rows, indexes, ...
#
CREATE DATABASE db1;
CREATE TABLE db1.t1 (id int, a int,PRIMARY KEY (id)) ENGINE=InnoDB
STATS_PERSISTENT=1 STATS_AUTO_RECALC=1;
INSERT INTO db1.t1 VALUES (1,2),(2,3),(3,4);
DROP DATABASE IF EXISTS db1;
CREATE DATABASE db1;
# Wait till statistics update after bulk insert operation
SELECT TABLE_ROWS, AVG_ROW_LENGTH>0 FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='db1';
TABLE_ROWS AVG_ROW_LENGTH>0
3 1
OPTIMIZE TABLE db1.t1;
Table Op Msg_type Msg_text
db1.t1 optimize note Table does not support optimize, doing recreate + analyze instead
db1.t1 optimize status OK
# Wait till statistics update after bulk insert operation
SELECT TABLE_ROWS, AVG_ROW_LENGTH>0 FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='db1';
TABLE_ROWS AVG_ROW_LENGTH>0
3 1
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
#
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)
26
DROP TABLE t1;
# End of 10.9 tests