Skip Menu |

This queue is for tickets about the HTTP-ClickHouse CPAN distribution.

Report information
The Basics
Id: 118676
Status: resolved
Priority: 0/
Queue: HTTP-ClickHouse

People
Owner: Nobody in particular
Requestors: MOCNII [...] cpan.org
Cc: msestak [...] irb.hr
AdminCc:

Bug Information
Severity: Critical
Broken in: 0.05
Fixed in: 0.061



CC: msestak [...] irb.hr
Subject: SELECT is broken for large tables
There is a bug parsing body of response which causes that large SELECTs are broken. SELECTing from a small table is unaffected so this is why this bug went unnoticed. _read() sub is affected. Proposed solution is: sub _read { my $self = shift; my @_response; my $remainder = ''; READBODY: { my $_bufer; my $l = $self->{socket}->read_entity_body($_bufer, READ_BUFFER_LENGTH); $_bufer = $remainder . $_bufer; $remainder = ''; last unless $l; if ($_bufer =~ s!([^\n]+\z)!!) { $remainder = $1; } push @_response, split (/\n/, $_bufer); redo READBODY; } return $self->body2array(@_response); } See discussion at http://www.perlmonks.org/?node_id=1175544 and thanks Corion for figuring out a problem.
Subject: Re: [rt.cpan.org #118676] SELECT is broken for large tables
Date: Wed, 09 Nov 2016 11:24:42 +0300
To: "bug-HTTP-ClickHouse [...] rt.cpan.org" <bug-http-clickhouse [...] rt.cpan.org>
From: Мотыльков Максим <motylkov [...] yandex.ru>
Fixed code for large SELECTs.
 
Thanks.
 
 
 
08.11.2016, 17:35, "Martin Sebastijan Šestak via RT" <bug-http-clickhouse@rt.cpan.org>:
Show quoted text

Tue Nov 08 09:34:50 2016: Request 118676 was acted upon.
Transaction: Ticket created by MOCNII
       Queue: HTTP-ClickHouse
     Subject: SELECT is broken for large tables
   Broken in: 0.05
    Severity: Critical
       Owner: Nobody
  Requestors: MOCNII@cpan.org
      Status: new
 Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=118676 >


There is a bug parsing body of response which causes that large SELECTs are broken. SELECTing from a small table is unaffected so this is why this bug went unnoticed.

_read() sub is affected.

Proposed solution is:
sub _read {
    my $self = shift;
    my @_response;
    my $remainder = '';
    READBODY: {
        my $_bufer;
        my $l = $self->{socket}->read_entity_body($_bufer, READ_BUFFER_LENGTH);
        $_bufer = $remainder . $_bufer;
        $remainder = '';
        last unless $l;
        if ($_bufer =~ s!([^\n]+\z)!!) {
            $remainder = $1;
        }
        push @_response, split (/\n/, $_bufer);
        redo READBODY;
    }
    return $self->body2array(@_response);
}

See discussion at http://www.perlmonks.org/?node_id=1175544 and thanks Corion for figuring out a problem.
 

RT-Send-CC: msestak [...] irb.hr, motylkov [...] yandex.ru
Thank you for fast response (and update). However, there is a misspelling error on line 176 of ClickHouse.pm $_bufer = $remainder . $buf; should be $_bufer = $remainder . $_bufer;
CC: "msestak [...] irb.hr" <msestak [...] irb.hr>
Subject: Re: [rt.cpan.org #118676] SELECT is broken for large tables
Date: Wed, 09 Nov 2016 15:34:29 +0300
To: "bug-HTTP-ClickHouse [...] rt.cpan.org" <bug-http-clickhouse [...] rt.cpan.org>
From: Мотыльков Максим <motylkov [...] yandex.ru>
Fixed
 
 
 
 
09.11.2016, 15:25, "Martin Sebastijan Šestak via RT" <bug-http-clickhouse@rt.cpan.org>:
Show quoted text

<URL: https://rt.cpan.org/Ticket/Display.html?id=118676 >

Thank you for fast response (and update).
However, there is a misspelling error on line 176 of ClickHouse.pm
$_bufer = $remainder . $buf;
should be
$_bufer = $remainder . $_bufer;