https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18651

Barton Chittenden <bar...@bywatersolutions.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bar...@bywatersolutions.com

--- Comment #10 from Barton Chittenden <bar...@bywatersolutions.com> ---
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 ###

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
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/

Reply via email to