~percona-toolkit-dev/percona-toolkit/fix-pt-osc-empty-table-bug-1020997

« back to all changes in this revision

Viewing changes to lib/UpgradeReportFormatter.pm

Merge pt-upgrade-hostname-bug-980318.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# This program is copyright 2009-2011 Percona Inc.
 
1
# This program is copyright 2009-2012 Percona Inc.
2
2
# Feedback and improvements are welcome.
3
3
#
4
4
# THIS PROGRAM IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
25
25
use strict;
26
26
use warnings FATAL => 'all';
27
27
use English qw(-no_match_vars);
 
28
 
28
29
use constant PTDEBUG           => $ENV{PTDEBUG};
29
 
 
30
 
Transformers->import(qw(make_checksum percentage_of shorten micro_t));
31
 
 
32
30
use constant LINE_LENGTH       => 74;
33
31
use constant MAX_STRING_LENGTH => 10;
34
32
 
 
33
Transformers->import(qw(make_checksum percentage_of shorten micro_t));
 
34
 
35
35
# Special formatting functions
36
36
my %formatting_function = (
37
37
   ts => sub {
70
70
   $line .= ('_' x (LINE_LENGTH - length($line)));
71
71
   push @result, $line;
72
72
 
 
73
   # Second line: full host names
 
74
   # https://bugs.launchpad.net/percona-toolkit/+bug/980318
 
75
   my $hostno = 0;
 
76
   foreach my $host ( @$hosts ) {
 
77
      $hostno++;
 
78
      push @result, "# host$hostno: " . ($host->{name} || '?')
 
79
   }
 
80
 
73
81
   # Differences report.  This relies on a sampleno attrib in each class
74
82
   # since all other attributes (except maybe Query_time) are optional.
75
83
   my $class = $meta_stats->{classes}->{$where};
89
97
      underline_header => 0,
90
98
      strip_whitespace => 0,
91
99
   );
 
100
   $hostno = 0;
92
101
   $report->set_columns(
93
102
      { name => '' },
94
 
      map { { name => $_->{name}, right_justify => 1 } } @$hosts,
 
103
      map { $hostno++; { name => "host$hostno", right_justify => 1 } } @$hosts,
95
104
   );
96
105
   # Bool values.
97
106
   foreach my $thing ( qw(Errors Warnings) ) {