Merge lp:~percona-toolkit-dev/percona-toolkit/fix-pt-osc-find-new-table-bug-1195628 into lp:~percona-toolkit-dev/percona-toolkit/release-2.2.6

Proposed by Daniel Nichter
Status: Merged
Approved by: Daniel Nichter
Approved revision: 594
Merged at revision: 598
Proposed branch: lp:~percona-toolkit-dev/percona-toolkit/fix-pt-osc-find-new-table-bug-1195628
Merge into: lp:~percona-toolkit-dev/percona-toolkit/release-2.2.6
Diff against target: 151 lines (+63/-13)
5 files modified
bin/pt-online-schema-change (+55/-9)
t/pt-online-schema-change/ansi_quotes.t (+1/-1)
t/pt-online-schema-change/basics.t (+3/-1)
t/pt-online-schema-change/charset.t (+2/-2)
t/pt-online-schema-change/samples/stats-execute-5.5.txt (+2/-0)
To merge this branch: bzr merge lp:~percona-toolkit-dev/percona-toolkit/fix-pt-osc-find-new-table-bug-1195628
Reviewer Review Type Date Requested Status
Daniel Nichter Approve
Review via email: mp+196802@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-11-08 01:47:46 +0000
3+++ bin/pt-online-schema-change 2013-11-27 00:28:21 +0000
4@@ -8031,8 +8031,22 @@
5 },
6 );
7 PTDEBUG && _d(scalar @$slaves, 'slaves found');
8+ if ( scalar @$slaves ) {
9+ print "Found " . scalar(@$slaves) . " slaves:\n";
10+ foreach my $cxn ( @$slaves ) {
11+ print " " . $cxn->name() . "\n";
12+ }
13+ }
14+ elsif ( ($o->get('recursion-method') || '') ne 'none') {
15+ print "No slaves found. See --recursion-method if host "
16+ . $cxn->name() . " has slaves.\n";
17+ }
18+ else {
19+ print "Ignoring all slaves because --recursion-method=none "
20+ . "was specified\n";
21+ }
22
23- if ( $o->get('check-slave-lag') ) {
24+ if ( my $dsn = $o->get('check-slave-lag') ) {
25 PTDEBUG && _d('Will use --check-slave-lag to check for slave lag');
26 my $cxn = $make_cxn->(
27 dsn_string => $o->get('check-slave-lag'),
28@@ -8044,6 +8058,16 @@
29 PTDEBUG && _d('Will check slave lag on all slaves');
30 $slave_lag_cxns = $slaves;
31 }
32+ if ( $slave_lag_cxns && scalar @$slave_lag_cxns ) {
33+ print "Will check slave lag on:\n";
34+ foreach my $cxn ( @$slave_lag_cxns ) {
35+ print " " . $cxn->name() . "\n";
36+ }
37+ }
38+ else {
39+ print "Not checking slave lag because no slaves were found "
40+ . "and --check-slave-lag was not specified.\n";
41+ }
42
43 # #####################################################################
44 # Check for replication filters.
45@@ -8513,14 +8537,36 @@
46 }
47 };
48
49- for my $slave (@$slaves) {
50- PTDEBUG && _d('Waiting until', $slave->name(),
51- 'replicates the table');
52- sleep 0.5 while ! $tp->check_table(
53- dbh => $slave->dbh(),
54- db => $new_tbl->{db},
55- tbl => $new_tbl->{tbl}
56- );
57+ if ( $slaves && scalar @$slaves ) {
58+ foreach my $slave (@$slaves) {
59+ my ($pr, $pr_first_report);
60+ if ( $o->get('progress') ) {
61+ $pr = new Progress(
62+ jobsize => scalar @$slaves,
63+ spec => $o->get('progress'),
64+ name => "Waiting for " . $slave->name(),
65+ );
66+ $pr_first_report = sub {
67+ print "Waiting forever for new table $new_tbl->{name} to replicate "
68+ . "to " . $slave->name() . "...\n";
69+ };
70+ }
71+ $pr->start() if $pr;
72+ my $has_table = 0;
73+ while ( !$has_table ) {
74+ $has_table = $tp->check_table(
75+ dbh => $slave->dbh(),
76+ db => $new_tbl->{db},
77+ tbl => $new_tbl->{tbl}
78+ );
79+ last if $has_table;
80+ $pr->update(
81+ sub { return 0; },
82+ first_report => $pr_first_report,
83+ ) if $pr;
84+ sleep 1;
85+ }
86+ }
87 }
88
89 # --plugin hook
90
91=== modified file 't/pt-online-schema-change/ansi_quotes.t'
92--- t/pt-online-schema-change/ansi_quotes.t 2013-03-02 17:17:23 +0000
93+++ t/pt-online-schema-change/ansi_quotes.t 2013-11-27 00:28:21 +0000
94@@ -61,7 +61,7 @@
95 $exit_status,
96 0,
97 "--dry-run exit 0 (bug 1058285)"
98-);
99+) or diag($output);
100
101 unlike(
102 $output,
103
104=== modified file 't/pt-online-schema-change/basics.t'
105--- t/pt-online-schema-change/basics.t 2013-10-10 02:13:49 +0000
106+++ t/pt-online-schema-change/basics.t 2013-11-27 00:28:21 +0000
107@@ -13,6 +13,7 @@
108 use Time::HiRes qw(sleep);
109
110 $ENV{PTTEST_FAKE_TS} = 1;
111+$ENV{PERCONA_TOOLKIT_TEST_USE_DSN_NAMES} = 1;
112
113 use PerconaTest;
114 use Sandbox;
115@@ -704,7 +705,8 @@
116 no_diff(
117 sub { pt_online_schema_change::main(@args, "$dsn,D=bug_1045317,t=bits",
118 '--execute', '--statistics',
119- '--alter', "modify column val ENUM('M','E','H') NOT NULL")
120+ '--alter', "modify column val ENUM('M','E','H') NOT NULL",
121+ '--recursion-method', 'none')
122 },
123 ($sandbox_version ge '5.5' && $db_flavor !~ m/XtraDB Cluster/
124 ? "$sample/stats-execute-5.5.txt"
125
126=== modified file 't/pt-online-schema-change/charset.t'
127--- t/pt-online-schema-change/charset.t 2013-06-26 17:47:19 +0000
128+++ t/pt-online-schema-change/charset.t 2013-11-27 00:28:21 +0000
129@@ -56,10 +56,10 @@
130 my @create = split("\n\n", $output);
131
132 like(
133- $create[1],
134+ $create[1] || '',
135 qr/DEFAULT CHARSET=utf8/,
136 "Can alter charset of new table"
137-);
138+) or diag($output);
139
140 # #############################################################################
141 # Done.
142
143=== modified file 't/pt-online-schema-change/samples/stats-execute-5.5.txt'
144--- t/pt-online-schema-change/samples/stats-execute-5.5.txt 2013-06-25 19:52:03 +0000
145+++ t/pt-online-schema-change/samples/stats-execute-5.5.txt 2013-11-27 00:28:21 +0000
146@@ -1,3 +1,5 @@
147+No slaves found. See --recursion-method if host h=127.1,P=12345 has slaves.
148+Not checking slave lag because no slaves were found and --check-slave-lag was not specified.
149 Operation, tries, wait:
150 copy_rows, 10, 0.25
151 create_triggers, 10, 1

Subscribers

People subscribed via source and target branches

to all changes: