Bug #40224 New AUTOINC changes mask reporting of deadlock/timeout errors
Submitted: 22 Oct 2008 1:44 Modified: 24 Feb 2:38
Reporter: Sunny Bains
Status: Closed
Category:Server: InnoDB Severity:S2 (Serious)
Version:5.1.22+ and plugin OS:Any
Assigned to: Sunny Bains Target Version:
Tags: autoinc

[22 Oct 2008 1:44] Sunny Bains
Description:
This error is relevant only when: autoinc_lock_mode = TRADITIONAL

In the pre 5.1.22 versions, errors related to the AUTOINC locking were returned by
ha_innobase::write_row(). With the new code they are not, an example:

  If the special AUTOINC lock caused a deadlock (pre 5.1.22) then that error would be
reported to the user as a deadlock error. However, with the new code this error is
reported as a generic AUTOINC failure error.

How to repeat:
set autoinc_lock_mode = TRADITIONAL and run lots of concurrent threads inserting rows.
Instead of DEADLOCK/TIMEOUT errors you will see AUTOINC failure errors.

Suggested fix:
Return the actual AUTOINC lock related error code from ha_innobase::write_row().
[23 Oct 2008 11:30] 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/56868

2739 He Zhenxing	2008-10-23
      BUG#40224 Optimized build of mysqld crashes when built with Sun Studio on SPARC
      
      Fix a segmental fault problem caused by unaligned memory when 
      built with optimization on SPARC 64
[23 Oct 2008 12:13] 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/56873

2739 He Zhenxing	2008-10-23
      BUG#40224 Optimized build of mysqld crashes when built with Sun Studio on SPARC
      
      Fix a segmental fault problem caused by unaligned memory when 
      built with optimization on SPARC 64
[23 Oct 2008 14:52] 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/56890

2739 He Zhenxing	2008-10-23
      BUG#40224 Optimized build of mysqld crashes when built with Sun Studio on SPARC
            
      Fix a segmental fault problem caused by unaligned memory when 
      built with optimization on SPARC 64
[24 Oct 2008 9:04] 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/56966

2740 He Zhenxing	2008-10-24
      fix previous patch for BUG#40224
      
      There is one 'int' not changed to 'long'.
[24 Oct 2008 9:09] Sunny Bains
What's with the previous comments by He Zhenxing ? What's going on here ? I can't figure
out what they have to do with the bug report.
[28 Oct 2008 9:09] Bugs System
Pushed into 6.0.8-alpha  (revid:hezx@mysql.com-20081024070330-zvhsk3pt42ki2c2n) (version
source revid:alik@mysql.com-20081028074606-nzkci70shxkah009) (pib:5)
[24 Feb 2:38] Paul DuBois
Noted in 6.0.8 changelog.

With innodb_autoinc_lock_mode set to 0 ("traditional" locking),
deadlock and lock-wait timeout errors encountered while reading
AUTO_INCREMENT values were being reported as a generic AUTO_INCREMENT
value allocation failure. (The actual error encountered was printed
in the error log.) The transaction was being rolled back but all the 
user saw was an AUTO_INCREMENT failure code. Now the actual locking
error code is returned to the user.