[Koha-bugs] [Bug 18651] Move of checkouts is still not correctly handled

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Tue May 23 00:52:03 CEST 2017


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

Barton Chittenden <barton at bywatersolutions.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |barton at bywatersolutions.com

--- Comment #10 from Barton Chittenden <barton at 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.


More information about the Koha-bugs mailing list