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
=== modified file 'bin/pt-table-checksum'
--- bin/pt-table-checksum 2012-10-26 23:06:21 +0000
+++ bin/pt-table-checksum 2012-10-30 22:39:32 +0000
@@ -5287,6 +5287,7 @@
5287 if ( $EVAL_ERROR && $EVAL_ERROR =~ m/failed: (.*?) at \S+ line/ ) {5287 if ( $EVAL_ERROR && $EVAL_ERROR =~ m/failed: (.*?) at \S+ line/ ) {
5288 $error .= qq{$func cannot be used because "$1"\n};5288 $error .= qq{$func cannot be used because "$1"\n};
5289 PTDEBUG && _d($func, 'cannot be used because', $1);5289 PTDEBUG && _d($func, 'cannot be used because', $1);
5290 next;
5290 }5291 }
5291 PTDEBUG && _d('Chosen hash func:', $result);5292 PTDEBUG && _d('Chosen hash func:', $result);
5292 return $func;5293 return $func;
52935294
=== modified file 'lib/RowChecksum.pm'
--- lib/RowChecksum.pm 2012-08-02 14:29:57 +0000
+++ lib/RowChecksum.pm 2012-10-30 22:39:32 +0000
@@ -274,7 +274,7 @@
274 }274 }
275 my ($dbh) = @args{@required_args};275 my ($dbh) = @args{@required_args};
276 my $o = $self->{OptionParser};276 my $o = $self->{OptionParser};
277 my @funcs = qw(CRC32 FNV1A_64 FNV_64 MD5 SHA1);277 my @funcs = qw(CRC32 FNV1A_64 FNV_64 MURMUR_HASH MD5 SHA1);
278278
279 if ( my $func = $o->get('function') ) {279 if ( my $func = $o->get('function') ) {
280 unshift @funcs, $func;280 unshift @funcs, $func;
@@ -290,11 +290,12 @@
290 if ( $EVAL_ERROR && $EVAL_ERROR =~ m/failed: (.*?) at \S+ line/ ) {290 if ( $EVAL_ERROR && $EVAL_ERROR =~ m/failed: (.*?) at \S+ line/ ) {
291 $error .= qq{$func cannot be used because "$1"\n};291 $error .= qq{$func cannot be used because "$1"\n};
292 PTDEBUG && _d($func, 'cannot be used because', $1);292 PTDEBUG && _d($func, 'cannot be used because', $1);
293 next;
293 }294 }
294 PTDEBUG && _d('Chosen hash func:', $result);295 PTDEBUG && _d('Chosen hash func:', $result);
295 return $func;296 return $func;
296 }297 }
297 die $error || 'No hash functions (CRC32, MD5, etc.) are available';298 die($error || 'No hash functions (CRC32, MD5, etc.) are available');
298}299}
299300
300# Returns how wide/long, in characters, a CRC function is.301# Returns how wide/long, in characters, a CRC function is.
301302
=== modified file 't/lib/RowChecksum.t'
--- t/lib/RowChecksum.t 2012-08-02 14:29:57 +0000
+++ t/lib/RowChecksum.t 2012-10-30 22:39:32 +0000
@@ -461,6 +461,22 @@
461 'Dies if all columns are ignored by --columns'461 'Dies if all columns are ignored by --columns'
462);462);
463463
464# #############################################################################
465# pt-table-checksum doesn't test all hash functions
466# https://bugs.launchpad.net/percona-toolkit/+bug/1059732
467# #############################################################################
468
469@ARGV = qw(--function FALSEFUNC);
470$o->get_opts();
471
472unlike(
473 $c->_get_hash_func(
474 dbh => $dbh,
475 ),
476 qr/FALSEFUNC/,
477 "_get_hash_func doesn't return failed functions",
478);
479
464# ############################################################################480# ############################################################################
465# Done.481# Done.
466# ############################################################################482# ############################################################################

Subscribers

People subscribed via source and target branches