https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43569 --- Comment #9 from David Nind <david@davidnind.com> --- Created attachment 207066 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207066&action=edit Bug 43569: Harden rebuild_elasticsearch.pl against silent failures This patch builds on the update_index() Koha::Result::Boolean contract from the previous patch so that misc/search_tools/rebuild_elasticsearch.pl no longer reports success when records fail to index. Changes: - _handle_response() now consumes the Koha::Result::Boolean, counts the per-document failures, and surfaces a summary regardless of verbosity so cronjobs notice (previously the error line was suppressed at the default verbosity used by cron) - Both the buffered commits and the final flush go through _commit_chunk(), so a whole-operation failure (e.g. Elasticsearch becoming unreachable) on the last chunk is handled like any other chunk instead of dying mid-run under 'use autodie' - The script now exits non-zero when any record failed to index, giving cron wrappers a way to detect trouble - In --processes mode, child exit status is aggregated by the parent (wait() return status is now checked), so a failed slice can no longer be hidden behind a clean parent slice - The final line reports processed vs indexed vs failed counts instead of overstating success Test plan: 1. Apply this patch 2. Reindex a healthy Elasticsearch: $ ktd --shell k$ perl misc/search_tools/rebuild_elasticsearch.pl -b k$ echo $? => SUCCESS: Reindex succeeds and exits 0 3. Make Elasticsearch unreachable and rerun step 2 => SUCCESS: The script reports the failure visibly and exits non-zero 4. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.