Bug 33987: Combine multiple db updates one in BatchCommitRecords
authorKyle M Hall <kyle@bywatersolutions.com>
Mon, 12 Jun 2023 18:20:53 +0000 (14:20 -0400)
committerPedro Amorim <pedro.amorim@ptfs-europe.com>
Tue, 18 Jul 2023 10:29:00 +0000 (10:29 +0000)
commit444a519f09901302ea2d061b787af25edfaafd90
tree95acbeff5781438f35a49373e4d839c670bf5c3c
parent2d594b64eb2f0eb60a3969a00b590e5976d96a69
Bug 33987: Combine multiple db updates one in BatchCommitRecords

When replacing existing records BatchCommitRecords will the table import_records will be updated three times for three different fields by three different queries. Not only is this inefficient ( especially for large batches ), it seems that this is causing the dreaded "Lock wait timeout exceeded; try restarting transaction" error on some mysql/mariadb configurations.

1) Test plan
2) Download a marc record from Koha
3) Modify the title of that same bib in Koha
4) Stage the downloaded record and overlay the existing record
5) Verify the title has reverted to the original title from the
   downloaded record!

Signed-off-by: Sam Lau <samalau@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit ab91409f7f3c18142e0694fab80effd7c0b35980)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 818ee1c312a0685719ca3f136f61a94e88195efa)
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
C4/ImportBatch.pm