From c78c3bfbab291764e3c70c3ad33b9c2cbbb68b70 Mon Sep 17 00:00:00 2001 From: Daniel Nichter Date: Tue, 17 Jul 2012 16:51:39 -0600 Subject: [PATCH] Update Compare* modules in pt-upgrade. --- bin/pt-upgrade | 54 +++++++++++++++++--------- t/pt-upgrade/samples/002/report-01.txt | 6 +-- t/pt-upgrade/samples/003/report001.txt | 6 +-- 3 files changed, 41 insertions(+), 25 deletions(-) diff --git a/bin/pt-upgrade b/bin/pt-upgrade index d7344cd3..51130acf 100755 --- a/bin/pt-upgrade +++ b/bin/pt-upgrade @@ -9498,8 +9498,10 @@ sub report { my $query_id_col = { name => 'Query ID', }; + my $hostno = 0; my @host_cols = map { - my $col = { name => $_->{name} }; + $hostno++; + my $col = { name => "host$hostno" }; $col; } @$hosts; @@ -9595,12 +9597,14 @@ sub _report_diff_row_counts { my $report = new ReportFormatter(); $report->set_title('Row count differences'); + my $hostno = 0; $report->set_columns( $args{query_id_col}, - map { - my $col = { name => $_->{name}, right_justify => 1 }; + (map { + $hostno++; + my $col = { name => "host$hostno", right_justify => 1 }; $col; - } @{$args{hosts}}, + } @{$args{hosts}}), ); my $diff_row_counts = $self->{diffs}->{row_counts}; @@ -9836,8 +9840,10 @@ sub report { my $query_id_col = { name => 'Query ID', }; + my $hostno = 0; my @host_cols = map { - my $col = { name => $_->{name} }; + $hostno++; + my $col = { name => "host$hostno" }; $col; } @$hosts; @@ -9867,12 +9873,14 @@ sub _report_diff_big { my $report = new ReportFormatter(); $report->set_title('Big query time differences'); + my $hostno = 0; $report->set_columns( $args{query_id_col}, - map { - my $col = { name => $_->{name}, right_justify => 1 }; + (map { + $hostno++; + my $col = { name => "host$hostno", right_justify => 1 }; $col; - } @{$args{hosts}}, + } @{$args{hosts}}), { name => 'Difference', right_justify => 1 }, ); @@ -9902,12 +9910,14 @@ sub _report_diff_in_bucket { my $report = new ReportFormatter(); $report->set_title('Significant query time differences'); + my $hostno = 0; $report->set_columns( $args{query_id_col}, - map { - my $col = { name => $_->{name}, right_justify => 1 }; + (map { + $hostno++; + my $col = { name => "host$hostno", right_justify => 1 }; $col; - } @{$args{hosts}}, + } @{$args{hosts}}), { name => '%Increase', right_justify => 1 }, { name => '%Threshold', right_justify => 1 }, ); @@ -10186,8 +10196,10 @@ sub report { my $query_id_col = { name => 'Query ID', }; + my $hostno = 0; my @host_cols = map { - my $col = { name => $_->{name} }; + $hostno++; + my $col = { name => "host$hostno" }; $col; } @$hosts; @@ -10230,7 +10242,7 @@ sub _report_diff_warnings { my ($hostno, $code, $message) = @{$diff_warnings->{$item}->{$_}}; $report->add_line( $get_id->($item) . '-' . $_, - $args{hosts}->[$hostno]->{name}, $code, $message, + "host" . ($hostno + 1), $code, $message, ); } sort { $a <=> $b } keys %{$diff_warnings->{$item}}; } @@ -10251,13 +10263,15 @@ sub _report_diff_levels { my $report = new ReportFormatter(extend_right => 1); $report->set_title('Warning level differences'); + my $hostno = 0; $report->set_columns( $args{query_id_col}, { name => 'Code', right_justify => 1 }, - map { - my $col = { name => $_->{name}, right_justify => 1 }; + (map { + $hostno++; + my $col = { name => "host$hostno", right_justify => 1 }; $col; - } @{$args{hosts}}, + } @{$args{hosts}}), { name => 'Message' }, ); @@ -10287,12 +10301,14 @@ sub _report_diff_warning_counts { my $report = new ReportFormatter(); $report->set_title('Warning count differences'); + my $hostno = 0; $report->set_columns( $args{query_id_col}, - map { - my $col = { name => $_->{name}, right_justify => 1 }; + (map { + $hostno++; + my $col = { name => "host$hostno", right_justify => 1 }; $col; - } @{$args{hosts}}, + } @{$args{hosts}}), ); my $diff_warning_counts = $self->{diffs}->{warning_counts}; diff --git a/t/pt-upgrade/samples/002/report-01.txt b/t/pt-upgrade/samples/002/report-01.txt index 420fcea6..05abde30 100644 --- a/t/pt-upgrade/samples/002/report-01.txt +++ b/t/pt-upgrade/samples/002/report-01.txt @@ -36,9 +36,9 @@ select i from t where i is not null # Row count differences -# Query ID 127.1:12345 127.1:12348 -# ================== =========== =========== -# 3C830E3839B916D7-1 4 3 +# Query ID host1 host2 +# ================== ===== ===== +# 3C830E3839B916D7-1 4 3 # Statistics # events 1 diff --git a/t/pt-upgrade/samples/003/report001.txt b/t/pt-upgrade/samples/003/report001.txt index 217d2f60..738e7b6b 100644 --- a/t/pt-upgrade/samples/003/report001.txt +++ b/t/pt-upgrade/samples/003/report001.txt @@ -36,9 +36,9 @@ SELECT SUM(total) FROM test.t WHERE id > 0 # Column value differences -# Query ID Column 127.1:12345 127.1:12348 -# ================== ========== =========== =========== -# C1B1E457814417E4-1 SUM(total) 14.68 13.68 +# Query ID Column host1 host2 +# ================== ========== ===== ===== +# C1B1E457814417E4-1 SUM(total) 14.68 13.68 # Statistics # events 1