diff options
author | Thirunarayanan B <thirunarayanan.balathandayuth@oracle.com> | 2014-02-10 10:13:35 +0530 |
---|---|---|
committer | Thirunarayanan B <thirunarayanan.balathandayuth@oracle.com> | 2014-02-10 10:13:35 +0530 |
commit | 7acdf29cb4f90498af143430e3bf0e9fd3bd39f5 (patch) | |
tree | 407483acf7b199ce206366d6c8216741417fbbfe /mysql-test | |
parent | 5ffe40022baad6b727627072a3e421fc9a6fc7ae (diff) | |
download | mariadb-git-7acdf29cb4f90498af143430e3bf0e9fd3bd39f5.tar.gz |
Bug #14049391 INNODB MISCALCULATES AUTO-INCREMENT AFTER DECREASING
AUTO_INCREMENT_INCREMENT
Problem:
=======
When auto_increment_increment system variable decreases,
immediate next value of auto increment column is not affected.
Solution:
========
Get the previous inserted value of auto increment column by
subtracting the previous auto_increment_increment from next
auto increment value. After that calculate the current autoinc value
using newly changed auto_increment_increment variable.
Approved by Sunny [rb#4394]
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/suite/innodb/r/innodb-autoinc.result | 27 | ||||
-rw-r--r-- | mysql-test/suite/innodb/t/innodb-autoinc.test | 14 |
2 files changed, 41 insertions, 0 deletions
diff --git a/mysql-test/suite/innodb/r/innodb-autoinc.result b/mysql-test/suite/innodb/r/innodb-autoinc.result index ef45255fc7b..6f168ecbce6 100644 --- a/mysql-test/suite/innodb/r/innodb-autoinc.result +++ b/mysql-test/suite/innodb/r/innodb-autoinc.result @@ -1357,3 +1357,30 @@ t1 CREATE TABLE `t1` ( INSERT INTO t1 VALUES (); ERROR HY000: Failed to read auto-increment value from storage engine DROP TABLE t1; +# +# Bug #14049391 INNODB MISCALCULATES AUTO-INCREMENT +# AFTER CHANGING AUTO_INCREMENT_INCREMEMENT +# +CREATE TABLE t ( i INT AUTO_INCREMENT, KEY(i) ) ENGINE=InnoDB; +SET auto_increment_increment = 300; +INSERT INTO t VALUES (NULL), (NULL); +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `i` int(11) NOT NULL AUTO_INCREMENT, + KEY `i` (`i`) +) ENGINE=InnoDB AUTO_INCREMENT=601 DEFAULT CHARSET=latin1 +SET auto_increment_increment = 50; +INSERT INTO t VALUES (NULL); +SELECT * FROM t; +i +1 +301 +351 +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `i` int(11) NOT NULL AUTO_INCREMENT, + KEY `i` (`i`) +) ENGINE=InnoDB AUTO_INCREMENT=401 DEFAULT CHARSET=latin1 +DROP TABLE t; diff --git a/mysql-test/suite/innodb/t/innodb-autoinc.test b/mysql-test/suite/innodb/t/innodb-autoinc.test index 38038de732f..3d9f5916d8c 100644 --- a/mysql-test/suite/innodb/t/innodb-autoinc.test +++ b/mysql-test/suite/innodb/t/innodb-autoinc.test @@ -685,3 +685,17 @@ SHOW CREATE TABLE t1; --error 1467 INSERT INTO t1 VALUES (); DROP TABLE t1; + +--echo # +--echo # Bug #14049391 INNODB MISCALCULATES AUTO-INCREMENT +--echo # AFTER CHANGING AUTO_INCREMENT_INCREMEMENT +--echo # +CREATE TABLE t ( i INT AUTO_INCREMENT, KEY(i) ) ENGINE=InnoDB; +SET auto_increment_increment = 300; +INSERT INTO t VALUES (NULL), (NULL); +SHOW CREATE TABLE t; +SET auto_increment_increment = 50; +INSERT INTO t VALUES (NULL); +SELECT * FROM t; +SHOW CREATE TABLE t; +DROP TABLE t; |