Merge lp:~percona-toolkit-dev/percona-toolkit/fix-pt-osc-get-typo-bug-1188264 into lp:~percona-toolkit-dev/percona-toolkit/release-2.2.4

Proposed by Daniel Nichter
Status: Merged
Merged at revision: 591
Proposed branch: lp:~percona-toolkit-dev/percona-toolkit/fix-pt-osc-get-typo-bug-1188264
Merge into: lp:~percona-toolkit-dev/percona-toolkit/release-2.2.4
Diff against target: 86 lines (+49/-13)
2 files modified
bin/pt-online-schema-change (+5/-13)
t/pt-online-schema-change/bugs.t (+44/-0)
To merge this branch: bzr merge lp:~percona-toolkit-dev/percona-toolkit/fix-pt-osc-get-typo-bug-1188264
Reviewer Review Type Date Requested Status
Daniel Nichter Approve
Review via email: mp+171659@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Daniel Nichter (daniel-nichter) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/pt-online-schema-change'
2--- bin/pt-online-schema-change 2013-06-25 22:32:19 +0000
3+++ bin/pt-online-schema-change 2013-06-26 20:30:34 +0000
4@@ -10285,22 +10285,14 @@
5 || $message =~ m/$warn_code{$code}->{pattern}/) )
6 {
7 if ( !$stats->{"mysql_warning_$code"}++ ) { # warn once
8- my $err
9- = "Copying rows caused a MySQL error $code: "
10+ warn "Copying rows caused a MySQL error $code: "
11 . ($warn_code{$code}->{message}
12 ? $warn_code{$code}->{message}
13 : $message)
14- . "\nThis MySQL error is being ignored ";
15- if ( get('statistics') ) {
16- $err .= "but further occurrences will be reported "
17- . "by --statistics when the tool finishes.\n";
18- }
19- else {
20- $err .= "and further occurrences will not be reported. "
21- . "Specify --statistics to see a count of all "
22- . "suppressed warnings and errors.\n";
23- }
24- warn $err;
25+ . "\nNo more warnings about this MySQL error will be "
26+ . "reported. If --statistics was specified, "
27+ . "mysql_warning_$code will list the total count of "
28+ . "this MySQL error.\n";
29 }
30 }
31 else {
32
33=== modified file 't/pt-online-schema-change/bugs.t'
34--- t/pt-online-schema-change/bugs.t 2013-06-26 17:14:46 +0000
35+++ t/pt-online-schema-change/bugs.t 2013-06-26 20:30:34 +0000
36@@ -326,6 +326,50 @@
37 );
38
39 # #############################################################################
40+# https://bugs.launchpad.net/percona-toolkit/+bug/1188264
41+# pt-online-schema-change error copying rows: Undefined subroutine
42+# &pt_online_schema_change::get
43+# #############################################################################
44+
45+# In exec_nibble() we had:
46+# if ( get('statistics') ) {
47+# $err .= "but further occurrences will be reported "
48+# . "by --statistics when the tool finishes.\n";
49+# }
50+# which is called when copying rows causes a MySQL warning
51+# for the first time. So to test this code path, we need to
52+# cause a MySQL warning while copying rows.
53+
54+$sb->load_file('master', "$sample/basic_no_fks_innodb.sql");
55+$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())");
56+
57+($output, $exit_status) = full_output(
58+ sub { pt_online_schema_change::main(@args,
59+ "$master_dsn,D=pt_osc,t=t",
60+ "--alter", "modify c varchar(8)",
61+ qw(--execute --print))
62+ },
63+);
64+
65+is(
66+ $exit_status,
67+ 0,
68+ "Bug 1188264: 0 exit"
69+);
70+
71+unlike(
72+ $output,
73+ qr/Undefined subroutine/i,
74+ "Bug 1188264: no undefined subroutine"
75+);
76+
77+like(
78+ $output,
79+ qr/error 1265/, # Data truncated for column 'c' at row 21
80+ "Bug 1188264: warning about expected MySQL error 1265"
81+);
82+
83+# #############################################################################
84 # Done.
85 # #############################################################################
86 $sb->wipe_clean($master_dbh);

Subscribers

People subscribed via source and target branches

to all changes: