Bug 35220 - Merging patrons can cause lock timeouts
Summary: Merging patrons can cause lock timeouts
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Patrons (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-11-01 18:49 UTC by Nick Clemens (kidclamp)
Modified: 2024-04-11 13:58 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Clemens (kidclamp) 2023-11-01 18:49:42 UTC
The code to merge patrons uses a transaction to update all of the related patron tables.

On systems with a long history (i.e. a big statistics table) this operation can take 30 seconds or more, which begins to cause issues writing to the tables.

We need to find a way to speed this up, or to defer the merging of patrons.
Comment 1 Nick Clemens (kidclamp) 2024-04-11 13:58:27 UTC
I was able to recreate this by adding a Sleep 100; after the update statement in merge with, and reducing the table updates ot only Statistics - then checkouts failed while waiting for the lock

It seems the best idea here is to defer patron merges and handle them via a nightly cronjob