From: Darold Gilles Date: Wed, 6 Aug 2014 09:49:01 +0000 (+0200) Subject: Fix revert to single thread when last_line_parsed exists. Thanks to Bruno Almeida... X-Git-Tag: v6.0~10 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8e54e0dd410158f185092588c4e605a56e69ddfb;p=pgbadger Fix revert to single thread when last_line_parsed exists. Thanks to Bruno Almeida for the report. --- diff --git a/pgbadger b/pgbadger index 7f0cb10..401e58c 100755 --- a/pgbadger +++ b/pgbadger @@ -10696,15 +10696,16 @@ sub split_logfile my $i = 1; if ($last_parsed && $saved_last_line{current_pos} && ($saved_last_line{current_pos} < $totalsize)) { $chunks[0] = $saved_last_line{current_pos}; - $i = $saved_last_line{current_pos}; } my ($lfile, $null) = &get_log_file($logf); # Get file handle to the file while ($i < $queue_size) { my $pos = int(($totalsize/$queue_size) * $i); - $lfile->seek($pos, 0); - #Move the offset to the BEGINNING of each line, because the logic in process_file requires so - $pos= $pos + length(<$lfile>) - 1; - push(@chunks, $pos); + if ($pos > $chunks[0]) { + $lfile->seek($pos, 0); + #Move the offset to the BEGINNING of each line, because the logic in process_file requires so + $pos= $pos + length(<$lfile>) - 1; + push(@chunks, $pos); + } $i++; } $lfile->close();