Use hostN intead of full hostname in Compare* summaries.

This commit is contained in:
Daniel Nichter
2012-07-17 16:47:33 -06:00
parent 859a8a2390
commit e797e463c1
6 changed files with 62 additions and 46 deletions

View File

@@ -254,8 +254,10 @@ sub report {
my $query_id_col = { my $query_id_col = {
name => 'Query ID', name => 'Query ID',
}; };
my $hostno = 0;
my @host_cols = map { my @host_cols = map {
my $col = { name => $_->{name} }; $hostno++;
my $col = { name => "host$hostno" };
$col; $col;
} @$hosts; } @$hosts;
@@ -297,12 +299,14 @@ sub _report_diff_big {
my $report = new ReportFormatter(); my $report = new ReportFormatter();
$report->set_title('Big query time differences'); $report->set_title('Big query time differences');
my $hostno = 0;
$report->set_columns( $report->set_columns(
$args{query_id_col}, $args{query_id_col},
map { (map {
my $col = { name => $_->{name}, right_justify => 1 }; $hostno++;
my $col = { name => "host$hostno", right_justify => 1 };
$col; $col;
} @{$args{hosts}}, } @{$args{hosts}}),
{ name => 'Difference', right_justify => 1 }, { name => 'Difference', right_justify => 1 },
); );
@@ -344,12 +348,14 @@ sub _report_diff_in_bucket {
my $report = new ReportFormatter(); my $report = new ReportFormatter();
$report->set_title('Significant query time differences'); $report->set_title('Significant query time differences');
my $hostno = 0;
$report->set_columns( $report->set_columns(
$args{query_id_col}, $args{query_id_col},
map { (map {
my $col = { name => $_->{name}, right_justify => 1 }; $hostno++;
my $col = { name => "host$hostno", right_justify => 1 };
$col; $col;
} @{$args{hosts}}, } @{$args{hosts}}),
{ name => '%Increase', right_justify => 1 }, { name => '%Increase', right_justify => 1 },
{ name => '%Threshold', right_justify => 1 }, { name => '%Threshold', right_justify => 1 },
); );

View File

@@ -836,8 +836,10 @@ sub report {
my $query_id_col = { my $query_id_col = {
name => 'Query ID', name => 'Query ID',
}; };
my $hostno = 0;
my @host_cols = map { my @host_cols = map {
my $col = { name => $_->{name} }; $hostno++;
my $col = { name => "host$hostno" };
$col; $col;
} @$hosts; } @$hosts;
@@ -933,12 +935,14 @@ sub _report_diff_row_counts {
my $report = new ReportFormatter(); my $report = new ReportFormatter();
$report->set_title('Row count differences'); $report->set_title('Row count differences');
my $hostno = 0;
$report->set_columns( $report->set_columns(
$args{query_id_col}, $args{query_id_col},
map { (map {
my $col = { name => $_->{name}, right_justify => 1 }; $hostno++;
my $col = { name => "host$hostno", right_justify => 1 };
$col; $col;
} @{$args{hosts}}, } @{$args{hosts}}),
); );
my $diff_row_counts = $self->{diffs}->{row_counts}; my $diff_row_counts = $self->{diffs}->{row_counts};

View File

@@ -292,8 +292,10 @@ sub report {
my $query_id_col = { my $query_id_col = {
name => 'Query ID', name => 'Query ID',
}; };
my $hostno = 0;
my @host_cols = map { my @host_cols = map {
my $col = { name => $_->{name} }; $hostno++;
my $col = { name => "host$hostno" };
$col; $col;
} @$hosts; } @$hosts;
@@ -336,7 +338,7 @@ sub _report_diff_warnings {
my ($hostno, $code, $message) = @{$diff_warnings->{$item}->{$_}}; my ($hostno, $code, $message) = @{$diff_warnings->{$item}->{$_}};
$report->add_line( $report->add_line(
$get_id->($item) . '-' . $_, $get_id->($item) . '-' . $_,
$args{hosts}->[$hostno]->{name}, $code, $message, "host" . ($hostno + 1), $code, $message,
); );
} sort { $a <=> $b } keys %{$diff_warnings->{$item}}; } sort { $a <=> $b } keys %{$diff_warnings->{$item}};
} }
@@ -357,13 +359,15 @@ sub _report_diff_levels {
my $report = new ReportFormatter(extend_right => 1); my $report = new ReportFormatter(extend_right => 1);
$report->set_title('Warning level differences'); $report->set_title('Warning level differences');
my $hostno = 0;
$report->set_columns( $report->set_columns(
$args{query_id_col}, $args{query_id_col},
{ name => 'Code', right_justify => 1 }, { name => 'Code', right_justify => 1 },
map { (map {
my $col = { name => $_->{name}, right_justify => 1 }; $hostno++;
my $col = { name => "host$hostno", right_justify => 1 };
$col; $col;
} @{$args{hosts}}, } @{$args{hosts}}),
{ name => 'Message' }, { name => 'Message' },
); );
@@ -393,12 +397,14 @@ sub _report_diff_warning_counts {
my $report = new ReportFormatter(); my $report = new ReportFormatter();
$report->set_title('Warning count differences'); $report->set_title('Warning count differences');
my $hostno = 0;
$report->set_columns( $report->set_columns(
$args{query_id_col}, $args{query_id_col},
map { (map {
my $col = { name => $_->{name}, right_justify => 1 }; $hostno++;
my $col = { name => "host$hostno", right_justify => 1 };
$col; $col;
} @{$args{hosts}}, } @{$args{hosts}}),
); );
my $diff_warning_counts = $self->{diffs}->{warning_counts}; my $diff_warning_counts = $self->{diffs}->{warning_counts};

View File

@@ -150,9 +150,9 @@ compare(0.000100, 0.000250);
$report = <<EOF; $report = <<EOF;
# Significant query time differences # Significant query time differences
# Query ID server1 server2 %Increase %Threshold # Query ID host1 host2 %Increase %Threshold
# ================== ======= ======= ========= ========== # ================== ===== ===== ========= ==========
# EDEF654FCCC4A4D8-0 100us 250us 150.00 100 # EDEF654FCCC4A4D8-0 100us 250us 150.00 100
EOF EOF
is( is(
@@ -166,9 +166,9 @@ compare(0.000100, 1.100251);
$report = <<EOF; $report = <<EOF;
# Big query time differences # Big query time differences
# Query ID server1 server2 Difference # Query ID host1 host2 Difference
# ================== ======= ======= ========== # ================== ===== ===== ==========
# EDEF654FCCC4A4D8-0 100us 1s 1s # EDEF654FCCC4A4D8-0 100us 1s 1s
EOF EOF
is( is(

View File

@@ -279,14 +279,14 @@ is_deeply(
$report = <<EOF; $report = <<EOF;
# Checksum differences # Checksum differences
# Query ID master slave # Query ID host1 host2
# ================== ========= ========== # ================== ========= ==========
# D2D386B840D3BEEA-1 $events[0]->{checksum} $events[1]->{checksum} # D2D386B840D3BEEA-1 $events[0]->{checksum} $events[1]->{checksum}
# Row count differences # Row count differences
# Query ID master slave # Query ID host1 host2
# ================== ====== ===== # ================== ===== =====
# D2D386B840D3BEEA-1 3 4 # D2D386B840D3BEEA-1 3 4
EOF EOF
is( is(
@@ -488,14 +488,14 @@ is_deeply(
$report = <<EOF; $report = <<EOF;
# Column value differences # Column value differences
# Query ID Column master slave # Query ID Column host1 host2
# ================== ====== ====== =========== # ================== ====== ===== ===========
# CFC309761E9131C5-3 c c should be c # CFC309761E9131C5-3 c c should be c
# Row count differences # Row count differences
# Query ID master slave # Query ID host1 host2
# ================== ====== ===== # ================== ===== =====
# B8B721D77EA1FD78-0 3 4 # B8B721D77EA1FD78-0 3 4
EOF EOF
is( is(
@@ -552,9 +552,9 @@ is_deeply(
$report = <<EOF; $report = <<EOF;
# Column value differences # Column value differences
# Query ID Column master slave # Query ID Column host1 host2
# ================== ====== ====== =========== # ================== ====== ===== ===========
# CFC309761E9131C5-3 c a should be a # CFC309761E9131C5-3 c a should be a
EOF EOF
is( is(
@@ -674,9 +674,9 @@ is_deeply(
$report = <<EOF; $report = <<EOF;
# Row count differences # Row count differences
# Query ID master slave # Query ID host1 host2
# ================== ====== ===== # ================== ===== =====
# D56E6FABA26D1F1C-3 3 1 # D56E6FABA26D1F1C-3 3 1
EOF EOF
is( is(

View File

@@ -257,7 +257,7 @@ is_deeply(
$report = <<EOF; $report = <<EOF;
# Warning level differences # Warning level differences
# Query ID Code dbh-1 dbh-2 Message # Query ID Code host1 host2 Message
# ================== ==== ======= ===== ====================================== # ================== ==== ======= ===== ======================================
# 4336C4AAA4EEF76B-1 1264 Warning Error Out of range value for column 'i' at row 1 # 4336C4AAA4EEF76B-1 1264 Warning Error Out of range value for column 'i' at row 1
EOF EOF
@@ -291,10 +291,10 @@ $report = <<EOF;
# New warnings # New warnings
# Query ID Host Code Message # Query ID Host Code Message
# ================== ===== ==== ========================================== # ================== ===== ==== ==========================================
# 4336C4AAA4EEF76B-1 dbh-1 1264 Out of range value for column 'i' at row 1 # 4336C4AAA4EEF76B-1 host1 1264 Out of range value for column 'i' at row 1
# Warning count differences # Warning count differences
# Query ID dbh-1 dbh-2 # Query ID host1 host2
# ================== ===== ===== # ================== ===== =====
# 4336C4AAA4EEF76B-1 1 0 # 4336C4AAA4EEF76B-1 1 0
EOF EOF
@@ -325,10 +325,10 @@ $report = <<EOF;
# New warnings # New warnings
# Query ID Host Code Message # Query ID Host Code Message
# ================== ===== ==== ========================================== # ================== ===== ==== ==========================================
# 4336C4AAA4EEF76B-1 dbh-2 1264 Out of range value for column 'i' at row 1 # 4336C4AAA4EEF76B-1 host2 1264 Out of range value for column 'i' at row 1
# Warning count differences # Warning count differences
# Query ID dbh-1 dbh-2 # Query ID host1 host2
# ================== ===== ===== # ================== ===== =====
# 4336C4AAA4EEF76B-1 0 1 # 4336C4AAA4EEF76B-1 0 1
EOF EOF