Bug #61962 | 'ON DUPLICATE KEY UPDATE' bug incrementing ID (auto increment field) on Updates | ||
---|---|---|---|
Submitted: | 23 Jul 2011 21:43 | Modified: | 6 Aug 2011 12:44 |
Reporter: | Luc L. | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server | Severity: | S1 (Critical) |
Version: | 5.5.14 | OS: | Any (Tested on 5.5.8 and 5.5.14) |
Assigned to: | CPU Architecture: | Any | |
Tags: | auto increment, on duplicate, ON DUPLICATE KEY UPDATE |
[23 Jul 2011 21:43]
Luc L.
[24 Jul 2011 7:42]
Peter Laursen
What is your setting for the server variable 'innodb_autoinc_lock_mode' ? In 5.5.x the default is "1" - before it was "0" (implicitly or explicitly). Refer: http://dev.mysql.com/doc/refman/5.1/en/innodb-auto-increment-handling.html "... To describe the way auto-increment works in InnoDB, the following discussion defines some terms, and explains how InnoDB behaves using different settings of the new innodb_autoinc_lock_mode configuration parameter. Additional considerations are described following the explanation of auto-increment locking behavior. ..." Peter (not a MySQL person)
[24 Jul 2011 7:46]
Peter Laursen
One correction: it seems that even MySQL 5.1 (from 5.1.22 probably) also has "1" as default for this variable.
[25 Jul 2011 15:51]
Luc L.
Hello, mysql> show global variables like "innodb_autoinc_lock_mode"; +--------------------------+-------+ | Variable_name | Value | +--------------------------+-------+ | innodb_autoinc_lock_mode | 1 | +--------------------------+-------+ 1 row in set (0.00 sec) So you are saying that even though there were no inserts, only updates, the auto-increment value will still be incremented if innodb_autoinc_lock_mode != 0? I just want to make sure I understand this correctly and that it is in fact not a bug. Also, is it safe to change this variable on an active database? Thank You, Luc
[6 Aug 2011 12:44]
Sveta Smirnova
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://dev.mysql.com/doc/ and the instructions on how to report a bug at http://bugs.mysql.com/how-to-report.php As Peter already wrote this is not a bug. Closing as such.