mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-10 05:00:45 +00:00
Add # HostN: <full hostname> to UpgradeReportFormatter header and use HostN in column instead.
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
# This program is copyright 2009-2011 Percona Inc.
|
# This program is copyright 2009-2012 Percona Inc.
|
||||||
# Feedback and improvements are welcome.
|
# Feedback and improvements are welcome.
|
||||||
#
|
#
|
||||||
# THIS PROGRAM IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
|
# THIS PROGRAM IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||||
@@ -25,13 +25,13 @@ package UpgradeReportFormatter;
|
|||||||
use strict;
|
use strict;
|
||||||
use warnings FATAL => 'all';
|
use warnings FATAL => 'all';
|
||||||
use English qw(-no_match_vars);
|
use English qw(-no_match_vars);
|
||||||
|
|
||||||
use constant PTDEBUG => $ENV{PTDEBUG};
|
use constant PTDEBUG => $ENV{PTDEBUG};
|
||||||
|
|
||||||
Transformers->import(qw(make_checksum percentage_of shorten micro_t));
|
|
||||||
|
|
||||||
use constant LINE_LENGTH => 74;
|
use constant LINE_LENGTH => 74;
|
||||||
use constant MAX_STRING_LENGTH => 10;
|
use constant MAX_STRING_LENGTH => 10;
|
||||||
|
|
||||||
|
Transformers->import(qw(make_checksum percentage_of shorten micro_t));
|
||||||
|
|
||||||
# Special formatting functions
|
# Special formatting functions
|
||||||
my %formatting_function = (
|
my %formatting_function = (
|
||||||
ts => sub {
|
ts => sub {
|
||||||
@@ -70,6 +70,14 @@ sub event_report {
|
|||||||
$line .= ('_' x (LINE_LENGTH - length($line)));
|
$line .= ('_' x (LINE_LENGTH - length($line)));
|
||||||
push @result, $line;
|
push @result, $line;
|
||||||
|
|
||||||
|
# Second line: full host names
|
||||||
|
# https://bugs.launchpad.net/percona-toolkit/+bug/980318
|
||||||
|
my $hostno = 0;
|
||||||
|
foreach my $host ( @$hosts ) {
|
||||||
|
$hostno++;
|
||||||
|
push @result, "# Host$hostno: " . ($host->{name} || '?')
|
||||||
|
}
|
||||||
|
|
||||||
# Differences report. This relies on a sampleno attrib in each class
|
# Differences report. This relies on a sampleno attrib in each class
|
||||||
# since all other attributes (except maybe Query_time) are optional.
|
# since all other attributes (except maybe Query_time) are optional.
|
||||||
my $class = $meta_stats->{classes}->{$where};
|
my $class = $meta_stats->{classes}->{$where};
|
||||||
@@ -89,9 +97,10 @@ sub event_report {
|
|||||||
underline_header => 0,
|
underline_header => 0,
|
||||||
strip_whitespace => 0,
|
strip_whitespace => 0,
|
||||||
);
|
);
|
||||||
|
$hostno = 0;
|
||||||
$report->set_columns(
|
$report->set_columns(
|
||||||
{ name => '' },
|
{ name => '' },
|
||||||
map { { name => $_->{name}, right_justify => 1 } } @$hosts,
|
map { $hostno++; { name => "host$hostno", right_justify => 1 } } @$hosts,
|
||||||
);
|
);
|
||||||
# Bool values.
|
# Bool values.
|
||||||
foreach my $thing ( qw(Errors Warnings) ) {
|
foreach my $thing ( qw(Errors Warnings) ) {
|
||||||
|
@@ -110,6 +110,8 @@ $meta_events = [
|
|||||||
|
|
||||||
$expected = <<EOF;
|
$expected = <<EOF;
|
||||||
# Query 1: ID 0x82860EDA9A88FCC5 at byte 0 _______________________________
|
# Query 1: ID 0x82860EDA9A88FCC5 at byte 0 _______________________________
|
||||||
|
# Host1: host1.domain.com:3306
|
||||||
|
# Host2: host2.domain.com:3307
|
||||||
# Found 1 differences in 3 samples:
|
# Found 1 differences in 3 samples:
|
||||||
# checksums 0
|
# checksums 0
|
||||||
# row counts 1
|
# row counts 1
|
||||||
@@ -130,8 +132,8 @@ aggregate();
|
|||||||
|
|
||||||
$result = $urf->event_report(
|
$result = $urf->event_report(
|
||||||
meta_ea => $meta_ea,
|
meta_ea => $meta_ea,
|
||||||
hosts => [ {name=>'host1', ea=>$ea1},
|
hosts => [ {name=>'host1.domain.com:3306', ea=>$ea1},
|
||||||
{name=>'host2', ea=>$ea2} ],
|
{name=>'host2.domain.com:3307', ea=>$ea2} ],
|
||||||
where => 'select id from users where name=?',
|
where => 'select id from users where name=?',
|
||||||
rank => 1,
|
rank => 1,
|
||||||
worst => 'differences',
|
worst => 'differences',
|
||||||
|
Reference in New Issue
Block a user