Koha/cataloguing
Andrew Nugged 3eec846d7f
Bug 24027: Call ModZebra once after all items added/deleted in a batch
Issue description:
- call to ModZebra was unconditional inside 'store' method for Koha::Item,
  so it was after each item added, or deleted.
- ModZebra called with param biblionumber, so it is the same parameter
  across calls for each items with same biblionumber, especially when we
  adding/removing in a batch.
- with ElasticSearch enabled this makes even more significant load
  and it is also progressively grows when more items already in DB

Solution:
- to add extra parameter 'skip_modzebra_update' and propagate it down to
 'store' method call to prevent call of ModZebra,
- but to call ModZebra once after the whole batch loop in the upper layer

Test plan / how to replicate:
- make sure that you have in the admin settings "SearchEngine" set to
  "Elasticsearch" and your ES is configured and working
  ( /cgi-bin/koha/admin/preferences.pl?op=search&searchfield=SearchEngine )
- select one of biblioitems without items
  ( /cgi-bin/koha/cataloguing/additem.pl?biblionumber=XXX )
- press button "add multiple copies of this item",
- enter 200 items, start measuring time and submit the page/form...

On my test machine when adding 200 items 3 times in a row (so 600 in
total, but to show that time grows with every next batch gradually):

WHEN ElasticSearch DISABLED (only Zebra queue):
- 9s, 12s, 13s
WHEN ElasticSearch ENABLED:
- 1.3m, 3.2m, 4.8m
WITH PATCH WHEN ElasticSearch ENABLED:
- 10s, 13s, 15s

Same slowness (because also same call to ModZebra) happens when you try
to delete all items ("op=delallitems"). And same fix.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-04-14 08:14:42 +01:00
..
value_builder Bug 22098: (QA follow-up) Improving documentation 2020-03-24 10:55:59 +00:00
addbiblio.pl Bug 8643: Add important constraint to marc subfields 2020-02-11 14:33:29 +00:00
addbooks.pl Bug 24735: Remove QueryParser-related code 2020-03-02 11:13:03 +00:00
additem.pl Bug 24027: Call ModZebra once after all items added/deleted in a batch 2020-04-14 08:14:42 +01:00
editor.pl
linkitem.pl
merge.pl
merge_ajax.pl
moveitem.pl Bug 19809: Re-allow to call Koha::Objects::find in list context 2020-01-23 10:27:28 +00:00
plugin_launcher.pl
ysearch.pl
z3950_auth_search.pl
z3950_search.pl Bug 21921: Add date publication year to biblio Z39.50 search form 2020-02-17 13:44:23 +00:00