From: Darold Gilles Date: Wed, 6 Feb 2013 10:53:52 +0000 (+0100) Subject: Fix checkpoint reports when there is on checkpoint warnings. X-Git-Tag: v3.2~45 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=086b4ad63312b86f382afc1d72be3d0d59c3f936;p=pgbadger Fix checkpoint reports when there is on checkpoint warnings. --- diff --git a/pgbadger b/pgbadger index 2c709fb..1441dd9 100644 --- a/pgbadger +++ b/pgbadger @@ -2663,8 +2663,10 @@ sub dump_as_html if ($tempfile_info{count}) { print $fh qq{Temporary files}; } - if (exists $checkpoint_info{chronos}) { - print $fh qq{Checkpoints}; + if ($checkpoint_info{wbuffer}) { + if (exists $checkpoint_info{chronos}) { + print $fh qq{Checkpoints}; + } } if (exists $checkpoint_info{warning}) { print $fh qq{Checkpoint warning}; @@ -2678,9 +2680,9 @@ sub dump_as_html if ($tempfile_info{count}) { print $fh qq{CountAv. size}; } - if (exists $checkpoint_info{chronos}) { + if (exists $checkpoint_info{chronos} && $checkpoint_info{wbuffer}) { print $fh -qq{Wrote buffersAddedRemovedRecycledWrite time (sec)Sync time (sec)Total time (sec)}; + qq{Wrote buffersAddedRemovedRecycledWrite time (sec)Sync time (sec)Total time (sec)}; } if (exists $checkpoint_info{warning}) { print $fh qq{CountAv. time (sec)}; @@ -2707,7 +2709,7 @@ qq{Wrote buffersAddedRemovedRecycledWrit print $fh "", &comma_numbers($tempfile_info{chronos}{$d}{$h}{count} || 0), "$temp_average"; } - if (exists $checkpoint_info{chronos}) { + if (exists $checkpoint_info{chronos} && $checkpoint_info{wbuffer}) { if (exists $checkpoint_info{chronos}{$d}{$h}) { print $fh "", &comma_numbers($checkpoint_info{chronos}{$d}{$h}{wbuffer}) || 0, "", &comma_numbers($checkpoint_info{chronos}{$d}{$h}{file_added}) || 0, @@ -2718,23 +2720,24 @@ qq{Wrote buffersAddedRemovedRecycledWrit "", &comma_numbers($checkpoint_info{chronos}{$d}{$h}{sync}) || 0, "", &comma_numbers($checkpoint_info{chronos}{$d}{$h}{total}) || 0, ""; - if ($checkpoint_info{warning}) { - print $fh "", &comma_numbers($checkpoint_info{chronos}{$d}{$h}{warning}) || 0, - "", - &comma_numbers( - sprintf( - "%.2f", - ($checkpoint_info{chronos}{$d}{$h}{warning_seconds} || 0) / - ($checkpoint_info{chronos}{$d}{$h}{warning} || 1) - ) - ) || 0, ""; - } } else { print $fh "0000000"; - if ($checkpoint_info{warning}) { - print $fh "00"; - } + } + } + if (exists $checkpoint_info{chronos} && $checkpoint_info{warning}) { + if (exists $checkpoint_info{chronos}{$d}{$h}{warning}) { + print $fh "", &comma_numbers($checkpoint_info{chronos}{$d}{$h}{warning}) || 0, + "", + &comma_numbers( + sprintf( + "%.2f", + ($checkpoint_info{chronos}{$d}{$h}{warning_seconds} || 0) / + ($checkpoint_info{chronos}{$d}{$h}{warning} || 1) + ) + ) || 0, ""; + } else { + print $fh "00"; } } if (exists $autovacuum_info{chronos}) { @@ -2750,7 +2753,7 @@ qq{Wrote buffersAddedRemovedRecycledWrit } if (!$disable_hourly && $graph) { # checkpoint size - if (exists $checkpoint_info{chronos}) { + if (exists $checkpoint_info{chronos} && $checkpoint_info{wbuffer}) { foreach my $tm (sort {$a <=> $b} keys %{$checkpoint_info{chronos}}) { $tm =~ /(\d{4})(\d{2})(\d{2})/; my $y = $1 - 1900;