Merge lp:~percona-toolkit-dev/percona-toolkit/mysql-5.6-test-fixes into lp:percona-toolkit/2.2

Proposed by Daniel Nichter
Status: Merged
Merged at revision: 504
Proposed branch: lp:~percona-toolkit-dev/percona-toolkit/mysql-5.6-test-fixes
Merge into: lp:percona-toolkit/2.2
Diff against target: 3530 lines (+2141/-278)
53 files modified
bin/pt-deadlock-logger (+14/-6)
bin/pt-duplicate-key-checker (+36/-18)
bin/pt-fk-error-logger (+5/-1)
bin/pt-heartbeat (+130/-13)
bin/pt-index-usage (+36/-18)
bin/pt-log-player (+5/-0)
bin/pt-mysql-summary (+4/-2)
bin/pt-table-checksum (+13/-7)
bin/pt-table-sync (+36/-18)
bin/pt-table-usage (+5/-1)
bin/pt-upgrade (+43/-2)
bin/pt-visual-explain (+5/-1)
lib/Sandbox.pm (+22/-4)
lib/SchemaIterator.pm (+9/-3)
lib/Transformers.pm (+4/-0)
sandbox/jenkins-test (+9/-1)
sandbox/start-sandbox (+20/-1)
sandbox/test-env (+8/-3)
t/lib/ExplainAnalyzer.t (+3/-6)
t/lib/NibbleIterator.t (+2/-2)
t/lib/QueryReportFormatter.t (+9/-7)
t/lib/SchemaIterator.t (+2/-6)
t/lib/bash/collect_system_info.sh (+2/-2)
t/lib/samples/QueryReportFormatter/report031.txt (+12/-0)
t/lib/samples/QueryReportFormatter/report032.txt (+58/-0)
t/lib/samples/SchemaIterator/all-dbs-tbls-5.6.txt (+537/-0)
t/lib/samples/SchemaIterator/mysql-user-ddl-5.6.txt (+48/-0)
t/lib/samples/stored-objs.sql (+30/-0)
t/pt-archiver/standard_options.t (+91/-65)
t/pt-config-diff/samples/case1.cnf (+2/-0)
t/pt-config-diff/samples/case2.cnf (+2/-0)
t/pt-deadlock-logger/bugs.t (+54/-1)
t/pt-deadlock-logger/samples/bug_1082104.txt (+53/-0)
t/pt-find/pt-find.t (+77/-3)
t/pt-heartbeat/bugs.t (+115/-0)
t/pt-heartbeat/pxc.t (+388/-0)
t/pt-ioprofile/pt-ioprofile.t (+15/-18)
t/pt-kill/basics.t (+2/-2)
t/pt-kill/kill.t (+2/-2)
t/pt-mysql-summary/pt-mysql-summary.t (+9/-6)
t/pt-online-schema-change/samples/bug_1045317.sql (+1/-1)
t/pt-query-digest/explain.t (+4/-8)
t/pt-query-digest/samples/issue_1196-output-5.6.txt (+62/-0)
t/pt-table-checksum/basics.t (+9/-12)
t/pt-table-checksum/error_handling.t (+3/-3)
t/pt-table-checksum/issue_388.t (+1/-0)
t/pt-table-checksum/run_time.t (+1/-1)
t/pt-table-checksum/samples/default-results-5.6.txt (+41/-0)
t/pt-table-checksum/samples/repl-table-myisam.sql (+19/-0)
t/pt-table-checksum/samples/static-chunk-size-results-5.6.txt (+41/-0)
t/pt-table-checksum/skip_innodb.t (+29/-12)
t/pt-table-sync/basics.t (+1/-1)
t/pt-upgrade/warnings.t (+12/-21)
To merge this branch: bzr merge lp:~percona-toolkit-dev/percona-toolkit/mysql-5.6-test-fixes
Reviewer Review Type Date Requested Status
Daniel Nichter Approve
Brian Fraser Pending
Review via email: mp+139357@code.launchpad.net
To post a comment you must log in.
504. By Daniel Nichter

Add /usr/local/bin to PATH in jenkins-test.

505. By Brian Fraser

Added two missing config files fort/pt-config-diff/basics.t

506. By Brian Fraser

Merged pxc-pt-heartbeat

507. By Brian Fraser

Merged fix-886059-pt-heartbeat-timezones

508. By Brian Fraser

Merged fix-1082104-pt-deadlock-logger-username-dash

509. By Daniel Nichter

Set USER=jenkins if not set in util/jenkins-test.

510. By Daniel Nichter

Fix two possible sources of test errors.

511. By Daniel Nichter

Only run pt-ioprofile.t if the system has strace.

512. By Daniel Nichter

Add REFETCH_MYSQL to jenkins-test.

513. By Daniel Nichter

Fix REFETCH_MYSQL.

514. By Brian Fraser

Merged mysql-5.6-test-fixes and resolved conflicts

515. By Brian Fraser

pt-deadlock-logger: InnoDB timestamps have a different format in 5.6

516. By Brian Fraser

t/pt-heartbeat/bugs.t: Wait for test.heartbeat in slave1 before testing

517. By Brian Fraser

pt-deadlock-logger: use a character class instead of \p{Hex}

518. By Brian Fraser

pt-fk-error-logger: Deal with 5.6 InnoDB timestamps

519. By Brian Fraser

t/pt-find/pt-find.t: Update plan

520. By Daniel Nichter

Merge 2.1 r514, just a doc change.

521. By Daniel Nichter

Remove ndb_binlog_index from auto-skipped sys tables in SchemaIterator because it wasn't previously skipped in 5.1 and 5.5.

522. By Daniel Nichter

Update SchemaIterator.t sample files.

523. By Daniel Nichter

Make timing test more reasonable on fast systems.

Revision history for this message
Daniel Nichter (daniel-nichter) wrote :

Post-merge approval.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/pt-deadlock-logger'
2--- bin/pt-deadlock-logger 2012-12-03 03:48:11 +0000
3+++ bin/pt-deadlock-logger 2012-12-20 23:20:32 +0000
4@@ -3757,8 +3757,9 @@
5 my $t = qr/((?:\d+ \d+)|(?:[A-Fa-f0-9]+))/; # Transaction ID
6 my $i = qr/((?:\d{1,3}\.){3}\d+)/; # IP address
7 my $n = qr/([^`\s]+)/; # MySQL object name
8-my $w = qr/(\w+)/; # Words
9-my $s = qr/(\d{6} .\d:\d\d:\d\d)/; # InnoDB timestamp
10+my $u = qr/(\S+)/; # Username. This is somewhat wrong, but
11+ # usernames with spaces are rare enough.
12+my $s = qr/((?:\d{6}|\d{4}-\d\d-\d\d) .\d:\d\d:\d\d)(?: [A-Fa-f0-9]+)?/; # InnoDB timestamp
13
14 # A thread's proc_info can be at least 98 different things I've found in the
15 # source. Fortunately, most of them begin with a gerunded verb. These are
16@@ -4082,7 +4083,7 @@
17 # the most useful marker for where I have to start guessing.
18 ( $hostname, $ip ) = $thread_line =~ m/query id \d+(?: ([A-Za-z]\S+))? $i/m;
19 if ( defined $ip ) {
20- ($user, $query_status) = $thread_line =~ m/$ip $w(?: (.*))?$/;
21+ ($user, $query_status) = $thread_line =~ m/$ip $u(?: (.*))?$/;
22 }
23 else {
24 # OK, there wasn't an IP address.
25@@ -4094,7 +4095,7 @@
26 # query_status.
27 # It's basically impossible to know which is which.
28 ( $hostname, $user, $query_status ) = $thread_line
29- =~ m/query id \d+(?: ([A-Za-z]\S+))?(?: $w(?: (.*))?)?$/m;
30+ =~ m/query id \d+(?: ([A-Za-z]\S+))?(?: $u(?: (.*))?)?$/m;
31 }
32 else {
33 $user = 'system user';
34@@ -4139,8 +4140,11 @@
35
36 # Extract some miscellaneous data from the deadlock.
37 my ( $ts ) = $dl_text =~ m/^$s$/m;
38- my ( $year, $mon, $day, $hour, $min, $sec ) = $ts =~ m/^(\d\d)(\d\d)(\d\d) +(\d+):(\d+):(\d+)$/;
39- $ts = sprintf('%02d-%02d-%02dT%02d:%02d:%02d', $year + 2000, $mon, $day, $hour, $min, $sec);
40+ my ( $year, $mon, $day, $hour, $min, $sec ) = $ts =~ m/^((?:\d\d)?\d\d)-?(\d\d)-?(\d\d) +(\d+):(\d+):(\d+)$/;
41+ if ( length($year) == 2 ) {
42+ $year += 2000;
43+ }
44+ $ts = sprintf('%02d-%02d-%02dT%02d:%02d:%02d', $year, $mon, $day, $hour, $min, $sec);
45 my ( $victim ) = $dl_text =~ m/^\*\*\* WE ROLL BACK TRANSACTION \((\d+)\)$/m;
46 $victim ||= 0;
47
48@@ -4387,6 +4391,10 @@
49 both wait-for locks and get more information. If the two waited-for locks are
50 not on the same table, more than two transactions were involved in the deadlock.
51
52+Finally, keep in mind that, because usernames with spaces are not quoted by
53+InnoDB, the tool will generally misreport the second word of these usernames
54+as the hostname.
55+
56 =head1 OPTIONS
57
58 This tool accepts additional command-line arguments. Refer to the
59
60=== modified file 'bin/pt-duplicate-key-checker'
61--- bin/pt-duplicate-key-checker 2012-12-03 03:48:11 +0000
62+++ bin/pt-duplicate-key-checker 2012-12-20 23:20:32 +0000
63@@ -3026,11 +3026,16 @@
64
65 if ( !$self->{initialized} ) {
66 $self->{initialized} = 1;
67- if ( $self->{resume}->{tbl}
68- && !$self->table_is_allowed(@{$self->{resume}}{qw(db tbl)}) ) {
69- PTDEBUG && _d('Will resume after',
70- join('.', @{$self->{resume}}{qw(db tbl)}));
71- $self->{resume}->{after} = 1;
72+ if ( $self->{resume}->{tbl} ) {
73+ if ( !$self->table_is_allowed(@{$self->{resume}}{qw(db tbl)}) ) {
74+ PTDEBUG && _d('Will resume after',
75+ join('.', @{$self->{resume}}{qw(db tbl)}));
76+ $self->{resume}->{after}->{tbl} = 1;
77+ }
78+ if ( !$self->database_is_allowed($self->{resume}->{db}) ) {
79+ PTDEBUG && _d('Will resume after', $self->{resume}->{db});
80+ $self->{resume}->{after}->{db} = 1;
81+ }
82 }
83 }
84
85@@ -3128,16 +3133,17 @@
86 if ( !defined $self->{dbs} ) {
87 my $sql = 'SHOW DATABASES';
88 PTDEBUG && _d($sql);
89- my @dbs = grep { $self->database_is_allowed($_) }
90- @{$dbh->selectcol_arrayref($sql)};
91+ my @dbs = grep {
92+ $self->_resume_from_database($_)
93+ &&
94+ $self->database_is_allowed($_)
95+ } @{$dbh->selectcol_arrayref($sql)};
96 PTDEBUG && _d('Found', scalar @dbs, 'databases');
97 $self->{dbs} = \@dbs;
98 }
99
100 if ( !$self->{db} ) {
101- do {
102- $self->{db} = shift @{$self->{dbs}};
103- } until $self->_resume_from_database($self->{db});
104+ $self->{db} = shift @{$self->{dbs}};
105 PTDEBUG && _d('Next database:', $self->{db});
106 return unless $self->{db};
107 }
108@@ -3239,9 +3245,15 @@
109
110 my $filter = $self->{filters};
111
112- if ( $db eq 'mysql' && ($tbl eq 'general_log' || $tbl eq 'slow_log') ) {
113- return 0;
114- }
115+ return 0 if $db eq 'mysql' && $tbl =~ m/^(?:
116+ general_log
117+ |slow_log
118+ |innodb_index_stats
119+ |innodb_table_stats
120+ |slave_master_info
121+ |slave_relay_log_info
122+ |slave_worker_info
123+ )$/x;
124
125 if ( $filter->{'ignore-tables'}->{$tbl}
126 && ($filter->{'ignore-tables'}->{$tbl} eq '*'
127@@ -3310,11 +3322,17 @@
128 my ($self, $db) = @_;
129
130 return 1 unless $self->{resume}->{db};
131-
132 if ( $db eq $self->{resume}->{db} ) {
133- PTDEBUG && _d('At resume db', $db);
134- delete $self->{resume}->{db};
135- return 1;
136+ if ( !$self->{resume}->{after}->{db} ) {
137+ PTDEBUG && _d('Resuming from db', $db);
138+ delete $self->{resume}->{db};
139+ return 1;
140+ }
141+ else {
142+ PTDEBUG && _d('Resuming after db', $db);
143+ delete $self->{resume}->{db};
144+ delete $self->{resume}->{tbl};
145+ }
146 }
147
148 return 0;
149@@ -3326,7 +3344,7 @@
150 return 1 unless $self->{resume}->{tbl};
151
152 if ( $tbl eq $self->{resume}->{tbl} ) {
153- if ( !$self->{resume}->{after} ) {
154+ if ( !$self->{resume}->{after}->{tbl} ) {
155 PTDEBUG && _d('Resuming from table', $tbl);
156 delete $self->{resume}->{tbl};
157 return 1;
158
159=== modified file 'bin/pt-fk-error-logger'
160--- bin/pt-fk-error-logger 2012-12-03 03:48:11 +0000
161+++ bin/pt-fk-error-logger 2012-12-20 23:20:32 +0000
162@@ -1942,6 +1942,9 @@
163 . (defined $f ? '%09.6f' : '%02d'),
164 $y + 2000, $m, $d, $h, $i, (defined $f ? $s + $f : $s);
165 }
166+ elsif ( $val =~ m/^$proper_ts$/ ) {
167+ return $val;
168+ }
169 return $val;
170 }
171
172@@ -3609,7 +3612,8 @@
173 # Quick check if text even has a foreign key error.
174 return unless $text =~ m/LATEST FOREIGN KEY ERROR/;
175
176- my $idb_ts = qr/(\d{6} .\d:\d\d:\d\d)/; # InnoDB timestamp
177+ # InnoDB timestamp
178+ my $idb_ts = qr/((?:\d{6}|\d{4}-\d\d-\d\d) .\d:\d\d:\d\d)/;
179
180 my ($ts, $fke) = $text =~ m/LATEST FOREIGN KEY ERROR.+?$idb_ts\s*(.+?)---/ms;
181 chomp $fke if $fke;
182
183=== modified file 'bin/pt-heartbeat'
184--- bin/pt-heartbeat 2012-12-03 03:48:11 +0000
185+++ bin/pt-heartbeat 2012-12-20 23:20:32 +0000
186@@ -20,6 +20,7 @@
187 Daemon
188 Quoter
189 TableParser
190+ Retry
191 Transformers
192 VersionCheck
193 HTTPMicro
194@@ -2921,6 +2922,84 @@
195 # ###########################################################################
196
197 # ###########################################################################
198+# Retry package
199+# This package is a copy without comments from the original. The original
200+# with comments and its test file can be found in the Bazaar repository at,
201+# lib/Retry.pm
202+# t/lib/Retry.t
203+# See https://launchpad.net/percona-toolkit for more information.
204+# ###########################################################################
205+{
206+package Retry;
207+
208+use strict;
209+use warnings FATAL => 'all';
210+use English qw(-no_match_vars);
211+use constant PTDEBUG => $ENV{PTDEBUG} || 0;
212+
213+sub new {
214+ my ( $class, %args ) = @_;
215+ my $self = {
216+ %args,
217+ };
218+ return bless $self, $class;
219+}
220+
221+sub retry {
222+ my ( $self, %args ) = @_;
223+ my @required_args = qw(try fail final_fail);
224+ foreach my $arg ( @required_args ) {
225+ die "I need a $arg argument" unless $args{$arg};
226+ };
227+ my ($try, $fail, $final_fail) = @args{@required_args};
228+ my $wait = $args{wait} || sub { sleep 1; };
229+ my $tries = $args{tries} || 3;
230+
231+ my $last_error;
232+ my $tryno = 0;
233+ TRY:
234+ while ( ++$tryno <= $tries ) {
235+ PTDEBUG && _d("Try", $tryno, "of", $tries);
236+ my $result;
237+ eval {
238+ $result = $try->(tryno=>$tryno);
239+ };
240+ if ( $EVAL_ERROR ) {
241+ PTDEBUG && _d("Try code failed:", $EVAL_ERROR);
242+ $last_error = $EVAL_ERROR;
243+
244+ if ( $tryno < $tries ) { # more retries
245+ my $retry = $fail->(tryno=>$tryno, error=>$last_error);
246+ last TRY unless $retry;
247+ PTDEBUG && _d("Calling wait code");
248+ $wait->(tryno=>$tryno);
249+ }
250+ }
251+ else {
252+ PTDEBUG && _d("Try code succeeded");
253+ return $result;
254+ }
255+ }
256+
257+ PTDEBUG && _d('Try code did not succeed');
258+ return $final_fail->(error=>$last_error);
259+}
260+
261+sub _d {
262+ my ($package, undef, $line) = caller 0;
263+ @_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }
264+ map { defined $_ ? $_ : 'undef' }
265+ @_;
266+ print STDERR "# $package:$line $PID ", join(' ', @_), "\n";
267+}
268+
269+1;
270+}
271+# ###########################################################################
272+# End Retry package
273+# ###########################################################################
274+
275+# ###########################################################################
276 # Transformers package
277 # This package is a copy without comments from the original. The original
278 # with comments and its test file can be found in the Bazaar repository at,
279@@ -4734,7 +4813,7 @@
280 $dbh->do($sql);
281
282 $sql = ($o->get('replace') ? "REPLACE" : "INSERT")
283- . qq/ INTO $db_tbl (ts, server_id) VALUES (NOW(), $server_id)/;
284+ . qq/ INTO $db_tbl (ts, server_id) VALUES (UTC_TIMESTAMP(), $server_id)/;
285 PTDEBUG && _d($sql);
286 # This may fail if the table already existed and already had this row.
287 # We eval to ignore this possibility.
288@@ -4831,7 +4910,7 @@
289 PTDEBUG && _d('No heartbeat row in table');
290 if ( $o->get('insert-heartbeat-row') ) {
291 my $sql = "INSERT INTO $db_tbl ($pk_col, ts) "
292- . "VALUES ('$pk_val', NOW())";
293+ . "VALUES ('$pk_val', UTC_TIMESTAMP())";
294 PTDEBUG && _d($sql);
295 $dbh->do($sql);
296 }
297@@ -4920,18 +4999,44 @@
298 }
299 }
300
301- $sth->execute(ts(time), @vals);
302- PTDEBUG && _d($sth->{Statement});
303- $sth->finish();
304-
305+ my $retry = Retry->new();
306+ $retry->retry(
307+ tries => 3,
308+ wait => sub { sleep 0.25; return; },
309+ try => sub {
310+ my ($now) = $dbh->selectrow_array(q{SELECT UTC_TIMESTAMP()});
311+ $sth->execute($now, @vals);
312+ PTDEBUG && _d($sth->{Statement});
313+ $sth->finish();
314+ },
315+ fail => sub {
316+ my (%args) = @_;
317+ my $error = $args{error};
318+ if ( $error =~ m/Deadlock found/ ) {
319+ return 1; # try again
320+ }
321+ else {
322+ return 0;
323+ }
324+ },
325+ final_fail => sub {
326+ my (%args) = @_;
327+ die $args{error};
328+ }
329+ );
330+
331 return;
332 };
333 }
334 else { # --monitor or --check
335 my $dbi_driver = lc $o->get('dbi-driver');
336
337+ # UNIX_TIMESTAMP(UTC_TIMESTAMP()) instead of UNIX_TIMESTAMP() alone,
338+ # so we make sure that we aren't being fooled by a timezone.
339+ # UNIX_TIMESTAMP(ts) replaces unix_timestamp($ts) -- MySQL is the
340+ # authority here, so let it calculate everything.
341 $heartbeat_sql
342- = "SELECT ts"
343+ = "SELECT UNIX_TIMESTAMP(UTC_TIMESTAMP()), UNIX_TIMESTAMP(ts)"
344 . ($dbi_driver eq 'mysql' ? '/*!50038, @@hostname AS host*/' : '')
345 . ($id ? "" : ", server_id")
346 . " FROM $db_tbl "
347@@ -4945,13 +5050,12 @@
348 my ($sth) = @_;
349 $sth->execute();
350 PTDEBUG && _d($sth->{Statement});
351- my ($ts, $hostname, $server_id) = $sth->fetchrow_array();
352- my $now = time;
353+ my ($now, $ts, $hostname, $server_id) = $sth->fetchrow_array();
354 PTDEBUG && _d("Heartbeat from server", $server_id, "\n",
355- " now:", ts($now), "\n",
356+ " now:", $now, "\n",
357 " ts:", $ts, "\n",
358 "skew:", $skew);
359- my $delay = $now - unix_timestamp($ts) - $skew;
360+ my $delay = $now - $ts - $skew;
361 PTDEBUG && _d('Delay', sprintf('%.6f', $delay), 'on', $hostname);
362
363 # Because we adjust for skew, if the ts are less than skew seconds
364@@ -5387,6 +5491,19 @@
365 columns are optional. If any are present, their corresponding information
366 will be saved.
367
368+=head1 Percona XtraDB Cluster
369+
370+Although pt-heartbeat should work with all supported versions of Percona XtraDB
371+Cluster (PXC), we recommend using 5.5.28-23.7 and newer.
372+
373+If you are setting up heartbeat instances between cluster nodes, keep in mind
374+that, since the speed of the cluster is determined by its slowest node,
375+pt-heartbeat will not report how fast the cluster itself is, but only how
376+fast events are replicating from one node to another.
377+
378+You must specify L<"--master-server-id"> for L<"--monitor"> and L<"--check">
379+instances.
380+
381 =head1 OPTIONS
382
383 Specify at least one of L<"--stop">, L<"--update">, L<"--monitor">, or L<"--check">.
384@@ -5446,7 +5563,7 @@
385 The heartbeat table requires at least one row. If you manually create the
386 heartbeat table, then you must insert a row by doing:
387
388- INSERT INTO heartbeat (ts, server_id) VALUES (NOW(), N);
389+ INSERT INTO heartbeat (ts, server_id) VALUES (UTC_TIMESTAMP(), N);
390
391 where C<N> is the server's ID; do not use @@server_id because it will replicate
392 and slaves will insert their own server ID instead of the master's server ID.
393@@ -5464,7 +5581,7 @@
394 of a multi-slave hierarchy like "master -> slave1 -> slave2".
395 To manually insert the one required row into a legacy table:
396
397- INSERT INTO heartbeat (id, ts) VALUES (1, NOW());
398+ INSERT INTO heartbeat (id, ts) VALUES (1, UTC_TIMESTAMP());
399
400 The tool automatically detects if the heartbeat table is legacy.
401
402
403=== modified file 'bin/pt-index-usage'
404--- bin/pt-index-usage 2012-12-03 03:48:11 +0000
405+++ bin/pt-index-usage 2012-12-20 23:20:32 +0000
406@@ -3844,11 +3844,16 @@
407
408 if ( !$self->{initialized} ) {
409 $self->{initialized} = 1;
410- if ( $self->{resume}->{tbl}
411- && !$self->table_is_allowed(@{$self->{resume}}{qw(db tbl)}) ) {
412- PTDEBUG && _d('Will resume after',
413- join('.', @{$self->{resume}}{qw(db tbl)}));
414- $self->{resume}->{after} = 1;
415+ if ( $self->{resume}->{tbl} ) {
416+ if ( !$self->table_is_allowed(@{$self->{resume}}{qw(db tbl)}) ) {
417+ PTDEBUG && _d('Will resume after',
418+ join('.', @{$self->{resume}}{qw(db tbl)}));
419+ $self->{resume}->{after}->{tbl} = 1;
420+ }
421+ if ( !$self->database_is_allowed($self->{resume}->{db}) ) {
422+ PTDEBUG && _d('Will resume after', $self->{resume}->{db});
423+ $self->{resume}->{after}->{db} = 1;
424+ }
425 }
426 }
427
428@@ -3946,16 +3951,17 @@
429 if ( !defined $self->{dbs} ) {
430 my $sql = 'SHOW DATABASES';
431 PTDEBUG && _d($sql);
432- my @dbs = grep { $self->database_is_allowed($_) }
433- @{$dbh->selectcol_arrayref($sql)};
434+ my @dbs = grep {
435+ $self->_resume_from_database($_)
436+ &&
437+ $self->database_is_allowed($_)
438+ } @{$dbh->selectcol_arrayref($sql)};
439 PTDEBUG && _d('Found', scalar @dbs, 'databases');
440 $self->{dbs} = \@dbs;
441 }
442
443 if ( !$self->{db} ) {
444- do {
445- $self->{db} = shift @{$self->{dbs}};
446- } until $self->_resume_from_database($self->{db});
447+ $self->{db} = shift @{$self->{dbs}};
448 PTDEBUG && _d('Next database:', $self->{db});
449 return unless $self->{db};
450 }
451@@ -4057,9 +4063,15 @@
452
453 my $filter = $self->{filters};
454
455- if ( $db eq 'mysql' && ($tbl eq 'general_log' || $tbl eq 'slow_log') ) {
456- return 0;
457- }
458+ return 0 if $db eq 'mysql' && $tbl =~ m/^(?:
459+ general_log
460+ |slow_log
461+ |innodb_index_stats
462+ |innodb_table_stats
463+ |slave_master_info
464+ |slave_relay_log_info
465+ |slave_worker_info
466+ )$/x;
467
468 if ( $filter->{'ignore-tables'}->{$tbl}
469 && ($filter->{'ignore-tables'}->{$tbl} eq '*'
470@@ -4128,11 +4140,17 @@
471 my ($self, $db) = @_;
472
473 return 1 unless $self->{resume}->{db};
474-
475 if ( $db eq $self->{resume}->{db} ) {
476- PTDEBUG && _d('At resume db', $db);
477- delete $self->{resume}->{db};
478- return 1;
479+ if ( !$self->{resume}->{after}->{db} ) {
480+ PTDEBUG && _d('Resuming from db', $db);
481+ delete $self->{resume}->{db};
482+ return 1;
483+ }
484+ else {
485+ PTDEBUG && _d('Resuming after db', $db);
486+ delete $self->{resume}->{db};
487+ delete $self->{resume}->{tbl};
488+ }
489 }
490
491 return 0;
492@@ -4144,7 +4162,7 @@
493 return 1 unless $self->{resume}->{tbl};
494
495 if ( $tbl eq $self->{resume}->{tbl} ) {
496- if ( !$self->{resume}->{after} ) {
497+ if ( !$self->{resume}->{after}->{tbl} ) {
498 PTDEBUG && _d('Resuming from table', $tbl);
499 delete $self->{resume}->{tbl};
500 return 1;
501
502=== modified file 'bin/pt-log-player'
503--- bin/pt-log-player 2012-12-03 03:48:11 +0000
504+++ bin/pt-log-player 2012-12-20 23:20:32 +0000
505@@ -3100,6 +3100,11 @@
506 At the time of this release there is a bug which causes pt-log-player to
507 exceed max open files during L<"--split">.
508
509+As of version 2.1.8, this tool no longer works with auto values on zero
510+because it sets a SQL mode with C<NO_AUTO_VALUE_ON_ZERO>. Therefore,
511+playing INSERT or UPDATE statements that use zero instead of C<NULL>
512+will not work.
513+
514 The authoritative source for updated information is always the online issue
515 tracking system. Issues that affect this tool will be marked as such. You can
516 see a list of such issues at the following URL:
517
518=== modified file 'bin/pt-mysql-summary'
519--- bin/pt-mysql-summary 2012-12-06 00:10:22 +0000
520+++ bin/pt-mysql-summary 2012-12-20 23:20:32 +0000
521@@ -2332,8 +2332,10 @@
522
523 TOOL="pt-mysql-summary"
524
525-CMD_MYSQL="$(_which mysql)"
526-CMD_MYSQLDUMP="$( _which mysqldump )"
527+# These vars are declared earlier in the collect_mysql_info package,
528+# but if they're still undefined here, try to find them in PATH.
529+[ "$CMD_MYSQL" ] || CMD_MYSQL="$(_which mysql)"
530+[ "$CMD_MYSQLDUMP" ] || CMD_MYSQLDUMP="$( _which mysqldump )"
531
532 check_mysql () {
533 # Check that mysql and mysqldump are in PATH. If not, we're
534
535=== modified file 'bin/pt-table-checksum'
536--- bin/pt-table-checksum 2012-12-11 14:48:44 +0000
537+++ bin/pt-table-checksum 2012-12-20 23:20:32 +0000
538@@ -6986,9 +6986,15 @@
539
540 my $filter = $self->{filters};
541
542- if ( $db eq 'mysql' && ($tbl eq 'general_log' || $tbl eq 'slow_log') ) {
543- return 0;
544- }
545+ return 0 if $db eq 'mysql' && $tbl =~ m/^(?:
546+ general_log
547+ |slow_log
548+ |innodb_index_stats
549+ |innodb_table_stats
550+ |slave_master_info
551+ |slave_relay_log_info
552+ |slave_worker_info
553+ )$/x;
554
555 if ( $filter->{'ignore-tables'}->{$tbl}
556 && ($filter->{'ignore-tables'}->{$tbl} eq '*'
557@@ -10123,9 +10129,9 @@
558 }
559 }
560 else {
561+ warn $EVAL_ERROR;
562 die "--replicate database $db does not exist and it cannot be "
563- . "created automatically. You need to create the database. "
564- . $EVAL_ERROR;
565+ . "created automatically. You need to create the database.\n";
566 }
567 }
568 }
569@@ -10193,9 +10199,9 @@
570 }
571 }
572 else {
573+ warn $EVAL_ERROR;
574 die "--replicate table $tbl does not exist and it cannot be "
575- . "created automatically. You need to create the table. "
576- . $EVAL_ERROR;
577+ . "created automatically. You need to create the table.\n"
578 }
579 }
580 }
581
582=== modified file 'bin/pt-table-sync'
583--- bin/pt-table-sync 2012-12-03 03:48:11 +0000
584+++ bin/pt-table-sync 2012-12-20 23:20:32 +0000
585@@ -7521,11 +7521,16 @@
586
587 if ( !$self->{initialized} ) {
588 $self->{initialized} = 1;
589- if ( $self->{resume}->{tbl}
590- && !$self->table_is_allowed(@{$self->{resume}}{qw(db tbl)}) ) {
591- PTDEBUG && _d('Will resume after',
592- join('.', @{$self->{resume}}{qw(db tbl)}));
593- $self->{resume}->{after} = 1;
594+ if ( $self->{resume}->{tbl} ) {
595+ if ( !$self->table_is_allowed(@{$self->{resume}}{qw(db tbl)}) ) {
596+ PTDEBUG && _d('Will resume after',
597+ join('.', @{$self->{resume}}{qw(db tbl)}));
598+ $self->{resume}->{after}->{tbl} = 1;
599+ }
600+ if ( !$self->database_is_allowed($self->{resume}->{db}) ) {
601+ PTDEBUG && _d('Will resume after', $self->{resume}->{db});
602+ $self->{resume}->{after}->{db} = 1;
603+ }
604 }
605 }
606
607@@ -7623,16 +7628,17 @@
608 if ( !defined $self->{dbs} ) {
609 my $sql = 'SHOW DATABASES';
610 PTDEBUG && _d($sql);
611- my @dbs = grep { $self->database_is_allowed($_) }
612- @{$dbh->selectcol_arrayref($sql)};
613+ my @dbs = grep {
614+ $self->_resume_from_database($_)
615+ &&
616+ $self->database_is_allowed($_)
617+ } @{$dbh->selectcol_arrayref($sql)};
618 PTDEBUG && _d('Found', scalar @dbs, 'databases');
619 $self->{dbs} = \@dbs;
620 }
621
622 if ( !$self->{db} ) {
623- do {
624- $self->{db} = shift @{$self->{dbs}};
625- } until $self->_resume_from_database($self->{db});
626+ $self->{db} = shift @{$self->{dbs}};
627 PTDEBUG && _d('Next database:', $self->{db});
628 return unless $self->{db};
629 }
630@@ -7734,9 +7740,15 @@
631
632 my $filter = $self->{filters};
633
634- if ( $db eq 'mysql' && ($tbl eq 'general_log' || $tbl eq 'slow_log') ) {
635- return 0;
636- }
637+ return 0 if $db eq 'mysql' && $tbl =~ m/^(?:
638+ general_log
639+ |slow_log
640+ |innodb_index_stats
641+ |innodb_table_stats
642+ |slave_master_info
643+ |slave_relay_log_info
644+ |slave_worker_info
645+ )$/x;
646
647 if ( $filter->{'ignore-tables'}->{$tbl}
648 && ($filter->{'ignore-tables'}->{$tbl} eq '*'
649@@ -7805,11 +7817,17 @@
650 my ($self, $db) = @_;
651
652 return 1 unless $self->{resume}->{db};
653-
654 if ( $db eq $self->{resume}->{db} ) {
655- PTDEBUG && _d('At resume db', $db);
656- delete $self->{resume}->{db};
657- return 1;
658+ if ( !$self->{resume}->{after}->{db} ) {
659+ PTDEBUG && _d('Resuming from db', $db);
660+ delete $self->{resume}->{db};
661+ return 1;
662+ }
663+ else {
664+ PTDEBUG && _d('Resuming after db', $db);
665+ delete $self->{resume}->{db};
666+ delete $self->{resume}->{tbl};
667+ }
668 }
669
670 return 0;
671@@ -7821,7 +7839,7 @@
672 return 1 unless $self->{resume}->{tbl};
673
674 if ( $tbl eq $self->{resume}->{tbl} ) {
675- if ( !$self->{resume}->{after} ) {
676+ if ( !$self->{resume}->{after}->{tbl} ) {
677 PTDEBUG && _d('Resuming from table', $tbl);
678 delete $self->{resume}->{tbl};
679 return 1;
680
681=== modified file 'bin/pt-table-usage'
682--- bin/pt-table-usage 2012-11-19 18:47:13 +0000
683+++ bin/pt-table-usage 2012-12-20 23:20:32 +0000
684@@ -212,7 +212,8 @@
685 . join(';', map { "$opts{$_}->{dsn}=$info->{$_}" }
686 grep { defined $info->{$_} }
687 qw(F h P S A))
688- . ';mysql_read_default_group=client';
689+ . ';mysql_read_default_group=client'
690+ . ($info->{L} ? ';mysql_local_infile=1' : '');
691 }
692 PTDEBUG && _d($dsn);
693 return ($dsn, $info->{u}, $info->{p});
694@@ -241,6 +242,9 @@
695 mysql_enable_utf8 => ($cxn_string =~ m/charset=utf8/i ? 1 : 0),
696 };
697 @{$defaults}{ keys %$opts } = values %$opts;
698+ if (delete $defaults->{L}) { # L for LOAD DATA LOCAL INFILE, our own extension
699+ $defaults->{mysql_local_infile} = 1;
700+ }
701
702 if ( $opts->{mysql_use_result} ) {
703 $defaults->{mysql_use_result} = 1;
704
705=== modified file 'bin/pt-upgrade'
706--- bin/pt-upgrade 2012-12-03 03:48:11 +0000
707+++ bin/pt-upgrade 2012-12-20 23:20:32 +0000
708@@ -11980,7 +11980,8 @@
709 # ########################################################################
710 # Do the version-check
711 # ########################################################################
712- if ( $o->get('version-check') ne 'off' && (!$o->has('quiet') || !$o->get('quiet')) ) {
713+ if ( $o->get('version-check') ne 'off'
714+ && (!$o->has('quiet') || !$o->get('quiet')) ) {
715 Pingback::version_check(
716 instances => [ map({ +{ dbh => $_->{dbh}, dsn => $_->{dsn} } } @$hosts) ],
717 protocol => $o->get('version-check'),
718@@ -11988,6 +11989,15 @@
719 }
720
721 # ########################################################################
722+ # Disable the query cache.
723+ # ########################################################################
724+ if ( $o->get('disable-query-cache') ) {
725+ foreach my $host ( @$hosts ) {
726+ disable_query_cache($host);
727+ }
728+ }
729+
730+ # ########################################################################
731 # Short version: do it! Long version: this callback does the main work.
732 # The big picture is:
733 # [event] -> exec on hosts -> compare -> aggregate -> [meta-event]
734@@ -12385,6 +12395,31 @@
735 return $dbh;
736 }
737
738+sub disable_query_cache {
739+ my ($host) = @_;
740+ die "I need a host argument" unless $host;
741+ my ($dbh, $host_name) = @{$host}{qw(dbh name)};
742+
743+ my $sql = 'SELECT @@query_cache_type';
744+ PTDEBUG && _d($host_name, $sql);
745+ my ($query_cache_type) = $dbh->selectrow_array($sql);
746+ PTDEBUG && _d($host_name, $query_cache_type);
747+ return if ($query_cache_type || '') =~ m/OFF|0/;
748+
749+ $sql = q/SET SESSION query_cache_type = OFF/;
750+ eval {
751+ PTDEBUG && _d($host_name, $sql);
752+ $dbh->do($sql);
753+ };
754+ if ( $EVAL_ERROR ) {
755+ warn $EVAL_ERROR;
756+ die "Failed to $sql on $host_name. Disable the query cache "
757+ . "manually, or specify --no-disable-query-cache.\n";
758+ }
759+
760+ return;
761+}
762+
763 # Catches signals so we can exit gracefully.
764 sub sig_int {
765 my ( $signal ) = @_;
766@@ -12693,6 +12728,12 @@
767 Fork to the background and detach from the shell. POSIX
768 operating systems only.
769
770+=item --[no]disable-query-cache
771+
772+default: yes
773+
774+C<SET SESSION query_cache_type = OFF> to disable the query cache.
775+
776 =item --explain-hosts
777
778 Print connection information and exit.
779@@ -12861,7 +12902,7 @@
780
781 =item --set-vars
782
783-type: string; default: wait_timeout=10000,query_cache_type=0
784+type: string; default: wait_timeout=10000
785
786 Set these MySQL variables. Immediately after connecting to MySQL, this
787 string will be appended to SET and executed.
788
789=== modified file 'bin/pt-visual-explain'
790--- bin/pt-visual-explain 2012-11-19 18:47:13 +0000
791+++ bin/pt-visual-explain 2012-12-20 23:20:32 +0000
792@@ -1900,7 +1900,8 @@
793 . join(';', map { "$opts{$_}->{dsn}=$info->{$_}" }
794 grep { defined $info->{$_} }
795 qw(F h P S A))
796- . ';mysql_read_default_group=client';
797+ . ';mysql_read_default_group=client'
798+ . ($info->{L} ? ';mysql_local_infile=1' : '');
799 }
800 PTDEBUG && _d($dsn);
801 return ($dsn, $info->{u}, $info->{p});
802@@ -1929,6 +1930,9 @@
803 mysql_enable_utf8 => ($cxn_string =~ m/charset=utf8/i ? 1 : 0),
804 };
805 @{$defaults}{ keys %$opts } = values %$opts;
806+ if (delete $defaults->{L}) { # L for LOAD DATA LOCAL INFILE, our own extension
807+ $defaults->{mysql_local_infile} = 1;
808+ }
809
810 if ( $opts->{mysql_use_result} ) {
811 $defaults->{mysql_use_result} = 1;
812
813=== modified file 'lib/Sandbox.pm'
814--- lib/Sandbox.pm 2012-11-30 18:13:04 +0000
815+++ lib/Sandbox.pm 2012-12-20 23:20:32 +0000
816@@ -126,12 +126,13 @@
817 }
818
819 sub get_dbh_for {
820- my ( $self, $server, $cxn_ops ) = @_;
821+ my ( $self, $server, $cxn_ops, $user ) = @_;
822 _check_server($server);
823 $cxn_ops ||= { AutoCommit => 1 };
824+ $user ||= 'msandbox';
825 PTDEBUG && _d('dbh for', $server, 'on port', $port_for{$server});
826 my $dp = $self->{DSNParser};
827- my $dsn = $dp->parse('h=127.0.0.1,u=msandbox,p=msandbox,P=' . $port_for{$server});
828+ my $dsn = $dp->parse("h=127.0.0.1,u=$user,p=msandbox,P=" . $port_for{$server});
829 my $dbh;
830 # This is primarily for the benefit of CompareResults, but it's
831 # also quite convenient when using an affected OS
832@@ -335,11 +336,11 @@
833 my $master_dbh = $self->get_dbh_for($args{master} || 'master');
834 my $slave2_dbh = $self->get_dbh_for($args{slave} || 'slave2');
835 my ($ping) = $master_dbh->selectrow_array("SELECT MD5(RAND())");
836- $master_dbh->do("UPDATE percona_test.sentinel SET ping='$ping' WHERE id=1");
837+ $master_dbh->do("UPDATE percona_test.sentinel SET ping='$ping' WHERE id=1 /* wait_for_slaves */");
838 PerconaTest::wait_until(
839 sub {
840 my ($pong) = $slave2_dbh->selectrow_array(
841- "SELECT ping FROM percona_test.sentinel WHERE id=1");
842+ "SELECT ping FROM percona_test.sentinel WHERE id=1 /* wait_for_slaves */");
843 return $ping eq $pong;
844 }, undef, 300
845 );
846@@ -542,6 +543,23 @@
847 return "/tmp/$port/my.sandbox.cnf"
848 }
849
850+sub do_as_root {
851+ my ($self, $server, @queries) = @_;
852+ my $dbh = $self->get_dbh_for($server, undef, 'root');
853+ my $ok = 1;
854+ eval {
855+ foreach my $query ( @queries ) {
856+ $dbh->do($query);
857+ }
858+ };
859+ if ( $EVAL_ERROR ) {
860+ $ok = 0;
861+ warn $EVAL_ERROR;
862+ }
863+ $dbh->disconnect;
864+ return $ok;
865+}
866+
867 sub _d {
868 my ($package, undef, $line) = caller 0;
869 @_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }
870
871=== modified file 'lib/SchemaIterator.pm'
872--- lib/SchemaIterator.pm 2012-12-05 23:30:29 +0000
873+++ lib/SchemaIterator.pm 2012-12-20 23:20:32 +0000
874@@ -444,9 +444,15 @@
875 my $filter = $self->{filters};
876
877 # Always auto-skip these pseudo tables.
878- if ( $db eq 'mysql' && ($tbl eq 'general_log' || $tbl eq 'slow_log') ) {
879- return 0;
880- }
881+ return 0 if $db eq 'mysql' && $tbl =~ m/^(?:
882+ general_log
883+ |slow_log
884+ |innodb_index_stats
885+ |innodb_table_stats
886+ |slave_master_info
887+ |slave_relay_log_info
888+ |slave_worker_info
889+ )$/x;
890
891 if ( $filter->{'ignore-tables'}->{$tbl}
892 && ($filter->{'ignore-tables'}->{$tbl} eq '*'
893
894=== modified file 'lib/Transformers.pm'
895--- lib/Transformers.pm 2012-02-07 14:07:41 +0000
896+++ lib/Transformers.pm 2012-12-20 23:20:32 +0000
897@@ -193,6 +193,10 @@
898 . (defined $f ? '%09.6f' : '%02d'),
899 $y + 2000, $m, $d, $h, $i, (defined $f ? $s + $f : $s);
900 }
901+ # MySQL 5.6+ uses "proper" timestamps
902+ elsif ( $val =~ m/^$proper_ts$/ ) {
903+ return $val;
904+ }
905 return $val;
906 }
907
908
909=== modified file 'sandbox/jenkins-test'
910--- sandbox/jenkins-test 2012-12-07 21:55:52 +0000
911+++ sandbox/jenkins-test 2012-12-20 23:20:32 +0000
912@@ -46,6 +46,13 @@
913 }
914
915 MYSQL_BASE_DIR="$(find_mysql_base_dir $MYSQL)"
916+
917+REFETCH_MYSQL="${REFETCH_MYSQL:-""}"
918+if [ "$MYSQL_BASE_DIR" -a "$REFETCH_MYSQL" ]; then
919+ rm -rf "$MYSQL_BASE_DIR"
920+ MYSQL_BASE_DIR=""
921+fi
922+
923 if [ -z "$MYSQL_BASE_DIR" ]; then
924 (
925 cd $MYSQL_BIN_DIR
926@@ -66,8 +73,9 @@
927 ##########################
928 export PERCONA_TOOLKIT_BRANCH="$PWD"
929 export PERCONA_TOOLKIT_SANDBOX="$MYSQL_BASE_DIR"
930-export PATH="$PATH:/usr/sbin:$MYSQL_BASE_DIR/bin"
931+export PATH="$PATH:/usr/sbin:/usr/local/bin:$MYSQL_BASE_DIR/bin"
932 export LANG="en_US.UTF-8"
933+export USER="${USER:-"jenkins"}"
934
935 # ######################################### #
936 # Remove conf files that's shouldn't exist. #
937
938=== modified file 'sandbox/servers/5.6/data.tar.gz'
939Binary files sandbox/servers/5.6/data.tar.gz 2012-10-16 15:13:19 +0000 and sandbox/servers/5.6/data.tar.gz 2012-12-20 23:20:32 +0000 differ
940=== modified file 'sandbox/start-sandbox'
941--- sandbox/start-sandbox 2012-11-16 19:08:49 +0000
942+++ sandbox/start-sandbox 2012-12-20 23:20:32 +0000
943@@ -34,7 +34,7 @@
944 cp $PERCONA_TOOLKIT_BRANCH/sandbox/servers/$version/my.sandbox.cnf /tmp/$port
945 tar xzf $PERCONA_TOOLKIT_BRANCH/sandbox/servers/$version/data.tar.gz -C /tmp/$port
946
947- for script in `ls $PERCONA_TOOLKIT_BRANCH/sandbox/servers/*`; do
948+ for script in "$PERCONA_TOOLKIT_BRANCH/sandbox/servers/"*; do
949 if [ -f $script ]; then
950 cp $script /tmp/$port
951 fi
952@@ -52,6 +52,10 @@
953 if [ -n "${master_port}" ]; then
954 local master_listen_port=$(($master_port + 10))
955 cluster_address="gcomm://$ip:$master_listen_port"
956+
957+ local this_listen_port=$(($port + 10))
958+ local this_cluster_address="gcomm://$ip:$this_listen_port"
959+ sed -e "s!gcomm://\$!$this_cluster_address!g" -i.bak "/tmp/$master_port/my.sandbox.cnf"
960 fi
961
962 sed -e "s/ADDR/$ip/g" -i.bak "/tmp/$port/my.sandbox.cnf"
963@@ -85,6 +89,9 @@
964 if [ -n "$SKIP_INNODB" ]; then
965 echo "skip-innodb" >> /tmp/$port/my.sandbox.cnf
966 echo "default-storage-engine=myisam" >> /tmp/$port/my.sandbox.cnf
967+ if [ "$version" ">" "5.5" ]; then
968+ echo "default-tmp-storage-engine=myisam" >> /tmp/$port/my.sandbox.cnf
969+ fi
970 fi
971 if [ -n "$MODE_ANSI" ]; then
972 echo "sql_mode=ansi" >> /tmp/$port/my.sandbox.cnf
973@@ -95,6 +102,10 @@
974 if [ -n "$LOCAL_INFILE" ]; then
975 echo "local-infile=$LOCAL_INFILE" >> /tmp/$port/my.sandbox.cnf
976 fi
977+ if [ -n "$QUERY_CACHE_SIZE" ]; then
978+ echo "query_cache_type=1" >> /tmp/$port/my.sandbox.cnf
979+ echo "query_cache_size=$QUERY_CACHE_SIZE" >> /tmp/$port/my.sandbox.cnf
980+ fi
981
982 # If the sandbox is a slave, set it read_only.
983 if [ "$type" = "slave" ]; then
984@@ -112,6 +123,10 @@
985 debug_sandbox $port
986 exit 1
987 fi
988+
989+ for sql in "$PERCONA_TOOLKIT_BRANCH/sandbox/servers/$version/"*.sql; do
990+ [ -f "$sql" ] && /tmp/$port/use < $sql
991+ done
992 fi
993 else
994 echo "Sandbox $type $port failed to start." >&2
995@@ -119,6 +134,10 @@
996 exit 1
997 fi
998
999+ /tmp/$port/use -e "CREATE DATABASE IF NOT EXISTS percona_test";
1000+ /tmp/$port/use -e "CREATE TABLE IF NOT EXISTS percona_test.sentinel (id INT PRIMARY KEY, ping VARCHAR(64) NOT NULL DEFAULT '')";
1001+ /tmp/$port/use -e "REPLACE INTO percona_test.sentinel (id, ping) VALUES (1, '')";
1002+
1003 # If the sandbox is a slave, start the slave.
1004 if [ "$type" = "slave" ]; then
1005 /tmp/$port/use -e "change master to master_host='127.0.0.1', master_user='msandbox', master_password='msandbox', master_port=$master_port"
1006
1007=== modified file 'sandbox/test-env'
1008--- sandbox/test-env 2012-12-03 20:06:47 +0000
1009+++ sandbox/test-env 2012-12-20 23:20:32 +0000
1010@@ -299,6 +299,12 @@
1011 exit_status=$((exit_status | $?))
1012
1013 if [ "${2:-""}" = "cluster" ]; then
1014+ # Bit of magic here. 'start-sandbox cluster new_node old_node'
1015+ # changes old_node's my.sandbox.cnf's wsrep_cluster_address to
1016+ # point to new_node. This is especially useful because otherwise,
1017+ # calling stop/start like below on 12345 would create a new cluster.
1018+ /tmp/12345/stop >/dev/null
1019+ /tmp/12345/start >/dev/null
1020 echo -n "Checking that the cluster size is correct... "
1021 size=$(/tmp/12345/use -ss -e "SHOW STATUS LIKE 'wsrep_cluster_size'" | awk '{print $2}')
1022 if [ ${size:-0} -ne 3 ]; then
1023@@ -328,11 +334,10 @@
1024 ../util/check-load-data
1025
1026 ping=$(/tmp/12345/use -ss -e "SELECT MD5(RAND())")
1027- /tmp/12345/use -e "create table percona_test.sentinel(id int primary key, ping varchar(64) not null default '')"
1028- /tmp/12345/use -e "insert into percona_test.sentinel(id, ping) values(1, '$ping')";
1029+ /tmp/12345/use -e "UPDATE percona_test.sentinel SET ping='$ping' WHERE id=1";
1030 echo -n "Waiting for replication to finish..."
1031 for i in $(_seq 60); do
1032- pong=$(/tmp/12347/use -ss -e 'select ping from percona_test.sentinel where id=1' 2>/dev/null)
1033+ pong=$(/tmp/12347/use -ss -e 'SELECT ping FROM percona_test.sentinel WHERE id=1' 2>/dev/null)
1034 [ "$ping" = "$pong" ] && break
1035 echo -n '.'
1036 sleep 1
1037
1038=== modified file 't/lib/ExplainAnalyzer.t'
1039--- t/lib/ExplainAnalyzer.t 2012-06-03 17:54:32 +0000
1040+++ t/lib/ExplainAnalyzer.t 2012-12-20 23:20:32 +0000
1041@@ -31,9 +31,6 @@
1042 if ( !$dbh ) {
1043 plan skip_all => "Cannot connect to sandbox master";
1044 }
1045-else {
1046- plan tests => 17;
1047-}
1048
1049 $dbh->do('use sakila');
1050
1051@@ -60,7 +57,7 @@
1052 key_len => 2,
1053 ref => 'const',
1054 rows => 1,
1055- Extra => '',
1056+ Extra => $sandbox_version eq '5.6' ? undef : '',
1057 },
1058 ],
1059 'Got a simple EXPLAIN result',
1060@@ -81,7 +78,7 @@
1061 key_len => 2,
1062 ref => 'const',
1063 rows => 1,
1064- Extra => '',
1065+ Extra => $sandbox_version eq '5.6' ? undef : '',
1066 },
1067 ],
1068 'Got EXPLAIN result for a DELETE',
1069@@ -575,4 +572,4 @@
1070 # Done.
1071 # #############################################################################
1072 ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
1073-exit;
1074+done_testing;
1075
1076=== modified file 't/lib/NibbleIterator.t'
1077--- t/lib/NibbleIterator.t 2012-11-28 22:00:30 +0000
1078+++ t/lib/NibbleIterator.t 2012-12-20 23:20:32 +0000
1079@@ -713,8 +713,8 @@
1080 # ############################################################################
1081 $ni = make_nibble_iter(
1082 db => 'mysql',
1083- tbl => 'host',
1084- argv => [qw(--tables mysql.host --chunk-size-limit 0)],
1085+ tbl => 'columns_priv',
1086+ argv => [qw(--tables mysql.columns_priv --chunk-size-limit 0)],
1087 );
1088
1089 @rows = ();
1090
1091=== modified file 't/lib/QueryReportFormatter.t'
1092--- t/lib/QueryReportFormatter.t 2012-11-15 18:17:03 +0000
1093+++ t/lib/QueryReportFormatter.t 2012-12-20 23:20:32 +0000
1094@@ -1141,9 +1141,9 @@
1095 );
1096
1097 my $explain = load_file(
1098- $sandbox_version ge '5.1'
1099- ? "t/lib/samples/QueryReportFormatter/report025.txt"
1100- : "t/lib/samples/QueryReportFormatter/report026.txt");
1101+ $sandbox_version eq '5.6' ? "t/lib/samples/QueryReportFormatter/report031.txt"
1102+ : $sandbox_version ge '5.1' ? "t/lib/samples/QueryReportFormatter/report025.txt"
1103+ : "t/lib/samples/QueryReportFormatter/report026.txt");
1104
1105 is(
1106 $qrf->explain_report("select * from qrf.t where i=2", 'qrf'),
1107@@ -1180,11 +1180,13 @@
1108 # so if it doesn't USE db then the EXPLAIN will fail. Here we reset
1109 # the db to something else because we already called explain_report()
1110 # above which did USE qrf.
1111+ #
1112+ # 5.6 really is that different: ia vs. TF>aI. It's smarter.
1113 $dbh->do("USE mysql");
1114 my $explain_sparkline = $qrf->explain_sparkline($arg, 'qrf');
1115 is(
1116 $explain_sparkline,
1117- "TF>aI",
1118+ $sandbox_version eq '5.6' ? "ia" : "TF>aI",
1119 "explain_sparkling() uses db"
1120 );
1121
1122@@ -1206,9 +1208,9 @@
1123 groupby => 'fingerprint',
1124 );
1125 },
1126- ($sandbox_version ge '5.1' ?
1127- "t/lib/samples/QueryReportFormatter/report027.txt"
1128- : "t/lib/samples/QueryReportFormatter/report029.txt"),
1129+ ( $sandbox_version eq '5.6' ? "t/lib/samples/QueryReportFormatter/report032.txt"
1130+ : $sandbox_version ge '5.1' ? "t/lib/samples/QueryReportFormatter/report027.txt"
1131+ : "t/lib/samples/QueryReportFormatter/report029.txt"),
1132 ),
1133 "EXPLAIN sparkline (issue 1141)"
1134 );
1135
1136=== modified file 't/lib/SchemaIterator.t'
1137--- t/lib/SchemaIterator.t 2012-12-05 23:30:29 +0000
1138+++ t/lib/SchemaIterator.t 2012-12-20 23:20:32 +0000
1139@@ -149,9 +149,7 @@
1140 # Test simple, unfiltered get_db_itr().
1141 # ########################################################################
1142 test_so(
1143- result => $sandbox_version ge '5.5' ? "$out/all-dbs-tbls.txt"
1144- : $sandbox_version ge '5.1' ? "$out/all-dbs-tbls-5.1.txt"
1145- : "$out/all-dbs-tbls-5.0.txt",
1146+ result => "$out/all-dbs-tbls-$sandbox_version.txt",
1147 test_name => "Iterate all schema objects with dbh",
1148 );
1149
1150@@ -331,9 +329,7 @@
1151 # ########################################################################
1152 test_so(
1153 filters => [qw(-t mysql.user)],
1154- result => $sandbox_version ge '5.5' ? "$out/mysql-user-ddl-5.5.txt"
1155- : $sandbox_version ge '5.1' ? "$out/mysql-user-ddl.txt"
1156- : "$out/mysql-user-ddl-5.0.txt",
1157+ result => "$out/mysql-user-ddl-$sandbox_version.txt",
1158 test_name => "Get CREATE TABLE with dbh",
1159 );
1160
1161
1162=== modified file 't/lib/bash/collect_system_info.sh'
1163--- t/lib/bash/collect_system_info.sh 2012-08-24 22:39:58 +0000
1164+++ t/lib/bash/collect_system_info.sh 2012-12-20 23:20:32 +0000
1165@@ -267,7 +267,7 @@
1166 ) 2>/dev/null &
1167 forked_pid="$!"
1168
1169-if [ -e /proc/$forked_pid/oom_adj ] \
1170+if [ -w /proc/$forked_pid/oom_adj ] \
1171 && echo "-17" > /proc/$forked_pid/oom_adj 2>/dev/null; then
1172
1173 notable_processes_info > "$PT_TMPDIR/notable_procs"
1174@@ -277,7 +277,7 @@
1175 "notable_proccesses_info finds the process we manually changed earlier"
1176
1177 else
1178- skip 1 1 "Either this OS doesn't have an oom, or this user doesn't have enough privileges to change the oom of other processes"
1179+ skip 1 1 "oom_adj doesn't exist or isn't writeable"
1180 fi
1181
1182 disown $forked_pid
1183
1184=== added file 't/lib/samples/QueryReportFormatter/report031.txt'
1185--- t/lib/samples/QueryReportFormatter/report031.txt 1970-01-01 00:00:00 +0000
1186+++ t/lib/samples/QueryReportFormatter/report031.txt 2012-12-20 23:20:32 +0000
1187@@ -0,0 +1,12 @@
1188+# *************************** 1. row ***************************
1189+# id: 1
1190+# select_type: SIMPLE
1191+# table: t
1192+# partitions: NULL
1193+# type: const
1194+# possible_keys: PRIMARY
1195+# key: PRIMARY
1196+# key_len: 4
1197+# ref: const
1198+# rows: 1
1199+# Extra: NULL
1200
1201=== added file 't/lib/samples/QueryReportFormatter/report032.txt'
1202--- t/lib/samples/QueryReportFormatter/report032.txt 1970-01-01 00:00:00 +0000
1203+++ t/lib/samples/QueryReportFormatter/report032.txt 2012-12-20 23:20:32 +0000
1204@@ -0,0 +1,58 @@
1205+
1206+# Profile
1207+# Rank Query ID Response time Calls R/Call Apdx V/M EXPLAIN Item
1208+# ==== ================== ============= ===== ====== ==== ===== ======= =========
1209+# 1 0x46F81B022F1AD76B 0.0003 100.0% 1 0.0003 NS 0.00 ia SELECT t
1210+# MISC 0xMISC 0.0003 100.0% 1 0.0003 NS 0.0 MISC <1 ITEMS>
1211+
1212+# Query 1: 0 QPS, 0x concurrency, ID 0x46F81B022F1AD76B at byte 0 ________
1213+# Scores: Apdex = NS [0.0]*, V/M = 0.00
1214+# EXPLAIN sparkline: ia
1215+# Query_time sparkline: | ^ |
1216+# Time range: all events occurred at 2009-12-08 09:23:49.637394
1217+# Attribute pct total min max avg 95% stddev median
1218+# ============ === ======= ======= ======= ======= ======= ======= =======
1219+# Count 100 1
1220+# Exec time 100 286us 286us 286us 286us 286us 0 286us
1221+# Query size 100 90 90 90 90 90 0 90
1222+# String:
1223+# cmd Query
1224+# Databases qrf
1225+# Query_time distribution
1226+# 1us
1227+# 10us
1228+# 100us ################################################################
1229+# 1ms
1230+# 10ms
1231+# 100ms
1232+# 1s
1233+# 10s+
1234+# Tables
1235+# SHOW TABLE STATUS FROM `qrf` LIKE 't'\G
1236+# SHOW CREATE TABLE `qrf`.`t`\G
1237+# EXPLAIN /*!50100 PARTITIONS*/
1238+select t1.i from t as t1 join t as t2 where t1.i < t2.i and t1.v is not null order by t1.i\G
1239+# *************************** 1. row ***************************
1240+# id: 1
1241+# select_type: SIMPLE
1242+# table: t1
1243+# partitions: NULL
1244+# type: index
1245+# possible_keys: PRIMARY
1246+# key: PRIMARY
1247+# key_len: 4
1248+# ref: NULL
1249+# rows: 4
1250+# Extra: Using where
1251+# *************************** 2. row ***************************
1252+# id: 1
1253+# select_type: SIMPLE
1254+# table: t2
1255+# partitions: NULL
1256+# type: ALL
1257+# possible_keys: PRIMARY
1258+# key: NULL
1259+# key_len: NULL
1260+# ref: NULL
1261+# rows: 4
1262+# Extra: Range checked for each record (index map: 0x1)
1263
1264=== renamed file 't/lib/samples/SchemaIterator/all-dbs-tbls.txt' => 't/lib/samples/SchemaIterator/all-dbs-tbls-5.5.txt'
1265=== added file 't/lib/samples/SchemaIterator/all-dbs-tbls-5.6.txt'
1266--- t/lib/samples/SchemaIterator/all-dbs-tbls-5.6.txt 1970-01-01 00:00:00 +0000
1267+++ t/lib/samples/SchemaIterator/all-dbs-tbls-5.6.txt 2012-12-20 23:20:32 +0000
1268@@ -0,0 +1,537 @@
1269+mysql.columns_priv
1270+CREATE TABLE `columns_priv` (
1271+ `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
1272+ `Db` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
1273+ `User` char(16) COLLATE utf8_bin NOT NULL DEFAULT '',
1274+ `Table_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
1275+ `Column_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
1276+ `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
1277+ `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8 NOT NULL DEFAULT '',
1278+ PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`,`Column_name`)
1279+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Column privileges'
1280+
1281+mysql.db
1282+CREATE TABLE `db` (
1283+ `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
1284+ `Db` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
1285+ `User` char(16) COLLATE utf8_bin NOT NULL DEFAULT '',
1286+ `Select_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1287+ `Insert_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1288+ `Update_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1289+ `Delete_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1290+ `Create_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1291+ `Drop_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1292+ `Grant_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1293+ `References_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1294+ `Index_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1295+ `Alter_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1296+ `Create_tmp_table_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1297+ `Lock_tables_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1298+ `Create_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1299+ `Show_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1300+ `Create_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1301+ `Alter_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1302+ `Execute_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1303+ `Event_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1304+ `Trigger_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1305+ PRIMARY KEY (`Host`,`Db`,`User`),
1306+ KEY `User` (`User`)
1307+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Database privileges'
1308+
1309+mysql.event
1310+CREATE TABLE `event` (
1311+ `db` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
1312+ `name` char(64) NOT NULL DEFAULT '',
1313+ `body` longblob NOT NULL,
1314+ `definer` char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
1315+ `execute_at` datetime DEFAULT NULL,
1316+ `interval_value` int(11) DEFAULT NULL,
1317+ `interval_field` enum('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') DEFAULT NULL,
1318+ `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
1319+ `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
1320+ `last_executed` datetime DEFAULT NULL,
1321+ `starts` datetime DEFAULT NULL,
1322+ `ends` datetime DEFAULT NULL,
1323+ `status` enum('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL DEFAULT 'ENABLED',
1324+ `on_completion` enum('DROP','PRESERVE') NOT NULL DEFAULT 'DROP',
1325+ `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') NOT NULL DEFAULT '',
1326+ `comment` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
1327+ `originator` int(10) unsigned NOT NULL,
1328+ `time_zone` char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM',
1329+ `character_set_client` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
1330+ `collation_connection` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
1331+ `db_collation` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
1332+ `body_utf8` longblob,
1333+ PRIMARY KEY (`db`,`name`)
1334+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Events'
1335+
1336+mysql.func
1337+CREATE TABLE `func` (
1338+ `name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
1339+ `ret` tinyint(1) NOT NULL DEFAULT '0',
1340+ `dl` char(128) COLLATE utf8_bin NOT NULL DEFAULT '',
1341+ `type` enum('function','aggregate') CHARACTER SET utf8 NOT NULL,
1342+ PRIMARY KEY (`name`)
1343+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='User defined functions'
1344+
1345+mysql.help_category
1346+CREATE TABLE `help_category` (
1347+ `help_category_id` smallint(5) unsigned NOT NULL,
1348+ `name` char(64) NOT NULL,
1349+ `parent_category_id` smallint(5) unsigned DEFAULT NULL,
1350+ `url` char(128) NOT NULL,
1351+ PRIMARY KEY (`help_category_id`),
1352+ UNIQUE KEY `name` (`name`)
1353+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='help categories'
1354+
1355+mysql.help_keyword
1356+CREATE TABLE `help_keyword` (
1357+ `help_keyword_id` int(10) unsigned NOT NULL,
1358+ `name` char(64) NOT NULL,
1359+ PRIMARY KEY (`help_keyword_id`),
1360+ UNIQUE KEY `name` (`name`)
1361+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='help keywords'
1362+
1363+mysql.help_relation
1364+CREATE TABLE `help_relation` (
1365+ `help_topic_id` int(10) unsigned NOT NULL,
1366+ `help_keyword_id` int(10) unsigned NOT NULL,
1367+ PRIMARY KEY (`help_keyword_id`,`help_topic_id`)
1368+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='keyword-topic relation'
1369+
1370+mysql.help_topic
1371+CREATE TABLE `help_topic` (
1372+ `help_topic_id` int(10) unsigned NOT NULL,
1373+ `name` char(64) NOT NULL,
1374+ `help_category_id` smallint(5) unsigned NOT NULL,
1375+ `description` text NOT NULL,
1376+ `example` text NOT NULL,
1377+ `url` char(128) NOT NULL,
1378+ PRIMARY KEY (`help_topic_id`),
1379+ UNIQUE KEY `name` (`name`)
1380+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='help topics'
1381+
1382+mysql.ndb_binlog_index
1383+CREATE TABLE `ndb_binlog_index` (
1384+ `Position` bigint(20) unsigned NOT NULL,
1385+ `File` varchar(255) NOT NULL,
1386+ `epoch` bigint(20) unsigned NOT NULL,
1387+ `inserts` int(10) unsigned NOT NULL,
1388+ `updates` int(10) unsigned NOT NULL,
1389+ `deletes` int(10) unsigned NOT NULL,
1390+ `schemaops` int(10) unsigned NOT NULL,
1391+ `orig_server_id` int(10) unsigned NOT NULL,
1392+ `orig_epoch` bigint(20) unsigned NOT NULL,
1393+ `gci` int(10) unsigned NOT NULL,
1394+ PRIMARY KEY (`epoch`,`orig_server_id`,`orig_epoch`)
1395+) ENGINE=MyISAM DEFAULT CHARSET=latin1
1396+
1397+mysql.plugin
1398+CREATE TABLE `plugin` (
1399+ `name` varchar(64) NOT NULL DEFAULT '',
1400+ `dl` varchar(128) NOT NULL DEFAULT '',
1401+ PRIMARY KEY (`name`)
1402+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='MySQL plugins'
1403+
1404+mysql.proc
1405+CREATE TABLE `proc` (
1406+ `db` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
1407+ `name` char(64) NOT NULL DEFAULT '',
1408+ `type` enum('FUNCTION','PROCEDURE') NOT NULL,
1409+ `specific_name` char(64) NOT NULL DEFAULT '',
1410+ `language` enum('SQL') NOT NULL DEFAULT 'SQL',
1411+ `sql_data_access` enum('CONTAINS_SQL','NO_SQL','READS_SQL_DATA','MODIFIES_SQL_DATA') NOT NULL DEFAULT 'CONTAINS_SQL',
1412+ `is_deterministic` enum('YES','NO') NOT NULL DEFAULT 'NO',
1413+ `security_type` enum('INVOKER','DEFINER') NOT NULL DEFAULT 'DEFINER',
1414+ `param_list` blob NOT NULL,
1415+ `returns` longblob NOT NULL,
1416+ `body` longblob NOT NULL,
1417+ `definer` char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
1418+ `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
1419+ `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
1420+ `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') NOT NULL DEFAULT '',
1421+ `comment` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
1422+ `character_set_client` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
1423+ `collation_connection` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
1424+ `db_collation` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
1425+ `body_utf8` longblob,
1426+ PRIMARY KEY (`db`,`name`,`type`)
1427+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Stored Procedures'
1428+
1429+mysql.procs_priv
1430+CREATE TABLE `procs_priv` (
1431+ `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
1432+ `Db` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
1433+ `User` char(16) COLLATE utf8_bin NOT NULL DEFAULT '',
1434+ `Routine_name` char(64) CHARACTER SET utf8 NOT NULL DEFAULT '',
1435+ `Routine_type` enum('FUNCTION','PROCEDURE') COLLATE utf8_bin NOT NULL,
1436+ `Grantor` char(77) COLLATE utf8_bin NOT NULL DEFAULT '',
1437+ `Proc_priv` set('Execute','Alter Routine','Grant') CHARACTER SET utf8 NOT NULL DEFAULT '',
1438+ `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
1439+ PRIMARY KEY (`Host`,`Db`,`User`,`Routine_name`,`Routine_type`),
1440+ KEY `Grantor` (`Grantor`)
1441+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Procedure privileges'
1442+
1443+mysql.proxies_priv
1444+CREATE TABLE `proxies_priv` (
1445+ `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
1446+ `User` char(16) COLLATE utf8_bin NOT NULL DEFAULT '',
1447+ `Proxied_host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
1448+ `Proxied_user` char(16) COLLATE utf8_bin NOT NULL DEFAULT '',
1449+ `With_grant` tinyint(1) NOT NULL DEFAULT '0',
1450+ `Grantor` char(77) COLLATE utf8_bin NOT NULL DEFAULT '',
1451+ `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
1452+ PRIMARY KEY (`Host`,`User`,`Proxied_host`,`Proxied_user`),
1453+ KEY `Grantor` (`Grantor`)
1454+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='User proxy privileges'
1455+
1456+mysql.servers
1457+CREATE TABLE `servers` (
1458+ `Server_name` char(64) NOT NULL DEFAULT '',
1459+ `Host` char(64) NOT NULL DEFAULT '',
1460+ `Db` char(64) NOT NULL DEFAULT '',
1461+ `Username` char(64) NOT NULL DEFAULT '',
1462+ `Password` char(64) NOT NULL DEFAULT '',
1463+ `Port` int(4) NOT NULL DEFAULT '0',
1464+ `Socket` char(64) NOT NULL DEFAULT '',
1465+ `Wrapper` char(64) NOT NULL DEFAULT '',
1466+ `Owner` char(64) NOT NULL DEFAULT '',
1467+ PRIMARY KEY (`Server_name`)
1468+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='MySQL Foreign Servers table'
1469+
1470+mysql.tables_priv
1471+CREATE TABLE `tables_priv` (
1472+ `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
1473+ `Db` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
1474+ `User` char(16) COLLATE utf8_bin NOT NULL DEFAULT '',
1475+ `Table_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
1476+ `Grantor` char(77) COLLATE utf8_bin NOT NULL DEFAULT '',
1477+ `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
1478+ `Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') CHARACTER SET utf8 NOT NULL DEFAULT '',
1479+ `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8 NOT NULL DEFAULT '',
1480+ PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`),
1481+ KEY `Grantor` (`Grantor`)
1482+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Table privileges'
1483+
1484+mysql.time_zone
1485+CREATE TABLE `time_zone` (
1486+ `Time_zone_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
1487+ `Use_leap_seconds` enum('Y','N') NOT NULL DEFAULT 'N',
1488+ PRIMARY KEY (`Time_zone_id`)
1489+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Time zones'
1490+
1491+mysql.time_zone_leap_second
1492+CREATE TABLE `time_zone_leap_second` (
1493+ `Transition_time` bigint(20) NOT NULL,
1494+ `Correction` int(11) NOT NULL,
1495+ PRIMARY KEY (`Transition_time`)
1496+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Leap seconds information for time zones'
1497+
1498+mysql.time_zone_name
1499+CREATE TABLE `time_zone_name` (
1500+ `Name` char(64) NOT NULL,
1501+ `Time_zone_id` int(10) unsigned NOT NULL,
1502+ PRIMARY KEY (`Name`)
1503+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Time zone names'
1504+
1505+mysql.time_zone_transition
1506+CREATE TABLE `time_zone_transition` (
1507+ `Time_zone_id` int(10) unsigned NOT NULL,
1508+ `Transition_time` bigint(20) NOT NULL,
1509+ `Transition_type_id` int(10) unsigned NOT NULL,
1510+ PRIMARY KEY (`Time_zone_id`,`Transition_time`)
1511+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Time zone transitions'
1512+
1513+mysql.time_zone_transition_type
1514+CREATE TABLE `time_zone_transition_type` (
1515+ `Time_zone_id` int(10) unsigned NOT NULL,
1516+ `Transition_type_id` int(10) unsigned NOT NULL,
1517+ `Offset` int(11) NOT NULL DEFAULT '0',
1518+ `Is_DST` tinyint(3) unsigned NOT NULL DEFAULT '0',
1519+ `Abbreviation` char(8) NOT NULL DEFAULT '',
1520+ PRIMARY KEY (`Time_zone_id`,`Transition_type_id`)
1521+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Time zone transition types'
1522+
1523+mysql.user
1524+CREATE TABLE `user` (
1525+ `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
1526+ `User` char(16) COLLATE utf8_bin NOT NULL DEFAULT '',
1527+ `Password` char(41) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '',
1528+ `Select_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1529+ `Insert_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1530+ `Update_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1531+ `Delete_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1532+ `Create_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1533+ `Drop_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1534+ `Reload_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1535+ `Shutdown_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1536+ `Process_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1537+ `File_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1538+ `Grant_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1539+ `References_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1540+ `Index_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1541+ `Alter_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1542+ `Show_db_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1543+ `Super_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1544+ `Create_tmp_table_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1545+ `Lock_tables_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1546+ `Execute_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1547+ `Repl_slave_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1548+ `Repl_client_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1549+ `Create_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1550+ `Show_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1551+ `Create_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1552+ `Alter_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1553+ `Create_user_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1554+ `Event_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1555+ `Trigger_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1556+ `Create_tablespace_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1557+ `ssl_type` enum('','ANY','X509','SPECIFIED') CHARACTER SET utf8 NOT NULL DEFAULT '',
1558+ `ssl_cipher` blob NOT NULL,
1559+ `x509_issuer` blob NOT NULL,
1560+ `x509_subject` blob NOT NULL,
1561+ `max_questions` int(11) unsigned NOT NULL DEFAULT '0',
1562+ `max_updates` int(11) unsigned NOT NULL DEFAULT '0',
1563+ `max_connections` int(11) unsigned NOT NULL DEFAULT '0',
1564+ `max_user_connections` int(11) unsigned NOT NULL DEFAULT '0',
1565+ `plugin` char(64) COLLATE utf8_bin DEFAULT '',
1566+ `authentication_string` text COLLATE utf8_bin,
1567+ `password_expired` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1568+ PRIMARY KEY (`Host`,`User`)
1569+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Users and global privileges'
1570+
1571+percona_test.checksums
1572+CREATE TABLE `checksums` (
1573+ `db_tbl` varchar(128) NOT NULL,
1574+ `checksum` int(10) unsigned NOT NULL,
1575+ PRIMARY KEY (`db_tbl`)
1576+) ENGINE=InnoDB DEFAULT CHARSET=latin1
1577+
1578+percona_test.load_data
1579+CREATE TABLE `load_data` (
1580+ `i` int(11) DEFAULT NULL
1581+) ENGINE=InnoDB DEFAULT CHARSET=latin1
1582+
1583+percona_test.sentinel
1584+CREATE TABLE `sentinel` (
1585+ `id` int(11) NOT NULL,
1586+ `ping` varchar(64) NOT NULL DEFAULT '',
1587+ PRIMARY KEY (`id`)
1588+) ENGINE=InnoDB DEFAULT CHARSET=latin1
1589+
1590+sakila.actor
1591+CREATE TABLE `actor` (
1592+ `actor_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
1593+ `first_name` varchar(45) NOT NULL,
1594+ `last_name` varchar(45) NOT NULL,
1595+ `last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
1596+ PRIMARY KEY (`actor_id`),
1597+ KEY `idx_actor_last_name` (`last_name`)
1598+) ENGINE=InnoDB AUTO_INCREMENT=201 DEFAULT CHARSET=utf8
1599+
1600+sakila.address
1601+CREATE TABLE `address` (
1602+ `address_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
1603+ `address` varchar(50) NOT NULL,
1604+ `address2` varchar(50) DEFAULT NULL,
1605+ `district` varchar(20) NOT NULL,
1606+ `city_id` smallint(5) unsigned NOT NULL,
1607+ `postal_code` varchar(10) DEFAULT NULL,
1608+ `phone` varchar(20) NOT NULL,
1609+ `last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
1610+ PRIMARY KEY (`address_id`),
1611+ KEY `idx_fk_city_id` (`city_id`),
1612+ CONSTRAINT `fk_address_city` FOREIGN KEY (`city_id`) REFERENCES `city` (`city_id`) ON UPDATE CASCADE
1613+) ENGINE=InnoDB AUTO_INCREMENT=606 DEFAULT CHARSET=utf8
1614+
1615+sakila.category
1616+CREATE TABLE `category` (
1617+ `category_id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
1618+ `name` varchar(25) NOT NULL,
1619+ `last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
1620+ PRIMARY KEY (`category_id`)
1621+) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8
1622+
1623+sakila.city
1624+CREATE TABLE `city` (
1625+ `city_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
1626+ `city` varchar(50) NOT NULL,
1627+ `country_id` smallint(5) unsigned NOT NULL,
1628+ `last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
1629+ PRIMARY KEY (`city_id`),
1630+ KEY `idx_fk_country_id` (`country_id`),
1631+ CONSTRAINT `fk_city_country` FOREIGN KEY (`country_id`) REFERENCES `country` (`country_id`) ON UPDATE CASCADE
1632+) ENGINE=InnoDB AUTO_INCREMENT=601 DEFAULT CHARSET=utf8
1633+
1634+sakila.country
1635+CREATE TABLE `country` (
1636+ `country_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
1637+ `country` varchar(50) NOT NULL,
1638+ `last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
1639+ PRIMARY KEY (`country_id`)
1640+) ENGINE=InnoDB AUTO_INCREMENT=110 DEFAULT CHARSET=utf8
1641+
1642+sakila.customer
1643+CREATE TABLE `customer` (
1644+ `customer_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
1645+ `store_id` tinyint(3) unsigned NOT NULL,
1646+ `first_name` varchar(45) NOT NULL,
1647+ `last_name` varchar(45) NOT NULL,
1648+ `email` varchar(50) DEFAULT NULL,
1649+ `address_id` smallint(5) unsigned NOT NULL,
1650+ `active` tinyint(1) NOT NULL DEFAULT '1',
1651+ `create_date` datetime NOT NULL,
1652+ `last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
1653+ PRIMARY KEY (`customer_id`),
1654+ KEY `idx_fk_store_id` (`store_id`),
1655+ KEY `idx_fk_address_id` (`address_id`),
1656+ KEY `idx_last_name` (`last_name`),
1657+ CONSTRAINT `fk_customer_address` FOREIGN KEY (`address_id`) REFERENCES `address` (`address_id`) ON UPDATE CASCADE,
1658+ CONSTRAINT `fk_customer_store` FOREIGN KEY (`store_id`) REFERENCES `store` (`store_id`) ON UPDATE CASCADE
1659+) ENGINE=InnoDB AUTO_INCREMENT=600 DEFAULT CHARSET=utf8
1660+
1661+sakila.film
1662+CREATE TABLE `film` (
1663+ `film_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
1664+ `title` varchar(255) NOT NULL,
1665+ `description` text,
1666+ `release_year` year(4) DEFAULT NULL,
1667+ `language_id` tinyint(3) unsigned NOT NULL,
1668+ `original_language_id` tinyint(3) unsigned DEFAULT NULL,
1669+ `rental_duration` tinyint(3) unsigned NOT NULL DEFAULT '3',
1670+ `rental_rate` decimal(4,2) NOT NULL DEFAULT '4.99',
1671+ `length` smallint(5) unsigned DEFAULT NULL,
1672+ `replacement_cost` decimal(5,2) NOT NULL DEFAULT '19.99',
1673+ `rating` enum('G','PG','PG-13','R','NC-17') DEFAULT 'G',
1674+ `special_features` set('Trailers','Commentaries','Deleted Scenes','Behind the Scenes') DEFAULT NULL,
1675+ `last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
1676+ PRIMARY KEY (`film_id`),
1677+ KEY `idx_title` (`title`),
1678+ KEY `idx_fk_language_id` (`language_id`),
1679+ KEY `idx_fk_original_language_id` (`original_language_id`),
1680+ CONSTRAINT `fk_film_language` FOREIGN KEY (`language_id`) REFERENCES `language` (`language_id`) ON UPDATE CASCADE,
1681+ CONSTRAINT `fk_film_language_original` FOREIGN KEY (`original_language_id`) REFERENCES `language` (`language_id`) ON UPDATE CASCADE
1682+) ENGINE=InnoDB AUTO_INCREMENT=1001 DEFAULT CHARSET=utf8
1683+
1684+sakila.film_actor
1685+CREATE TABLE `film_actor` (
1686+ `actor_id` smallint(5) unsigned NOT NULL,
1687+ `film_id` smallint(5) unsigned NOT NULL,
1688+ `last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
1689+ PRIMARY KEY (`actor_id`,`film_id`),
1690+ KEY `idx_fk_film_id` (`film_id`),
1691+ CONSTRAINT `fk_film_actor_actor` FOREIGN KEY (`actor_id`) REFERENCES `actor` (`actor_id`) ON UPDATE CASCADE,
1692+ CONSTRAINT `fk_film_actor_film` FOREIGN KEY (`film_id`) REFERENCES `film` (`film_id`) ON UPDATE CASCADE
1693+) ENGINE=InnoDB DEFAULT CHARSET=utf8
1694+
1695+sakila.film_category
1696+CREATE TABLE `film_category` (
1697+ `film_id` smallint(5) unsigned NOT NULL,
1698+ `category_id` tinyint(3) unsigned NOT NULL,
1699+ `last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
1700+ PRIMARY KEY (`film_id`,`category_id`),
1701+ KEY `fk_film_category_category` (`category_id`),
1702+ CONSTRAINT `fk_film_category_film` FOREIGN KEY (`film_id`) REFERENCES `film` (`film_id`) ON UPDATE CASCADE,
1703+ CONSTRAINT `fk_film_category_category` FOREIGN KEY (`category_id`) REFERENCES `category` (`category_id`) ON UPDATE CASCADE
1704+) ENGINE=InnoDB DEFAULT CHARSET=utf8
1705+
1706+sakila.film_text
1707+CREATE TABLE `film_text` (
1708+ `film_id` smallint(6) NOT NULL,
1709+ `title` varchar(255) NOT NULL,
1710+ `description` text,
1711+ PRIMARY KEY (`film_id`),
1712+ FULLTEXT KEY `idx_title_description` (`title`,`description`)
1713+) ENGINE=MyISAM DEFAULT CHARSET=utf8
1714+
1715+sakila.inventory
1716+CREATE TABLE `inventory` (
1717+ `inventory_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
1718+ `film_id` smallint(5) unsigned NOT NULL,
1719+ `store_id` tinyint(3) unsigned NOT NULL,
1720+ `last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
1721+ PRIMARY KEY (`inventory_id`),
1722+ KEY `idx_fk_film_id` (`film_id`),
1723+ KEY `idx_store_id_film_id` (`store_id`,`film_id`),
1724+ CONSTRAINT `fk_inventory_store` FOREIGN KEY (`store_id`) REFERENCES `store` (`store_id`) ON UPDATE CASCADE,
1725+ CONSTRAINT `fk_inventory_film` FOREIGN KEY (`film_id`) REFERENCES `film` (`film_id`) ON UPDATE CASCADE
1726+) ENGINE=InnoDB AUTO_INCREMENT=4582 DEFAULT CHARSET=utf8
1727+
1728+sakila.language
1729+CREATE TABLE `language` (
1730+ `language_id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
1731+ `name` char(20) NOT NULL,
1732+ `last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
1733+ PRIMARY KEY (`language_id`)
1734+) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8
1735+
1736+sakila.payment
1737+CREATE TABLE `payment` (
1738+ `payment_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
1739+ `customer_id` smallint(5) unsigned NOT NULL,
1740+ `staff_id` tinyint(3) unsigned NOT NULL,
1741+ `rental_id` int(11) DEFAULT NULL,
1742+ `amount` decimal(5,2) NOT NULL,
1743+ `payment_date` datetime NOT NULL,
1744+ `last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
1745+ PRIMARY KEY (`payment_id`),
1746+ KEY `idx_fk_staff_id` (`staff_id`),
1747+ KEY `idx_fk_customer_id` (`customer_id`),
1748+ KEY `fk_payment_rental` (`rental_id`),
1749+ CONSTRAINT `fk_payment_rental` FOREIGN KEY (`rental_id`) REFERENCES `rental` (`rental_id`) ON DELETE SET NULL ON UPDATE CASCADE,
1750+ CONSTRAINT `fk_payment_customer` FOREIGN KEY (`customer_id`) REFERENCES `customer` (`customer_id`) ON UPDATE CASCADE,
1751+ CONSTRAINT `fk_payment_staff` FOREIGN KEY (`staff_id`) REFERENCES `staff` (`staff_id`) ON UPDATE CASCADE
1752+) ENGINE=InnoDB AUTO_INCREMENT=16050 DEFAULT CHARSET=utf8
1753+
1754+sakila.rental
1755+CREATE TABLE `rental` (
1756+ `rental_id` int(11) NOT NULL AUTO_INCREMENT,
1757+ `rental_date` datetime NOT NULL,
1758+ `inventory_id` mediumint(8) unsigned NOT NULL,
1759+ `customer_id` smallint(5) unsigned NOT NULL,
1760+ `return_date` datetime DEFAULT NULL,
1761+ `staff_id` tinyint(3) unsigned NOT NULL,
1762+ `last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
1763+ PRIMARY KEY (`rental_id`),
1764+ UNIQUE KEY `rental_date` (`rental_date`,`inventory_id`,`customer_id`),
1765+ KEY `idx_fk_inventory_id` (`inventory_id`),
1766+ KEY `idx_fk_customer_id` (`customer_id`),
1767+ KEY `idx_fk_staff_id` (`staff_id`),
1768+ CONSTRAINT `fk_rental_staff` FOREIGN KEY (`staff_id`) REFERENCES `staff` (`staff_id`) ON UPDATE CASCADE,
1769+ CONSTRAINT `fk_rental_inventory` FOREIGN KEY (`inventory_id`) REFERENCES `inventory` (`inventory_id`) ON UPDATE CASCADE,
1770+ CONSTRAINT `fk_rental_customer` FOREIGN KEY (`customer_id`) REFERENCES `customer` (`customer_id`) ON UPDATE CASCADE
1771+) ENGINE=InnoDB AUTO_INCREMENT=16050 DEFAULT CHARSET=utf8
1772+
1773+sakila.staff
1774+CREATE TABLE `staff` (
1775+ `staff_id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
1776+ `first_name` varchar(45) NOT NULL,
1777+ `last_name` varchar(45) NOT NULL,
1778+ `address_id` smallint(5) unsigned NOT NULL,
1779+ `picture` blob,
1780+ `email` varchar(50) DEFAULT NULL,
1781+ `store_id` tinyint(3) unsigned NOT NULL,
1782+ `active` tinyint(1) NOT NULL DEFAULT '1',
1783+ `username` varchar(16) NOT NULL,
1784+ `password` varchar(40) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
1785+ `last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
1786+ PRIMARY KEY (`staff_id`),
1787+ KEY `idx_fk_store_id` (`store_id`),
1788+ KEY `idx_fk_address_id` (`address_id`),
1789+ CONSTRAINT `fk_staff_store` FOREIGN KEY (`store_id`) REFERENCES `store` (`store_id`) ON UPDATE CASCADE,
1790+ CONSTRAINT `fk_staff_address` FOREIGN KEY (`address_id`) REFERENCES `address` (`address_id`) ON UPDATE CASCADE
1791+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8
1792+
1793+sakila.store
1794+CREATE TABLE `store` (
1795+ `store_id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
1796+ `manager_staff_id` tinyint(3) unsigned NOT NULL,
1797+ `address_id` smallint(5) unsigned NOT NULL,
1798+ `last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
1799+ PRIMARY KEY (`store_id`),
1800+ UNIQUE KEY `idx_unique_manager` (`manager_staff_id`),
1801+ KEY `idx_fk_address_id` (`address_id`),
1802+ CONSTRAINT `fk_store_staff` FOREIGN KEY (`manager_staff_id`) REFERENCES `staff` (`staff_id`) ON UPDATE CASCADE,
1803+ CONSTRAINT `fk_store_address` FOREIGN KEY (`address_id`) REFERENCES `address` (`address_id`) ON UPDATE CASCADE
1804+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8
1805+
1806
1807=== renamed file 't/lib/samples/SchemaIterator/mysql-user-ddl.txt' => 't/lib/samples/SchemaIterator/mysql-user-ddl-5.1.txt'
1808=== added file 't/lib/samples/SchemaIterator/mysql-user-ddl-5.6.txt'
1809--- t/lib/samples/SchemaIterator/mysql-user-ddl-5.6.txt 1970-01-01 00:00:00 +0000
1810+++ t/lib/samples/SchemaIterator/mysql-user-ddl-5.6.txt 2012-12-20 23:20:32 +0000
1811@@ -0,0 +1,48 @@
1812+mysql.user
1813+CREATE TABLE `user` (
1814+ `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
1815+ `User` char(16) COLLATE utf8_bin NOT NULL DEFAULT '',
1816+ `Password` char(41) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '',
1817+ `Select_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1818+ `Insert_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1819+ `Update_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1820+ `Delete_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1821+ `Create_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1822+ `Drop_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1823+ `Reload_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1824+ `Shutdown_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1825+ `Process_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1826+ `File_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1827+ `Grant_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1828+ `References_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1829+ `Index_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1830+ `Alter_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1831+ `Show_db_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1832+ `Super_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1833+ `Create_tmp_table_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1834+ `Lock_tables_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1835+ `Execute_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1836+ `Repl_slave_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1837+ `Repl_client_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1838+ `Create_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1839+ `Show_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1840+ `Create_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1841+ `Alter_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1842+ `Create_user_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1843+ `Event_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1844+ `Trigger_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1845+ `Create_tablespace_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1846+ `ssl_type` enum('','ANY','X509','SPECIFIED') CHARACTER SET utf8 NOT NULL DEFAULT '',
1847+ `ssl_cipher` blob NOT NULL,
1848+ `x509_issuer` blob NOT NULL,
1849+ `x509_subject` blob NOT NULL,
1850+ `max_questions` int(11) unsigned NOT NULL DEFAULT '0',
1851+ `max_updates` int(11) unsigned NOT NULL DEFAULT '0',
1852+ `max_connections` int(11) unsigned NOT NULL DEFAULT '0',
1853+ `max_user_connections` int(11) unsigned NOT NULL DEFAULT '0',
1854+ `plugin` char(64) COLLATE utf8_bin DEFAULT '',
1855+ `authentication_string` text COLLATE utf8_bin,
1856+ `password_expired` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
1857+ PRIMARY KEY (`Host`,`User`)
1858+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Users and global privileges'
1859+
1860
1861=== added file 't/lib/samples/stored-objs.sql'
1862--- t/lib/samples/stored-objs.sql 1970-01-01 00:00:00 +0000
1863+++ t/lib/samples/stored-objs.sql 2012-12-20 23:20:32 +0000
1864@@ -0,0 +1,30 @@
1865+DROP DATABASE IF EXISTS pt_find;
1866+CREATE DATABASE pt_find;
1867+USE pt_find;
1868+
1869+create table t1 (
1870+ id int not null primary key
1871+) engine=innodb;
1872+
1873+create table t2 (
1874+ id int not null primary key
1875+) engine=innodb;
1876+
1877+CREATE FUNCTION hello (s CHAR(20))
1878+RETURNS CHAR(50) DETERMINISTIC
1879+RETURN CONCAT('Hello, ',s,'!');
1880+
1881+delimiter //
1882+
1883+CREATE PROCEDURE simpleproc (OUT param1 INT)
1884+BEGIN
1885+ SELECT COUNT(*) INTO param1 FROM t;
1886+END//
1887+
1888+CREATE TRIGGER ins_trg BEFORE INSERT ON t1
1889+ FOR EACH ROW BEGIN
1890+ INSERT INTO t2 VALUES (NEW.id);
1891+ END;
1892+//
1893+
1894+delimiter ;
1895
1896=== modified file 't/pt-archiver/standard_options.t'
1897--- t/pt-archiver/standard_options.t 2012-06-07 03:14:20 +0000
1898+++ t/pt-archiver/standard_options.t 2012-12-20 23:20:32 +0000
1899@@ -23,101 +23,127 @@
1900 if ( !$dbh ) {
1901 plan skip_all => 'Cannot connect to sandbox master';
1902 }
1903-else {
1904- plan tests => 7;
1905+elsif ( !$dbh2 ) {
1906+ plan skip_all => 'Cannot connect to sandbox slave';
1907 }
1908
1909 my $output;
1910-my $cnf = "/tmp/12345/my.sandbox.cnf";
1911-my $cmd = "$trunk/bin/pt-archiver";
1912+my $cnf = "/tmp/12345/my.sandbox.cnf";
1913+my $pid_file = "/tmp/pt-archiver-test.pid.$PID";
1914+my $sentinel = "/tmp/pt-archiver-test.sentinel.$PID";
1915
1916 $sb->create_dbs($dbh, [qw(test)]);
1917
1918-SKIP: {
1919- skip 'Sandbox master does not have the sakila database', 1
1920- unless @{$dbh->selectcol_arrayref("SHOW DATABASES LIKE 'sakila'")};
1921-
1922- $output = `$cmd --source F=$cnf,h=127.1,D=sakila,t=film --no-check-charset --where "film_id < 100" --purge --dry-run --port 12345 | diff $trunk/t/pt-archiver/samples/issue-248.txt -`;
1923- is(
1924- $output,
1925- '',
1926- 'DSNs inherit from standard connection options (issue 248)'
1927- );
1928-};
1929-
1930+ok(
1931+ no_diff(
1932+ sub {
1933+ pt_archiver::main('--source', "F=$cnf,h=127.1,D=sakila,t=film",
1934+ qw(--no-check-charset --purge --dry-run --port 12345),
1935+ "--where", "film_id < 100")
1936+ },
1937+ "t/pt-archiver/samples/issue-248.txt",
1938+ ),
1939+ 'DSNs inherit from standard connection options (issue 248)'
1940+);
1941
1942 # Test with a sentinel file
1943 $sb->load_file('master', 't/pt-archiver/samples/table1.sql');
1944-diag(`touch sentinel`);
1945+diag(`touch $sentinel`);
1946+
1947 $output = output(
1948- sub { pt_archiver::main(qw(--where 1=1 --why-quit --sentinel sentinel), "--source", "D=test,t=table_1,F=$cnf", qw(--purge)) },
1949-);
1950-like($output, qr/because sentinel/, 'Exits because of sentinel');
1951+ sub { pt_archiver::main("--source", "D=test,t=table_1,F=$cnf",
1952+ qw(--where 1=1 --why-quit --purge),
1953+ "--sentinel", $sentinel)
1954+ },
1955+ stderr => 1,
1956+);
1957+
1958+like(
1959+ $output,
1960+ qr/because sentinel file $sentinel exists/,
1961+ 'Exits because of sentinel'
1962+);
1963+
1964 $output = `/tmp/12345/use -N -e "select count(*) from test.table_1"`;
1965-is($output + 0, 4, 'No rows were deleted');
1966-`rm sentinel`;
1967+is(
1968+ $output + 0,
1969+ 4,
1970+ 'No rows were deleted'
1971+) or diag($output);
1972+
1973+diag(`rm -f $sentinel`);
1974
1975 # Test --stop, which sets the sentinel
1976 $output = output(
1977- sub { pt_archiver::main(qw(--sentinel sentinel --stop)) },
1978-);
1979-like($output, qr/Successfully created file sentinel/, 'Created the sentinel OK');
1980-diag(`rm -f sentinel >/dev/null`);
1981+ sub { pt_archiver::main("--sentinel", $sentinel, "--stop") },
1982+);
1983+
1984+like(
1985+ $output,
1986+ qr/Successfully created file $sentinel/,
1987+ 'Created the sentinel OK'
1988+);
1989+
1990+diag(`rm -f $sentinel`);
1991
1992 # #############################################################################
1993 # Issue 391: Add --pid option to mk-table-sync
1994 # #############################################################################
1995-`touch /tmp/mk-archiver.pid`;
1996-$output = `$cmd --where 1=1 --source F=$cnf,D=test,t=issue_131_src --statistics --dest t=issue_131_dst --pid /tmp/mk-archiver.pid 2>&1`;
1997+diag(`touch $pid_file`);
1998+
1999+$output = output(
2000+ sub { pt_archiver::main('--source', "F=$cnf,D=test,t=issue_131_src",
2001+ qw(--where 1=1 --statistics --dest t=issue_131_dst),
2002+ "--pid", $pid_file)
2003+ },
2004+ stderr => 1,
2005+);
2006+
2007 like(
2008 $output,
2009- qr{PID file /tmp/mk-archiver.pid already exists},
2010+ qr{PID file $pid_file already exists},
2011 'Dies if PID file already exists (issue 391)'
2012 );
2013
2014-`rm -rf /tmp/mk-archiver.pid`;
2015+diag(`rm -f $pid_file`);
2016
2017 # #############################################################################
2018 # Issue 460: mk-archiver does not inherit DSN as documented
2019 # #############################################################################
2020-SKIP: {
2021- skip 'Cannot connect to sandbox slave1', 1 unless $dbh2;
2022-
2023- # This test will achive rows from dbh:test.table_1 to dbh2:test.table_2.
2024- $sb->load_file('master', 't/pt-archiver/samples/tables1-4.sql');
2025-
2026- # Change passwords so defaults files won't work.
2027- $dbh->do("SET PASSWORD FOR msandbox = PASSWORD('foo')");
2028- $dbh2->do("SET PASSWORD FOR msandbox = PASSWORD('foo')");
2029-
2030- $dbh2->do('TRUNCATE TABLE test.table_2');
2031-
2032- $output = `$trunk/bin/pt-archiver --where 1=1 --source h=127.1,P=12345,D=test,t=table_1,u=msandbox,p=foo --dest P=12346,t=table_2 2>&1`;
2033- my $r = $dbh2->selectall_arrayref('SELECT * FROM test.table_2');
2034- is(
2035- scalar @$r,
2036- 4,
2037- '--dest inherited from --source'
2038- );
2039-
2040- # Set the passwords back. If this fails we should bail out because
2041- # nothing else is going to work.
2042- eval {
2043- $dbh->do("SET PASSWORD FOR msandbox = PASSWORD('msandbox')");
2044- $dbh2->do("SET PASSWORD FOR msandbox = PASSWORD('msandbox')");
2045- };
2046- if ( $EVAL_ERROR ) {
2047- BAIL_OUT('Failed to reset the msandbox password on the master or slave '
2048- . 'sandbox. Check the Maatkit test environment with "test-env '
2049- . 'status" and restart with "test-env restart". The error was: '
2050- . $EVAL_ERROR);
2051- }
2052-};
2053+
2054+# This test will achive rows from dbh:test.table_1 to dbh2:test.table_2.
2055+$sb->load_file('master', 't/pt-archiver/samples/tables1-4.sql');
2056+
2057+# Change passwords so defaults files won't work.
2058+$sb->do_as_root(
2059+ 'master',
2060+ q/CREATE USER 'bob'@'%' IDENTIFIED BY 'foo'/,
2061+ q/GRANT ALL ON *.* TO 'bob'@'%'/,
2062+);
2063+$dbh2->do('TRUNCATE TABLE test.table_2');
2064+$sb->wait_for_slaves;
2065+
2066+$output = output(
2067+ sub { pt_archiver::main(
2068+ '--source', 'h=127.1,P=12345,D=test,t=table_1,u=bob,p=foo',
2069+ '--dest', 'P=12346,t=table_2',
2070+ qw(--where 1=1))
2071+ },
2072+ stderr => 1,
2073+);
2074+
2075+my $r = $dbh2->selectall_arrayref('SELECT * FROM test.table_2');
2076+is(
2077+ scalar @$r,
2078+ 4,
2079+ '--dest inherited from --source'
2080+);
2081+
2082+$sb->do_as_root('master', q/DROP USER 'bob'@'%'/);
2083
2084 # #############################################################################
2085 # Done.
2086 # #############################################################################
2087 $sb->wipe_clean($dbh);
2088-$sb->wipe_clean($dbh2) if $dbh2;
2089 ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
2090-exit;
2091+done_testing;
2092
2093=== added file 't/pt-config-diff/samples/case1.cnf'
2094--- t/pt-config-diff/samples/case1.cnf 1970-01-01 00:00:00 +0000
2095+++ t/pt-config-diff/samples/case1.cnf 2012-12-20 23:20:32 +0000
2096@@ -0,0 +1,2 @@
2097+[mysqld]
2098+binlog_format = genlog
2099
2100=== added file 't/pt-config-diff/samples/case2.cnf'
2101--- t/pt-config-diff/samples/case2.cnf 1970-01-01 00:00:00 +0000
2102+++ t/pt-config-diff/samples/case2.cnf 2012-12-20 23:20:32 +0000
2103@@ -0,0 +1,2 @@
2104+[mysqld]
2105+binlog_format = GENLOG
2106
2107=== modified file 't/pt-deadlock-logger/bugs.t'
2108--- t/pt-deadlock-logger/bugs.t 2012-06-03 18:47:00 +0000
2109+++ t/pt-deadlock-logger/bugs.t 2012-12-20 23:20:32 +0000
2110@@ -9,7 +9,7 @@
2111 use strict;
2112 use warnings FATAL => 'all';
2113 use English qw(-no_match_vars);
2114-use Test::More tests => 1;
2115+use Test::More;
2116
2117 use PerconaTest;
2118 use Sandbox;
2119@@ -68,6 +68,59 @@
2120 );
2121
2122 # #############################################################################
2123+# https://bugs.launchpad.net/percona-toolkit/+bug/1082104
2124+# pt-deadlock-logger problem when the user have a dash in the name
2125+# #############################################################################
2126+
2127+$innodb_status_sample = load_file("t/pt-deadlock-logger/samples/bug_1082104.txt");
2128+
2129+is_deeply(
2130+ pt_deadlock_logger::parse_deadlocks($innodb_status_sample),
2131+ {
2132+ '1' => {
2133+ db => 'test',
2134+ hostname => 'localhost',
2135+ id => 1,
2136+ idx => 'PRIMARY',
2137+ ip => '',
2138+ lock_mode => 'X',
2139+ lock_type => 'RECORD',
2140+ query => 'update a set movie_id=96 where id =2',
2141+ server => '',
2142+ tbl => 'a',
2143+ thread => '19',
2144+ ts => '2011-12-12T22:52:42',
2145+ txn_id => 0,
2146+ txn_time => '161',
2147+ user => 'ro-ot',
2148+ victim => 0,
2149+ wait_hold => 'w'
2150+ },
2151+ '2' => {
2152+ db => 'test',
2153+ hostname => 'localhost',
2154+ id => 2,
2155+ idx => 'PRIMARY',
2156+ ip => '',
2157+ lock_mode => 'X',
2158+ lock_type => 'RECORD',
2159+ query => 'update a set movie_id=98 where id =4',
2160+ server => '',
2161+ tbl => 'a',
2162+ thread => '18',
2163+ ts => '2011-12-12T22:52:42',
2164+ txn_id => 0,
2165+ txn_time => '1026',
2166+ user => 'ro-ot',
2167+ victim => 1,
2168+ wait_hold => 'w'
2169+ }
2170+ },
2171+ "Bug 1082104: pt-deadlock-logger shows host as user when the username has a dash in the name",
2172+);
2173+
2174+# #############################################################################
2175 # Done.
2176 # #############################################################################
2177+done_testing;
2178 exit;
2179
2180=== added file 't/pt-deadlock-logger/samples/bug_1082104.txt'
2181--- t/pt-deadlock-logger/samples/bug_1082104.txt 1970-01-01 00:00:00 +0000
2182+++ t/pt-deadlock-logger/samples/bug_1082104.txt 2012-12-20 23:20:32 +0000
2183@@ -0,0 +1,53 @@
2184+=====================================
2185+070915 15:34:37 INNODB MONITOR OUTPUT
2186+=====================================
2187+Per second averages calculated from the last 24 seconds
2188+------------------------
2189+LATEST DETECTED DEADLOCK
2190+------------------------
2191+111212 22:52:42
2192+*** (1) TRANSACTION:
2193+TRANSACTION 3405, ACTIVE 161 sec starting index read
2194+mysql tables in use 1, locked 1
2195+LOCK WAIT 3 lock struct(s), heap size 376, 3 row lock(s), undo log entries 2
2196+MySQL thread id 19, OS thread handle 0x7fac301e4700, query id 180 localhost ro-ot Updating
2197+update a set movie_id=96 where id =2
2198+*** (1) WAITING FOR THIS LOCK TO BE GRANTED:
2199+RECORD LOCKS space id 0 page no 307 n bits 72 index `PRIMARY` of table `test`.`a` trx id 3405 lock_mode X locks rec but not gap waiting
2200+Record lock, heap no 3 PHYSICAL RECORD: n_fields 6; compact format; info bits 0
2201+ 0: len 4; hex 80000002; asc ;;
2202+ 1: len 6; hex 000000003404; asc 4 ;;
2203+ 2: len 7; hex 040000163b2515; asc ;% ;;
2204+ 3: len 4; hex 80000063; asc c;;
2205+ 4: len 1; hex 01; asc ;;
2206+ 5: len 8; hex 8000124a7c1acb8c; asc J| ;;
2207+
2208+*** (2) TRANSACTION:
2209+TRANSACTION 3404, ACTIVE 1026 sec starting index read
2210+mysql tables in use 1, locked 1
2211+3 lock struct(s), heap size 376, 2 row lock(s), undo log entries 1
2212+MySQL thread id 18, OS thread handle 0x7fac30225700, query id 181 localhost ro-ot Updating
2213+update a set movie_id=98 where id =4
2214+*** (2) HOLDS THE LOCK(S):
2215+RECORD LOCKS space id 0 page no 307 n bits 72 index `PRIMARY` of table `test`.`a` trx id 3404 lock_mode X locks rec but not gap
2216+Record lock, heap no 3 PHYSICAL RECORD: n_fields 6; compact format; info bits 0
2217+ 0: len 4; hex 80000002; asc ;;
2218+ 1: len 6; hex 000000003404; asc 4 ;;
2219+ 2: len 7; hex 040000163b2515; asc ;% ;;
2220+ 3: len 4; hex 80000063; asc c;;
2221+ 4: len 1; hex 01; asc ;;
2222+ 5: len 8; hex 8000124a7c1acb8c; asc J| ;;
2223+
2224+*** (2) WAITING FOR THIS LOCK TO BE GRANTED:
2225+RECORD LOCKS space id 0 page no 307 n bits 72 index `PRIMARY` of table `test`.`a` trx id 3404 lock_mode X locks rec but not gap waiting
2226+Record lock, heap no 5 PHYSICAL RECORD: n_fields 6; compact format; info bits 0
2227+ 0: len 4; hex 80000004; asc ;;
2228+ 1: len 6; hex 000000003405; asc 4 ;;
2229+ 2: len 7; hex 0500000e7017e8; asc p ;;
2230+ 3: len 4; hex 80000062; asc b;;
2231+ 4: len 1; hex 01; asc ;;
2232+ 5: len 8; hex 8000124a7c1acbb6; asc J| ;;
2233+
2234+*** WE ROLL BACK TRANSACTION (2)
2235+END OF INNODB MONITOR OUTPUT
2236+============================
2237
2238=== modified file 't/pt-find/pt-find.t'
2239--- t/pt-find/pt-find.t 2012-12-07 22:46:51 +0000
2240+++ t/pt-find/pt-find.t 2012-12-20 23:20:32 +0000
2241@@ -22,9 +22,8 @@
2242 if ( !$dbh ) {
2243 plan skip_all => 'Cannot connect to sandbox master';
2244 }
2245-else {
2246- plan tests => 23;
2247-}
2248+
2249+$sb->load_file('master', 't/lib/samples/stored-objs.sql');
2250
2251 my $output;
2252 my $cnf = '/tmp/12345/my.sandbox.cnf';
2253@@ -111,6 +110,80 @@
2254 "--view that doesn't match"
2255 );
2256
2257+ # Test --procedure.
2258+ $output = `$cmd pt_find --procedure param1 --print`;
2259+ is(
2260+ $output,
2261+ "`pt_find`.`PROCEDURE simpleproc`\n",
2262+ '--procedure that matches'
2263+ );
2264+
2265+ $output = `$cmd pt_find --procedure blah --print`;
2266+ is(
2267+ $output,
2268+ '',
2269+ "--procedure that doesn't match"
2270+ );
2271+
2272+ # Test --function.
2273+ $output = `$cmd pt_find --function Hello --print`;
2274+ is(
2275+ $output,
2276+ "`pt_find`.`FUNCTION hello`\n",
2277+ '--function that matches'
2278+ );
2279+
2280+ $output = `$cmd pt_find --function blah --print`;
2281+ is(
2282+ $output,
2283+ '',
2284+ "--function that doesn't match"
2285+ );
2286+
2287+ # Test --trigger without --trigger-table.
2288+ $output = `$cmd pt_find --trigger 'INSERT INTO t2' --print`;
2289+ is(
2290+ $output,
2291+ "`pt_find`.`INSERT TRIGGER ins_trg on t1`\n",
2292+ '--trigger that matches without --trigger-table'
2293+ );
2294+
2295+ $output = `$cmd pt_find --trigger blah --print`;
2296+ is(
2297+ $output,
2298+ '',
2299+ "--trigger that doesn't match without --trigger-table"
2300+ );
2301+
2302+ # Test --trigger with --trigger-table.
2303+ $output = `$cmd pt_find --trigger 'INSERT INTO t2' --trigger-table t1 --print`;
2304+ is(
2305+ $output,
2306+ "`pt_find`.`INSERT TRIGGER ins_trg on t1`\n",
2307+ '--trigger that matches with matching --trigger-table'
2308+ );
2309+
2310+ $output = `$cmd pt_find --trigger blah --trigger-table t1 --print`;
2311+ is(
2312+ $output,
2313+ '',
2314+ "--trigger that doesn't match with matching --trigger-table"
2315+ );
2316+
2317+ $output = `$cmd pt_find --trigger 'INSERT INTO t2' --trigger-table foo --print`;
2318+ is(
2319+ $output,
2320+ '',
2321+ '--trigger that matches with non-matching --trigger-table'
2322+ );
2323+
2324+ $output = `$cmd pt_find --trigger blah --trigger-table foo --print`;
2325+ is(
2326+ $output,
2327+ '',
2328+ "--trigger that doesn't match with non-matching --trigger-table"
2329+ );
2330+
2331 # Test NULL sizes.
2332 $output = `$cmd sakila --datasize NULL`,
2333 is(
2334@@ -223,4 +296,5 @@
2335 # #############################################################################
2336 $sb->wipe_clean($dbh);
2337 ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
2338+done_testing;
2339 exit;
2340
2341=== added file 't/pt-heartbeat/bugs.t'
2342--- t/pt-heartbeat/bugs.t 1970-01-01 00:00:00 +0000
2343+++ t/pt-heartbeat/bugs.t 2012-12-20 23:20:32 +0000
2344@@ -0,0 +1,115 @@
2345+#!/usr/bin/env perl
2346+
2347+BEGIN {
2348+ die "The PERCONA_TOOLKIT_BRANCH environment variable is not set.\n"
2349+ unless $ENV{PERCONA_TOOLKIT_BRANCH} && -d $ENV{PERCONA_TOOLKIT_BRANCH};
2350+ unshift @INC, "$ENV{PERCONA_TOOLKIT_BRANCH}/lib";
2351+};
2352+
2353+use strict;
2354+use warnings FATAL => 'all';
2355+use English qw(-no_match_vars);
2356+use Test::More;
2357+
2358+use POSIX qw( tzset );
2359+use File::Temp qw(tempfile);
2360+
2361+use PerconaTest;
2362+use Sandbox;
2363+require "$trunk/bin/pt-heartbeat";
2364+
2365+my $dp = new DSNParser(opts=>$dsn_opts);
2366+my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
2367+my $master_dbh = $sb->get_dbh_for('master');
2368+my $slave1_dbh = $sb->get_dbh_for('slave1');
2369+my $slave2_dbh = $sb->get_dbh_for('slave2');
2370+
2371+if ( !$master_dbh ) {
2372+ plan skip_all => 'Cannot connect to sandbox master';
2373+}
2374+elsif ( !$slave1_dbh ) {
2375+ plan skip_all => 'Cannot connect to sandbox slave1';
2376+}
2377+elsif ( !$slave2_dbh ) {
2378+ plan skip_all => 'Cannot connect to sandbox slave2';
2379+}
2380+
2381+unlink '/tmp/pt-heartbeat-sentinel';
2382+$sb->create_dbs($master_dbh, ['test']);
2383+$sb->wait_for_slaves();
2384+
2385+my $output;
2386+my $base_pidfile = (tempfile("/tmp/pt-heartbeat-test.XXXXXXXX", OPEN => 0, UNLINK => 0))[1];
2387+my $master_port = $sb->port_for('master');
2388+
2389+my @exec_pids;
2390+my @pidfiles;
2391+
2392+sub start_update_instance {
2393+ my ($port) = @_;
2394+ my $pidfile = "$base_pidfile.$port.pid";
2395+ push @pidfiles, $pidfile;
2396+
2397+ my $pid = fork();
2398+ if ( $pid == 0 ) {
2399+ my $cmd = "$trunk/bin/pt-heartbeat";
2400+ exec { $cmd } $cmd, qw(-h 127.0.0.1 -u msandbox -p msandbox -P), $port,
2401+ qw(--database test --table heartbeat --create-table),
2402+ qw(--update --interval 0.5 --pid), $pidfile;
2403+ exit 1;
2404+ }
2405+ push @exec_pids, $pid;
2406+
2407+ PerconaTest::wait_for_files($pidfile);
2408+ ok(
2409+ -f $pidfile,
2410+ "--update on $port started"
2411+ );
2412+}
2413+
2414+sub stop_all_instances {
2415+ my @pids = @exec_pids, map { chomp; $_ } map { slurp_file($_) } @pidfiles;
2416+ diag(`$trunk/bin/pt-heartbeat --stop >/dev/null`);
2417+
2418+ waitpid($_, 0) for @pids;
2419+ PerconaTest::wait_until(sub{ !-e $_ }) for @pidfiles;
2420+
2421+ unlink '/tmp/pt-heartbeat-sentinel';
2422+}
2423+
2424+# ############################################################################
2425+# pt-heartbeat handles timezones inconsistently
2426+# https://bugs.launchpad.net/percona-toolkit/+bug/886059
2427+# ############################################################################
2428+
2429+start_update_instance( $master_port );
2430+
2431+PerconaTest::wait_for_table($slave1_dbh, 'test.heartbeat', 'server_id=12345');
2432+
2433+my $slave1_dsn = $sb->dsn_for('slave1');
2434+# Using full_output here to work around a Perl bug: Only the first explicit
2435+# tzset works.
2436+($output) = full_output(sub {
2437+ local $ENV{TZ} = '-09:00';
2438+ tzset();
2439+ pt_heartbeat::main($slave1_dsn, qw(--database test --table heartbeat),
2440+ qw(--check --master-server-id), $master_port)
2441+});
2442+
2443+# If the servers use UTC then the lag should be 0.00, or at least
2444+# no greater than 9.99 for slow test boxes. When this fails, the
2445+# lag is like 25200.00 becaues the servers are hours off.
2446+like(
2447+ $output,
2448+ qr/\A\d.\d{2}$/,
2449+ "Bug 886059: pt-heartbeat doesn't get confused with differing timezones"
2450+);
2451+
2452+stop_all_instances();
2453+
2454+# ############################################################################
2455+# Done.
2456+# ############################################################################
2457+$sb->wipe_clean($master_dbh);
2458+ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
2459+done_testing;
2460
2461=== added file 't/pt-heartbeat/pxc.t'
2462--- t/pt-heartbeat/pxc.t 1970-01-01 00:00:00 +0000
2463+++ t/pt-heartbeat/pxc.t 2012-12-20 23:20:32 +0000
2464@@ -0,0 +1,388 @@
2465+#!/usr/bin/env perl
2466+
2467+BEGIN {
2468+ die "The PERCONA_TOOLKIT_BRANCH environment variable is not set.\n"
2469+ unless $ENV{PERCONA_TOOLKIT_BRANCH} && -d $ENV{PERCONA_TOOLKIT_BRANCH};
2470+ unshift @INC, "$ENV{PERCONA_TOOLKIT_BRANCH}/lib";
2471+};
2472+
2473+use strict;
2474+use warnings FATAL => 'all';
2475+use English qw(-no_match_vars);
2476+use Test::More;
2477+use Data::Dumper;
2478+
2479+use File::Temp qw(tempfile);
2480+
2481+use PerconaTest;
2482+use Sandbox;
2483+
2484+require "$trunk/bin/pt-heartbeat";
2485+# Do this after requiring pt-hb, since it uses Mo
2486+require VersionParser;
2487+
2488+my $dp = new DSNParser(opts=>$dsn_opts);
2489+my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
2490+my $node1 = $sb->get_dbh_for('node1');
2491+my $node2 = $sb->get_dbh_for('node2');
2492+my $node3 = $sb->get_dbh_for('node3');
2493+
2494+if ( !$node1 ) {
2495+ plan skip_all => 'Cannot connect to cluster node1';
2496+}
2497+elsif ( !$node2 ) {
2498+ plan skip_all => 'Cannot connect to cluster node2';
2499+}
2500+elsif ( !$node3 ) {
2501+ plan skip_all => 'Cannot connect to cluster node3';
2502+}
2503+
2504+my $db_flavor = VersionParser->new($node1)->flavor();
2505+if ( $db_flavor !~ /XtraDB Cluster/ ) {
2506+ plan skip_all => "PXC tests";
2507+}
2508+
2509+my $node1_dsn = $sb->dsn_for('node1');
2510+my $node2_dsn = $sb->dsn_for('node2');
2511+my $node3_dsn = $sb->dsn_for('node3');
2512+my $node1_port = $sb->port_for('node1');
2513+my $node2_port = $sb->port_for('node2');
2514+my $node3_port = $sb->port_for('node3');
2515+
2516+my $output;
2517+my $exit;
2518+my $base_pidfile = (tempfile("/tmp/pt-heartbeat-test.XXXXXXXX", OPEN => 0, UNLINK => 0))[1];
2519+my $sample = "t/pt-heartbeat/samples/";
2520+
2521+my $sentinel = '/tmp/pt-heartbeat-sentinel';
2522+
2523+# Remove any leftover instances
2524+diag(`$trunk/bin/pt-heartbeat --stop >/dev/null`);
2525+sleep 1;
2526+
2527+diag(`rm -rf $sentinel >/dev/null 2>&1`);
2528+$sb->create_dbs($node1, ['test']);
2529+
2530+my @exec_pids;
2531+my @pidfiles;
2532+
2533+sub start_update_instance {
2534+ my ($port) = @_;
2535+ my $pidfile = "$base_pidfile.$port.pid";
2536+ push @pidfiles, $pidfile;
2537+
2538+ my $pid = fork();
2539+ die "Cannot fork: $OS_ERROR" unless defined $pid;
2540+ if ( $pid == 0 ) {
2541+ my $cmd = "$trunk/bin/pt-heartbeat";
2542+ exec { $cmd } $cmd, qw(-h 127.0.0.1 -u msandbox -p msandbox -P), $port,
2543+ qw(--database test --table heartbeat --create-table),
2544+ qw(--update --interval 0.5 --pid), $pidfile;
2545+ exit 1;
2546+ }
2547+ push @exec_pids, $pid;
2548+
2549+ PerconaTest::wait_for_files($pidfile);
2550+ ok(
2551+ -f $pidfile,
2552+ "--update on $port started"
2553+ );
2554+}
2555+
2556+sub stop_all_instances {
2557+ my @pids = @exec_pids, map { chomp; $_ } map { slurp_file($_) } @pidfiles;
2558+ diag(`$trunk/bin/pt-heartbeat --stop >/dev/null`);
2559+
2560+ waitpid($_, 0) for @pids;
2561+ PerconaTest::wait_until(sub{ !-e $_ }) for @pidfiles;
2562+
2563+ unlink $sentinel;
2564+}
2565+
2566+foreach my $port ( map { $sb->port_for($_) } qw(node1 node2 node3) ) {
2567+ start_update_instance($port);
2568+}
2569+
2570+# #############################################################################
2571+# Basic cluster tests
2572+# #############################################################################
2573+
2574+my $rows = $node1->selectall_hashref("select * from test.heartbeat", 'server_id');
2575+
2576+is(
2577+ scalar keys %$rows,
2578+ 3,
2579+ "Sanity check: All nodes are in the heartbeat table"
2580+);
2581+
2582+my $only_slave_data = {
2583+ map {
2584+ $_ => {
2585+ relay_master_log_file => $rows->{$_}->{relay_master_log_file},
2586+ exec_master_log_pos => $rows->{$_}->{exec_master_log_pos},
2587+ } } keys %$rows
2588+};
2589+
2590+my $same_data = { relay_master_log_file => undef, exec_master_log_pos => undef };
2591+is_deeply(
2592+ $only_slave_data,
2593+ {
2594+ 12345 => $same_data,
2595+ 12346 => $same_data,
2596+ 12347 => $same_data,
2597+ },
2598+ "Sanity check: No slave data (relay log or master pos) is stored"
2599+);
2600+
2601+$output = output(sub{
2602+ pt_heartbeat::main($node1_dsn, qw(-D test --check)),
2603+ },
2604+ stderr => 1,
2605+);
2606+
2607+like(
2608+ $output,
2609+ qr/\QThe --master-server-id option must be specified because the heartbeat table `test`.`heartbeat`/,
2610+ "pt-heartbeat --check + PXC doesn't autodetect a master if there isn't any"
2611+);
2612+
2613+$output = output(sub{
2614+ pt_heartbeat::main($node1_dsn, qw(-D test --check),
2615+ '--master-server-id', $node3_port),
2616+ },
2617+ stderr => 1,
2618+);
2619+
2620+$output =~ s/\d\.\d{2}/0.00/g;
2621+is(
2622+ $output,
2623+ "0.00\n",
2624+ "pt-heartbeat --check + PXC works with --master-server-id"
2625+);
2626+
2627+# Test --monitor
2628+
2629+$output = output(sub {
2630+ pt_heartbeat::main($node1_dsn,
2631+ qw(-D test --monitor --run-time 1s),
2632+ '--master-server-id', $node3_port)
2633+ },
2634+ stderr => 1,
2635+);
2636+
2637+$output =~ s/\d\.\d{2}/0.00/g;
2638+is(
2639+ $output,
2640+ "0.00s [ 0.00s, 0.00s, 0.00s ]\n",
2641+ "--monitor works"
2642+);
2643+
2644+# Try to generate some lag between cluster nodes. Rather brittle at the moment.
2645+
2646+# Lifted from alter active table
2647+my $pt_osc_sample = "t/pt-online-schema-change/samples";
2648+
2649+my $query_table_stop = "/tmp/query_table.$PID.stop";
2650+my $query_table_pid = "/tmp/query_table.$PID.pid";
2651+my $query_table_output = "/tmp/query_table.$PID.output";
2652+
2653+$sb->create_dbs($node1, ['pt_osc']);
2654+$sb->load_file('master', "$pt_osc_sample/basic_no_fks_innodb.sql");
2655+
2656+$node1->do("USE pt_osc");
2657+$node1->do("TRUNCATE TABLE t");
2658+$node1->do("LOAD DATA INFILE '$trunk/$pt_osc_sample/basic_no_fks.data' INTO TABLE t");
2659+$node1->do("ANALYZE TABLE t");
2660+$sb->wait_for_slaves();
2661+
2662+diag(`rm -rf $query_table_stop`);
2663+diag(`echo > $query_table_output`);
2664+
2665+my $cmd = "$trunk/$pt_osc_sample/query_table.pl";
2666+system("$cmd 127.0.0.1 $node1_port pt_osc t id $query_table_stop $query_table_pid >$query_table_output 2>&1 &");
2667+wait_until(sub{-e $query_table_pid});
2668+
2669+# Reload sakila
2670+system "$trunk/sandbox/load-sakila-db $node1_port &";
2671+
2672+$output = output(sub {
2673+ pt_heartbeat::main($node3_dsn,
2674+ qw(-D test --monitor --run-time 5s),
2675+ '--master-server-id', $node1_port)
2676+ },
2677+ stderr => 1,
2678+);
2679+
2680+like(
2681+ $output,
2682+ qr/^(?:0\.(?:\d[1-9]|[1-9]\d)|\d*[1-9]\d*\.\d{2})s\s+\[/m,
2683+ "pt-heartbeat can detect replication lag between nodes"
2684+);
2685+
2686+diag(`touch $query_table_stop`);
2687+chomp(my $p = slurp_file($query_table_pid));
2688+wait_until(sub{!kill 0, $p});
2689+
2690+$node1->do(q{DROP DATABASE pt_osc});
2691+
2692+$sb->wait_for_slaves();
2693+
2694+# #############################################################################
2695+# cluster, node1 -> slave, run on node1
2696+# #############################################################################
2697+
2698+my ($slave_dbh, $slave_dsn) = $sb->start_sandbox(
2699+ server => 'cslave1',
2700+ type => 'slave',
2701+ master => 'node1',
2702+ env => q/BINLOG_FORMAT="ROW"/,
2703+);
2704+
2705+$sb->create_dbs($slave_dbh, ['test']);
2706+
2707+start_update_instance($sb->port_for('cslave1'));
2708+PerconaTest::wait_for_table($slave_dbh, "test.heartbeat", "1=1");
2709+
2710+$output = output(sub{
2711+ pt_heartbeat::main($slave_dsn, qw(-D test --check)),
2712+ },
2713+ stderr => 1,
2714+);
2715+
2716+like(
2717+ $output,
2718+ qr/\d\.\d{2}\n/,
2719+ "pt-heartbeat --check works on a slave of a cluster node"
2720+);
2721+
2722+$output = output(sub {
2723+ pt_heartbeat::main($slave_dsn,
2724+ qw(-D test --monitor --run-time 2s))
2725+ },
2726+ stderr => 1,
2727+);
2728+
2729+like(
2730+ $output,
2731+ qr/^\d.\d{2}s\s+\[/,
2732+ "pt-heartbeat --monitor + slave of a node1, without --master-server-id"
2733+);
2734+
2735+$output = output(sub {
2736+ pt_heartbeat::main($slave_dsn,
2737+ qw(-D test --monitor --run-time 2s),
2738+ '--master-server-id', $node3_port)
2739+ },
2740+ stderr => 1,
2741+);
2742+
2743+like(
2744+ $output,
2745+ qr/^\d.\d{2}s\s+\[/,
2746+ "pt-heartbeat --monitor + slave of node1, --master-server-id pointing to node3"
2747+);
2748+
2749+# #############################################################################
2750+# master -> node1 in cluster
2751+# #############################################################################
2752+
2753+# CAREFUL! See the comments in t/pt-table-checksum/pxc.t about cmaster.
2754+# Nearly everything applies here.
2755+
2756+my ($master_dbh, $master_dsn) = $sb->start_sandbox(
2757+ server => 'cmaster',
2758+ type => 'master',
2759+ env => q/BINLOG_FORMAT="ROW"/,
2760+);
2761+
2762+my $cmaster_port = $sb->port_for('cmaster');
2763+
2764+$sb->create_dbs($master_dbh, ['test']);
2765+
2766+$master_dbh->do("FLUSH LOGS");
2767+$master_dbh->do("RESET MASTER");
2768+
2769+$sb->set_as_slave('node1', 'cmaster');
2770+
2771+start_update_instance($sb->port_for('cmaster'));
2772+PerconaTest::wait_for_table($node1, "test.heartbeat", "server_id=$cmaster_port");
2773+
2774+$output = output(sub{
2775+ pt_heartbeat::main($node1_dsn, qw(-D test --check --print-master-server-id)),
2776+ },
2777+ stderr => 1,
2778+);
2779+
2780+like(
2781+ $output,
2782+ qr/^\d.\d{2} $cmaster_port$/,
2783+ "--print-master-id works for master -> $node1_port, when run from $node1_port"
2784+);
2785+
2786+# Wait until node2 & node3 get cmaster in their heartbeat tables
2787+$sb->wait_for_slaves(master => 'node1', slave => 'node2');
2788+$sb->wait_for_slaves(master => 'node1', slave => 'node3');
2789+
2790+foreach my $test (
2791+ [ $node2_port, $node2_dsn, $node2 ],
2792+ [ $node3_port, $node3_dsn, $node3 ],
2793+) {
2794+ my ($port, $dsn, $dbh) = @$test;
2795+
2796+ $output = output(sub{
2797+ pt_heartbeat::main($dsn, qw(-D test --check --print-master-server-id)),
2798+ },
2799+ stderr => 1,
2800+ );
2801+
2802+ # This could be made to work, see the node autodiscovery branch
2803+ TODO: {
2804+ local $::TODO = "cmaster -> node1, other nodes can't autodetect the master";
2805+ like(
2806+ $output,
2807+ qr/$cmaster_port/,
2808+ "--print-master-id works for master -> $node1_port, when run from $port"
2809+ );
2810+ }
2811+
2812+ $output = output(sub{
2813+ pt_heartbeat::main($dsn, qw(-D test --check --master-server-id), $cmaster_port),
2814+ },
2815+ stderr => 1,
2816+ );
2817+
2818+ $output =~ s/\d\.\d{2}/0.00/g;
2819+ is(
2820+ $output,
2821+ "0.00\n",
2822+ "--check + explicit --master-server-id work for master -> node1, run from $port"
2823+ );
2824+}
2825+
2826+# ############################################################################
2827+# Stop the --update instances.
2828+# ############################################################################
2829+
2830+stop_all_instances();
2831+
2832+# ############################################################################
2833+# Disconnect & stop the two servers we started
2834+# ############################################################################
2835+
2836+# We have to do this after the --stop, otherwise the --update processes will
2837+# spew a bunch of warnings and clog
2838+
2839+$slave_dbh->disconnect;
2840+$master_dbh->disconnect;
2841+$sb->stop_sandbox('cslave1', 'cmaster');
2842+$node1->do("STOP SLAVE");
2843+$node1->do("RESET SLAVE");
2844+
2845+# #############################################################################
2846+# Done.
2847+# #############################################################################
2848+$sb->wipe_clean($node1);
2849+diag(`/tmp/12345/stop`);
2850+diag(`/tmp/12345/start`);
2851+ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
2852+done_testing;
2853
2854=== modified file 't/pt-ioprofile/pt-ioprofile.t'
2855--- t/pt-ioprofile/pt-ioprofile.t 2012-07-23 15:17:37 +0000
2856+++ t/pt-ioprofile/pt-ioprofile.t 2012-12-20 23:20:32 +0000
2857@@ -19,24 +19,22 @@
2858 my $dp = new DSNParser(opts=>$dsn_opts);
2859 my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
2860 my $dbh = $sb->get_dbh_for('master');
2861+my $have_strace = `which strace 2>/dev/null`;
2862
2863 if ( !$dbh ) {
2864 plan skip_all => "Cannot connect to master sandbox";
2865 }
2866-else {
2867- plan tests => 5;
2868+elsif ( !$have_strace ) {
2869+ plan skip_all => 'strace is not installed or not in PATH';
2870 }
2871
2872-my $output = "";
2873-
2874-$output = `$trunk/bin/pt-ioprofile --help 2>&1`;
2875+my $output = `$trunk/bin/pt-ioprofile --help 2>&1`;
2876 like(
2877 $output,
2878 qr/--version/,
2879 "--help"
2880 );
2881
2882-
2883 my $t0 = time;
2884 $output = `$trunk/bin/pt-ioprofile --run-time 3 2>&1`;
2885 my $t1 = time;
2886@@ -47,17 +45,16 @@
2887 "Runs without a file (bug 925778)"
2888 );
2889
2890-TODO: {
2891- local $::TODO = "Timing-related test, may occasionally fail";
2892- # If the system is really slow, it may take a second to process the files
2893- # and then clean up all the temp stuff. We'll give it a few seconds benefit of the doubt.
2894- cmp_ok(
2895- int($t1 - $t0),
2896- '<=',
2897- 6,
2898- "Runs for --run-time, more or less"
2899- );
2900-}
2901+# If the system is really slow, it may take a second to process the files
2902+# and then clean up all the temp stuff. We'll give it a few seconds benefit
2903+# of the doubt.
2904+cmp_ok(
2905+ int($t1 - $t0),
2906+ '<=',
2907+ 6,
2908+ "Runs for --run-time, more or less"
2909+);
2910+
2911 # #############################################################################
2912 # Short options.
2913 # #############################################################################
2914@@ -72,4 +69,4 @@
2915 # Done.
2916 # #############################################################################
2917 ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
2918-exit;
2919+done_testing;
2920
2921=== modified file 't/pt-kill/basics.t'
2922--- t/pt-kill/basics.t 2012-07-12 22:49:15 +0000
2923+++ t/pt-kill/basics.t 2012-12-20 23:20:32 +0000
2924@@ -35,7 +35,7 @@
2925
2926 # Shell out to a sleep(10) query and try to capture the query.
2927 # Backticks don't work here.
2928-system("/tmp/12345/use -h127.1 -P12345 -umsandbox -pmsandbox -e 'select sleep(5)' >/dev/null &");
2929+system("/tmp/12345/use -e 'select sleep(5)' >/dev/null &");
2930
2931 $output = `$cmd --busy-time 1s --print --run-time 10`;
2932
2933@@ -59,7 +59,7 @@
2934 # --iterations was 0, and another bug when --run-time was not respected.
2935 # Do it all over again, this time with --iterations 0.
2936 # Re issue 1181, --iterations no longer exists, but we'll still keep this test.
2937-system("/tmp/12345/use -h127.1 -P12345 -umsandbox -pmsandbox -e 'select sleep(10)' >/dev/null&");
2938+system("/tmp/12345/use -e 'select sleep(10)' >/dev/null&");
2939 $output = `$cmd --busy-time 1s --print --run-time 11s`;
2940 @times = $output =~ m/\(Query (\d+) sec\)/g;
2941 ok(
2942
2943=== modified file 't/pt-kill/kill.t'
2944--- t/pt-kill/kill.t 2012-12-04 21:05:32 +0000
2945+++ t/pt-kill/kill.t 2012-12-20 23:20:32 +0000
2946@@ -35,7 +35,7 @@
2947 # TODO: These tests need something to match, so we background
2948 # a SLEEP(4) query and match that, but this isn't ideal because
2949 # it's time-based. Better is to use a specific db and --match-db.
2950-my $sys_cmd = "/tmp/12345/use -h127.1 -P12345 -umsandbox -pmsandbox -e 'select sleep(4)' >/dev/null 2>&1 &";
2951+my $sys_cmd = "/tmp/12345/use -e 'select sleep(4)' >/dev/null 2>&1 &";
2952
2953 # #############################################################################
2954 # Test that --kill kills the connection.
2955@@ -83,7 +83,7 @@
2956 # Here's how this works. This cmd is going to try 2 queries on the same
2957 # connection: sleep5 and sleep3. --kill-query will kill sleep5 causing
2958 # sleep3 to start using the same connection id (pid).
2959-system("/tmp/12345/use -h127.1 -P12345 -umsandbox -pmsandbox -e 'select sleep(5); select sleep(3)' >/dev/null&");
2960+system("/tmp/12345/use -e 'select sleep(5); select sleep(3)' >/dev/null&");
2961 sleep 0.5;
2962 $rows = $dbh->selectall_hashref('show processlist', 'id');
2963 $pid = 0; # reuse, reset
2964
2965=== modified file 't/pt-mysql-summary/pt-mysql-summary.t'
2966--- t/pt-mysql-summary/pt-mysql-summary.t 2012-11-27 22:05:45 +0000
2967+++ t/pt-mysql-summary/pt-mysql-summary.t 2012-12-20 23:20:32 +0000
2968@@ -19,13 +19,18 @@
2969
2970 local $ENV{PTDEBUG} = "";
2971
2972+# mysqldump from earlier versions doesn't seem to work with 5.6,
2973+# so use the actual mysqldump from each MySQL bin which should
2974+# always be compatible with itself.
2975+my $env = qq\CMD_MYSQLDUMP="$ENV{PERCONA_TOOLKIT_SANDBOX}/bin/mysqldump"\;
2976+
2977 #
2978 # --save-samples
2979 #
2980
2981 my $dir = tempdir( "percona-testXXXXXXXX", CLEANUP => 1 );
2982
2983-`$trunk/bin/$tool --sleep 1 --save-samples $dir -- --defaults-file=/tmp/12345/my.sandbox.cnf`;
2984+`$env $trunk/bin/$tool --sleep 1 --save-samples $dir -- --defaults-file=/tmp/12345/my.sandbox.cnf`;
2985
2986 ok(
2987 -e $dir,
2988@@ -41,13 +46,13 @@
2989 "And leaves all files in there"
2990 ) or diag($n_files, `ls -l $dir`);
2991
2992-undef($dir);
2993+undef($dir); # rm the dir because CLEANUP => 1
2994
2995 #
2996 # --databases
2997 #
2998
2999-my $out = `$trunk/bin/$tool --sleep 1 --databases mysql 2>/dev/null -- --defaults-file=/tmp/12345/my.sandbox.cnf`;
3000+my $out = `$env $trunk/bin/$tool --sleep 1 --databases mysql 2>/dev/null -- --defaults-file=/tmp/12345/my.sandbox.cnf`;
3001
3002 like(
3003 $out,
3004@@ -61,8 +66,7 @@
3005 no_diff(
3006 sub {
3007 local $ENV{_NO_FALSE_NEGATIVES} = 1;
3008- my $out = `$trunk/bin/$tool --read-samples $trunk/t/pt-mysql-summary/samples/temp00$i -- --defaults-file=/tmp/12345/my.sandbox.cnf | tail -n+3 | perl -wlnpe 's/Skipping schema analysis.*/Skipping schema analysis/'`;
3009- print $out;
3010+ print `$env $trunk/bin/$tool --read-samples $trunk/t/pt-mysql-summary/samples/temp00$i -- --defaults-file=/tmp/12345/my.sandbox.cnf | tail -n+3 | perl -wlnpe 's/Skipping schema analysis.*/Skipping schema analysis/'`
3011 },
3012 "t/pt-mysql-summary/samples/expected_output_temp00$i.txt",
3013 ),
3014@@ -82,4 +86,3 @@
3015 );
3016
3017 done_testing;
3018-exit;
3019
3020=== modified file 't/pt-online-schema-change/samples/bug_1045317.sql'
3021--- t/pt-online-schema-change/samples/bug_1045317.sql 2012-11-06 17:22:56 +0000
3022+++ t/pt-online-schema-change/samples/bug_1045317.sql 2012-12-20 23:20:32 +0000
3023@@ -6,5 +6,5 @@
3024 `val` ENUM('M','E','H') NOT NULL,
3025 PRIMARY KEY (`id`)
3026 );
3027-
3028 INSERT INTO `bits` VALUES (1, 'M'), (2, 'E'), (3, 'H');
3029+ANALYZE TABLE bits;
3030
3031=== modified file 't/pt-query-digest/explain.t'
3032--- t/pt-query-digest/explain.t 2012-11-21 16:58:40 +0000
3033+++ t/pt-query-digest/explain.t 2012-12-20 23:20:32 +0000
3034@@ -23,9 +23,6 @@
3035 if ( !$dbh ) {
3036 plan skip_all => 'Cannot connect to sandbox master';
3037 }
3038-else {
3039- plan tests => 6;
3040-}
3041
3042 my $sample = "t/pt-query-digest/samples/";
3043
3044@@ -90,7 +87,6 @@
3045 'Analysis for slow007 with --explain, failed',
3046 );
3047
3048-
3049 # #############################################################################
3050 # Issue 1196: mk-query-digest --explain is broken
3051 # #############################################################################
3052@@ -102,9 +98,9 @@
3053 '--report-format', 'profile,query_report',
3054 "$trunk/t/pt-query-digest/samples/issue_1196.log",)
3055 },
3056- ($sandbox_version ge '5.1'
3057- ? "t/pt-query-digest/samples/issue_1196-output.txt"
3058- : "t/pt-query-digest/samples/issue_1196-output-5.0.txt"),
3059+ ( $sandbox_version eq '5.6' ? "$sample/issue_1196-output-5.6.txt"
3060+ : $sandbox_version ge '5.1' ? "$sample/issue_1196-output.txt"
3061+ : "$sample/issue_1196-output-5.0.txt"),
3062 ),
3063 "--explain sparkline uses event db and doesn't crash ea (issue 1196"
3064 );
3065@@ -114,4 +110,4 @@
3066 # #############################################################################
3067 $sb->wipe_clean($dbh);
3068 ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
3069-exit;
3070+done_testing;
3071
3072=== added file 't/pt-query-digest/samples/issue_1196-output-5.6.txt'
3073--- t/pt-query-digest/samples/issue_1196-output-5.6.txt 1970-01-01 00:00:00 +0000
3074+++ t/pt-query-digest/samples/issue_1196-output-5.6.txt 2012-12-20 23:20:32 +0000
3075@@ -0,0 +1,62 @@
3076+
3077+# Profile
3078+# Rank Query ID Response time Calls R/Call Apdx V/M EXPLAIN Item
3079+# ==== ================== ============= ===== ====== ==== ===== ======= ========
3080+# 1 0xD4B6A5CD2F2F485C 0.2148 100.0% 1 0.2148 1.00 0.00 TF>aa SELECT t
3081+
3082+# Query 1: 0 QPS, 0x concurrency, ID 0xD4B6A5CD2F2F485C at byte 0 ________
3083+# This item is included in the report because it matches --limit.
3084+# Scores: Apdex = 1.00 [1.0]*, V/M = 0.00
3085+# EXPLAIN sparkline: TF>aa
3086+# Query_time sparkline: | ^ |
3087+# Time range: all events occurred at 2010-12-14 16:12:28
3088+# Attribute pct total min max avg 95% stddev median
3089+# ============ === ======= ======= ======= ======= ======= ======= =======
3090+# Count 100 1
3091+# Exec time 100 215ms 215ms 215ms 215ms 215ms 0 215ms
3092+# Lock time 99 162us 162us 162us 162us 162us 0 162us
3093+# Rows sent 100 10 10 10 10 10 0 10
3094+# Rows examine 100 1.96k 1.96k 1.96k 1.96k 1.96k 0 1.96k
3095+# Query size 100 82 82 82 82 82 0 82
3096+# String:
3097+# Databases issue_1196
3098+# Hosts localhost
3099+# Users root
3100+# Query_time distribution
3101+# 1us
3102+# 10us
3103+# 100us
3104+# 1ms
3105+# 10ms
3106+# 100ms ################################################################
3107+# 1s
3108+# 10s+
3109+# Tables
3110+# SHOW TABLE STATUS FROM `issue_1196` LIKE 't'\G
3111+# SHOW CREATE TABLE `issue_1196`.`t`\G
3112+# EXPLAIN /*!50100 PARTITIONS*/
3113+select t.a, count(*) from t join t t2 using(a) group by 1 order by 2 desc limit 10\G
3114+# *************************** 1. row ***************************
3115+# id: 1
3116+# select_type: SIMPLE
3117+# table: t
3118+# partitions: NULL
3119+# type: ALL
3120+# possible_keys: NULL
3121+# key: NULL
3122+# key_len: NULL
3123+# ref: NULL
3124+# rows: 14
3125+# Extra: Using temporary; Using filesort
3126+# *************************** 2. row ***************************
3127+# id: 1
3128+# select_type: SIMPLE
3129+# table: t2
3130+# partitions: NULL
3131+# type: ALL
3132+# possible_keys: NULL
3133+# key: NULL
3134+# key_len: NULL
3135+# ref: NULL
3136+# rows: 14
3137+# Extra: Using where; Using join buffer (Block Nested Loop)
3138
3139=== modified file 't/pt-table-checksum/basics.t'
3140--- t/pt-table-checksum/basics.t 2012-11-21 16:58:40 +0000
3141+++ t/pt-table-checksum/basics.t 2012-12-20 23:20:32 +0000
3142@@ -68,9 +68,7 @@
3143 ok(
3144 no_diff(
3145 sub { pt_table_checksum::main(@args) },
3146- $sandbox_version gt "5.1 " ? "$sample/default-results-5.5.txt"
3147- : $sandbox_version gt "5.0 " ? "$sample/default-results-5.1.txt"
3148- : "$sample/default-results-5.0.txt",
3149+ "$sample/default-results-$sandbox_version.txt",
3150 post_pipe => 'awk \'{print $2 " " $3 " " $4 " " $6 " " $8}\'',
3151 ),
3152 "Default checksum"
3153@@ -93,29 +91,28 @@
3154 ok(
3155 no_diff(
3156 sub { pt_table_checksum::main(@args, qw(--chunk-time 0)) },
3157- $sandbox_version gt "5.1" ? "$sample/static-chunk-size-results-5.5.txt"
3158- : $sandbox_version gt "5.0" ? "$sample/static-chunk-size-results-5.1.txt"
3159- : "$sample/static-chunk-size-results-5.0.txt",
3160+ "$sample/static-chunk-size-results-$sandbox_version.txt",
3161 post_pipe => 'awk \'{print $2 " " $3 " " $4 " " $5 " " $6 " " $8}\'',
3162 ),
3163 "Static chunk size (--chunk-time 0)"
3164 );
3165
3166+my $n_checksums = $sandbox_version eq "5.6" ? 89
3167+ : $sandbox_version eq "5.5" ? 90
3168+ : $sandbox_version eq "5.1" ? 89
3169+ : 85;
3170+
3171 $row = $master_dbh->selectrow_arrayref("select count(*) from percona.checksums");
3172 is(
3173 $row->[0],
3174- ( $sandbox_version gt "5.1" ? 90
3175- : $sandbox_version gt "5.0" ? 89
3176- : 85),
3177+ $n_checksums,
3178 'Expected checksums on master'
3179 );
3180
3181 $row = $slave1_dbh->selectrow_arrayref("select count(*) from percona.checksums");
3182 is(
3183 $row->[0],
3184- ( $sandbox_version gt "5.1" ? 90
3185- : $sandbox_version gt "5.0" ? 89
3186- : 85),
3187+ $n_checksums,
3188 'Expected checksums on slave'
3189 );
3190
3191
3192=== modified file 't/pt-table-checksum/error_handling.t'
3193--- t/pt-table-checksum/error_handling.t 2012-11-21 16:58:40 +0000
3194+++ t/pt-table-checksum/error_handling.t 2012-12-20 23:20:32 +0000
3195@@ -178,8 +178,8 @@
3196 # Use the --replicate table created by the previous ^ tests.
3197
3198 # Create a user that can't create the --replicate table.
3199-diag(`/tmp/12345/use -uroot -pmsandbox < $trunk/t/lib/samples/ro-checksum-user.sql`);
3200-diag(`/tmp/12345/use -uroot -pmsandbox -e "GRANT REPLICATION CLIENT, REPLICATION SLAVE ON *.* TO ro_checksum_user\@'%'"`);
3201+diag(`/tmp/12345/use -uroot < $trunk/t/lib/samples/ro-checksum-user.sql`);
3202+diag(`/tmp/12345/use -uroot -e "GRANT REPLICATION CLIENT, REPLICATION SLAVE ON *.* TO ro_checksum_user\@'%'"`);
3203
3204 # Remove the --replicate table from slave1 and slave2,
3205 # so it's only on the master...
3206@@ -199,7 +199,7 @@
3207 "CREATE DATABASE error and db is missing on slaves (bug 1039569)"
3208 );
3209
3210-diag(`/tmp/12345/use -uroot -pmsandbox -e "DROP USER ro_checksum_user\@'%'"`);
3211+diag(`/tmp/12345/use -uroot -e "DROP USER ro_checksum_user\@'%'"`);
3212
3213 # #############################################################################
3214 # Done.
3215
3216=== modified file 't/pt-table-checksum/issue_388.t'
3217--- t/pt-table-checksum/issue_388.t 2012-11-21 16:58:40 +0000
3218+++ t/pt-table-checksum/issue_388.t 2012-12-20 23:20:32 +0000
3219@@ -45,6 +45,7 @@
3220
3221 $output = output(
3222 sub { pt_table_checksum::main(@args, qw(-d test)) },
3223+ stderr => 1,
3224 );
3225
3226 unlike(
3227
3228=== modified file 't/pt-table-checksum/run_time.t'
3229--- t/pt-table-checksum/run_time.t 2012-11-21 16:58:40 +0000
3230+++ t/pt-table-checksum/run_time.t 2012-12-20 23:20:32 +0000
3231@@ -44,7 +44,7 @@
3232 my $t = time - $t0;
3233
3234 ok(
3235- $t >= 1.5 && $t <= 2.5,
3236+ $t >= 1.1 && $t <= 2.5,
3237 "Ran in roughly --run-time 1 second"
3238 ) or diag("Actual run time: $t");
3239
3240
3241=== added file 't/pt-table-checksum/samples/default-results-5.6.txt'
3242--- t/pt-table-checksum/samples/default-results-5.6.txt 1970-01-01 00:00:00 +0000
3243+++ t/pt-table-checksum/samples/default-results-5.6.txt 2012-12-20 23:20:32 +0000
3244@@ -0,0 +1,41 @@
3245+ERRORS DIFFS ROWS SKIPPED TABLE
3246+0 0 0 0 mysql.columns_priv
3247+0 0 2 0 mysql.db
3248+0 0 0 0 mysql.event
3249+0 0 0 0 mysql.func
3250+0 0 39 0 mysql.help_category
3251+0 0 461 0 mysql.help_keyword
3252+0 0 1045 0 mysql.help_relation
3253+0 0 324 0 mysql.help_topic
3254+0 0 0 0 mysql.ndb_binlog_index
3255+0 0 0 0 mysql.plugin
3256+0 0 0 0 mysql.proc
3257+0 0 0 0 mysql.procs_priv
3258+0 0 2 0 mysql.proxies_priv
3259+0 0 0 0 mysql.servers
3260+0 0 0 0 mysql.tables_priv
3261+0 0 0 0 mysql.time_zone
3262+0 0 0 0 mysql.time_zone_leap_second
3263+0 0 0 0 mysql.time_zone_name
3264+0 0 0 0 mysql.time_zone_transition
3265+0 0 0 0 mysql.time_zone_transition_type
3266+0 0 2 0 mysql.user
3267+0 0 42 0 percona_test.checksums
3268+0 0 1 0 percona_test.load_data
3269+0 0 1 0 percona_test.sentinel
3270+0 0 200 0 sakila.actor
3271+0 0 603 0 sakila.address
3272+0 0 16 0 sakila.category
3273+0 0 600 0 sakila.city
3274+0 0 109 0 sakila.country
3275+0 0 599 0 sakila.customer
3276+0 0 1000 0 sakila.film
3277+0 0 5462 0 sakila.film_actor
3278+0 0 1000 0 sakila.film_category
3279+0 0 1000 0 sakila.film_text
3280+0 0 4581 0 sakila.inventory
3281+0 0 6 0 sakila.language
3282+0 0 16049 0 sakila.payment
3283+0 0 16044 0 sakila.rental
3284+0 0 2 0 sakila.staff
3285+0 0 2 0 sakila.store
3286
3287=== added file 't/pt-table-checksum/samples/repl-table-myisam.sql'
3288--- t/pt-table-checksum/samples/repl-table-myisam.sql 1970-01-01 00:00:00 +0000
3289+++ t/pt-table-checksum/samples/repl-table-myisam.sql 2012-12-20 23:20:32 +0000
3290@@ -0,0 +1,19 @@
3291+DROP DATABASE IF EXISTS percona;
3292+CREATE DATABASE percona;
3293+USE percona;
3294+CREATE TABLE checksums (
3295+ db char(64) NOT NULL,
3296+ tbl char(64) NOT NULL,
3297+ chunk int NOT NULL,
3298+ chunk_time float NULL,
3299+ chunk_index varchar(200) NULL,
3300+ lower_boundary text NULL,
3301+ upper_boundary text NULL,
3302+ this_crc char(40) NOT NULL,
3303+ this_cnt int NOT NULL,
3304+ master_crc char(40) NULL,
3305+ master_cnt int NULL,
3306+ ts timestamp NOT NULL,
3307+ PRIMARY KEY (db, tbl, chunk),
3308+ INDEX ts_db_tbl (ts, db, tbl)
3309+) ENGINE=MyISAM;
3310
3311=== added file 't/pt-table-checksum/samples/static-chunk-size-results-5.6.txt'
3312--- t/pt-table-checksum/samples/static-chunk-size-results-5.6.txt 1970-01-01 00:00:00 +0000
3313+++ t/pt-table-checksum/samples/static-chunk-size-results-5.6.txt 2012-12-20 23:20:32 +0000
3314@@ -0,0 +1,41 @@
3315+ERRORS DIFFS ROWS CHUNKS SKIPPED TABLE
3316+0 0 0 1 0 mysql.columns_priv
3317+0 0 2 1 0 mysql.db
3318+0 0 0 1 0 mysql.event
3319+0 0 0 1 0 mysql.func
3320+0 0 39 1 0 mysql.help_category
3321+0 0 461 1 0 mysql.help_keyword
3322+0 0 1045 1 0 mysql.help_relation
3323+0 0 324 1 0 mysql.help_topic
3324+0 0 0 1 0 mysql.ndb_binlog_index
3325+0 0 0 1 0 mysql.plugin
3326+0 0 0 1 0 mysql.proc
3327+0 0 0 1 0 mysql.procs_priv
3328+0 0 2 1 0 mysql.proxies_priv
3329+0 0 0 1 0 mysql.servers
3330+0 0 0 1 0 mysql.tables_priv
3331+0 0 0 1 0 mysql.time_zone
3332+0 0 0 1 0 mysql.time_zone_leap_second
3333+0 0 0 1 0 mysql.time_zone_name
3334+0 0 0 1 0 mysql.time_zone_transition
3335+0 0 0 1 0 mysql.time_zone_transition_type
3336+0 0 2 1 0 mysql.user
3337+0 0 42 1 0 percona_test.checksums
3338+0 0 1 1 0 percona_test.load_data
3339+0 0 1 1 0 percona_test.sentinel
3340+0 0 200 1 0 sakila.actor
3341+0 0 603 1 0 sakila.address
3342+0 0 16 1 0 sakila.category
3343+0 0 600 1 0 sakila.city
3344+0 0 109 1 0 sakila.country
3345+0 0 599 1 0 sakila.customer
3346+0 0 1000 1 0 sakila.film
3347+0 0 5462 8 0 sakila.film_actor
3348+0 0 1000 1 0 sakila.film_category
3349+0 0 1000 1 0 sakila.film_text
3350+0 0 4581 7 0 sakila.inventory
3351+0 0 6 1 0 sakila.language
3352+0 0 16049 19 0 sakila.payment
3353+0 0 16044 19 0 sakila.rental
3354+0 0 2 1 0 sakila.staff
3355+0 0 2 1 0 sakila.store
3356
3357=== modified file 't/pt-table-checksum/skip_innodb.t'
3358--- t/pt-table-checksum/skip_innodb.t 2012-11-21 16:58:40 +0000
3359+++ t/pt-table-checksum/skip_innodb.t 2012-12-20 23:20:32 +0000
3360@@ -15,11 +15,12 @@
3361 use Sandbox;
3362 require "$trunk/bin/pt-table-checksum";
3363
3364-diag("Stopping/reconfiguring/restarting sandboxes 12348 and 12349");
3365-diag(`$trunk/sandbox/stop-sandbox 12348 >/dev/null`);
3366+if ( $sandbox_version eq '5.6' ) {
3367+ plan skip_all => 'http://bugs.mysql.com/67798';
3368+}
3369+
3370+diag(`$trunk/sandbox/stop-sandbox 12348 12349 >/dev/null`);
3371 diag(`SKIP_INNODB=1 $trunk/sandbox/start-sandbox master 12348 >/dev/null`);
3372-
3373-diag(`$trunk/sandbox/stop-sandbox 12349 >/dev/null`);
3374 diag(`SKIP_INNODB=1 $trunk/sandbox/start-sandbox slave 12349 12348 >/dev/null`);
3375
3376 my $dp = new DSNParser(opts=>$dsn_opts);
3377@@ -33,9 +34,6 @@
3378 elsif ( !$slave_dbh ) {
3379 plan skip_all => 'Cannot connect to sandbox slave 12349';
3380 }
3381-else {
3382- plan tests => 3;
3383-}
3384
3385 # The sandbox servers run with lock_wait_timeout=3 and it's not dynamic
3386 # so we need to specify --lock-wait-timeout=3 else the tool will die.
3387@@ -45,6 +43,26 @@
3388 my $output;
3389 my $retval;
3390
3391+if ( $sandbox_version ge '5.6' ) {
3392+ # Before MySQL 5.6, even with the InnoDB engine off, creating an InnoDB
3393+ # table would simply result in:
3394+ #
3395+ # mysql> create table t (i int) engine=innodb;
3396+ # Query OK, 0 rows affected, 2 warnings (0.01 sec)
3397+ #
3398+ # mysql> show warnings;
3399+ # +---------+------+-------------------------------------------+
3400+ # | Level | Code | Message |
3401+ # +---------+------+-------------------------------------------+
3402+ # | Warning | 1286 | Unknown table engine 'innodb' |
3403+ # | Warning | 1266 | Using storage engine MyISAM for table 't' |
3404+ # +---------+------+-------------------------------------------+
3405+ #
3406+ # But 5.6 throws an error. So we have to create the table manually.
3407+ $sb->load_file('master1', "t/pt-table-checksum/samples/repl-table-myisam.sql");
3408+ $sb->wait_for_slaves(master => 'master1', slave => 'master2');
3409+}
3410+
3411 $output = output(
3412 sub { $retval = pt_table_checksum::main(@args) },
3413 stderr => 1,
3414@@ -60,13 +78,12 @@
3415 $retval,
3416 0,
3417 "0 exit status (bug 996110)"
3418-);
3419+) or diag($output);
3420
3421 # #############################################################################
3422 # Done.
3423 # #############################################################################
3424-diag('Shutting down sandboxes');
3425-diag(`$trunk/sandbox/stop-sandbox 12349 >/dev/null`);
3426-diag(`$trunk/sandbox/stop-sandbox 12348 >/dev/null`);
3427+$sb->wipe_clean($master_dbh);
3428+diag(`$trunk/sandbox/stop-sandbox 12349 12348 >/dev/null`);
3429 ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
3430-exit;
3431+done_testing;
3432
3433=== modified file 't/pt-table-sync/basics.t'
3434--- t/pt-table-sync/basics.t 2012-06-07 14:25:44 +0000
3435+++ t/pt-table-sync/basics.t 2012-12-20 23:20:32 +0000
3436@@ -188,7 +188,7 @@
3437
3438 like(
3439 $output,
3440- qr/^REPLACE INTO `sakila`.`actor`\(`actor_id`, `first_name`, `last_name`, `last_update`\) VALUES \('30', 'SANDRA', 'PECK', '2006-02-15 04:34:33'\)/,
3441+ qr/^REPLACE INTO `sakila`.`actor`\(`actor_id`, `first_name`, `last_name`, `last_update`\) VALUES \('30', 'SANDRA', 'PECK', '2006-02-15 11:34:33'\)/,
3442 "--replicate with char index col (bug 911996)"
3443 );
3444
3445
3446=== modified file 't/pt-upgrade/warnings.t'
3447--- t/pt-upgrade/warnings.t 2012-10-17 22:19:44 +0000
3448+++ t/pt-upgrade/warnings.t 2012-12-20 23:20:32 +0000
3449@@ -15,38 +15,36 @@
3450 use Sandbox;
3451 require "$trunk/bin/pt-upgrade";
3452
3453-# This runs immediately if the server is already running, else it starts it.
3454-diag(`$trunk/sandbox/start-sandbox master 12348 >/dev/null`);
3455+diag(`$trunk/sandbox/stop-sandbox master 12349 >/dev/null`);
3456+diag(`QUERY_CACHE_SIZE=1048576 $trunk/sandbox/start-sandbox master 12349 >/dev/null`);
3457
3458 my $dp = new DSNParser(opts=>$dsn_opts);
3459 my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
3460 my $dbh1 = $sb->get_dbh_for('master');
3461-my $dbh2 = $sb->get_dbh_for('master1');
3462+my $dbh2 = $sb->get_dbh_for('master2');
3463
3464 if ( !$dbh1 ) {
3465- diag(`$trunk/sandbox/stop-sandbox master 12348 >/dev/null`);
3466 plan skip_all => 'Cannot connect to sandbox master';
3467 }
3468 elsif ( !$dbh2 ) {
3469- diag(`$trunk/sandbox/stop-sandbox master 12348 >/dev/null`);
3470+ diag(`$trunk/sandbox/stop-sandbox master 12349 >/dev/null`);
3471 plan skip_all => 'Cannot connect to second sandbox master';
3472 }
3473
3474 $sb->load_file('master', 't/pt-upgrade/samples/001/tables.sql');
3475-$sb->load_file('master1', 't/pt-upgrade/samples/001/tables.sql');
3476+$sb->load_file('master2', 't/pt-upgrade/samples/001/tables.sql');
3477
3478 my $output;
3479-my $cmd = "$trunk/bin/pt-upgrade h=127.1,P=12345,u=msandbox,p=msandbox,L=1 P=12348 --compare results,warnings --zero-query-times --compare-results-method rows --limit 10";
3480+my $cmd = "$trunk/bin/pt-upgrade h=127.1,P=12345,u=msandbox,p=msandbox,L=1 P=12349 --compare results,warnings --zero-query-times --compare-results-method rows --limit 10";
3481
3482 # This test really deals with,
3483 # http://code.google.com/p/maatkit/issues/detail?id=754
3484 # http://bugs.mysql.com/bug.php?id=49634
3485
3486-$dbh2->do('set global query_cache_size=1000000');
3487-
3488 my $qc = $dbh2->selectrow_arrayref("show variables like 'query_cache_size'")->[1];
3489-ok(
3490- $qc > 999000,
3491+is(
3492+ $qc,
3493+ 1048576,
3494 'Query size'
3495 );
3496
3497@@ -62,7 +60,7 @@
3498 $output = `$cmd $trunk/t/pt-upgrade/samples/001/one-error.log`;
3499 like(
3500 $output,
3501- qr/# 3B323396273BC4C7-1 127.1:12348 Failed to execute query.+Unknown column 'borked' in 'field list' \[for Statement "select borked"\] at .+?\n\n/,
3502+ qr/# 3B323396273BC4C7-1 127.1:12349 Failed to execute query.+Unknown column 'borked' in 'field list' \[for Statement "select borked"\] at .+?\n\n/,
3503 '--clear-warnings',
3504 );
3505
3506@@ -78,22 +76,15 @@
3507 $output = `$cmd --no-clear-warnings $trunk/t/pt-upgrade/samples/001/one-error.log`;
3508 like(
3509 $output,
3510- qr/# 3B323396273BC4C7-1 127.1:12348 Failed to execute query.+Unknown column 'borked' in 'field list' \[for Statement "select borked"\] at .+?\n\n/,
3511+ qr/# 3B323396273BC4C7-1 127.1:12349 Failed to execute query.+Unknown column 'borked' in 'field list' \[for Statement "select borked"\] at .+?\n\n/,
3512 '--no-clear-warnings'
3513 );
3514
3515-$dbh2->do('set global query_cache_size=0');
3516-$qc = $dbh2->selectrow_arrayref("show variables like 'query_cache_size'")->[1];
3517-ok(
3518- $qc == 0,
3519- 'Query size'
3520-);
3521-
3522 # #############################################################################
3523 # Done.
3524 # #############################################################################
3525+diag(`$trunk/sandbox/stop-sandbox 12349 >/dev/null`);
3526 $sb->wipe_clean($dbh1);
3527-diag(`$trunk/sandbox/stop-sandbox master 12348 >/dev/null`);
3528 ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
3529 done_testing;
3530 exit;

Subscribers

People subscribed via source and target branches