pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Perl Elasticsearch client p5-Search-Elasticsearch and older stacks



On Fri, 12 Apr 2024 at 15:24, Brad Spencer <brad%anduin.eldar.org@localhost> wrote:
>
> I won't go into the drama behind this, as one can do a Internet search
> and find it for yourself, but Elasticsearch is in an argument with
> Opensearch and a resulting fall out is that the 8.0 Perl Elasticsearch
> client (p5-Search-Elasticsearch) has been broken such that it will not
> speak to most older Elasticsearch clusters, either from Elasticsearch
> themselves, or from Opensearch.
>
> For perl, you can get it working again with something like this after
> the client code is installed (this was from a NetBSD pkgsrc 2024Q1 from
> /usr/pkg):
>
> --- lib/perl5/vendor_perl/5.38.0/Search/Elasticsearch/Role/Cxn.pm.ORIG  2022-12-29 07:21:56.000000000 -0500
> +++ lib/perl5/vendor_perl/5.38.0/Search/Elasticsearch/Role/Cxn.pm       2024-04-12 09:44:50.870719667 -0400
> @@ -361,12 +361,12 @@
>      my ( $self, $params, $code, $msg, $body, $headers ) = @_;
>
>      # Product check
> -    if ( $code >= 200 and $code < 300 ) {
> -        my $product = $headers->{$PRODUCT_CHECK_HEADER} // '';
> -        if ($product ne $PRODUCT_CHECK_VALUE) {
> -            throw( "ProductCheck", "The client noticed that the server is not Elasticsearch and we do not support this unknown product" );
> -        }
> -    }
> +#    if ( $code >= 200 and $code < 300 ) {
> +#        my $product = $headers->{$PRODUCT_CHECK_HEADER} // '';
> +#        if ($product ne $PRODUCT_CHECK_VALUE) {
> +#            throw( "ProductCheck", "The client noticed that the server is not Elasticsearch and we do not support this unknown product" );
> +#        }
> +#    }
>
>      $self->_decompress_body( \$body, $headers );
>
> The client code for 8.0 appears to work just fine with a 7.x
> Elasticsearch cluster, at the very least, and likely works for older
> Elasticsearch nodes.  I have a bunch of stuff that uses Elasticsearch as
> a client from NetBSD to an ArchLinux cluster running 7.x.  It is very
> common for clusters to never be updated once installed, or not updated
> very often as those updates can be very painful if there are a lot of
> indexes or even a small number of very large indexes.
>
> This could probably be cleaned up some and included officially in pkgsrc
> if that isn't against the rules.  The maintainer for the Elasticsearch
> perl code is pkgsrc-users.
>
> An aside, the error that will get shown to the end using program can be
> quite wrong, as a lot of the internal users in the perl Elasticsearch
> client code itself are not expecting ProductCheck to be tossed at that
> point and you are often just presented with a generic "No Nodes are
> available" error is tossed back to your program and not ProductCheck.

Would it be reasonable to switch it to "warn log and continue" rather
than throw?

David


Home | Main Index | Thread Index | Old Index