Merge lp:~percona-toolkit-dev/percona-toolkit/fix-ptc-slave-binglog-formats-on-5.0 into lp:percona-toolkit/2.1

Proposed by Daniel Nichter
Status: Merged
Merged at revision: 435
Proposed branch: lp:~percona-toolkit-dev/percona-toolkit/fix-ptc-slave-binglog-formats-on-5.0
Merge into: lp:percona-toolkit/2.1
Diff against target: 101 lines (+40/-28)
2 files modified
bin/pt-table-checksum (+12/-4)
t/pt-table-checksum/bugs.t (+28/-24)
To merge this branch: bzr merge lp:~percona-toolkit-dev/percona-toolkit/fix-ptc-slave-binglog-formats-on-5.0
Reviewer Review Type Date Requested Status
Daniel Nichter Approve
Review via email: mp+131701@code.launchpad.net
To post a comment you must log in.
437. By Daniel Nichter

Presume STATEMENT binlog format if < 5.1.5 and still check other slaves in case they're newer versions of MySQL.

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 2012-10-22 18:17:08 +0000
3+++ bin/pt-table-checksum 2012-10-26 23:08:23 +0000
4@@ -8555,12 +8555,20 @@
5
6 # https://bugs.launchpad.net/percona-toolkit/+bug/938068
7 if ( $o->get('check-binlog-format') ) {
8- my ($master_binlog) = $master_dbh->selectrow_array(
9- 'SELECT @@binlog_format');
10+ my $master_binlog = 'STATEMENT';
11+ if ( VersionParser->new($master_dbh) >= '5.1.5' ) {
12+ ($master_binlog) = $master_dbh->selectrow_array(
13+ 'SELECT @@binlog_format');
14+ }
15+
16 my $err = '';
17 for my $slave_cxn (@$slaves) {
18- my ($slave_binlog) = $slave_cxn->dbh->selectrow_array(
19- 'SELECT @@binlog_format');
20+ my $slave_binlog = 'STATEMENT';
21+ if ( VersionParser->new($slave_cxn->dbh) >= '5.1.5' ) {
22+ ($slave_binlog) = $slave_cxn->dbh->selectrow_array(
23+ 'SELECT @@binlog_format');
24+ }
25+
26 if ( $master_binlog ne $slave_binlog ) {
27 $err .= $master_cxn->name() . " has binlog_format "
28 . $master_binlog . " but replica " . $slave_cxn->name()
29
30=== modified file 't/pt-table-checksum/bugs.t'
31--- t/pt-table-checksum/bugs.t 2012-10-19 22:57:53 +0000
32+++ t/pt-table-checksum/bugs.t 2012-10-26 23:08:23 +0000
33@@ -180,9 +180,10 @@
34 # https://bugs.launchpad.net/percona-toolkit/+bug/1016131
35 # #############################################################################
36
37-($output) = full_output(
38+($output) = output(
39 sub { pt_table_checksum::main(@args, '--tables', 'mysql.user,mysql.host',
40 '--columns', 'some_fale_column') },
41+ stderr => 1,
42 );
43
44 like(
45@@ -196,30 +197,33 @@
46 # https://bugs.launchpad.net/percona-toolkit/+bug/938068
47 # #############################################################################
48
49-{
50-diag("Adding two new slaves to master");
51-local $ENV{BINLOG_FORMAT} = 'ROW';
52-diag(`$trunk/sandbox/start-sandbox slave 12348 12345`);
53-local $ENV{BINLOG_FORMAT} = 'MIXED';
54-diag(`$trunk/sandbox/start-sandbox slave 12349 12348`);
55-
56-$output = output( sub { pt_table_checksum::main(@args) }, stderr => 1 );
57-
58-my $re = qr/ has binlog_format .*? has binlog_format (\S+)\./msi;
59-like(
60- $output,
61- $re,
62- "Bug 938068: doesn't warn if binlog_format=row or mixed on slaves"
63-);
64-
65-is_deeply(
66- [ $output =~ /$re/g ],
67- [ 'ROW', 'MIXED' ],
68- "...and warns for both level 1 and level 2 slaves"
69-) or diag($output);
70-
71-diag(`$trunk/sandbox/stop-sandbox 12348 12349`);
72+SKIP: {
73+ skip "binlog_format tests require MySQL 5.1 and newer", 2
74+ unless $sandbox_version ge '5.1';
75+
76+ local $ENV{BINLOG_FORMAT} = 'ROW';
77+ diag(`$trunk/sandbox/start-sandbox slave 12348 12345`);
78+ local $ENV{BINLOG_FORMAT} = 'MIXED';
79+ diag(`$trunk/sandbox/start-sandbox slave 12349 12348`);
80+
81+ $output = output( sub { pt_table_checksum::main(@args) }, stderr => 1 );
82+
83+ my $re = qr/ has binlog_format .*? has binlog_format (\S+)\./msi;
84+ like(
85+ $output,
86+ $re,
87+ "Bug 938068: doesn't warn if binlog_format=row or mixed on slaves"
88+ );
89+
90+ is_deeply(
91+ [ $output =~ /$re/g ],
92+ [ 'ROW', 'MIXED' ],
93+ "...and warns for both level 1 and level 2 slaves"
94+ ) or diag($output);
95+
96+ diag(`$trunk/sandbox/stop-sandbox 12348 12349`);
97 }
98+
99 # #############################################################################
100 # Done.
101 # #############################################################################

Subscribers

People subscribed via source and target branches