https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18651
Colin Campbell <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |colin.campbell@ptfs-europe. | |com --- Comment #11 from Colin Campbell <[email protected]> --- (In reply to Barton Chittenden from comment #10) > We have a problem with the auto_increment on issues.issue_id -- the > auto_increment is not kept if the database is stopped; it is simply > calculated by mysql when the database starts. > > That caused problems if we re-start the database after we've moved issues to > the old_issues table but before we've checked out enough items to increase > auto_increment past max(old_issues.issue_id) + 1. > > As a concrete example, let's say that we check out 3 items. items.issue_id > is now 3, and the auto_increment is set to 4. > > We then check in the items with issue_id = 2 and issue_id = 3. > > max(old_issues.issue_id) is now 3 > max(issues.issue_id) is now 1. > > We restart mysql at this point, mysql reads max(issues.issue_id) and sets > auto_increment to 2. We try to check in the item with issue_id=2. We can't > insert into old_issues due to the duplicate key constraint. > > I suspect that the right thing to do might be to use the mysql --init-file > option to run something like > > ALTER TABLE issues AUTO_INCREMENT= ### ( find the max of issues.issue_id and > old_issues.issue_id ) + 1 ### old_issues should not be auto_increment there is one id sequence and that comes from issues. If you try and maintain 2 sequences you have a race condition -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list [email protected] http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
