Merge lp:~gryp/percona-toolkit/bug1311584 into lp:percona-toolkit/2.2

Proposed by Kenny Gryp on 2014-04-23
Status: Needs review
Proposed branch: lp:~gryp/percona-toolkit/bug1311584
Merge into: lp:percona-toolkit/2.2
Diff against target: 60 lines (+21/-2)
3 files modified
bin/pt-table-sync (+2/-1)
t/pt-table-sync/columns.t (+6/-1)
t/pt-table-sync/samples/before.sql (+13/-0)
To merge this branch: bzr merge lp:~gryp/percona-toolkit/bug1311584
Reviewer Review Type Date Requested Status
Daniel Nichter 2014-04-23 Pending
Review via email: mp+216869@code.launchpad.net

Commit message

Fix of bug 1311584: remove case sensitivity for --ignore-columns

Description of the change

Fix of bug 1311584: remove case sensitivity for --ignore-columns

To post a comment you must log in.

Unmerged revisions

600. By root <email address hidden> on 2014-04-23

working fix now, this computer has the test-environment :)

599. By Kenny Gryp on 2014-04-23

fix bug https://bugs.launchpad.net/percona-toolkit/+bug/1311584, --ignore-columns should not be case sensitive

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/pt-table-sync'
2--- bin/pt-table-sync 2014-02-20 08:10:16 +0000
3+++ bin/pt-table-sync 2014-04-23 12:01:14 +0000
4@@ -10510,8 +10510,9 @@
5
6 # Determine which columns to compare.
7 my $ignore_columns = $o->get('ignore-columns');
8+ my %ignore_columns_lc = map { lc $_ => $ignore_columns->{$_} } keys %$ignore_columns;
9 my @compare_columns = grep {
10- !$ignore_columns->{lc $_};
11+ !$ignore_columns_lc{lc $_};
12 } @{$o->get('columns') || $tbl_struct->{cols}};
13
14 # Make sure conflict col is in compare cols else conflicting
15
16=== modified file 't/pt-table-sync/columns.t'
17--- t/pt-table-sync/columns.t 2012-07-11 18:21:47 +0000
18+++ t/pt-table-sync/columns.t 2014-04-23 12:01:14 +0000
19@@ -28,7 +28,7 @@
20 plan skip_all => 'Cannot connect to sandbox slave';
21 }
22 else {
23- plan tests => 6;
24+ plan tests => 7;
25 }
26
27 $sb->wipe_clean($master_dbh);
28@@ -54,6 +54,11 @@
29 $output = `$trunk/bin/pt-table-sync --ignore-columns name --print h=127.1,P=12345,u=msandbox,p=msandbox,D=test,t=test3 t=test4`;
30 is($output, "", '--ignore-columns name: found no differences');
31
32+# bug https://bugs.launchpad.net/percona-toolkit/+bug/1311584
33+# case sensitivity of --ignore-columns was broken.
34+$output = `$trunk/bin/pt-table-sync --ignore-columns Name --print h=127.1,P=12345,u=msandbox,p=msandbox,D=test,t=test5 t=test6`;
35+is($output, "", '--ignore-columns Name (case sensitive): found no differences');
36+
37 $output = `$trunk/bin/pt-table-sync --ignore-columns id --print h=127.1,P=12345,u=msandbox,p=msandbox,D=test,t=test3 t=test4`;
38 $output = remove_traces($output);
39 # This test changed for the same reason as above.
40
41=== modified file 't/pt-table-sync/samples/before.sql'
42--- t/pt-table-sync/samples/before.sql 2011-06-24 22:02:05 +0000
43+++ t/pt-table-sync/samples/before.sql 2014-04-23 12:01:14 +0000
44@@ -28,3 +28,16 @@
45 );
46 insert into test3(id, name) values(15034, '51707'),(1, '001');
47 insert into test4(id, name) values(15034, '051707'),(1, '1');
48+
49+
50+create table test5 (
51+ id int not null primary key,
52+ Name varchar(255)
53+);
54+insert into test5(id, Name) values(15034, 'master'),(1, '1');
55+
56+create table test6 (
57+ id int not null primary key,
58+ Name varchar(255)
59+);
60+insert into test6(id, Name) values(15034, 'slave'),(1, '1');

Subscribers

People subscribed via source and target branches