Bug #46965 | crash in ha_innobase::get_auto_increment | ||
---|---|---|---|
Submitted: | 27 Aug 2009 20:20 | Modified: | 18 Mar 2010 18:52 |
Reporter: | Matthias Leich | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: InnoDB storage engine | Severity: | S3 (Non-critical) |
Version: | OS: | Any | |
Assigned to: | Satya B | CPU Architecture: | Any |
Tags: | 5.4 |
[27 Aug 2009 20:20]
Matthias Leich
[27 Aug 2009 20:54]
Philip Stoev
See bug#34335
[28 Aug 2009 12:25]
Matthias Leich
Simplified test: ---------------- --source include/have_innodb.inc --disable_warnings DROP TABLE IF EXISTS t1; --enable_warnings CREATE TABLE t1 (pk INTEGER AUTO_INCREMENT, PRIMARY KEY (pk)) ENGINE = InnoDB; # The next statement causes a crash INSERT INTO t1 VALUES (NULL) , ('-685113344') , (NULL) ; DROP TABLE t1;
[15 Sep 2009 6:53]
Calvin Sun
Mattias - could you please check with 5.4.2, or mysql-trunk?
[15 Sep 2009 13:23]
Matthias Leich
Hi Calvin, I get with mysql-trunk (last change 2009-08-29): CREATE TABLE t1 (pk INTEGER AUTO_INCREMENT, PRIMARY KEY (pk)) ENGINE = InnoDB; INSERT INTO t1 VALUES (NULL) , ('-685113344') , (NULL) ; ERROR HY000: Failed to read auto-increment value from storage engine which is also not satisfying, but at least no crash. Regards Matthias
[16 Sep 2009 23:26]
Sunny Bains
It doesn't crash for me with 5.1. mysql> CREATE TABLE t1 (pk INTEGER AUTO_INCREMENT, PRIMARY KEY (pk)) ENGINE = InnoDB; Query OK, 0 rows affected (0.05 sec) mysql> INSERT INTO t1 VALUES (NULL) , ('-685113344') , (NULL) ; ERROR 1467 (HY000): Failed to read auto-increment value from storage engine mysql> Bye Writing -ve values according to the manual is undefined behavior and as long as it doesn't crash I see no reason to fix it. One option that was discussed internally was to mask the -ve value with the max value for the column type. The results end up looking like this instead of the failure to read error that we get above. mysql> CREATE TABLE t1 (pk INTEGER AUTO_INCREMENT, PRIMARY KEY (pk)) ENGINE = -> InnoDB; Query OK, 0 rows affected (0.05 sec) mysql> INSERT INTO t1 VALUES (NULL) , ('-685113344') , (NULL) ; Query OK, 3 rows affected, 1 warning (1 min 6.39 sec) Records: 3 Duplicates: 0 Warnings: 1 mysql> select * from t1; +------------+ | pk | +------------+ | -685113344 | | 1 | | 2147483647 | +------------+ 3 rows in set (0.00 sec)
[17 Sep 2009 0:23]
Sunny Bains
I think there is a possible simple improvement, we should simply ignore -ve values when updating the table's max autoinc counter.
[4 Nov 2009 11:54]
Sergey Vojtovich
Pushed into 5.1.41.
[22 Nov 2009 0:57]
Paul DuBois
Noted in 5.1.41 changelog. InnoDB now ignores negative values supplied by a user for an AUTO_INCREMENT column when calculating the next value to store in the data dictionary. Setting AUTO_INCREMENT columns to negative values is undefined behavior and this change should bring the behavior of InnoDB closer to what users expect. Setting report to NDI pending push into 5.5.x+.
[7 Dec 2009 16:40]
Paul DuBois
Noted in 5.1.40sp1 changelog.
[18 Mar 2010 17:15]
Sergey Vojtovich
This bugfix first appeared in 5.5.0-m2.
[18 Mar 2010 18:52]
Paul DuBois
Noted in 5.5.0 changelog.