mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-16 16:23:30 +00:00
Merge right-sth-bug-1039184
This commit is contained in:
100
bin/pt-upgrade
100
bin/pt-upgrade
@@ -8335,7 +8335,7 @@ sub get_report {
|
|||||||
if ( $self->{underline_header} ) {
|
if ( $self->{underline_header} ) {
|
||||||
my @underlines = map { '=' x $_->{print_width} } @{$self->{cols}};
|
my @underlines = map { '=' x $_->{print_width} } @{$self->{cols}};
|
||||||
push @lines, $self->_truncate_line(
|
push @lines, $self->_truncate_line(
|
||||||
sprintf($fmt, @underlines),
|
sprintf($fmt, map { $_ || '' } @underlines),
|
||||||
mark => '',
|
mark => '',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -8344,7 +8344,10 @@ sub get_report {
|
|||||||
my $vals = $_;
|
my $vals = $_;
|
||||||
my $i = 0;
|
my $i = 0;
|
||||||
my @vals = map {
|
my @vals = map {
|
||||||
defined $_ ? $_ : $self->{cols}->[$i++]->{undef_value}
|
my $val = defined $_ ? $_ : $self->{cols}->[$i++]->{undef_value};
|
||||||
|
$val = '' if !defined $val;
|
||||||
|
$val =~ s/\n/ /g;
|
||||||
|
$val;
|
||||||
} @$vals;
|
} @$vals;
|
||||||
my $line = sprintf($fmt, @vals);
|
my $line = sprintf($fmt, @vals);
|
||||||
if ( $self->{extend_right} ) {
|
if ( $self->{extend_right} ) {
|
||||||
@@ -8563,7 +8566,7 @@ sub event_report {
|
|||||||
my $line = sprintf(
|
my $line = sprintf(
|
||||||
'# Query %d: ID 0x%s at byte %d ',
|
'# Query %d: ID 0x%s at byte %d ',
|
||||||
$rank || 0,
|
$rank || 0,
|
||||||
make_checksum($where),
|
make_checksum($where) || '0x0',
|
||||||
0, # $sample->{pos_in_log} || 0
|
0, # $sample->{pos_in_log} || 0
|
||||||
);
|
);
|
||||||
$line .= ('_' x (LINE_LENGTH - length($line)));
|
$line .= ('_' x (LINE_LENGTH - length($line)));
|
||||||
@@ -8584,7 +8587,7 @@ sub event_report {
|
|||||||
my @diffs = grep { $_ =~ m/^different_/ } keys %$class;
|
my @diffs = grep { $_ =~ m/^different_/ } keys %$class;
|
||||||
foreach my $diff ( sort @diffs ) {
|
foreach my $diff ( sort @diffs ) {
|
||||||
push @result,
|
push @result,
|
||||||
sprintf $fmt, ' ' . make_label($diff), $class->{$diff}->{sum};
|
sprintf $fmt, ' ' . (make_label($diff) || ''), ($class->{$diff}->{sum} || 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
my $report = new ReportFormatter(
|
my $report = new ReportFormatter(
|
||||||
@@ -8998,6 +9001,12 @@ sub _compare_rows {
|
|||||||
|
|
||||||
$event->{row_count} = 0;
|
$event->{row_count} = 0;
|
||||||
|
|
||||||
|
if ( !$right ) {
|
||||||
|
PTDEBUG && _d('No results sth on host', $i);
|
||||||
|
delete $event->{results_sth};
|
||||||
|
next EVENT;
|
||||||
|
}
|
||||||
|
|
||||||
my $no_diff = 1; # results are identical; this catches 0 row results
|
my $no_diff = 1; # results are identical; this catches 0 row results
|
||||||
my $outfile = new Outfile();
|
my $outfile = new Outfile();
|
||||||
my ($left_outfile, $right_outfile, $n_rows);
|
my ($left_outfile, $right_outfile, $n_rows);
|
||||||
@@ -11855,40 +11864,44 @@ sub main {
|
|||||||
my $item = $worst->[$rank - 1]->[0];
|
my $item = $worst->[$rank - 1]->[0];
|
||||||
my $sample = $meta_ea->results->{samples}->{$item};
|
my $sample = $meta_ea->results->{samples}->{$item};
|
||||||
my $samp_query = $sample->{arg} || '';
|
my $samp_query = $sample->{arg} || '';
|
||||||
|
eval {
|
||||||
|
print "\n";
|
||||||
|
print $urf->event_report(
|
||||||
|
meta_ea => $meta_ea,
|
||||||
|
hosts => $hosts,
|
||||||
|
where => $item,
|
||||||
|
rank => $rank,
|
||||||
|
worst => 'differences',
|
||||||
|
);
|
||||||
|
|
||||||
print "\n";
|
if ( $sample->{original_arg} ) {
|
||||||
print $urf->event_report(
|
my $orig = $sample->{original_arg};
|
||||||
meta_ea => $meta_ea,
|
if ( $o->get('shorten') ) {
|
||||||
hosts => $hosts,
|
$orig = $qr->shorten($orig, $o->get('shorten'));
|
||||||
where => $item,
|
}
|
||||||
rank => $rank,
|
print "# Converted non-SELECT:\n# $orig\n";
|
||||||
worst => 'differences',
|
|
||||||
);
|
|
||||||
|
|
||||||
if ( $sample->{original_arg} ) {
|
|
||||||
my $orig = $sample->{original_arg};
|
|
||||||
if ( $o->get('shorten') ) {
|
|
||||||
$orig = $qr->shorten($orig, $o->get('shorten'));
|
|
||||||
}
|
}
|
||||||
print "# Converted non-SELECT:\n# $orig\n";
|
if ( $o->get('fingerprints') ) {
|
||||||
}
|
print "# Fingerprint\n# $item\n";
|
||||||
if ( $o->get('fingerprints') ) {
|
}
|
||||||
print "# Fingerprint\n# $item\n";
|
print "use `$sample->{db}`;\n" if $sample->{db};
|
||||||
}
|
$samp_query = $qr->shorten($samp_query, $o->get('shorten'))
|
||||||
print "use `$sample->{db}`;\n" if $sample->{db};
|
if $o->get('shorten');
|
||||||
$samp_query = $qr->shorten($samp_query, $o->get('shorten'))
|
print "$samp_query\n";
|
||||||
if $o->get('shorten');
|
|
||||||
print "$samp_query\n";
|
|
||||||
|
|
||||||
my $query_id = make_checksum($item);
|
my $query_id = make_checksum($item);
|
||||||
foreach my $c ( @compare_modules ) {
|
foreach my $c ( @compare_modules ) {
|
||||||
my %compare_samples = $c->samples($item);
|
my %compare_samples = $c->samples($item);
|
||||||
@{$samples{$item}}{keys %compare_samples}
|
@{$samples{$item}}{keys %compare_samples}
|
||||||
= values %compare_samples;
|
= values %compare_samples;
|
||||||
}
|
}
|
||||||
map {
|
map {
|
||||||
print "/* $query_id-$_ */ $samples{$item}->{$_}\n";
|
print "/* $query_id-$_ */ $samples{$item}->{$_}\n";
|
||||||
} sort { $a <=> $b } keys %{$samples{$item}};
|
} sort { $a <=> $b } keys %{$samples{$item}};
|
||||||
|
};
|
||||||
|
if ( $EVAL_ERROR ) {
|
||||||
|
warn "Error printing queries report for $item: $EVAL_ERROR";
|
||||||
|
}
|
||||||
} # Each worst ITEM
|
} # Each worst ITEM
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -11897,19 +11910,30 @@ sub main {
|
|||||||
# ##################################################################
|
# ##################################################################
|
||||||
if ( $o->get('reports')->{differences} ) {
|
if ( $o->get('reports')->{differences} ) {
|
||||||
foreach my $c ( @compare_modules ) {
|
foreach my $c ( @compare_modules ) {
|
||||||
my $report = $c->report(hosts => $hosts);
|
eval {
|
||||||
print "\n$report" if $report;
|
my $report = $c->report(hosts => $hosts);
|
||||||
|
print "\n$report" if $report;
|
||||||
|
};
|
||||||
|
if ( $EVAL_ERROR ) {
|
||||||
|
warn "Error printing differences report: $EVAL_ERROR";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $o->get('reports')->{errors} ) {
|
if ( $o->get('reports')->{errors} ) {
|
||||||
report_errors(errors => $errors);
|
eval {
|
||||||
|
report_errors(errors => $errors);
|
||||||
|
};
|
||||||
|
if ( $EVAL_ERROR ) {
|
||||||
|
warn "Error printing errors report: $EVAL_ERROR";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $o->get('reports')->{statistics} ) {
|
if ( $o->get('reports')->{statistics} ) {
|
||||||
my $fmt = "# %-30s %d\n";
|
my $fmt = "# %-30s %d\n";
|
||||||
print "\n# Statistics\n";
|
print "\n# Statistics\n";
|
||||||
map { printf $fmt, $_, $stats->{$_} } sort keys %$stats;
|
map { printf($fmt, ($_ || ''), ($stats->{$_} || 0)) }
|
||||||
|
sort keys %$stats;
|
||||||
}
|
}
|
||||||
|
|
||||||
# ##################################################################
|
# ##################################################################
|
||||||
|
@@ -364,6 +364,12 @@ sub _compare_rows {
|
|||||||
|
|
||||||
$event->{row_count} = 0;
|
$event->{row_count} = 0;
|
||||||
|
|
||||||
|
if ( !$right ) {
|
||||||
|
PTDEBUG && _d('No results sth on host', $i);
|
||||||
|
delete $event->{results_sth};
|
||||||
|
next EVENT;
|
||||||
|
}
|
||||||
|
|
||||||
# Identical rows are ignored. Once a difference on either side is found,
|
# Identical rows are ignored. Once a difference on either side is found,
|
||||||
# we gobble the remaining rows in that sth and print them to an outfile.
|
# we gobble the remaining rows in that sth and print them to an outfile.
|
||||||
# This short circuits RowDiff::compare_sets() which is what we want to do.
|
# This short circuits RowDiff::compare_sets() which is what we want to do.
|
||||||
|
@@ -256,7 +256,7 @@ sub get_report {
|
|||||||
if ( $self->{underline_header} ) {
|
if ( $self->{underline_header} ) {
|
||||||
my @underlines = map { '=' x $_->{print_width} } @{$self->{cols}};
|
my @underlines = map { '=' x $_->{print_width} } @{$self->{cols}};
|
||||||
push @lines, $self->_truncate_line(
|
push @lines, $self->_truncate_line(
|
||||||
sprintf($fmt, @underlines),
|
sprintf($fmt, map { $_ || '' } @underlines),
|
||||||
mark => '',
|
mark => '',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -265,7 +265,10 @@ sub get_report {
|
|||||||
my $vals = $_;
|
my $vals = $_;
|
||||||
my $i = 0;
|
my $i = 0;
|
||||||
my @vals = map {
|
my @vals = map {
|
||||||
defined $_ ? $_ : $self->{cols}->[$i++]->{undef_value}
|
my $val = defined $_ ? $_ : $self->{cols}->[$i++]->{undef_value};
|
||||||
|
$val = '' if !defined $val;
|
||||||
|
$val =~ s/\n/ /g;
|
||||||
|
$val;
|
||||||
} @$vals;
|
} @$vals;
|
||||||
my $line = sprintf($fmt, @vals);
|
my $line = sprintf($fmt, @vals);
|
||||||
if ( $self->{extend_right} ) {
|
if ( $self->{extend_right} ) {
|
||||||
|
@@ -64,7 +64,7 @@ sub event_report {
|
|||||||
my $line = sprintf(
|
my $line = sprintf(
|
||||||
'# Query %d: ID 0x%s at byte %d ',
|
'# Query %d: ID 0x%s at byte %d ',
|
||||||
$rank || 0,
|
$rank || 0,
|
||||||
make_checksum($where),
|
make_checksum($where) || '0x0',
|
||||||
0, # $sample->{pos_in_log} || 0
|
0, # $sample->{pos_in_log} || 0
|
||||||
);
|
);
|
||||||
$line .= ('_' x (LINE_LENGTH - length($line)));
|
$line .= ('_' x (LINE_LENGTH - length($line)));
|
||||||
@@ -89,7 +89,7 @@ sub event_report {
|
|||||||
my @diffs = grep { $_ =~ m/^different_/ } keys %$class;
|
my @diffs = grep { $_ =~ m/^different_/ } keys %$class;
|
||||||
foreach my $diff ( sort @diffs ) {
|
foreach my $diff ( sort @diffs ) {
|
||||||
push @result,
|
push @result,
|
||||||
sprintf $fmt, ' ' . make_label($diff), $class->{$diff}->{sum};
|
sprintf $fmt, ' ' . (make_label($diff) || ''), ($class->{$diff}->{sum} || 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
# Side-by-side hosts report.
|
# Side-by-side hosts report.
|
||||||
|
Reference in New Issue
Block a user