[Koha-bugs] [Bug 26312] Add some error handling during Elasticsearch indexing

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Sun Apr 25 22:30:20 CEST 2021


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26312

--- Comment #39 from Victor Grousset/tuxayo <victor at tuxayo.net> ---
Hi, trying to backport to 19.11.x.
I had a conflict but I'm not very sure about it's resolution.

Here it is.
== The conflict ==

3 parts of the conflict view:

<<<<<<< HEAD
THIS IS 19.11 before the patch
|||||||
THIS IS 20.05 before the patch
=======
THIS IS 20.05 after the patch
>>>>>>>

↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

<<<<<<< HEAD
        $response = $elasticsearch->bulk(
            index => $conf->{index_name},
            type => 'data', # is just hard coded in Indexer.pm?
            body => \@body
        );
||||||| parent of a60a3b26d7 (Bug 26312: Catch ES Client errors, log, and
continue indexing when error encountered)
        my $elasticsearch = $self->get_elasticsearch();
        $response = $elasticsearch->bulk(
            index => $self->index_name,
            type => 'data', # is just hard coded in Indexer.pm?
            body => \@body
        );
        if ($response->{errors}) {
            carp "One or more ElasticSearch errors occurred when indexing
documents";
        }
=======
        try{
            my $elasticsearch = $self->get_elasticsearch();
            $response = $elasticsearch->bulk(
                index => $self->index_name,
                type => 'data', # is just hard coded in Indexer.pm?
                body => \@body
            );
            if ($response->{errors}) {
                carp "One or more ElasticSearch errors occurred when indexing
documents";
            }
        } catch {
            if( ref $_ eq 'Search::Elasticsearch::Error::Timeout' ){
            Koha::Exceptions::Elasticsearch::BadResponse->throw(
                error => "Record commit failed.",
                details => "Timeout",
            );
            }
        };
>>>>>>> a60a3b26d7 (Bug 26312: Catch ES Client errors, log, and continue indexing when error encountered)


== The resolution ==
        try{
            $response = $elasticsearch->bulk(
                index => $conf->{index_name},
                type => 'data', # is just hard coded in Indexer.pm?
                body => \@body
            );
        } catch {
            if ( ref $_ eq 'Search::Elasticsearch::Error::Timeout' ) {
                Koha::Exceptions::Elasticsearch::BadResponse->throw(
                    error => "Record commit failed.",
                    details => "Timeout",
                );
            }
        };
But I'm not sure not to have caused a side effect when filtering the changes to
keep between 19.11 and 20.05

There are also two other minor conflicts. Not worried about these.

== Test ==
misc/search_tools/rebuild_elasticsearch.pl -v -d -c 1
# PLUS
docker restart koha_es_1
# during the process
# It did show the expected difference with and without the patch

But still worried about an eventual side effect.

If someone would like to have this in 19.11.x some review is need.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list