From: Björn Nylén Date: Wed, 11 Nov 2020 07:35:21 +0000 (+0100) Subject: Bug 26996: Convert Elasticsearch indexer commit buffer size to integer X-Git-Tag: v21.05.00~1644 X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=commitdiff_plain;h=ba9c9cc794123d60c92a4ce499aa4554299936b6;p=srvgit Bug 26996: Convert Elasticsearch indexer commit buffer size to integer When multithreaded indexing is used, the commit size for children are spread out resulting in them being of type float. When records are processed and the commit counter decreased it may then never reach *exactly* 0. This means records are never commited. This patch makes sure the counter is an integer to avoid the problem. To test you must find a set of circumstances that causes the issue. For me: 1. Run: ./rebuild_elasticsearch -v -b -p 2 -c 400 2. Note that only one process is logging "Committing xxx records..." 3. Kill processes. 4. Apply patch. 5. Repeat 1 6. Note that both processes are logging "Committing xxx records..." Sponsored-by: Lund University Library Signed-off-by: Joonas Kylmälä Signed-off-by: Nick Clemens Signed-off-by: Jonathan Druart --- diff --git a/misc/search_tools/rebuild_elasticsearch.pl b/misc/search_tools/rebuild_elasticsearch.pl index ff83562f25..6b9487fcb5 100755 --- a/misc/search_tools/rebuild_elasticsearch.pl +++ b/misc/search_tools/rebuild_elasticsearch.pl @@ -188,6 +188,7 @@ if ($slice_count > 1) { } # Fudge the commit count a bit to spread out the Elasticsearch commits $commit *= 1 + 0.10 * $slice_index; + $commit = int( $commit ); _log(1, "Processing slice @{[$slice_index + 1]} of $slice_count\n"); $iterator_options{slice} = { index => $slice_index, count => $slice_count }; }