Bugzilla – Attachment 187014 Details for
Bug 40890
Make batch_size configurable for koha-es-indexer
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40890: Make batch_size configurable for koha-es-indexer
Bug-40890-Make-batchsize-configurable-for-koha-es-.patch (text/plain), 3.91 KB, created by
Tomás Cohen Arazi (tcohen)
on 2025-09-26 20:07:05 UTC
(
hide
)
Description:
Bug 40890: Make batch_size configurable for koha-es-indexer
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2025-09-26 20:07:05 UTC
Size:
3.91 KB
patch
obsolete
>From afe7aaa56cc3105477d4dbeffcafb2b243a3a689 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Tom=C3=A1s=20Cohen=20Arazi?= <tomascohen@theke.io> >Date: Fri, 26 Sep 2025 17:00:44 -0300 >Subject: [PATCH] Bug 40890: Make batch_size configurable for koha-es-indexer >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >This patch adds a new configuration entry in `koha-conf.xml` for making >it possible to set a different `batch_size` for `koha-es-indexer`. > >The current implementation has a default of *10* that can be overridden >using the CLI parameter `--batch_size N`. > >Unfortunately, if you restart the server or the service without passing >the parameter, it will be set back to 10. This patch solves that by >adding a new config entry and making the script use it. The passed CLI >parameter will keep overridding the configured value. > >To test: >1. Run: > $ ktd --shell > k$ koha-es-indexer --restart --batch_size 100 kohadev > k$ ps -ef | grep elastic >=> SUCCESS: No errors. Notice '100' is passed to the called perl script >2. Run: > k$ koha-es-indexer --restart kohadev > k$ ps -ef | grep elastic >=> FAIL: Notice '10' is the new value >3. Apply this patch >4. Run: > k$ reset_all >5. Repeat 1 and 2 >=> SUCCESS: '100' is kept. >6. Try standalone `--start` too >7. Sign off :-D >--- > debian/scripts/koha-es-indexer | 2 +- > debian/scripts/koha-functions.sh | 11 +++++++++++ > debian/templates/koha-conf-site.xml.in | 3 +++ > etc/koha-conf.xml | 3 +++ > 4 files changed, 18 insertions(+), 1 deletion(-) > >diff --git a/debian/scripts/koha-es-indexer b/debian/scripts/koha-es-indexer >index c28963f733..e5b67e61fe 100755 >--- a/debian/scripts/koha-es-indexer >+++ b/debian/scripts/koha-es-indexer >@@ -163,7 +163,7 @@ set_action() > > op="" > quiet="no" >-batch_size=10 >+batch_size=$(get_es_indexer_batch_size ${name}) > > # Read command line parameters > while [ $# -gt 0 ]; do >diff --git a/debian/scripts/koha-functions.sh b/debian/scripts/koha-functions.sh >index ade6e3c197..fbfe788604 100755 >--- a/debian/scripts/koha-functions.sh >+++ b/debian/scripts/koha-functions.sh >@@ -501,3 +501,14 @@ run_safe_xmlstarlet() > echo $(xmlstarlet sel -t -v "yazgfs/config/$myexpr" /etc/koha/sites/$instancename/koha-conf.xml) > return 0 > } >+ >+get_es_indexer_batch_size() >+{ >+ local instancename=$1 >+ local retval=$(xmlstarlet sel -t -v 'yazgfs/config/es_indexer_batch_size' /etc/koha/sites/$instancename/koha-conf.xml) >+ if [ "$retval" != "" ]; then >+ echo "$retval" >+ else >+ echo "10" >+ fi >+} >diff --git a/debian/templates/koha-conf-site.xml.in b/debian/templates/koha-conf-site.xml.in >index 0e07af36d8..36f632fdb9 100644 >--- a/debian/templates/koha-conf-site.xml.in >+++ b/debian/templates/koha-conf-site.xml.in >@@ -372,6 +372,9 @@ __END_SRU_PUBLICSERVER__ > Resetting mappings will override any changes made in the Search engine configuration UI. > --> > <!-- <elasticsearch_index_mappings>__KOHA_CONF_DIR__/searchengine/elasticsearch/mappings.yaml</elasticsearch_index_mappings> --> >+ <!-- How many indexing tasks the ES indexer will pick at a time >+ If the site is so busy the queue keeps growing, raise it --> >+ <es_indexer_batch_size>10</es_indexer_batch_size> > > <interlibrary_loans> > <!-- Path to where Illbackends are located on the system >diff --git a/etc/koha-conf.xml b/etc/koha-conf.xml >index cd58487213..5c8bab6d67 100644 >--- a/etc/koha-conf.xml >+++ b/etc/koha-conf.xml >@@ -191,6 +191,9 @@ > Resetting mappings will override any changes made in the Search engine configuration UI. > --> > <!-- <elasticsearch_index_mappings>__KOHA_CONF_DIR__/searchengine/elasticsearch/mappings.yaml</elasticsearch_index_mappings> --> >+ <!-- How many indexing tasks the ES indexer will pick at a time >+ If the site is so busy the queue keeps growing, raise it --> >+ <es_indexer_batch_size>10</es_indexer_batch_size> > > <interlibrary_loans> > <!-- Path to where Illbackends are located on the system >-- >2.51.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 40890
: 187014