Merge lp:~percona-toolkit-dev/percona-toolkit/fix-ptc-ts-col-bug-1163735 into lp:~percona-toolkit-dev/percona-toolkit/release-2.2.4

Proposed by Daniel Nichter
Status: Merged
Merged at revision: 587
Proposed branch: lp:~percona-toolkit-dev/percona-toolkit/fix-ptc-ts-col-bug-1163735
Merge into: lp:~percona-toolkit-dev/percona-toolkit/release-2.2.4
Diff against target: 120 lines (+65/-3)
6 files modified
bin/pt-table-checksum (+1/-1)
sandbox/start-sandbox (+4/-0)
t/pt-table-checksum/create_replicate_table.t (+1/-1)
t/pt-table-checksum/samples/checksum_tbl_truncated.sql (+1/-1)
t/pt-table-checksum/samples/explicit_defaults_for_timestamp.cnf (+1/-0)
t/pt-table-checksum/settings.t (+57/-0)
To merge this branch: bzr merge lp:~percona-toolkit-dev/percona-toolkit/fix-ptc-ts-col-bug-1163735
Reviewer Review Type Date Requested Status
Daniel Nichter Approve
Review via email: mp+171448@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Daniel Nichter (daniel-nichter) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/pt-table-checksum'
2--- bin/pt-table-checksum 2013-06-25 23:30:23 +0000
3+++ bin/pt-table-checksum 2013-06-26 01:32:25 +0000
4@@ -12042,7 +12042,7 @@
5 this_cnt int NOT NULL,
6 master_crc char(40) NULL,
7 master_cnt int NULL,
8- ts timestamp NOT NULL,
9+ ts timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
10 PRIMARY KEY (db, tbl, chunk),
11 INDEX ts_db_tbl (ts, db, tbl)
12 ) ENGINE=InnoDB;
13
14=== modified file 'sandbox/start-sandbox'
15--- sandbox/start-sandbox 2013-04-12 15:58:10 +0000
16+++ sandbox/start-sandbox 2013-06-26 01:32:25 +0000
17@@ -113,6 +113,10 @@
18 echo "query_cache_size=$QUERY_CACHE_SIZE" >> /tmp/$port/my.sandbox.cnf
19 fi
20
21+ if [ -n "$EXTRA_DEFAULTS_FILE" ]; then
22+ cat "$EXTRA_DEFAULTS_FILE" >> /tmp/$port/my.sandbox.cnf
23+ fi
24+
25 # If the sandbox is a slave, set it read_only.
26 if [ "$type" = "slave" ]; then
27 echo "read_only" >> /tmp/$port/my.sandbox.cnf
28
29=== modified file 't/pt-table-checksum/create_replicate_table.t'
30--- t/pt-table-checksum/create_replicate_table.t 2013-03-02 02:02:13 +0000
31+++ t/pt-table-checksum/create_replicate_table.t 2013-06-26 01:32:25 +0000
32@@ -80,7 +80,7 @@
33 this_cnt int NOT NULL,
34 master_crc char(40) NULL,
35 master_cnt int NULL,
36- ts timestamp NOT NULL,
37+ ts timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
38 PRIMARY KEY (db, tbl, chunk)
39 ) ENGINE=InnoDB;";
40
41
42=== modified file 't/pt-table-checksum/samples/checksum_tbl_truncated.sql'
43--- t/pt-table-checksum/samples/checksum_tbl_truncated.sql 2011-10-13 18:46:44 +0000
44+++ t/pt-table-checksum/samples/checksum_tbl_truncated.sql 2013-06-26 01:32:25 +0000
45@@ -12,6 +12,6 @@
46 this_cnt int NOT NULL,
47 master_crc char(40) NULL,
48 master_cnt int NULL,
49- ts timestamp NOT NULL,
50+ ts timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
51 PRIMARY KEY (db, tbl, chunk)
52 ) ENGINE=InnoDB;
53
54=== added file 't/pt-table-checksum/samples/explicit_defaults_for_timestamp.cnf'
55--- t/pt-table-checksum/samples/explicit_defaults_for_timestamp.cnf 1970-01-01 00:00:00 +0000
56+++ t/pt-table-checksum/samples/explicit_defaults_for_timestamp.cnf 2013-06-26 01:32:25 +0000
57@@ -0,0 +1,1 @@
58+explicit_defaults_for_timestamp=ON
59
60=== added file 't/pt-table-checksum/settings.t'
61--- t/pt-table-checksum/settings.t 1970-01-01 00:00:00 +0000
62+++ t/pt-table-checksum/settings.t 2013-06-26 01:32:25 +0000
63@@ -0,0 +1,57 @@
64+#!/usr/bin/env perl
65+
66+BEGIN {
67+ die "The PERCONA_TOOLKIT_BRANCH environment variable is not set.\n"
68+ unless $ENV{PERCONA_TOOLKIT_BRANCH} && -d $ENV{PERCONA_TOOLKIT_BRANCH};
69+ unshift @INC, "$ENV{PERCONA_TOOLKIT_BRANCH}/lib";
70+};
71+
72+use strict;
73+use warnings FATAL => 'all';
74+use English qw(-no_match_vars);
75+use Test::More;
76+
77+use PerconaTest;
78+use Sandbox;
79+require "$trunk/bin/pt-table-checksum";
80+
81+if ( $sandbox_version lt '5.6' ) {
82+ plan skip_all => 'Tests for MySQL 5.6';
83+}
84+
85+diag(`$trunk/sandbox/stop-sandbox 12348 >/dev/null`);
86+diag(`EXTRA_DEFAULTS_FILE="$trunk/t/pt-table-checksum/samples/explicit_defaults_for_timestamp.cnf" $trunk/sandbox/start-sandbox master 12348 >/dev/null`);
87+
88+my $dp = new DSNParser(opts=>$dsn_opts);
89+my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
90+my $master_dbh = $sb->get_dbh_for('master1');
91+
92+if ( !$master_dbh ) {
93+ plan skip_all => 'Cannot connect to sandbox master 12348';
94+}
95+
96+my $master_dsn = 'h=127.1,P=12348,u=msandbox,p=msandbox';
97+my @args = ($master_dsn, '--max-load', '');
98+my $output;
99+my $retval;
100+
101+$output = output(
102+ sub { $retval = pt_table_checksum::main(@args, qw(-t mysql.user)) },
103+ stderr => 1,
104+);
105+
106+unlike(
107+ $output,
108+ qr/error 1364/i,
109+ "explicit_defaults_for_timestamp (bug 1163735): no error"
110+);
111+
112+# Exit will be non-zero because of "Diffs cannot be detected because
113+# no slaves were found."
114+
115+# #############################################################################
116+# Done.
117+# #############################################################################
118+diag(`$trunk/sandbox/stop-sandbox 12348 >/dev/null`);
119+ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
120+done_testing;

Subscribers

People subscribed via source and target branches

to all changes: