Merge fix-pt-osc-get-typo-bug-1188264.

This commit is contained in:
Daniel Nichter
2013-06-26 13:30:30 -07:00
2 changed files with 49 additions and 13 deletions

View File

@@ -10285,22 +10285,14 @@ sub exec_nibble {
|| $message =~ m/$warn_code{$code}->{pattern}/) )
{
if ( !$stats->{"mysql_warning_$code"}++ ) { # warn once
my $err
= "Copying rows caused a MySQL error $code: "
warn "Copying rows caused a MySQL error $code: "
. ($warn_code{$code}->{message}
? $warn_code{$code}->{message}
: $message)
. "\nThis MySQL error is being ignored ";
if ( get('statistics') ) {
$err .= "but further occurrences will be reported "
. "by --statistics when the tool finishes.\n";
}
else {
$err .= "and further occurrences will not be reported. "
. "Specify --statistics to see a count of all "
. "suppressed warnings and errors.\n";
}
warn $err;
. "\nNo more warnings about this MySQL error will be "
. "reported. If --statistics was specified, "
. "mysql_warning_$code will list the total count of "
. "this MySQL error.\n";
}
}
else {

View File

@@ -325,6 +325,50 @@ like(
"Bug 1171653: table charset is not preserved"
);
# #############################################################################
# https://bugs.launchpad.net/percona-toolkit/+bug/1188264
# pt-online-schema-change error copying rows: Undefined subroutine
# &pt_online_schema_change::get
# #############################################################################
# In exec_nibble() we had:
# if ( get('statistics') ) {
# $err .= "but further occurrences will be reported "
# . "by --statistics when the tool finishes.\n";
# }
# which is called when copying rows causes a MySQL warning
# for the first time. So to test this code path, we need to
# cause a MySQL warning while copying rows.
$sb->load_file('master', "$sample/basic_no_fks_innodb.sql");
$master_dbh->do("INSERT INTO pt_osc.t VALUES (null, 'This string will be too long after we modify the table so it will cause a warning about the value being truncated in the new table. The other column values are a single character.', NOW())");
($output, $exit_status) = full_output(
sub { pt_online_schema_change::main(@args,
"$master_dsn,D=pt_osc,t=t",
"--alter", "modify c varchar(8)",
qw(--execute --print))
},
);
is(
$exit_status,
0,
"Bug 1188264: 0 exit"
);
unlike(
$output,
qr/Undefined subroutine/i,
"Bug 1188264: no undefined subroutine"
);
like(
$output,
qr/error 1265/, # Data truncated for column 'c' at row 21
"Bug 1188264: warning about expected MySQL error 1265"
);
# #############################################################################
# Done.
# #############################################################################