Merge pull request #329 from percona/PT-118

PT-118 Modify pt-checksum such that it can report the number of rows of difference between master and slave
This commit is contained in:
Carlos Salguero
2018-05-18 14:27:20 -03:00
committed by GitHub
19 changed files with 66 additions and 49 deletions

View File

@@ -11194,6 +11194,7 @@ sub main {
# Update chunk-size based on rows/s checksum rate.
$nibble_iter->set_chunk_size($tbl->{chunk_size});
PTDEBUG && _d('Updated chunk size: '.$tbl->{chunk_size});
}
# Every table should have a Progress obj; update it.
@@ -11267,6 +11268,12 @@ sub main {
map { $diff_chunks{ $_->{chunk} }++ } @$diffs;
$exit_status |= $PTC_EXIT_STATUS{TABLE_DIFF};
}
my $max_cnt_diff=0;
for my $diff (@$diffs) {
if ( $diff->{cnt_diff} > $max_cnt_diff ) {
$tbl->{checksum_results}->{max_rows_cnt_diff} = $diff->{cnt_diff};
}
}
};
if ($EVAL_ERROR) {
if ( $o->get('quiet') < 2 ) {
@@ -11701,8 +11708,8 @@ sub exec_nibble {
}
{
my $line_fmt = "%14s %6s %6s %8s %7s %7s %7s %-s\n";
my @headers = qw(TS ERRORS DIFFS ROWS CHUNKS SKIPPED TIME TABLE);
my $line_fmt = "%14s %6s %6s %8s % 10s %7s %7s %7s %-s\n";
my @headers = qw(TS ERRORS DIFFS ROWS DIFF_ROWS CHUNKS SKIPPED TIME TABLE);
sub print_checksum_results {
my (%args) = @_;
@@ -11722,7 +11729,8 @@ sub print_checksum_results {
ts(),
$res->{errors} || 0,
$res->{diffs} || 0,
$res->{n_rows} || 0,
$res->{n_rows} || 0,
$tbl->{checksum_results}->{max_rows_cnt_diff} || 0,
$res->{n_chunks} || 0,
$res->{skipped} || 0,
sprintf('%.3f', $res->{start_time} ? time - $res->{start_time} : 0),