Bug 26457: (QA follow-up) Switch to PK index in UPDATE on issues
The deadlock reports tell us that multiple transactions are waiting for a X lock on a record but using a secondary index on borrowernumber and itemnumber. Since we have the issue_id at hand already, we should use that and benefit from the clustered index (on PK) instead of using a secondary index. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
e05ad0c1f8
commit
3beeb020ef
|
|
@ -3034,13 +3034,10 @@ sub AddRenewal {
|
|||
# Update the issues record to have the new due date, and a new count
|
||||
# of how many times it has been renewed.
|
||||
my $renews = ( $issue->renewals || 0 ) + 1;
|
||||
my $sth = $dbh->prepare("UPDATE issues SET date_due = ?, renewals = ?, unseen_renewals = ?, lastreneweddate = ?
|
||||
WHERE borrowernumber=?
|
||||
AND itemnumber=?"
|
||||
);
|
||||
my $sth = $dbh->prepare("UPDATE issues SET date_due = ?, renewals = ?, unseen_renewals = ?, lastreneweddate = ? WHERE issue_id = ?");
|
||||
|
||||
eval{
|
||||
$sth->execute( $datedue->strftime('%Y-%m-%d %H:%M'), $renews, $unseen_renewals, $lastreneweddate, $borrowernumber, $itemnumber );
|
||||
$sth->execute( $datedue->strftime('%Y-%m-%d %H:%M'), $renews, $unseen_renewals, $lastreneweddate, $issue->issue_id );
|
||||
};
|
||||
if( $sth->err ){
|
||||
Koha::Exceptions::Checkout::FailedRenewal->throw(
|
||||
|
|
|
|||
Loading…
Reference in New Issue