diff --git a/bin/pt-online-schema-change b/bin/pt-online-schema-change index f5a03543..32640922 100755 --- a/bin/pt-online-schema-change +++ b/bin/pt-online-schema-change @@ -8583,30 +8583,29 @@ sub main { line_width => 74, ); $report->set_columns( - { name => 'Error Code', }, - { name => 'Count', right_justify => 1 }, - { name => 'Type', right_justify => 1 }, + { name => 'Event', }, + { name => 'Count', right_justify => 1 }, ); + $report->add_line( + "INSERTS", + $statistics{INSERTS}, + ); + foreach my $code (keys %{$statistics{ignored_code}}) { next unless $statistics{ignored_code}->{$code}; $report->add_line( - $code, + "Error $code", $statistics{ignored_code}->{$code}, - "Ignorable", ) } my $warnings_seen; foreach my $code (keys %{$statistics{warned_code}}) { $report->add_line( - $code, - scalar @{$statistics{warned_code}->{$code}}, - "Warning", + "Error $code", + $statistics{warned_code}->{$code}, ); - $warnings_seen .= join "\n", - map { "# $_" } - @{$statistics{warned_code}->{$code}}; } print $report->get_report(); @@ -9475,6 +9474,8 @@ sub exec_nibble { ); my $t_end = time; + $statistics{INSERTS}++; + # ################################################################### # End timing the query. # ################################################################### @@ -9508,8 +9509,7 @@ sub exec_nibble { . "a total count will be shown if --statistics was " . "specified.\n"; } - push @{ $statistics{warned_code}->{$code} ||= [] }, - $sth->{nibble}->{Statement}; + $statistics{warned_code}->{$code}++; } else { # This die will propagate to fail which will return 0 diff --git a/t/pt-online-schema-change/basics.t b/t/pt-online-schema-change/basics.t index 2967826e..f16c945d 100644 --- a/t/pt-online-schema-change/basics.t +++ b/t/pt-online-schema-change/basics.t @@ -657,10 +657,11 @@ like( like( $output, - qr/\#\Q Error Code Count Type\E\s* -\#\Q ========== ===== =========\E\s* -\#\Q 1592 1 Ignorable\E\s* -\#\Q 1265 1 Warning\E\s*/x, + qr/\#\Q Event Count\E\s* +\#\Q ========== =====\E\s* +\#\Q INSERTS 1\E\s* +\#\Q Error 1592 1\E\s* +\#\Q Error 1265 1\E\s*/x, "--statistics works as expected with 1 ignore & 1 warning" ); diff --git a/t/pt-online-schema-change/samples/bug_1045317.sql b/t/pt-online-schema-change/samples/bug_1045317.sql new file mode 100644 index 00000000..9f611702 --- /dev/null +++ b/t/pt-online-schema-change/samples/bug_1045317.sql @@ -0,0 +1,10 @@ +DROP DATABASE IF EXISTS bug_1045317; +CREATE DATABASE bug_1045317; +USE bug_1045317; +CREATE TABLE `bits` ( + `id` int, + `val` ENUM('M','E','H') NOT NULL, + PRIMARY KEY (`id`) +); + +INSERT INTO `bits` VALUES (1, 'M'), (2, 'E'), (3, 'H');