Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDEV-28416 Incorrect AUTO_INCREMENT may be issued when close to UINT6…
…4_MAX ha_innobase::get_auto_increment(): In the overflow check, account for 64-bit unsigned integer wrap-around. Based on mysql/mysql-server@25ecfe7
- Loading branch information
Showing
5 changed files
with
101 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# | ||
# MDEV-28416 Incorrect AUTO_INCREMENT may be issued | ||
# | ||
SET @aii=@@auto_increment_increment; | ||
SET auto_increment_increment=300; | ||
CREATE TABLE t1 (a SERIAL) ENGINE=innodb | ||
PARTITION BY RANGE (a) ( | ||
PARTITION p0 VALUES LESS THAN (6), | ||
PARTITION p1 VALUES LESS THAN MAXVALUE | ||
); | ||
INSERT INTO t1 VALUES (18446744073709551613); | ||
SHOW CREATE TABLE t1; | ||
Table Create Table | ||
t1 CREATE TABLE `t1` ( | ||
`a` bigint(20) unsigned NOT NULL AUTO_INCREMENT, | ||
UNIQUE KEY `a` (`a`) | ||
) ENGINE=InnoDB AUTO_INCREMENT=18446744073709551614 DEFAULT CHARSET=latin1 | ||
PARTITION BY RANGE (`a`) | ||
(PARTITION `p0` VALUES LESS THAN (6) ENGINE = InnoDB, | ||
PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) | ||
INSERT INTO t1 VALUES (NULL); | ||
ERROR 22003: Out of range value for column 'a' at row 1 | ||
SHOW CREATE TABLE t1; | ||
Table Create Table | ||
t1 CREATE TABLE `t1` ( | ||
`a` bigint(20) unsigned NOT NULL AUTO_INCREMENT, | ||
UNIQUE KEY `a` (`a`) | ||
) ENGINE=InnoDB AUTO_INCREMENT=298 DEFAULT CHARSET=latin1 | ||
PARTITION BY RANGE (`a`) | ||
(PARTITION `p0` VALUES LESS THAN (6) ENGINE = InnoDB, | ||
PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) | ||
DROP TABLE t1; | ||
SET auto_increment_increment=@aii; | ||
# End of 10.2 tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--source include/have_partition.inc | ||
--source include/have_innodb.inc | ||
|
||
--echo # | ||
--echo # MDEV-28416 Incorrect AUTO_INCREMENT may be issued | ||
--echo # | ||
|
||
SET @aii=@@auto_increment_increment; | ||
SET auto_increment_increment=300; | ||
|
||
CREATE TABLE t1 (a SERIAL) ENGINE=innodb | ||
PARTITION BY RANGE (a) ( | ||
PARTITION p0 VALUES LESS THAN (6), | ||
PARTITION p1 VALUES LESS THAN MAXVALUE | ||
); | ||
INSERT INTO t1 VALUES (18446744073709551613); | ||
SHOW CREATE TABLE t1; | ||
--error HA_ERR_AUTOINC_ERANGE | ||
INSERT INTO t1 VALUES (NULL); | ||
SHOW CREATE TABLE t1; | ||
DROP TABLE t1; | ||
SET auto_increment_increment=@aii; | ||
|
||
--echo # End of 10.2 tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters