Fix --recur-method=cluster crash.

This commit is contained in:
Daniel Nichter
2013-10-02 11:27:10 -07:00
parent ccb9ac616c
commit 8767640b1c

View File

@@ -9208,15 +9208,23 @@ sub main {
}
my $trimmed_nodes = Cxn->remove_duplicate_cxns(
cxns => [ $master_cxn, @$slaves ],
);
cxns => [ $master_cxn, @$slaves ],
);
($master_cxn, @$slaves) = @$trimmed_nodes;
# If no slaves or nodes were found, and a recursion method was given
# (implicitly or explicitly), and that method is not none, then warn
# and continue but exit non-zero because there won't be any diffs but
# this could be a false-positive from having no slaves/nodes to check.
# https://bugs.launchpad.net/percona-toolkit/+bug/1210537
PTDEBUG && _d(scalar @$slaves, 'slaves found');
if ( !@$slaves && $o->get('recursion-method')->[0] ne 'none' ) {
if ( !@$slaves
&& $o->get('recursion-method')->[0]
&& $o->get('recursion-method')->[0] ne 'none' ) {
$exit_status |= 1;
if ( $o->get('quiet') < 2 ) {
warn "Diffs cannot be detected because no slaves were found. "
my $type = $autodiscover_cluster ? 'nodes' : 'slaves';
warn "Diffs cannot be detected because no $type were found. "
. "Please read the --recursion-method documentation for "
. "information.\n";
}