Merge lp:~percona-toolkit-dev/percona-toolkit/fix-1059732-ptc-hash-functions into lp:percona-toolkit/2.1

Proposed by Brian Fraser
Status: Merged
Approved by: Brian Fraser
Approved revision: 437
Merged at revision: 443
Proposed branch: lp:~percona-toolkit-dev/percona-toolkit/fix-1059732-ptc-hash-functions
Merge into: lp:percona-toolkit/2.1
Diff against target: 65 lines (+20/-2)
3 files modified
bin/pt-table-checksum (+1/-0)
lib/RowChecksum.pm (+3/-2)
t/lib/RowChecksum.t (+16/-0)
To merge this branch: bzr merge lp:~percona-toolkit-dev/percona-toolkit/fix-1059732-ptc-hash-functions
Reviewer Review Type Date Requested Status
Daniel Nichter Approve
Review via email: mp+132223@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 2012-10-26 23:06:21 +0000
3+++ bin/pt-table-checksum 2012-10-30 22:39:32 +0000
4@@ -5287,6 +5287,7 @@
5 if ( $EVAL_ERROR && $EVAL_ERROR =~ m/failed: (.*?) at \S+ line/ ) {
6 $error .= qq{$func cannot be used because "$1"\n};
7 PTDEBUG && _d($func, 'cannot be used because', $1);
8+ next;
9 }
10 PTDEBUG && _d('Chosen hash func:', $result);
11 return $func;
12
13=== modified file 'lib/RowChecksum.pm'
14--- lib/RowChecksum.pm 2012-08-02 14:29:57 +0000
15+++ lib/RowChecksum.pm 2012-10-30 22:39:32 +0000
16@@ -274,7 +274,7 @@
17 }
18 my ($dbh) = @args{@required_args};
19 my $o = $self->{OptionParser};
20- my @funcs = qw(CRC32 FNV1A_64 FNV_64 MD5 SHA1);
21+ my @funcs = qw(CRC32 FNV1A_64 FNV_64 MURMUR_HASH MD5 SHA1);
22
23 if ( my $func = $o->get('function') ) {
24 unshift @funcs, $func;
25@@ -290,11 +290,12 @@
26 if ( $EVAL_ERROR && $EVAL_ERROR =~ m/failed: (.*?) at \S+ line/ ) {
27 $error .= qq{$func cannot be used because "$1"\n};
28 PTDEBUG && _d($func, 'cannot be used because', $1);
29+ next;
30 }
31 PTDEBUG && _d('Chosen hash func:', $result);
32 return $func;
33 }
34- die $error || 'No hash functions (CRC32, MD5, etc.) are available';
35+ die($error || 'No hash functions (CRC32, MD5, etc.) are available');
36 }
37
38 # Returns how wide/long, in characters, a CRC function is.
39
40=== modified file 't/lib/RowChecksum.t'
41--- t/lib/RowChecksum.t 2012-08-02 14:29:57 +0000
42+++ t/lib/RowChecksum.t 2012-10-30 22:39:32 +0000
43@@ -461,6 +461,22 @@
44 'Dies if all columns are ignored by --columns'
45 );
46
47+# #############################################################################
48+# pt-table-checksum doesn't test all hash functions
49+# https://bugs.launchpad.net/percona-toolkit/+bug/1059732
50+# #############################################################################
51+
52+@ARGV = qw(--function FALSEFUNC);
53+$o->get_opts();
54+
55+unlike(
56+ $c->_get_hash_func(
57+ dbh => $dbh,
58+ ),
59+ qr/FALSEFUNC/,
60+ "_get_hash_func doesn't return failed functions",
61+);
62+
63 # ############################################################################
64 # Done.
65 # ############################################################################

Subscribers

People subscribed via source and target branches