Merge lp:~percona-toolkit-dev/percona-toolkit/fix-md-bug-926598 into lp:percona-toolkit/2.0

Proposed by Daniel Nichter
Status: Merged
Approved by: Daniel Nichter
Approved revision: 175
Merged at revision: 195
Proposed branch: lp:~percona-toolkit-dev/percona-toolkit/fix-md-bug-926598
Merge into: lp:percona-toolkit/2.0
Diff against target: 1111 lines (+359/-195)
21 files modified
bin/pt-upgrade (+182/-120)
lib/MockSyncStream.pm (+9/-6)
t/lib/MockSyncStream.t (+2/-2)
t/pt-upgrade/basics.t (+75/-33)
t/pt-upgrade/daemon.t (+3/-3)
t/pt-upgrade/rewrite_non_select.t (+4/-4)
t/pt-upgrade/samples/001/non-selects-rewritten.txt (+3/-3)
t/pt-upgrade/samples/001/non-selects.txt (+1/-1)
t/pt-upgrade/samples/001/one-error-no-clear-warnings.txt (+3/-3)
t/pt-upgrade/samples/001/one-error.txt (+3/-3)
t/pt-upgrade/samples/001/select-everyone-no-stats.txt (+1/-1)
t/pt-upgrade/samples/001/select-everyone-rows.txt (+1/-1)
t/pt-upgrade/samples/001/select-everyone.txt (+1/-1)
t/pt-upgrade/samples/001/select-one-rows.txt (+1/-1)
t/pt-upgrade/samples/001/select-one.txt (+1/-1)
t/pt-upgrade/samples/002/report-01.txt (+2/-2)
t/pt-upgrade/samples/003/double.log (+4/-0)
t/pt-upgrade/samples/003/report001.txt (+42/-0)
t/pt-upgrade/samples/003/tables.sql (+11/-0)
t/pt-upgrade/skip_non_select.t (+4/-4)
t/pt-upgrade/warnings.t (+6/-6)
To merge this branch: bzr merge lp:~percona-toolkit-dev/percona-toolkit/fix-md-bug-926598
Reviewer Review Type Date Requested Status
Daniel Nichter Approve
Review via email: mp+95637@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-upgrade'
2--- bin/pt-upgrade 2012-02-03 23:25:29 +0000
3+++ bin/pt-upgrade 2012-03-02 18:11:19 +0000
4@@ -141,12 +141,14 @@
5 sub as_string {
6 my ( $self, $dsn, $props ) = @_;
7 return $dsn unless ref $dsn;
8- my %allowed = $props ? map { $_=>1 } @$props : ();
9+ my @keys = $props ? @$props : sort keys %$dsn;
10 return join(',',
11- map { "$_=" . ($_ eq 'p' ? '...' : $dsn->{$_}) }
12- grep { defined $dsn->{$_} && $self->{opts}->{$_} }
13- grep { !$props || $allowed{$_} }
14- sort keys %$dsn );
15+ map { "$_=" . ($_ eq 'p' ? '...' : $dsn->{$_}) }
16+ grep {
17+ exists $self->{opts}->{$_}
18+ && exists $dsn->{$_}
19+ && defined $dsn->{$_}
20+ } @keys);
21 }
22
23 sub usage {
24@@ -700,19 +702,56 @@
25 return bless $self, $class;
26 }
27
28+sub get_create_table {
29+ my ( $self, $dbh, $db, $tbl ) = @_;
30+ die "I need a dbh parameter" unless $dbh;
31+ die "I need a db parameter" unless $db;
32+ die "I need a tbl parameter" unless $tbl;
33+ my $q = $self->{Quoter};
34+
35+ my $sql = '/*!40101 SET @OLD_SQL_MODE := @@SQL_MODE, '
36+ . q{@@SQL_MODE := REPLACE(REPLACE(@@SQL_MODE, 'ANSI_QUOTES', ''), ',,', ','), }
37+ . '@OLD_QUOTE := @@SQL_QUOTE_SHOW_CREATE, '
38+ . '@@SQL_QUOTE_SHOW_CREATE := 1 */';
39+ PTDEBUG && _d($sql);
40+ eval { $dbh->do($sql); };
41+ PTDEBUG && $EVAL_ERROR && _d($EVAL_ERROR);
42+
43+ $sql = 'USE ' . $q->quote($db);
44+ PTDEBUG && _d($dbh, $sql);
45+ $dbh->do($sql);
46+
47+ $sql = "SHOW CREATE TABLE " . $q->quote($db, $tbl);
48+ PTDEBUG && _d($sql);
49+ my $href;
50+ eval { $href = $dbh->selectrow_hashref($sql); };
51+ if ( $EVAL_ERROR ) {
52+ PTDEBUG && _d($EVAL_ERROR);
53+ return;
54+ }
55+
56+ $sql = '/*!40101 SET @@SQL_MODE := @OLD_SQL_MODE, '
57+ . '@@SQL_QUOTE_SHOW_CREATE := @OLD_QUOTE */';
58+ PTDEBUG && _d($sql);
59+ $dbh->do($sql);
60+
61+ my ($key) = grep { m/create table/i } keys %$href;
62+ if ( $key ) {
63+ PTDEBUG && _d('This table is a base table');
64+ $href->{$key} =~ s/\b[ ]{2,}/ /g;
65+ $href->{$key} .= "\n";
66+ }
67+ else {
68+ PTDEBUG && _d('This table is a view');
69+ ($key) = grep { m/create view/i } keys %$href;
70+ }
71+
72+ return $href->{$key};
73+}
74+
75 sub parse {
76 my ( $self, $ddl, $opts ) = @_;
77 return unless $ddl;
78- if ( ref $ddl eq 'ARRAY' ) {
79- if ( lc $ddl->[0] eq 'table' ) {
80- $ddl = $ddl->[1];
81- }
82- else {
83- return {
84- engine => 'VIEW',
85- };
86- }
87- }
88
89 if ( $ddl !~ m/CREATE (?:TEMPORARY )?TABLE `/ ) {
90 die "Cannot parse table definition; is ANSI quoting "
91@@ -1019,41 +1058,31 @@
92 return $ddl;
93 }
94
95-sub remove_secondary_indexes {
96- my ( $self, $ddl ) = @_;
97- my $sec_indexes_ddl;
98- my $tbl_struct = $self->parse($ddl);
99-
100- if ( ($tbl_struct->{engine} || '') =~ m/InnoDB/i ) {
101- my $clustered_key = $tbl_struct->{clustered_key};
102- $clustered_key ||= '';
103-
104- my @sec_indexes = map {
105- my $key_def = $_->{ddl};
106- $key_def =~ s/([\(\)])/\\$1/g;
107- $ddl =~ s/\s+$key_def//i;
108-
109- my $key_ddl = "ADD $_->{ddl}";
110- $key_ddl .= ',' unless $key_ddl =~ m/,$/;
111- $key_ddl;
112- }
113- grep { $_->{name} ne $clustered_key }
114- values %{$tbl_struct->{keys}};
115- PTDEBUG && _d('Secondary indexes:', Dumper(\@sec_indexes));
116-
117- if ( @sec_indexes ) {
118- $sec_indexes_ddl = join(' ', @sec_indexes);
119- $sec_indexes_ddl =~ s/,$//;
120- }
121-
122- $ddl =~ s/,(\n\) )/$1/s;
123- }
124- else {
125- PTDEBUG && _d('Not removing secondary indexes from',
126- $tbl_struct->{engine}, 'table');
127- }
128-
129- return $ddl, $sec_indexes_ddl, $tbl_struct;
130+sub get_table_status {
131+ my ( $self, $dbh, $db, $like ) = @_;
132+ my $q = $self->{Quoter};
133+ my $sql = "SHOW TABLE STATUS FROM " . $q->quote($db);
134+ my @params;
135+ if ( $like ) {
136+ $sql .= ' LIKE ?';
137+ push @params, $like;
138+ }
139+ PTDEBUG && _d($sql, @params);
140+ my $sth = $dbh->prepare($sql);
141+ eval { $sth->execute(@params); };
142+ if ($EVAL_ERROR) {
143+ PTDEBUG && _d($EVAL_ERROR);
144+ return;
145+ }
146+ my @tables = @{$sth->fetchall_arrayref({})};
147+ @tables = map {
148+ my %tbl; # Make a copy with lowercased keys
149+ @tbl{ map { lc $_ } keys %$_ } = values %$_;
150+ $tbl{engine} ||= $tbl{type} || $tbl{comment};
151+ delete $tbl{type};
152+ \%tbl;
153+ } @tables;
154+ return @tables;
155 }
156
157 sub _d {
158@@ -1141,6 +1170,48 @@
159 return $db ? "$db.$tbl" : $tbl;
160 }
161
162+sub serialize_list {
163+ my ( $self, @args ) = @_;
164+ return unless @args;
165+
166+ return $args[0] if @args == 1 && !defined $args[0];
167+
168+ die "Cannot serialize multiple values with undef/NULL"
169+ if grep { !defined $_ } @args;
170+
171+ return join ',', map { quotemeta } @args;
172+}
173+
174+sub deserialize_list {
175+ my ( $self, $string ) = @_;
176+ return $string unless defined $string;
177+ my @escaped_parts = $string =~ /
178+ \G # Start of string, or end of previous match.
179+ ( # Each of these is an element in the original list.
180+ [^\\,]* # Anything not a backslash or a comma
181+ (?: # When we get here, we found one of the above.
182+ \\. # A backslash followed by something so we can continue
183+ [^\\,]* # Same as above.
184+ )* # Repeat zero of more times.
185+ )
186+ , # Comma dividing elements
187+ /sxgc;
188+
189+ push @escaped_parts, pos($string) ? substr( $string, pos($string) ) : $string;
190+
191+ my @unescaped_parts = map {
192+ my $part = $_;
193+
194+ my $char_class = utf8::is_utf8($part) # If it's a UTF-8 string,
195+ ? qr/(?=\p{ASCII})\W/ # We only care about non-word
196+ : qr/(?=\p{ASCII})\W|[\x{80}-\x{FF}]/; # Otherwise,
197+ $part =~ s/\\($char_class)/$1/g;
198+ $part;
199+ } @escaped_parts;
200+
201+ return @unescaped_parts;
202+}
203+
204 1;
205 }
206 # ###########################################################################
207@@ -2098,7 +2169,7 @@
208 $opt->{value} = ($pre || '') . $num;
209 }
210 else {
211- $self->save_error("Invalid size for --$opt->{long}");
212+ $self->save_error("Invalid size for --$opt->{long}: $val");
213 }
214 return;
215 }
216@@ -6019,23 +6090,21 @@
217 die "I need a $arg argument" unless defined $args{$arg};
218 }
219 my ($tbl_struct, $index) = @args{@required_args};
220- my @cols = $args{cols} ? @{$args{cols}} : @{$tbl_struct->{cols}};
221+ my @cols = $args{cols} ? @{$args{cols}} : @{$tbl_struct->{cols}};
222 my $q = $self->{Quoter};
223
224 die "Index '$index' does not exist in table"
225 unless exists $tbl_struct->{keys}->{$index};
226+ PTDEBUG && _d('Will ascend index', $index);
227
228 my @asc_cols = @{$tbl_struct->{keys}->{$index}->{cols}};
229- my @asc_slice;
230-
231- @asc_cols = @{$tbl_struct->{keys}->{$index}->{cols}};
232- PTDEBUG && _d('Will ascend index', $index);
233- PTDEBUG && _d('Will ascend columns', join(', ', @asc_cols));
234 if ( $args{asc_first} ) {
235 @asc_cols = $asc_cols[0];
236 PTDEBUG && _d('Ascending only first column');
237 }
238+ PTDEBUG && _d('Will ascend columns', join(', ', @asc_cols));
239
240+ my @asc_slice;
241 my %col_posn = do { my $i = 0; map { $_ => $i++ } @cols };
242 foreach my $col ( @asc_cols ) {
243 if ( !exists $col_posn{$col} ) {
244@@ -6596,18 +6665,16 @@
245 sub find_replication_differences {
246 my ( $self, $dbh, $table ) = @_;
247
248- (my $sql = <<" EOF") =~ s/\s+/ /gm;
249- SELECT db, tbl, chunk, boundaries,
250- COALESCE(this_cnt-master_cnt, 0) AS cnt_diff,
251- COALESCE(
252- this_crc <> master_crc OR ISNULL(master_crc) <> ISNULL(this_crc),
253- 0
254- ) AS crc_diff,
255- this_cnt, master_cnt, this_crc, master_crc
256- FROM $table
257- WHERE master_cnt <> this_cnt OR master_crc <> this_crc
258- OR ISNULL(master_crc) <> ISNULL(this_crc)
259- EOF
260+ my $sql
261+ = "SELECT db, tbl, CONCAT(db, '.', tbl) AS `table`, "
262+ . "chunk, chunk_index, lower_boundary, upper_boundary, "
263+ . "COALESCE(this_cnt-master_cnt, 0) AS cnt_diff, "
264+ . "COALESCE("
265+ . "this_crc <> master_crc OR ISNULL(master_crc) <> ISNULL(this_crc), 0"
266+ . ") AS crc_diff, this_cnt, master_cnt, this_crc, master_crc "
267+ . "FROM $table "
268+ . "WHERE master_cnt <> this_cnt OR master_crc <> this_crc "
269+ . "OR ISNULL(master_crc) <> ISNULL(this_crc)";
270
271 PTDEBUG && _d($sql);
272 my $diffs = $dbh->selectall_arrayref($sql, { Slice => {} });
273@@ -7016,11 +7083,12 @@
274
275 eval {
276 if ( my $timeout = $args{wait} ) {
277- my $wait = $args{wait_retry_args}->{wait} || 10;
278+ my $ms = $self->{MasterSlave};
279 my $tries = $args{wait_retry_args}->{tries} || 3;
280+ my $wait;
281 $self->{Retry}->retry(
282- wait => sub { sleep $wait; },
283 tries => $tries,
284+ wait => sub { sleep $args{wait_retry_args}->{wait} || 10 },
285 try => sub {
286 my ( %args ) = @_;
287
288@@ -7028,12 +7096,18 @@
289 warn "Retrying MASTER_POS_WAIT() for --wait $timeout...";
290 }
291
292- my $ms = $self->{MasterSlave};
293- my $wait = $ms->wait_for_master(
294+ $wait = $ms->wait_for_master(
295 master_status => $ms->get_master_status($src->{misc_dbh}),
296 slave_dbh => $dst->{dbh},
297 timeout => $timeout,
298 );
299+ if ( defined $wait->{result} && $wait->{result} != -1 ) {
300+ return; # slave caught up
301+ }
302+ die; # call fail
303+ },
304+ fail => sub {
305+ my (%args) = @_;
306 if ( !defined $wait->{result} ) {
307 my $msg;
308 if ( $wait->{waited} ) {
309@@ -7048,20 +7122,14 @@
310 $msg .= " Sleeping $wait seconds then retrying "
311 . ($tries - $args{tryno}) . " more times.";
312 }
313- warn $msg;
314- return;
315+ warn "$msg\n";
316+ return 1; # call wait, call try
317 }
318 elsif ( $wait->{result} == -1 ) {
319- die "Slave did not catch up to its master after waiting "
320- . "$timeout seconds with MASTER_POS_WAIT. Try inceasing "
321- . "the --wait time, or disable this feature by specifying "
322- . "--wait 0.";
323- }
324- else {
325- return $result; # slave caught up
326+ return 0; # call final_fail
327 }
328 },
329- on_failure => sub {
330+ final_fail => sub {
331 die "Slave did not catch up to its master after $tries attempts "
332 . "of waiting $timeout seconds with MASTER_POS_WAIT. "
333 . "Check that the slave is running, increase the --wait "
334@@ -8088,8 +8156,6 @@
335 my @cols = @{$sth->{NAME}};
336 my @types = map { $dbh->type_info($_)->{TYPE_NAME} } @{$sth->{TYPE}};
337 my @nullable = map { $dbh->type_info($_)->{NULLABLE} == 1 ? 1 : 0 } @{$sth->{TYPE}};
338- my @p = @{$sth->{PRECISION}};
339- my @s = @{$sth->{SCALE}};
340
341 my $struct = {
342 cols => \@cols,
343@@ -8104,11 +8170,11 @@
344 $struct->{is_nullable}->{$col} = $nullable[$i];
345 $struct->{is_numeric}->{$col}
346 = ($type =~ m/(?:(?:tiny|big|medium|small)?int|float|double|decimal|year)/ ? 1 : 0);
347+
348 $struct->{size}->{$col}
349- = ($type =~ m/(?:float|double)/) ? "($s[$i],$p[$i])"
350- : ($type =~ m/(?:decimal)/) ? "($p[$i],$s[$i])"
351- : ($type =~ m/(?:char|varchar)/ && $p[$i]) ? "($p[$i])"
352- : undef;
353+ = $type =~ m/(?:char|varchar)/ && $sth->{PRECISION}->[$i]
354+ ? "($sth->{PRECISION}->[$i])"
355+ : undef;
356 }
357
358 return $struct;
359@@ -8857,7 +8923,7 @@
360 sub new {
361 my ( $class, %args ) = @_;
362 my @required_args = qw(method base-dir plugins get_id
363- QueryParser MySQLDump TableParser TableSyncer Quoter);
364+ QueryParser TableParser TableSyncer Quoter);
365 foreach my $arg ( @required_args ) {
366 die "I need a $arg argument" unless $args{$arg};
367 }
368@@ -9454,7 +9520,6 @@
369 my $qp = $self->{QueryParser};
370 my $tp = $self->{TableParser};
371 my $q = $self->{Quoter};
372- my $du = $self->{MySQLDump};
373
374 my @src_tbls = $qp->get_tables($query);
375 my @keys;
376@@ -9464,8 +9529,11 @@
377 my $tbl_struct;
378 eval {
379 $tbl_struct = $tp->parse(
380- $du->get_create_table($dsts->[0]->{dbh}, $q, $db, $tbl)
381- );
382+ $tp->get_create_table(
383+ dbh => $dsts->[0]->{dbh},
384+ db => $db,
385+ tbl => $tbl,
386+ ));
387 };
388 if ( $EVAL_ERROR ) {
389 PTDEBUG && _d('Error parsing', $db, '.', $tbl, ':', $EVAL_ERROR);
390@@ -10384,48 +10452,42 @@
391
392 sub retry {
393 my ( $self, %args ) = @_;
394- my @required_args = qw(try wait);
395+ my @required_args = qw(try fail final_fail);
396 foreach my $arg ( @required_args ) {
397 die "I need a $arg argument" unless $args{$arg};
398 };
399- my ($try, $wait) = @args{@required_args};
400+ my ($try, $fail, $final_fail) = @args{@required_args};
401+ my $wait = $args{wait} || sub { sleep 1; };
402 my $tries = $args{tries} || 3;
403
404+ my $last_error;
405 my $tryno = 0;
406+ TRY:
407 while ( ++$tryno <= $tries ) {
408- PTDEBUG && _d("Retry", $tryno, "of", $tries);
409+ PTDEBUG && _d("Try", $tryno, "of", $tries);
410 my $result;
411 eval {
412 $result = $try->(tryno=>$tryno);
413 };
414+ if ( $EVAL_ERROR ) {
415+ PTDEBUG && _d("Try code failed:", $EVAL_ERROR);
416+ $last_error = $EVAL_ERROR;
417
418- if ( defined $result ) {
419+ if ( $tryno < $tries ) { # more retries
420+ my $retry = $fail->(tryno=>$tryno, error=>$last_error);
421+ last TRY unless $retry;
422+ PTDEBUG && _d("Calling wait code");
423+ $wait->(tryno=>$tryno);
424+ }
425+ }
426+ else {
427 PTDEBUG && _d("Try code succeeded");
428- if ( my $on_success = $args{on_success} ) {
429- PTDEBUG && _d("Calling on_success code");
430- $on_success->(tryno=>$tryno, result=>$result);
431- }
432 return $result;
433 }
434-
435- if ( $EVAL_ERROR ) {
436- PTDEBUG && _d("Try code died:", $EVAL_ERROR);
437- die $EVAL_ERROR unless $args{retry_on_die};
438- }
439-
440- if ( $tryno < $tries ) {
441- PTDEBUG && _d("Try code failed, calling wait code");
442- $wait->(tryno=>$tryno);
443- }
444- }
445-
446- PTDEBUG && _d("Try code did not succeed");
447- if ( my $on_failure = $args{on_failure} ) {
448- PTDEBUG && _d("Calling on_failure code");
449- $on_failure->();
450- }
451-
452- return;
453+ }
454+
455+ PTDEBUG && _d('Try code did not succeed');
456+ return $final_fail->(error=>$last_error);
457 }
458
459 sub _d {
460
461=== modified file 'lib/MockSyncStream.pm'
462--- lib/MockSyncStream.pm 2012-01-19 19:46:56 +0000
463+++ lib/MockSyncStream.pm 2012-03-02 18:11:19 +0000
464@@ -97,8 +97,6 @@
465 my @cols = @{$sth->{NAME}};
466 my @types = map { $dbh->type_info($_)->{TYPE_NAME} } @{$sth->{TYPE}};
467 my @nullable = map { $dbh->type_info($_)->{NULLABLE} == 1 ? 1 : 0 } @{$sth->{TYPE}};
468- my @p = @{$sth->{PRECISION}};
469- my @s = @{$sth->{SCALE}};
470
471 my $struct = {
472 cols => \@cols,
473@@ -114,11 +112,16 @@
474 $struct->{is_nullable}->{$col} = $nullable[$i];
475 $struct->{is_numeric}->{$col}
476 = ($type =~ m/(?:(?:tiny|big|medium|small)?int|float|double|decimal|year)/ ? 1 : 0);
477+
478+ # We no longer specify the (precision, scale) for double, float, and
479+ # decimal because DBD::mysql isn't reliable and defaults should work.
480+ # But char col sizes are important, e.g. varchar(16) and varchar(255)
481+ # won't hold the same values.
482+ # https://bugs.launchpad.net/percona-toolkit/+bug/926598
483 $struct->{size}->{$col}
484- = ($type =~ m/(?:float|double)/) ? "($s[$i],$p[$i])"
485- : ($type =~ m/(?:decimal)/) ? "($p[$i],$s[$i])"
486- : ($type =~ m/(?:char|varchar)/ && $p[$i]) ? "($p[$i])"
487- : undef;
488+ = $type =~ m/(?:char|varchar)/ && $sth->{PRECISION}->[$i]
489+ ? "($sth->{PRECISION}->[$i])"
490+ : undef;
491 }
492
493 return $struct;
494
495=== modified file 't/lib/MockSyncStream.t'
496--- t/lib/MockSyncStream.t 2011-08-24 17:37:45 +0000
497+++ t/lib/MockSyncStream.t 2012-03-02 18:11:19 +0000
498@@ -169,8 +169,8 @@
499 size => {
500 id => undef,
501 i => undef,
502- f => '(31,12)',
503- d => $DBD::mysql::VERSION ge '4.001' ? '(7,2)' : '(7)',
504+ f => undef,
505+ d => undef,
506 dt => undef,
507 ts => undef,
508 c => '(1)',
509
510=== modified file 't/pt-upgrade/basics.t'
511--- t/pt-upgrade/basics.t 2012-02-02 16:07:18 +0000
512+++ t/pt-upgrade/basics.t 2012-03-02 18:11:19 +0000
513@@ -16,12 +16,12 @@
514 require "$trunk/bin/pt-upgrade";
515
516 # This runs immediately if the server is already running, else it starts it.
517-diag(`$trunk/sandbox/start-sandbox master 12347 >/dev/null`);
518+diag(`$trunk/sandbox/start-sandbox master 12348 >/dev/null`);
519
520 my $dp = new DSNParser(opts=>$dsn_opts);
521 my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
522 my $dbh1 = $sb->get_dbh_for('master');
523-my $dbh2 = $sb->get_dbh_for('slave2');
524+my $dbh2 = $sb->get_dbh_for('master1');
525
526 if ( !$dbh1 ) {
527 plan skip_all => 'Cannot connect to sandbox master';
528@@ -30,96 +30,109 @@
529 plan skip_all => 'Cannot connect to second sandbox master';
530 }
531 else {
532- plan tests => 10;
533+ plan tests => 12;
534 }
535
536-$sb->load_file('master', 't/pt-upgrade/samples/001/tables.sql');
537-$sb->load_file('slave2', 't/pt-upgrade/samples/001/tables.sql');
538+my @host_args = ('h=127.1,P=12345', 'P=12348');
539+my @op_args = (qw(-u msandbox -p msandbox),
540+ '--compare', 'results,warnings',
541+ '--zero-query-times',
542+);
543+my @args = (@host_args, @op_args);
544+my $sample = "t/pt-upgrade/samples";
545+my $log = "$trunk/$sample";
546
547-my $cmd = "$trunk/bin/pt-upgrade h=127.1,P=12345,u=msandbox,p=msandbox P=12347 --compare results,warnings --zero-query-times";
548-my @args = ('--compare', 'results,warnings', '--zero-query-times');
549-my $sample = "$trunk/t/pt-upgrade/samples/";
550+# ###########################################################################
551+# Basic run.
552+# ###########################################################################
553+$sb->load_file('master', "$sample/001/tables.sql");
554+$sb->load_file('master1', "$sample/001/tables.sql");
555
556 ok(
557 no_diff(
558- "$cmd $trunk/t/pt-upgrade/samples/001/select-one.log",
559- 't/pt-upgrade/samples/001/select-one.txt'
560+ sub { pt_upgrade::main(@args, "$log/001/select-one.log") },
561+ "$sample/001/select-one.txt",
562 ),
563 'Report for a single query (checksum method)'
564 );
565
566 ok(
567 no_diff(
568- "$cmd $trunk/t/pt-upgrade/samples/001/select-everyone.log",
569- 't/pt-upgrade/samples/001/select-everyone.txt'
570+ sub { pt_upgrade::main(@args, "$log/001/select-everyone.log") },
571+ "$sample/001/select-everyone.txt"
572 ),
573 'Report for multiple queries (checksum method)'
574 );
575
576 ok(
577 no_diff(
578- "$cmd $trunk/t/pt-upgrade/samples/001/select-one.log --compare-results-method rows",
579- 't/pt-upgrade/samples/001/select-one-rows.txt'
580+ sub { pt_upgrade::main(@args, "$trunk/$sample/001/select-one.log",
581+ "--compare-results-method", "rows") },
582+ "$sample/001/select-one-rows.txt"
583 ),
584 'Report for a single query (rows method)'
585 );
586
587 ok(
588 no_diff(
589- "$cmd $trunk/t/pt-upgrade/samples/001/select-everyone.log --compare-results-method rows",
590- 't/pt-upgrade/samples/001/select-everyone-rows.txt'
591+ sub { pt_upgrade::main(@args, "$trunk/$sample/001/select-everyone.log",
592+ "--compare-results-method", "rows") },
593+ "$sample/001/select-everyone-rows.txt"
594 ),
595 'Report for multiple queries (rows method)'
596 );
597
598 ok(
599 no_diff(
600- "$cmd --reports queries,differences,errors $trunk/t/pt-upgrade/samples/001/select-everyone.log",
601- 't/pt-upgrade/samples/001/select-everyone-no-stats.txt'
602+ sub { pt_upgrade::main(@args, "$trunk/$sample/001/select-everyone.log",
603+ "--reports", "queries,differences,errors") },
604+ "$sample/001/select-everyone-no-stats.txt"
605 ),
606 'Report without statistics'
607 );
608
609 ok(
610 no_diff(
611- "$cmd --reports differences,errors,statistics $trunk/t/pt-upgrade/samples/001/select-everyone.log",
612- 't/pt-upgrade/samples/001/select-everyone-no-queries.txt'
613+ sub { pt_upgrade::main(@args, "$trunk/$sample/001/select-everyone.log",
614+ "--reports", "differences,errors,statistics") },
615+ "$sample/001/select-everyone-no-queries.txt"
616 ),
617 'Report without per-query reports'
618 );
619
620+$sb->wipe_clean($dbh1);
621+$sb->wipe_clean($dbh2);
622+
623 # #############################################################################
624 # Issue 951: mk-upgrade "I need a db argument" error with
625 # compare-results-method=rows
626 # #############################################################################
627-$sb->load_file('master', 't/pt-upgrade/samples/002/tables.sql');
628-$sb->load_file('slave2', 't/pt-upgrade/samples/002/tables.sql');
629+$sb->load_file('master', "$sample/002/tables.sql");
630+$sb->load_file('master1', "$sample/002/tables.sql");
631
632-# Make a difference so diff_rows() is called.
633+# Make a difference on one host so diff_rows() is called.
634 $dbh1->do('insert into test.t values (5)');
635
636 ok(
637 no_diff(
638- sub { pt_upgrade::main(@args,
639- 'h=127.1,P=12345,u=msandbox,p=msandbox,D=test', 'P=12347,D=test',
640- "$sample/002/no-db.log",
641+ sub { pt_upgrade::main(@op_args, "$log/002/no-db.log",
642+ 'h=127.1,P=12345,D=test', 'P=12348,D=test',
643 qw(--compare-results-method rows --temp-database test)) },
644- 't/pt-upgrade/samples/002/report-01.txt',
645+ "$sample/002/report-01.txt",
646 ),
647 'No db, compare results row, DSN D, --temp-database (issue 951)'
648 );
649
650-$sb->load_file('master', 't/pt-upgrade/samples/002/tables.sql');
651-$sb->load_file('slave2', 't/pt-upgrade/samples/002/tables.sql');
652+$sb->load_file('master', "$sample/002/tables.sql");
653+$sb->load_file('master1', "$sample/002/tables.sql");
654 $dbh1->do('insert into test.t values (5)');
655
656 ok(
657 no_diff(
658- sub { pt_upgrade::main(@args,
659- 'h=127.1,P=12345,u=msandbox,p=msandbox,D=test', 'P=12347,D=test',
660- "$sample/002/no-db.log",
661+ sub { pt_upgrade::main(@op_args, "$log/002/no-db.log",
662+ 'h=127.1,P=12345,D=test', 'P=12348,D=test',
663 qw(--compare-results-method rows --temp-database tmp_db)) },
664- 't/pt-upgrade/samples/002/report-01.txt',
665+ "$sample/002/report-01.txt",
666 ),
667 'No db, compare results row, DSN D'
668 );
669@@ -136,6 +149,35 @@
670 "Createed temp table in --temp-database"
671 );
672
673+$sb->wipe_clean($dbh1);
674+$sb->wipe_clean($dbh2);
675+
676+# #############################################################################
677+# Bug 926598: DBD::mysql bug causes pt-upgrade to use wrong
678+# precision (M) and scale (D)
679+# #############################################################################
680+$sb->load_file('master', "$sample/003/tables.sql");
681+$sb->load_file('master1', "$sample/003/tables.sql");
682+
683+# Make a difference on one host so diff_rows() is called.
684+$dbh1->do('insert into test.t values (4, 1.00)');
685+
686+ok(
687+ no_diff(
688+ sub { pt_upgrade::main(@args, "$log/003/double.log",
689+ qw(--compare-results-method rows)) },
690+ "$sample/003/report001.txt",
691+ ),
692+ 'M, D diff (bug 926598)',
693+);
694+
695+my $row = $dbh1->selectrow_arrayref("show create table test.mk_upgrade_left");
696+like(
697+ $row->[1],
698+ qr/`SUM\(total\)`\s+double\sDEFAULT/,
699+ "No M,D in table def (bug 926598)"
700+);
701+
702 # #############################################################################
703 # Done.
704 # #############################################################################
705
706=== modified file 't/pt-upgrade/daemon.t'
707--- t/pt-upgrade/daemon.t 2011-07-12 22:56:55 +0000
708+++ t/pt-upgrade/daemon.t 2012-03-02 18:11:19 +0000
709@@ -16,12 +16,12 @@
710 require "$trunk/bin/pt-upgrade";
711
712 # This runs immediately if the server is already running, else it starts it.
713-diag(`$trunk/sandbox/start-sandbox master 12347 >/dev/null`);
714+diag(`$trunk/sandbox/start-sandbox master 12348 >/dev/null`);
715
716 my $dp = new DSNParser(opts=>$dsn_opts);
717 my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
718 my $dbh1 = $sb->get_dbh_for('master');
719-my $dbh2 = $sb->get_dbh_for('slave2');
720+my $dbh2 = $sb->get_dbh_for('master1');
721
722 if ( !$dbh1 ) {
723 plan skip_all => 'Cannot connect to sandbox master';
724@@ -33,7 +33,7 @@
725 plan tests => 1;
726 }
727
728-my $cmd = "$trunk/bin/pt-upgrade h=127.1,P=12345,u=msandbox,p=msandbox P=12347 --compare results,warnings --zero-query-times";
729+my $cmd = "$trunk/bin/pt-upgrade h=127.1,P=12345,u=msandbox,p=msandbox P=12348 --compare results,warnings --zero-query-times";
730
731 # Issue 391: Add --pid option to all scripts
732 `touch /tmp/mk-script.pid`;
733
734=== modified file 't/pt-upgrade/rewrite_non_select.t'
735--- t/pt-upgrade/rewrite_non_select.t 2011-07-12 22:56:55 +0000
736+++ t/pt-upgrade/rewrite_non_select.t 2012-03-02 18:11:19 +0000
737@@ -16,12 +16,12 @@
738 require "$trunk/bin/pt-upgrade";
739
740 # This runs immediately if the server is already running, else it starts it.
741-diag(`$trunk/sandbox/start-sandbox master 12347 >/dev/null`);
742+diag(`$trunk/sandbox/start-sandbox master 12348 >/dev/null`);
743
744 my $dp = new DSNParser(opts=>$dsn_opts);
745 my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
746 my $dbh1 = $sb->get_dbh_for('master');
747-my $dbh2 = $sb->get_dbh_for('slave2');
748+my $dbh2 = $sb->get_dbh_for('master1');
749
750 if ( !$dbh1 ) {
751 plan skip_all => 'Cannot connect to sandbox master';
752@@ -34,11 +34,11 @@
753 }
754
755 $sb->load_file('master', 't/pt-upgrade/samples/001/tables.sql');
756-$sb->load_file('slave2', 't/pt-upgrade/samples/001/tables.sql');
757+$sb->load_file('master1', 't/pt-upgrade/samples/001/tables.sql');
758
759 # Issue 747: Make mk-upgrade rewrite non-SELECT
760
761-my $cmd = "$trunk/bin/pt-upgrade h=127.1,P=12345 P=12347 -u msandbox -p msandbox --compare results,warnings --zero-query-times --convert-to-select --fingerprints";
762+my $cmd = "$trunk/bin/pt-upgrade h=127.1,P=12345 P=12348 -u msandbox -p msandbox --compare results,warnings --zero-query-times --convert-to-select --fingerprints";
763
764 my $c1 = $dbh1->selectrow_arrayref('checksum table test.t')->[1];
765 my $c2 = $dbh2->selectrow_arrayref('checksum table test.t')->[1];
766
767=== modified file 't/pt-upgrade/samples/001/non-selects-rewritten.txt'
768--- t/pt-upgrade/samples/001/non-selects-rewritten.txt 2011-06-24 22:02:05 +0000
769+++ t/pt-upgrade/samples/001/non-selects-rewritten.txt 2012-03-02 18:11:19 +0000
770@@ -8,7 +8,7 @@
771 # warning counts 0
772 # warning levels 0
773 # warnings 0
774-# 127.1:12345 127.1:12347
775+# 127.1:12345 127.1:12348
776 # Errors 0 0
777 # Warnings 0 0
778 # Query_time
779@@ -42,7 +42,7 @@
780 # warning counts 0
781 # warning levels 0
782 # warnings 0
783-# 127.1:12345 127.1:12347
784+# 127.1:12345 127.1:12348
785 # Errors 0 0
786 # Warnings 0 0
787 # Query_time
788@@ -75,7 +75,7 @@
789 # warning counts 0
790 # warning levels 0
791 # warnings 0
792-# 127.1:12345 127.1:12347
793+# 127.1:12345 127.1:12348
794 # Errors 0 0
795 # Warnings 0 0
796 # Query_time
797
798=== modified file 't/pt-upgrade/samples/001/non-selects.txt'
799--- t/pt-upgrade/samples/001/non-selects.txt 2011-06-24 22:02:05 +0000
800+++ t/pt-upgrade/samples/001/non-selects.txt 2012-03-02 18:11:19 +0000
801@@ -8,7 +8,7 @@
802 # warning counts 0
803 # warning levels 0
804 # warnings 0
805-# 127.1:12345 127.1:12347
806+# 127.1:12345 127.1:12348
807 # Errors 0 0
808 # Warnings 0 0
809 # Query_time
810
811=== modified file 't/pt-upgrade/samples/001/one-error-no-clear-warnings.txt'
812--- t/pt-upgrade/samples/001/one-error-no-clear-warnings.txt 2011-06-24 22:02:05 +0000
813+++ t/pt-upgrade/samples/001/one-error-no-clear-warnings.txt 2012-03-02 18:11:19 +0000
814@@ -8,7 +8,7 @@
815 # warning counts 0
816 # warning levels 0
817 # warnings 0
818-# P=12345,h=127.1,p=...,u=msandbox P=12347,h=127.1,p=...,u=msandbox
819+# P=12345,h=127.1,p=...,u=msandbox P=12348,h=127.1,p=...,u=msandbox
820 # Errors 1 1
821 # Warnings 1 1
822 # Query_time
823@@ -31,7 +31,7 @@
824 # warning counts 0
825 # warning levels 0
826 # warnings 0
827-# P=12345,h=127.1,p=...,u=msandbox P=12347,h=127.1,p=...,u=msandbox
828+# P=12345,h=127.1,p=...,u=msandbox P=12348,h=127.1,p=...,u=msandbox
829 # Errors 0 0
830 # Warnings 0 0
831 # Query_time
832@@ -55,7 +55,7 @@
833 # Errors
834 # Query ID Host Error
835 # ================== ================================ ========================
836-# 3B323396273BC4C7-1 P=12347,h=127.1,p=...,u=msandbox Failed to execute query: DBD::mysql::st execute failed: Unknown column 'borked' in 'field list' [for Statement "select borked"] at mk-upgrade line 0, <$fh> line 2.
837+# 3B323396273BC4C7-1 P=12348,h=127.1,p=...,u=msandbox Failed to execute query: DBD::mysql::st execute failed: Unknown column 'borked' in 'field list' [for Statement "select borked"] at mk-upgrade line 0, <$fh> line 2.
838
839 # Statistics
840 # CompareResults_after_execute_skipped 2
841
842=== modified file 't/pt-upgrade/samples/001/one-error.txt'
843--- t/pt-upgrade/samples/001/one-error.txt 2011-06-24 22:02:05 +0000
844+++ t/pt-upgrade/samples/001/one-error.txt 2012-03-02 18:11:19 +0000
845@@ -8,7 +8,7 @@
846 # warning counts 0
847 # warning levels 0
848 # warnings 0
849-# P=12345,h=127.1,p=...,u=msandbox P=12347,h=127.1,p=...,u=msandbox
850+# P=12345,h=127.1,p=...,u=msandbox P=12348,h=127.1,p=...,u=msandbox
851 # Errors 1 1
852 # Warnings 0 0
853 # Query_time
854@@ -31,7 +31,7 @@
855 # warning counts 0
856 # warning levels 0
857 # warnings 0
858-# P=12345,h=127.1,p=...,u=msandbox P=12347,h=127.1,p=...,u=msandbox
859+# P=12345,h=127.1,p=...,u=msandbox P=12348,h=127.1,p=...,u=msandbox
860 # Errors 0 0
861 # Warnings 0 0
862 # Query_time
863@@ -55,7 +55,7 @@
864 # Errors
865 # Query ID Host Error
866 # ================== ================================ ========================
867-# 3B323396273BC4C7-1 P=12347,h=127.1,p=...,u=msandbox Failed to execute query: DBD::mysql::st execute failed: Unknown column 'borked' in 'field list' [for Statement "select borked"] at ../mk-upgrade line 7059, <$fh> line 2.
868+# 3B323396273BC4C7-1 P=12348,h=127.1,p=...,u=msandbox Failed to execute query: DBD::mysql::st execute failed: Unknown column 'borked' in 'field list' [for Statement "select borked"] at ../mk-upgrade line 7059, <$fh> line 2.
869
870 # Statistics
871 # CompareResults_after_execute_skipped 2
872
873=== modified file 't/pt-upgrade/samples/001/select-everyone-no-stats.txt'
874--- t/pt-upgrade/samples/001/select-everyone-no-stats.txt 2011-06-24 22:02:05 +0000
875+++ t/pt-upgrade/samples/001/select-everyone-no-stats.txt 2012-03-02 18:11:19 +0000
876@@ -8,7 +8,7 @@
877 # warning counts 0
878 # warning levels 0
879 # warnings 0
880-# 127.1:12345 127.1:12347
881+# 127.1:12345 127.1:12348
882 # Errors 0 0
883 # Warnings 0 0
884 # Query_time
885
886=== modified file 't/pt-upgrade/samples/001/select-everyone-rows.txt'
887--- t/pt-upgrade/samples/001/select-everyone-rows.txt 2011-06-24 22:02:05 +0000
888+++ t/pt-upgrade/samples/001/select-everyone-rows.txt 2012-03-02 18:11:19 +0000
889@@ -8,7 +8,7 @@
890 # warning counts 0
891 # warning levels 0
892 # warnings 0
893-# 127.1:12345 127.1:12347
894+# 127.1:12345 127.1:12348
895 # Errors 0 0
896 # Warnings 0 0
897 # Query_time
898
899=== modified file 't/pt-upgrade/samples/001/select-everyone.txt'
900--- t/pt-upgrade/samples/001/select-everyone.txt 2011-06-24 22:02:05 +0000
901+++ t/pt-upgrade/samples/001/select-everyone.txt 2012-03-02 18:11:19 +0000
902@@ -8,7 +8,7 @@
903 # warning counts 0
904 # warning levels 0
905 # warnings 0
906-# 127.1:12345 127.1:12347
907+# 127.1:12345 127.1:12348
908 # Errors 0 0
909 # Warnings 0 0
910 # Query_time
911
912=== modified file 't/pt-upgrade/samples/001/select-one-rows.txt'
913--- t/pt-upgrade/samples/001/select-one-rows.txt 2011-06-24 22:02:05 +0000
914+++ t/pt-upgrade/samples/001/select-one-rows.txt 2012-03-02 18:11:19 +0000
915@@ -8,7 +8,7 @@
916 # warning counts 0
917 # warning levels 0
918 # warnings 0
919-# 127.1:12345 127.1:12347
920+# 127.1:12345 127.1:12348
921 # Errors 0 0
922 # Warnings 0 0
923 # Query_time
924
925=== modified file 't/pt-upgrade/samples/001/select-one.txt'
926--- t/pt-upgrade/samples/001/select-one.txt 2011-06-24 22:02:05 +0000
927+++ t/pt-upgrade/samples/001/select-one.txt 2012-03-02 18:11:19 +0000
928@@ -8,7 +8,7 @@
929 # warning counts 0
930 # warning levels 0
931 # warnings 0
932-# 127.1:12345 127.1:12347
933+# 127.1:12345 127.1:12348
934 # Errors 0 0
935 # Warnings 0 0
936 # Query_time
937
938=== modified file 't/pt-upgrade/samples/002/report-01.txt'
939--- t/pt-upgrade/samples/002/report-01.txt 2011-06-24 22:02:05 +0000
940+++ t/pt-upgrade/samples/002/report-01.txt 2012-03-02 18:11:19 +0000
941@@ -8,7 +8,7 @@
942 # warning counts 0
943 # warning levels 0
944 # warnings 0
945-# 127.1:12345 127.1:12347
946+# 127.1:12345 127.1:12348
947 # Errors 0 0
948 # Warnings 0 0
949 # Query_time
950@@ -34,7 +34,7 @@
951
952
953 # Row count differences
954-# Query ID 127.1:12345 127.1:12347
955+# Query ID 127.1:12345 127.1:12348
956 # ================== =========== ===========
957 # 3C830E3839B916D7-1 4 3
958
959
960=== added directory 't/pt-upgrade/samples/003'
961=== added file 't/pt-upgrade/samples/003/double.log'
962--- t/pt-upgrade/samples/003/double.log 1970-01-01 00:00:00 +0000
963+++ t/pt-upgrade/samples/003/double.log 2012-03-02 18:11:19 +0000
964@@ -0,0 +1,4 @@
965+# User@Host: root[root] @ localhost []
966+# Query_time: 1 Lock_time: 0 Rows_sent: 1 Rows_examined: 1
967+use test;
968+SELECT SUM(total) FROM test.t WHERE id > 0
969
970=== added file 't/pt-upgrade/samples/003/report001.txt'
971--- t/pt-upgrade/samples/003/report001.txt 1970-01-01 00:00:00 +0000
972+++ t/pt-upgrade/samples/003/report001.txt 2012-03-02 18:11:19 +0000
973@@ -0,0 +1,42 @@
974+
975+# Query 1: ID 0xC1B1E457814417E4 at byte 0 _______________________________
976+# Found 1 differences in 1 samples:
977+# column counts 0
978+# column types 0
979+# column values 1
980+# row counts 0
981+# warning counts 0
982+# warning levels 0
983+# warnings 0
984+# 127.1:12345 127.1:12348
985+# Errors 0 0
986+# Warnings 0 0
987+# Query_time
988+# sum 0 0
989+# min 0 0
990+# max 0 0
991+# avg 0 0
992+# pct_95 0 0
993+# stddev 0 0
994+# median 0 0
995+# row_count
996+# sum 1 1
997+# min 1 1
998+# max 1 1
999+# avg 1 1
1000+# pct_95 1 1
1001+# stddev 0 0
1002+# median 1 1
1003+use `test`;
1004+SELECT SUM(total) FROM test.t WHERE id > 0
1005+
1006+/* C1B1E457814417E4-1 */ SELECT SUM(total) FROM test.t WHERE id > 0
1007+
1008+
1009+# Column value differences
1010+# Query ID Column 127.1:12345 127.1:12348
1011+# ================== ========== =========== ===========
1012+# C1B1E457814417E4-1 SUM(total) 14.68 13.68
1013+
1014+# Statistics
1015+# events 1
1016
1017=== added file 't/pt-upgrade/samples/003/tables.sql'
1018--- t/pt-upgrade/samples/003/tables.sql 1970-01-01 00:00:00 +0000
1019+++ t/pt-upgrade/samples/003/tables.sql 2012-03-02 18:11:19 +0000
1020@@ -0,0 +1,11 @@
1021+DROP DATABASE IF EXISTS test;
1022+CREATE DATABASE test;
1023+USE test;
1024+CREATE TABLE t (
1025+ id INT NOT NULL PRIMARY KEY,
1026+ total DOUBLE NOT NULL
1027+) ENGINE=InnoDB;
1028+INSERT INTO test.t VALUES
1029+ (1, 1.23),
1030+ (2, 4.56),
1031+ (3, 7.89);
1032
1033=== modified file 't/pt-upgrade/skip_non_select.t'
1034--- t/pt-upgrade/skip_non_select.t 2011-07-12 22:56:55 +0000
1035+++ t/pt-upgrade/skip_non_select.t 2012-03-02 18:11:19 +0000
1036@@ -16,12 +16,12 @@
1037 require "$trunk/bin/pt-upgrade";
1038
1039 # This runs immediately if the server is already running, else it starts it.
1040-diag(`$trunk/sandbox/start-sandbox master 12347 >/dev/null`);
1041+diag(`$trunk/sandbox/start-sandbox master 12348 >/dev/null`);
1042
1043 my $dp = new DSNParser(opts=>$dsn_opts);
1044 my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
1045 my $dbh1 = $sb->get_dbh_for('master');
1046-my $dbh2 = $sb->get_dbh_for('slave2');
1047+my $dbh2 = $sb->get_dbh_for('master1');
1048
1049 if ( !$dbh1 ) {
1050 plan skip_all => 'Cannot connect to sandbox master';
1051@@ -34,9 +34,9 @@
1052 }
1053
1054 $sb->load_file('master', 't/pt-upgrade/samples/001/tables.sql');
1055-$sb->load_file('slave2', 't/pt-upgrade/samples/001/tables.sql');
1056+$sb->load_file('master1', 't/pt-upgrade/samples/001/tables.sql');
1057
1058-my $cmd = "$trunk/bin/pt-upgrade h=127.1,P=12345,u=msandbox,p=msandbox P=12347 --compare results,warnings --zero-query-times";
1059+my $cmd = "$trunk/bin/pt-upgrade h=127.1,P=12345,u=msandbox,p=msandbox P=12348 --compare results,warnings --zero-query-times";
1060
1061 # Test that non-SELECT queries are skipped by default.
1062 ok(
1063
1064=== modified file 't/pt-upgrade/warnings.t'
1065--- t/pt-upgrade/warnings.t 2011-07-12 22:56:55 +0000
1066+++ t/pt-upgrade/warnings.t 2012-03-02 18:11:19 +0000
1067@@ -16,12 +16,12 @@
1068 require "$trunk/bin/pt-upgrade";
1069
1070 # This runs immediately if the server is already running, else it starts it.
1071-diag(`$trunk/sandbox/start-sandbox master 12347 >/dev/null`);
1072+diag(`$trunk/sandbox/start-sandbox master 12348 >/dev/null`);
1073
1074 my $dp = new DSNParser(opts=>$dsn_opts);
1075 my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
1076 my $dbh1 = $sb->get_dbh_for('master');
1077-my $dbh2 = $sb->get_dbh_for('slave2');
1078+my $dbh2 = $sb->get_dbh_for('master1');
1079
1080 if ( !$dbh1 ) {
1081 plan skip_all => 'Cannot connect to sandbox master';
1082@@ -34,10 +34,10 @@
1083 }
1084
1085 $sb->load_file('master', 't/pt-upgrade/samples/001/tables.sql');
1086-$sb->load_file('slave2', 't/pt-upgrade/samples/001/tables.sql');
1087+$sb->load_file('master1', 't/pt-upgrade/samples/001/tables.sql');
1088
1089 my $output;
1090-my $cmd = "$trunk/bin/pt-upgrade h=127.1,P=12345,u=msandbox,p=msandbox P=12347 --compare results,warnings --zero-query-times --compare-results-method rows --limit 10";
1091+my $cmd = "$trunk/bin/pt-upgrade h=127.1,P=12345,u=msandbox,p=msandbox P=12348 --compare results,warnings --zero-query-times --compare-results-method rows --limit 10";
1092
1093 # This test really deals with,
1094 # http://code.google.com/p/maatkit/issues/detail?id=754
1095@@ -63,7 +63,7 @@
1096 $output = `$cmd $trunk/t/pt-upgrade/samples/001/one-error.log`;
1097 like(
1098 $output,
1099- qr/# 3B323396273BC4C7-1 127.1:12347 Failed to execute query.+Unknown column 'borked' in 'field list' \[for Statement "select borked"\] at .+?\n\n/,
1100+ qr/# 3B323396273BC4C7-1 127.1:12348 Failed to execute query.+Unknown column 'borked' in 'field list' \[for Statement "select borked"\] at .+?\n\n/,
1101 '--clear-warnings',
1102 );
1103
1104@@ -79,7 +79,7 @@
1105 $output = `$cmd --no-clear-warnings $trunk/t/pt-upgrade/samples/001/one-error.log`;
1106 like(
1107 $output,
1108- qr/# 3B323396273BC4C7-1 127.1:12347 Failed to execute query.+Unknown column 'borked' in 'field list' \[for Statement "select borked"\] at .+?\n\n/,
1109+ qr/# 3B323396273BC4C7-1 127.1:12348 Failed to execute query.+Unknown column 'borked' in 'field list' \[for Statement "select borked"\] at .+?\n\n/,
1110 '--no-clear-warnings'
1111 );
1112

Subscribers

People subscribed via source and target branches