Bug #31860 Server crashes after inserting into InnoDB table with auto_increment column
Submitted: 25 Oct 2007 18:03 Modified: 18 Jun 2010 22:33
Reporter: Sveta Smirnova Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S1 (Critical)
Version:5.1 BK OS:Linux
Assigned to: Sunny Bains CPU Architecture:Any

[25 Oct 2007 18:03] Sveta Smirnova
Description:
Server crashes after inserting into InnoDB table with auto_increment column

How to repeat:
use test
drop table if exists t;
create table t(`_id` bigint(20) NOT NULL auto_increment primary key)engine=innodb;
insert into t values(-10);
select * from t;

mysqld restart

use test
insert into t values(null),(null);
ERROR 2013 (HY000): Lost connection to MySQL server during query
[26 Oct 2007 2:00] Sunny Bains
This bug was introduced when fixing Bug#16979. It assumes that the table AUTOINC 
counter stored in the table cannot be negative.
[26 Oct 2007 18:01] Sunny Bains
The fix will change the way InnoDB behaves if the auto-increment column contains negative values. Earlier the behavior was undefined. With the change, if the maximum value read from an auto-increment column is negative during auto-increment initialization, the auto-increment counter will be reset to 0 and the next number that will be allocated, will start from 1.
[6 Nov 2007 23:41] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/37233

ChangeSet@1.2605, 2007-11-06 16:40:50-07:00, tsmith@ramayana.hindu.god +6 -0
  Apply snapshot innodb-5.1-ss2034
  
  The following bugs are fixed:
  
  Bug #31860: Server crashes after inserting into InnoDB table with auto_increment column
    In the Bug 16979 fix there was an erroneous assertion that
    autoincrement columns can't contain negative values. With the fix, the
    autoincrement table counter is set to 0 if the maximum value read from
    the autoinc column index is negative.
[7 Nov 2007 1:03] Timothy Smith
Queued to 5.1-build
[21 Nov 2007 18:54] Bugs System
Pushed into 5.1.23-rc
[21 Nov 2007 18:54] Bugs System
Pushed into 6.0.4-alpha
[4 Dec 2007 21:19] Paul Dubois
Noted in 5.1.23, 6.0.4 changelogs.

The server crashed after insertion of a negative value into an
AUTO_INCREMENT column of an InnoDB table.
[5 May 2010 15:13] Bugs System
Pushed into 5.1.47 (revid:joro@sun.com-20100505145753-ivlt4hclbrjy8eye) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46) (pib:16)
[6 May 2010 3:05] Paul Dubois
Push resulted from incorporation of InnoDB tree. No changes pertinent to this bug. Re-closing.
[28 May 2010 5:54] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100524190136-egaq7e8zgkwb9aqi) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (pib:16)
[28 May 2010 6:23] Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20100524190941-nuudpx60if25wsvx) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46) (pib:16)
[28 May 2010 6:51] Bugs System
Pushed into 5.5.5-m3 (revid:alik@sun.com-20100524185725-c8k5q7v60i5nix3t) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46) (pib:16)
[29 May 2010 2:51] Paul Dubois
Push resulted from incorporation of InnoDB tree. No changes pertinent to this bug.
Re-closing.
[17 Jun 2010 11:55] Bugs System
Pushed into 5.1.47-ndb-7.0.16 (revid:martin.skold@mysql.com-20100617114014-bva0dy24yyd67697) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46) (pib:16)
[17 Jun 2010 12:34] Bugs System
Pushed into 5.1.47-ndb-6.2.19 (revid:martin.skold@mysql.com-20100617115448-idrbic6gbki37h1c) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46) (pib:16)
[17 Jun 2010 13:21] Bugs System
Pushed into 5.1.47-ndb-6.3.35 (revid:martin.skold@mysql.com-20100617114611-61aqbb52j752y116) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46) (pib:16)