Bug #22173 | TRUNCATE does not reset auto_increment counter | ||
---|---|---|---|
Submitted: | 9 Sep 2006 10:24 | Modified: | 3 Dec 2007 14:11 |
Reporter: | Georg Richter | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Falcon storage engine | Severity: | S3 (Non-critical) |
Version: | 5.2 | OS: | Any (all) |
Assigned to: | Christopher Powers | CPU Architecture: | Any |
[9 Sep 2006 10:24]
Georg Richter
[19 Oct 2007 16:31]
Kevin Lewis
ToDo: Falcon is seeing the truncate as a row-by-row delete. If it could recognize the TRUNCATE, then maybe it could reset the sequence.
[26 Oct 2007 10:14]
Kevin Lewis
Assign to Chris Powers
[1 Nov 2007 5:54]
Christopher Powers
For TRUNCATE, the server first tries to invoke the "delete all rows" interface, such as that provided by InnoDB. If the storage engine does not support "delete all rows", then all rows are deleted individually. In the absence of "delete all rows", the server must provide some indication to the storage engine that the delete row operations are part of a TRUNCATE operation.
[12 Nov 2007 23: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/37624 ChangeSet@1.2666, 2007-11-12 17:13:28-06:00, chris@xeno.mysql.com +20 -0 Bug#22173, "TRUNCATE does not reset auto_increment counter" - Implemented delete_all_rows() in handler. - Added fast truncate to StorageTable, StorageTableShare, StorageDatabase, Database, and Transaction classes. - Added Sequence::recreate() to drop and add autoincrement sequence.
[13 Nov 2007 22:10]
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/37707 ChangeSet@1.2675, 2007-11-13 16:09:39-06:00, chris@xeno.mysql.com +20 -0 Bug#22173, "TRUNCATE does not reset auto_increment counter" - Implemented fast truncate via delete_all_rows() interface. - Added recreate sequence capability to reset auto_increment counters.
[16 Nov 2007 0:47]
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/37908 ChangeSet@1.2681, 2007-11-15 18:46:54-06:00, chris@xeno.mysql.com +5 -0 Bug#22173, "TRUNCATE does not reset auto_increment counter" - Added multiclient testcase, falcon_bug_22173a. - Disabled falcon_bug_22173a until concurrency issues with TRUNCATE are resolved. - Enabled simple TRUNCATE testcase, falcon_bug_22173 - Table::retireRecords() - ensure 'records' is non-null after acquiring scavenger lock
[26 Nov 2007 18:13]
Hakan Küçükyılmaz
falcon_bug_22173.test passes now.
[30 Nov 2007 20:43]
Bugs System
Pushed into 6.0.4-alpha
[3 Dec 2007 14:11]
MC Brown
A note has been added to the 6.0.4 changelog: Using TRUNCATE on a Falcon table did not reset the auto-increment counters and used an inefficient method of deleting existing data.
[13 Jan 2009 14:14]
Georgi Kodinov
Still doesn't work after the introduction of transaction TRUNCATE TABLE (bug#37016): see bug #42079.