From: madtibo Date: Wed, 23 Jan 2019 13:33:08 +0000 (+0100) Subject: editor config changes X-Git-Tag: v10.3~7^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8f00b6e60936efa3572e170d41485499e4b3a4d4;p=pgbadger editor config changes --- diff --git a/pgbadger b/pgbadger index c8910ae..dbc0330 100755 --- a/pgbadger +++ b/pgbadger @@ -709,7 +709,7 @@ elsif ($#outfiles == -1) { ($extension) ? push(@outfiles, 'out.' . $extension) : push(@outfiles, 'out.html'); map { s/\.text/.txt/; } @outfiles; - + } # Set the default extension and output format, load JSON Perl module if required @@ -1212,7 +1212,7 @@ if ( $outdir && $retention && ($saved_last_line{datetime} || $pgb_saved_last_lin } } } - # Now removed the corresponding days + # Now removed the corresponding days foreach my $y (sort { $a <=> $b } @dyears) { unless(opendir(DIR, "$outdir/$y")) { localdie("Error: can't opendir $outdir/$y: $!"); @@ -1320,7 +1320,7 @@ if ($incremental && !$remote_host) # Auto detect log format for proper parsing my $fmt = autodetect_format($f); - # Set regex to parse the log file + # Set regex to parse the log file $fmt = set_parser_regex($fmt); if (($fmt ne 'pgbouncer') && ($saved_last_line{current_pos} > 0)) @@ -1607,7 +1607,7 @@ if ( !$incremental && ($#given_log_files >= 0) ) &restore_log_type_count(); foreach $outfile (@outfiles) - { + { ($current_out_file, $extens) = &set_output_extension($outfile, $extension); $extens = $dft_extens if ($current_out_file eq '-' && $dft_extens); @@ -1942,7 +1942,7 @@ reports: If you have a pg_dump at 23:00 and 13:00 each day during half an hour, you can use pgBadger as follow to exclude these period from the report: - pgbadger --exclude-time "2013-09-.* (23|13):.*" postgresql.log + pgbadger --exclude-time "2013-09-.* (23|13):.*" postgresql.log This will help avoid having COPY statements, as generated by pg_dump, on top of the list of slowest queries. You can also use --exclude-appname "pg_dump" to @@ -2379,7 +2379,7 @@ sub build_incremental_reports - $pgbadger_logo + $pgbadger_logo
$local_title
@@ -3018,7 +3018,7 @@ sub process_file print STDERR "reset CSV parser\n"; $csv->SetDiag(0); } else { - $cursize = $totalsize; + $cursize = $totalsize; } } } @@ -3486,7 +3486,7 @@ sub unescape_jsonlog while ($str =~ s/\\r\\n/\n/gs) {}; while ($str =~ s/([^\\])\\r/$1\n/gs) {}; while ($str =~ s/([^\\])\\n/$1\n/gs) {}; - + return $str; } @@ -3571,7 +3571,7 @@ sub parse_orphan_line if ($1 > $autovacuum_info{peak}{system_usage}{elapsed}) { $autovacuum_info{peak}{system_usage}{elapsed} = $1; $autovacuum_info{peak}{system_usage}{table} = $cur_info{$cur_pid}{vacuum}; - $autovacuum_info{peak}{system_usage}{date} = + $autovacuum_info{peak}{system_usage}{date} = "$cur_info{$cur_pid}{year}-$cur_info{$cur_pid}{month}-$cur_info{$cur_pid}{day} " . "$cur_info{$cur_pid}{hour}:$cur_info{$cur_pid}{min}:$cur_info{$cur_pid}{sec}"; } @@ -3658,7 +3658,7 @@ sub check_file_changed if ($iscompressed) { close($lfile); return (1, "log file is compressed"); - + } my ($gsec, $gmin, $ghour, $gmday, $gmon, $gyear, $gwday, $gyday, $gisdst) = localtime(time); @@ -3837,7 +3837,7 @@ sub check_incremental_position my $bpath = $incr_date; $bpath =~ s/\-/\//g; - # Mark this directory as needing a reindex + # Mark this directory as needing a reindex if (open(my $out, '>>' , "$last_parsed.tmp")) { flock($out, 2) || return 1; print $out "$incr_date\n"; @@ -3915,7 +3915,7 @@ sub normalize_query # Remove extra space, new line and tab characters by a single space $orig_query =~ s/\s+/ /gs; - # Removed start of transaction + # Removed start of transaction if ($orig_query !~ /^\s*begin\s*;\s*$/) { $orig_query =~ s/^\s*begin\s*;\s*//gs } @@ -4073,7 +4073,7 @@ sub convert_time $milliseconds =~ s/\.\d+//; } $milliseconds =~ s/^[0]+// if ($milliseconds !~ /\./); - + $time = $days . $hours . $minutes . $seconds . $milliseconds; $time = '0ms' if ($time eq ''); @@ -4621,7 +4621,7 @@ Report not supported by text format print $fh "\t- Example $j: ", &convert_time($d), " - $db - ", $normalyzed_info{$k}{samples}{$d}{query}, "\n"; $j++; } - } + } $idx++; } @top_temporary = (); @@ -4681,7 +4681,7 @@ Report not supported by text format print $fh "\t- Example $j: ", &convert_time($d), " - $db - ", $normalyzed_info{$k}{samples}{$d}{query}, "\n"; $j++; } - } + } $idx++; } @top_cancelled = (); @@ -5235,7 +5235,7 @@ sub html_header
  • Checkpoints buffers
  • Checkpoints files
  • Checkpoints distance
  • -
  • Checkpoint activity
  • +
  • Checkpoint activity
  • }; @@ -5302,7 +5302,7 @@ sub html_header }; } print $fh qq{ - + }; } @@ -5330,7 +5330,7 @@ sub html_header $sqlstate_report
  • Most frequent errors/events
  • - + }; } @@ -5411,7 +5411,7 @@ sub html_footer @@ -5681,7 +5681,7 @@ sub print_general_activity @{$all_query_duration{'WRITE'}}= sort{ $a <=> $b } (@{$all_query_duration{'INSERT'}},@{$all_query_duration{'UPDATE'}},@{$all_query_duration{'DELETE'}},@{$all_query_duration{'COPY FROM'}}); $cur_period_info{'WRITE'}{$lp}{percentileindex} = int(@{$all_query_duration{'WRITE'}} * $lp / 100) ; $cur_period_info{'WRITE'}{$lp}{percentile} = $all_query_duration{'WRITE'}[$cur_period_info{'WRITE'}{$lp}{percentileindex}]; - $percentile{'WRITE'}{$lp} = &convert_time($cur_period_info{'WRITE'}{$lp}{percentile}); + $percentile{'WRITE'}{$lp} = &convert_time($cur_period_info{'WRITE'}{$lp}{percentile}); } $queries .= qq{ @@ -5806,7 +5806,7 @@ sub print_general_activity $queries - +
    @@ -5824,7 +5824,7 @@ sub print_general_activity $select_queries -
    +
    @@ -5844,7 +5844,7 @@ sub print_general_activity $write_queries -
    +
    @@ -5860,7 +5860,7 @@ sub print_general_activity $prepared_queries -
    +
    @@ -5874,7 +5874,7 @@ sub print_general_activity $connections -
    +
    @@ -5888,7 +5888,7 @@ sub print_general_activity $sessions -
    +
    Back to the top of the General Activity table @@ -5940,7 +5940,7 @@ sub print_sql_traffic
    @@ -5959,7 +5959,7 @@ $drawn_graphs{queriespersecond_graph}
    @@ -5978,7 +5978,7 @@ $drawn_graphs{selectqueries_graph}
    @@ -6071,7 +6071,7 @@ sub print_pgbouncer_stats
    @@ -6090,9 +6090,9 @@ $drawn_graphs{pgb_requestpersecond_graph}
    @@ -6111,7 +6111,7 @@ $drawn_graphs{pgb_bytepersecond_graph}
    @@ -6263,7 +6263,7 @@ sub compute_query_graphs # Average duration per minute $graph_data{query4} .= "[$t, " . sprintf("%.3f", ($q_dataavg{duration}{"$rd"} || 0) / ($q_dataavg{count}{"$rd"} || 1)) . "],"; } - if (scalar keys %c_dataavg) { + if (scalar keys %c_dataavg) { # Average connections per minute $graph_data{conn_avg} .= "[$t, " . int(($c_dataavg{average}{"$rd"} || 0) / (60 * $avg_minutes)) . "],"; # Max connections per minute @@ -6272,7 +6272,7 @@ sub compute_query_graphs # Min connections per minute $graph_data{conn_min} .= "[$t, " . ($c_dataavg{min}{"$rd"} || 0) . "],"; } - if (scalar keys %s_dataavg) { + if (scalar keys %s_dataavg) { # Average connections per minute $graph_data{sess_avg} .= "[$t, " . int(($s_dataavg{average}{"$rd"} || 0) / (60 * $avg_minutes)) . "],"; # Max connections per minute @@ -6281,7 +6281,7 @@ sub compute_query_graphs # Min connections per minute $graph_data{sess_min} .= "[$t, " . ($s_dataavg{min}{"$rd"} || 0) . "],"; } - if (!$disable_query && (scalar keys %a_dataavg > 0)) { + if (!$disable_query && (scalar keys %a_dataavg > 0)) { foreach my $action (@SQL_ACTION) { next if ($select_only && ($action ne 'SELECT')); @@ -6300,7 +6300,7 @@ sub compute_query_graphs } } } - if (!$disable_query && (scalar keys %p_dataavg> 0)) { + if (!$disable_query && (scalar keys %p_dataavg> 0)) { $graph_data{prepare} .= "[$t, " . ($p_dataavg{prepare}{"$rd"} || 0) . "],"; $graph_data{execute} .= "[$t, " . ($p_dataavg{execute}{"$rd"} || 0) . "],"; $graph_data{ratio_bind_prepare} .= "[$t, " . sprintf("%.2f", ($p_dataavg{execute}{"$rd"} || 0) / ($p_dataavg{prepare}{"$rd"} || 1)) . "],"; @@ -6426,7 +6426,7 @@ sub compute_pgbouncer_graphs next if ($t < $t_min); last if ($t > $t_max); - if (scalar keys %c_dataavg) { + if (scalar keys %c_dataavg) { # Average connections per minute $graph_data{conn_avg} .= "[$t, " . int(($c_dataavg{average}{"$rd"} || 0) / (60 * $avg_minutes)) . "],"; # Max connections per minute @@ -6435,7 +6435,7 @@ sub compute_pgbouncer_graphs # Min connections per minute $graph_data{conn_min} .= "[$t, " . ($c_dataavg{min}{"$rd"} || 0) . "],"; } - if (scalar keys %s_dataavg) { + if (scalar keys %s_dataavg) { # Average connections per minute $graph_data{sess_avg} .= "[$t, " . int(($s_dataavg{average}{"$rd"} || 0) / (60 * $avg_minutes)) . "],"; # Max connections per minute @@ -6489,7 +6489,7 @@ sub print_established_connection
    @@ -6521,7 +6521,7 @@ sub print_established_pgb_connection
    @@ -6576,7 +6576,7 @@ sub print_user_connection
    @@ -6601,7 +6601,7 @@ sub print_user_connection $conn_user_info - + @@ -6653,7 +6653,7 @@ sub print_user_pgb_connection
    @@ -6678,7 +6678,7 @@ sub print_user_pgb_connection $conn_user_info - + @@ -6729,7 +6729,7 @@ sub print_host_connection
    @@ -6754,7 +6754,7 @@ sub print_host_connection $conn_host_info - + @@ -6806,7 +6806,7 @@ sub print_host_pgb_connection
    @@ -6831,7 +6831,7 @@ sub print_host_pgb_connection $conn_host_info - + @@ -6887,7 +6887,7 @@ sub print_database_connection
    @@ -6913,7 +6913,7 @@ sub print_database_connection $conn_database_info - + @@ -6968,7 +6968,7 @@ sub print_database_pgb_connection
    @@ -6994,7 +6994,7 @@ sub print_database_pgb_connection $conn_database_info - + @@ -7023,7 +7023,7 @@ sub print_simultaneous_session
    @@ -7055,7 +7055,7 @@ sub print_simultaneous_pgb_session
    @@ -7134,7 +7134,7 @@ sub print_histogram_session_times $histogram_info - + @@ -7209,7 +7209,7 @@ sub print_histogram_pgb_session_times $histogram_info - + @@ -7263,7 +7263,7 @@ sub print_user_session
    @@ -7290,7 +7290,7 @@ sub print_user_session $sess_user_info - + @@ -7344,7 +7344,7 @@ sub print_user_pgb_session
    @@ -7371,7 +7371,7 @@ sub print_user_pgb_session $sess_user_info - + @@ -7425,7 +7425,7 @@ sub print_host_session
    @@ -7452,7 +7452,7 @@ sub print_host_session $sess_host_info - + @@ -7507,7 +7507,7 @@ sub print_host_pgb_session
    @@ -7534,7 +7534,7 @@ sub print_host_pgb_session $sess_host_info - + @@ -7589,7 +7589,7 @@ sub print_app_session
    @@ -7616,7 +7616,7 @@ sub print_app_session $sess_app_info - + @@ -7671,7 +7671,7 @@ sub print_database_session
    @@ -7699,7 +7699,7 @@ sub print_database_session $sess_database_info - + @@ -7753,7 +7753,7 @@ sub print_database_pgb_session
    @@ -7781,7 +7781,7 @@ sub print_database_pgb_session $sess_database_info - + @@ -7862,7 +7862,7 @@ sub print_checkpoint } } # Checkpoint buffers and files - $drawn_graphs{checkpointwritebuffers_graph} = + $drawn_graphs{checkpointwritebuffers_graph} = &jqplot_linegraph($graphid++, 'checkpointwritebuffers_graph', $graph_data{wbuffer}, '', '', 'Checkpoint write buffers (' . $avg_minutes . ' minutes period)', 'Buffers', 'Write buffers', '', '' @@ -7911,7 +7911,7 @@ sub print_checkpoint
    @@ -7951,7 +7951,7 @@ $drawn_graphs{checkpointfiles_graph}
    • $checkpoint_distance_peak Mo Distance Peak
    • -
    • $checkpoint_distance_peak_date Date
    • +
    • $checkpoint_distance_peak_date Date
    @@ -8070,7 +8070,7 @@ $drawn_graphs{checkpointdistance_graph} $buffers - +
    @@ -8088,7 +8088,7 @@ $drawn_graphs{checkpointdistance_graph} $files -
    +
    @@ -8102,7 +8102,7 @@ $drawn_graphs{checkpointdistance_graph} $warnings -
    +
    @@ -8116,8 +8116,8 @@ $drawn_graphs{checkpointdistance_graph} $distance -
    -
    + + Back to the top of the Checkpoint Activity table @@ -8430,7 +8430,7 @@ sub print_analyze_per_table
    @@ -8455,7 +8455,7 @@ sub print_analyze_per_table $analyze_info - + @@ -8687,7 +8687,7 @@ sub print_vacuum_per_table
    @@ -8713,7 +8713,7 @@ sub print_vacuum_per_table $vacuum_info - + @@ -8808,7 +8808,7 @@ sub print_vacuum_tuple_removed $vacuum_info - + @@ -8904,7 +8904,7 @@ sub print_vacuum_page_removed $vacuum_info - + @@ -9002,7 +9002,7 @@ sub print_lock_type $locktype_info - + @@ -9093,7 +9093,7 @@ sub print_query_type $querytype_info - + @@ -9190,7 +9190,7 @@ sub print_query_per_database $query_database_info - + @@ -9284,7 +9284,7 @@ sub print_query_per_application $query_application_info - + @@ -9339,7 +9339,7 @@ sub print_query_per_user $infos{duration}{$d} = $user_info{$d}{duration} || 0; } else { $infos{duration}{"Sum duration per users < $pie_percentage_limit%"} += $user_info{$d}{duration} || 0; - push(@{$small{duration}}, $d); + push(@{$small{duration}}, $d); } } if ($#{$small{queries}} == 0) { @@ -9348,7 +9348,7 @@ sub print_query_per_user } if ($#{$small{duration}} == 0){ $infos{duration}{$small{duration}[0]} = $infos{duration}{"Sum duration per users < $pie_percentage_limit%"}; - delete $infos{duration}{"Sum duration per users < $pie_percentage_limit%"}; + delete $infos{duration}{"Sum duration per users < $pie_percentage_limit%"}; } } $drawn_graphs{queriesbyuser_graph} = &jqplot_piegraph($graphid++, 'graph_queriesbyuser', 'Queries per user', %{$infos{queries}}); @@ -9392,7 +9392,7 @@ sub print_query_per_user $query_user_info - + @@ -9435,7 +9435,7 @@ sub print_query_per_user $query_user_info - + @@ -9531,7 +9531,7 @@ sub print_query_per_host $query_host_info - + @@ -9796,7 +9796,7 @@ sub print_tempfile_report print $fh qq{
    $query
    $md5 - +
    $details
    }; @@ -9811,7 +9811,7 @@ sub print_tempfile_report }; - } + } $rank++; } print $fh qq{ @@ -9940,7 +9940,7 @@ sub print_cancelled_report print $fh qq{
    $query
    $md5 - +
    $details
    }; @@ -9955,7 +9955,7 @@ sub print_cancelled_report }; - } + } $rank++; } print $fh qq{ @@ -10089,7 +10089,7 @@ sub print_histogram_query_times $histogram_info - + @@ -10256,7 +10256,7 @@ sub print_time_consuming if (scalar keys %{$normalyzed_info{$k}{apps}} > 0) { $apps_involved = qq{}; } - my $query_histo = + my $query_histo = &jqplot_histograph($graphid++, 'time_consuming_queries_details_'.$rank, $graph_data{count}, $graph_data{duration}, 'Queries', 'Avg. duration'); print $fh qq{ @@ -11322,7 +11322,7 @@ sub print_log_level $logtype_info - + @@ -11433,7 +11433,7 @@ sub print_error_code $errorclass_info - + @@ -11466,9 +11466,9 @@ sub show_error_as_html
    -
    +
    @@ -11573,7 +11573,7 @@ sub show_error_as_html }; print $fh qq{ -

    +

    } if (($sample > 0) && ($#{$error_info{$k}{date}} >= 0)); print $fh qq{ @@ -11657,9 +11657,9 @@ sub show_pgb_error_as_html
    • $main_error Max number of times the same event was reported
    • -
    • $total Total events found
    • +
    • $total Total events found
    -
    +
    @@ -11761,7 +11761,7 @@ sub show_pgb_error_as_html }; print $fh qq{ -

    +

    } if (($sample > 0) && ($#{$pgb_error_info{$k}{date}} >= 0)); print $fh qq{ @@ -11829,9 +11829,9 @@ sub show_pgb_reserved_pool - +
    @@ -11984,7 +11984,7 @@ sub load_stats if ($_overall_stat{'first_log_ts'}) { $overall_stat{'first_log_ts'} = $_overall_stat{'first_log_ts'} - if (!$overall_stat{'first_log_ts'} || + if (!$overall_stat{'first_log_ts'} || ($overall_stat{'first_log_ts'} gt $_overall_stat{'first_log_ts'})); } @@ -11999,7 +11999,7 @@ sub load_stats } $overall_stat{'last_query_ts'} = $_overall_stat{'last_query_ts'} - if not $overall_stat{'last_query_ts'} + if not $overall_stat{'last_query_ts'} or $overall_stat{'last_query_ts'} lt $_overall_stat{'last_query_ts'}; $overall_stat{errors_number} += $_overall_stat{errors_number}; @@ -12211,13 +12211,13 @@ sub load_stats } } for (my $i = 0; $i <= $#{$_error_info{$q}{date}}; $i++) { - &set_top_error_sample( $q, - $_error_info{$q}{date}[$i], + &set_top_error_sample( $q, + $_error_info{$q}{date}[$i], $_error_info{$q}{error}[$i], - $_error_info{$q}{detail}[$i], - $_error_info{$q}{context}[$i], + $_error_info{$q}{detail}[$i], + $_error_info{$q}{context}[$i], $_error_info{$q}{statement}[$i], - $_error_info{$q}{hint}[$i], + $_error_info{$q}{hint}[$i], $_error_info{$q}{db}[$i], $_error_info{$q}{user}[$i], $_error_info{$q}{app}[$i], @@ -12240,8 +12240,8 @@ sub load_stats } } for (my $i = 0; $i <= $#{$_pgb_error_info{$q}{date}}; $i++) { - &pgb_set_top_error_sample( $q, - $_pgb_error_info{$q}{date}[$i], + &pgb_set_top_error_sample( $q, + $_pgb_error_info{$q}{date}[$i], $_pgb_error_info{$q}{error}[$i], $_pgb_error_info{$q}{db}[$i], $_pgb_error_info{$q}{user}[$i], @@ -12349,13 +12349,13 @@ sub load_stats ($_pgb_per_minute_info{$day}{$hour}{$min}{connection}{count} || 0); $pgb_per_minute_info{$day}{$hour}{$min}{session}{count} += ($_pgb_per_minute_info{$day}{$hour}{$min}{session}{count} || 0); - $pgb_per_minute_info{$day}{$hour}{$min}{t_req} += + $pgb_per_minute_info{$day}{$hour}{$min}{t_req} += ($_pgb_per_minute_info{$day}{$hour}{$min}{t_req} || 0); - $pgb_per_minute_info{$day}{$hour}{$min}{t_inbytes} += + $pgb_per_minute_info{$day}{$hour}{$min}{t_inbytes} += ($_pgb_per_minute_info{$day}{$hour}{$min}{t_inbytes} || 0); - $pgb_per_minute_info{$day}{$hour}{$min}{t_outbytes} += + $pgb_per_minute_info{$day}{$hour}{$min}{t_outbytes} += ($_pgb_per_minute_info{$day}{$hour}{$min}{t_outbytes} || 0); - $pgb_per_minute_info{$day}{$hour}{$min}{t_avgduration} += + $pgb_per_minute_info{$day}{$hour}{$min}{t_avgduration} += ($_pgb_per_minute_info{$day}{$hour}{$min}{t_avgduration} || 0); } } @@ -12409,10 +12409,10 @@ sub load_stats $normalyzed_info{$stmt}{count} += $_normalyzed_info{$stmt}{count}; # Set min / max duration for this query - if (!exists $normalyzed_info{$stmt}{min} || ($normalyzed_info{$stmt}{min} > $_normalyzed_info{$stmt}{min})) { + if (!exists $normalyzed_info{$stmt}{min} || ($normalyzed_info{$stmt}{min} > $_normalyzed_info{$stmt}{min})) { $normalyzed_info{$stmt}{min} = $_normalyzed_info{$stmt}{min}; } - if (!exists $normalyzed_info{$stmt}{max} || ($normalyzed_info{$stmt}{max} < $_normalyzed_info{$stmt}{max})) { + if (!exists $normalyzed_info{$stmt}{max} || ($normalyzed_info{$stmt}{max} < $_normalyzed_info{$stmt}{max})) { $normalyzed_info{$stmt}{max} = $_normalyzed_info{$stmt}{max}; } @@ -12438,10 +12438,10 @@ sub load_stats if (exists $_normalyzed_info{$stmt}{locks}) { $normalyzed_info{$stmt}{locks}{count} += $_normalyzed_info{$stmt}{locks}{count}; $normalyzed_info{$stmt}{locks}{wait} += $_normalyzed_info{$stmt}{locks}{wait}; - if (!exists $normalyzed_info{$stmt}{locks}{minwait} || ($normalyzed_info{$stmt}{locks}{minwait} > $_normalyzed_info{$stmt}{locks}{minwait})) { + if (!exists $normalyzed_info{$stmt}{locks}{minwait} || ($normalyzed_info{$stmt}{locks}{minwait} > $_normalyzed_info{$stmt}{locks}{minwait})) { $normalyzed_info{$stmt}{locks}{minwait} = $_normalyzed_info{$stmt}{locks}{minwait}; } - if (!exists $normalyzed_info{$stmt}{locks}{maxwait} || ($normalyzed_info{$stmt}{locks}{maxwait} < $_normalyzed_info{$stmt}{locks}{maxwait})) { + if (!exists $normalyzed_info{$stmt}{locks}{maxwait} || ($normalyzed_info{$stmt}{locks}{maxwait} < $_normalyzed_info{$stmt}{locks}{maxwait})) { $normalyzed_info{$stmt}{locks}{maxwait} = $_normalyzed_info{$stmt}{locks}{maxwait}; } } @@ -12449,10 +12449,10 @@ sub load_stats if (exists $_normalyzed_info{$stmt}{tempfiles}) { $normalyzed_info{$stmt}{tempfiles}{count} += $_normalyzed_info{$stmt}{tempfiles}{count}; $normalyzed_info{$stmt}{tempfiles}{size} += $_normalyzed_info{$stmt}{tempfiles}{size}; - if (!exists $normalyzed_info{$stmt}{tempfiles}{minsize} || ($normalyzed_info{$stmt}{tempfiles}{minsize} > $_normalyzed_info{$stmt}{tempfiles}{minsize})) { + if (!exists $normalyzed_info{$stmt}{tempfiles}{minsize} || ($normalyzed_info{$stmt}{tempfiles}{minsize} > $_normalyzed_info{$stmt}{tempfiles}{minsize})) { $normalyzed_info{$stmt}{tempfiles}{minsize} = $_normalyzed_info{$stmt}{tempfiles}{minsize}; } - if (!exists $normalyzed_info{$stmt}{tempfiles}{maxsize} || ($normalyzed_info{$stmt}{tempfiles}{maxsize} < $_normalyzed_info{$stmt}{tempfiles}{maxsize})) { + if (!exists $normalyzed_info{$stmt}{tempfiles}{maxsize} || ($normalyzed_info{$stmt}{tempfiles}{maxsize} < $_normalyzed_info{$stmt}{tempfiles}{maxsize})) { $normalyzed_info{$stmt}{tempfiles}{maxsize} = $_normalyzed_info{$stmt}{tempfiles}{maxsize}; } } @@ -12981,7 +12981,7 @@ sub parse_query my $fmt = shift; my $is_log_level = 0; - + my $t_pid = $prefix_vars{'t_pid'}; my $date_part = "$prefix_vars{'t_year'}$prefix_vars{'t_month'}$prefix_vars{'t_day'}"; @@ -13324,7 +13324,7 @@ sub parse_query if ($1 > $autovacuum_info{peak}{system_usage}{elapsed}) { $autovacuum_info{peak}{system_usage}{elapsed} = $1; $autovacuum_info{peak}{system_usage}{table} = $cur_info{$t_pid}{vacuum}; - $autovacuum_info{peak}{system_usage}{date} = + $autovacuum_info{peak}{system_usage}{date} = "$prefix_vars{'t_year'}-$prefix_vars{'t_month'}-$prefix_vars{'t_day'} " . "$prefix_vars{'t_hour'}:$prefix_vars{'t_min'}:$prefix_vars{'t_sec'}"; } @@ -14013,14 +14013,14 @@ sub store_queries if ($sample > 0) { my $cur_last_log_timestamp = "$cur_info{$t_pid}{year}-$cur_info{$t_pid}{month}-$cur_info{$t_pid}{day} " . "$cur_info{$t_pid}{hour}:$cur_info{$t_pid}{min}:$cur_info{$t_pid}{sec}"; - &set_top_error_sample( $normalized_error, - $cur_last_log_timestamp, - $cur_info{$t_pid}{query}, + &set_top_error_sample( $normalized_error, + $cur_last_log_timestamp, + $cur_info{$t_pid}{query}, $cur_info{$t_pid}{detail}, - $cur_info{$t_pid}{context}, - $cur_info{$t_pid}{statement}, - $cur_info{$t_pid}{hint}, - $cur_info{$t_pid}{dbname}, + $cur_info{$t_pid}{context}, + $cur_info{$t_pid}{statement}, + $cur_info{$t_pid}{hint}, + $cur_info{$t_pid}{dbname}, $cur_info{$t_pid}{dbuser}, $cur_info{$t_pid}{dbappname}, $cur_info{$t_pid}{dbclient}, @@ -14616,7 +14616,7 @@ sub search_log_format return ($fmt, $ident_name); } - + sub progress_bar { my ($got, $total, $width, $char, $queries, $errors) = @_; @@ -15187,7 +15187,7 @@ sub split_logfile $chunks[0] = $saved_pos; } } - # With small files splitting is inefficient + # With small files splitting is inefficient if ($totalsize <= 16777216) { return ($chunks[0], $totalsize); } @@ -15236,7 +15236,7 @@ sub get_week_number } else { $weekNumber = POSIX::strftime("%W", 1, 1, 1, $day, $month - 1, $year - 1900); } - + return sprintf("%02d", $weekNumber+1); } @@ -15313,7 +15313,7 @@ sub get_wdays_per_month sub IsLeapYear { return ((($_[0] & 3) == 0) && (($_[0] % 100 != 0) || ($_[0] % 400 == 0))); -} +} #### # Display calendar @@ -15365,7 +15365,7 @@ sub get_calendar $str .= "$week" . join('', @currow) . "\n"; @currow = ('','','','','','',''); } - } + } if ( ($wd != 6) || ($currow[0] ne '') ) { $week = sprintf("%02d", $wn); if (-e "$outdir/$year/week-$week/index.html") { @@ -15758,7 +15758,7 @@ sub query { while ($tmp_str =~ s/\s+AS\s+([^\s]+)\s+//is) { my $code_sep = quotemeta($1); foreach my $k (@{ $self->{ 'keywords' } }) { - last if ($code_sep =~ s/\b$k$//i); + last if ($code_sep =~ s/\b$k$//i); } if ($tmp_str =~ /\s+$code_sep[\s;]+/) { while ( $temp_content[$j] =~ s/($code_sep.*$code_sep)/CODEPART${i}CODEPART/s) { @@ -16149,7 +16149,7 @@ sub beautify { elsif ($token =~ /^(RETURN|RETURNS)$/i) { $self->{ '_is_in_index' } = 0; } - + #### # Mark statements that use string_agg() or group_concat() function # as statement that can have an ORDER BY clause inside the call to @@ -16329,7 +16329,7 @@ sub beautify { $self->{ '_is_in_type' }-- if ($self->{ '_is_in_type' }); $self->_new_line if ($self->{ '_current_sql_stmt' } ne 'INSERT' and !$self->{ '_is_in_function' } - and (defined $self->_next_token + and (defined $self->_next_token and $self->_next_token =~ /^(SELECT|WITH)$/i) and $last ne ')' ); @@ -16714,7 +16714,7 @@ sub beautify { { $self->_new_line; $self->_over if (!$self->{ '_is_in_join' }); - } + } $self->_add_token( $token ); } @@ -16798,7 +16798,7 @@ sub beautify { } elsif ($token =~ /^\\\S/) { - # treat everything starting with a \ and at least one character as psql meta command. + # treat everything starting with a \ and at least one character as psql meta command. $self->_add_token( $token ); $self->_new_line; } @@ -16902,7 +16902,7 @@ sub _add_token { if ( (!defined($last_token) || $last_token ne '(') && $token ne ')' && ($token !~ /^::/) ) { $self->{ 'content' } .= $sp if ($token ne ')' && defined($last_token) - && $last_token ne '::' + && $last_token ne '::' && ($token ne '(' || !$self->_is_function( $last_token ) || $self->{ '_is_in_type' }) ); $self->{ 'content' } .= $sp if (!defined($last_token) && $token); @@ -17410,7 +17410,7 @@ sub set_dicts { # First load it all as "my" variables, to make it simpler to modify/map/grep/add # Afterwards, when everything is ready, put it in $self->{'dict'}->{...} - my @pg_keywords = map { uc } qw( + my @pg_keywords = map { uc } qw( ADD AFTER ALL ALTER ANALYSE ANALYZE AND ANY ARRAY AS ASC ASYMMETRIC AUTHORIZATION AUTO_INCREMENT BACKWARD BEFORE BEGIN BERNOULLI BETWEEN BINARY BOTH BY BY CACHE CASCADE CASE CAST CHECK CHECKPOINT CLOSE CLUSTER COLLATE COLLATION COLUMN COMMENT COMMIT COMMITTED CONCURRENTLY CONFLICT CONSTRAINT @@ -17823,7 +17823,7 @@ sub _remove_dynamic_code } } - # Replace any COMMENT constant between single quote + # Replace any COMMENT constant between single quote while ($$str =~ s/IS\s+('[^;]+);/IS TEXTVALUE$idx;/s) { $self->{dynamic_code}{$idx} = $1; $idx++;