From 162d4dcd28b671b8387d962ecc5c90677a0c864b Mon Sep 17 00:00:00 2001 From: frank-cizmich Date: Fri, 29 Apr 2016 07:23:42 -0300 Subject: [PATCH] corrected index choosing bug in NibbleHandler --- bin/pt-table-checksum | 3 ++- lib/NibbleIterator.pm | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/pt-table-checksum b/bin/pt-table-checksum index 3cd28498..8c49f9f9 100755 --- a/bin/pt-table-checksum +++ b/bin/pt-table-checksum @@ -6556,7 +6556,8 @@ sub _find_best_index { push @possible_indexes, $want_index; } } - else { + + if (!$best_index) { PTDEBUG && _d('Auto-selecting best index'); foreach my $index ( $tp->sort_indexes($tbl_struct) ) { if ( $index eq 'PRIMARY' || $indexes->{$index}->{is_unique} ) { diff --git a/lib/NibbleIterator.pm b/lib/NibbleIterator.pm index 61e2513f..cbf42676 100644 --- a/lib/NibbleIterator.pm +++ b/lib/NibbleIterator.pm @@ -529,7 +529,8 @@ sub _find_best_index { push @possible_indexes, $want_index; } } - else { + + if (!$best_index) { PTDEBUG && _d('Auto-selecting best index'); foreach my $index ( $tp->sort_indexes($tbl_struct) ) { if ( $index eq 'PRIMARY' || $indexes->{$index}->{is_unique} ) {