mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-11 13:40:07 +00:00
Warn if no slaves are found.
This commit is contained in:
@@ -8741,6 +8741,15 @@ sub main {
|
|||||||
} @$slaves;
|
} @$slaves;
|
||||||
}
|
}
|
||||||
PTDEBUG && _d(scalar @$slaves, 'slaves found');
|
PTDEBUG && _d(scalar @$slaves, 'slaves found');
|
||||||
|
if ( !@$slaves && $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. "
|
||||||
|
. "Please read the --recursion-method documentation for "
|
||||||
|
. "information.\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# https://bugs.launchpad.net/percona-toolkit/+bug/938068
|
# https://bugs.launchpad.net/percona-toolkit/+bug/938068
|
||||||
if ( $o->get('check-binlog-format') ) {
|
if ( $o->get('check-binlog-format') ) {
|
||||||
@@ -11490,6 +11499,13 @@ type: array; default: processlist,hosts
|
|||||||
|
|
||||||
Preferred recursion method for discovering replicas. pt-table-checksum
|
Preferred recursion method for discovering replicas. pt-table-checksum
|
||||||
performs several L<"REPLICA CHECKS"> before and while running.
|
performs several L<"REPLICA CHECKS"> before and while running.
|
||||||
|
|
||||||
|
Although replicas are not required to run pt-table-checksum, the tool
|
||||||
|
cannot detect diffs on slaves that it cannot discover. Therefore,
|
||||||
|
a warning is printed and the L<"EXIT STATUS"> is non-zero if no replicas
|
||||||
|
are found and the method is not C<none>. If this happens, try a different
|
||||||
|
recursion method, or use the C<dsn> method to specify the replicas to check.
|
||||||
|
|
||||||
Possible methods are:
|
Possible methods are:
|
||||||
|
|
||||||
METHOD USES
|
METHOD USES
|
||||||
|
@@ -361,10 +361,11 @@ $output = output(
|
|||||||
stderr => 1,
|
stderr => 1,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
# Before 2.2 the exit status was 0, but bug 1087804 changed this to 1.
|
||||||
is(
|
is(
|
||||||
$exit_status,
|
$exit_status,
|
||||||
0,
|
1,
|
||||||
"No host in DSN, zero exit status"
|
"No host in DSN, non-zero exit status"
|
||||||
);
|
);
|
||||||
|
|
||||||
is(
|
is(
|
||||||
@@ -490,6 +491,55 @@ is(
|
|||||||
"Bug 821675 (dot): 0 errors"
|
"Bug 821675 (dot): 0 errors"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
# #############################################################################
|
||||||
|
# Bug 1087804: pt-table-checksum doesn't warn if no slaves are found
|
||||||
|
# #############################################################################
|
||||||
|
$sb->load_file('master', "$sample/dsn-table.sql");
|
||||||
|
$master_dbh->do('TRUNCATE TABLE dsns.dsns');
|
||||||
|
$sb->wait_for_slaves;
|
||||||
|
|
||||||
|
my $slave1_dsn = $sb->dsn_for('slave1');
|
||||||
|
|
||||||
|
$output = output(
|
||||||
|
sub { $exit_status = pt_table_checksum::main(@args,
|
||||||
|
qw(-t sakila.country),
|
||||||
|
"--recursion-method", "dsn=$slave1_dsn,t=dsns.dsns")
|
||||||
|
},
|
||||||
|
stderr => 1,
|
||||||
|
);
|
||||||
|
|
||||||
|
like(
|
||||||
|
$output,
|
||||||
|
qr/no slaves were found/,
|
||||||
|
"Warns if no slaves are found"
|
||||||
|
);
|
||||||
|
|
||||||
|
is(
|
||||||
|
$exit_status,
|
||||||
|
1,
|
||||||
|
'...exit status 1'
|
||||||
|
);
|
||||||
|
|
||||||
|
$output = output(
|
||||||
|
sub { $exit_status = pt_table_checksum::main(@args,
|
||||||
|
qw(-t sakila.country),
|
||||||
|
"--recursion-method", "none")
|
||||||
|
},
|
||||||
|
stderr => 1,
|
||||||
|
);
|
||||||
|
|
||||||
|
unlike(
|
||||||
|
$output,
|
||||||
|
qr/no slaves were found/,
|
||||||
|
"No warning if no slaves and --recursion-method=none"
|
||||||
|
);
|
||||||
|
|
||||||
|
is(
|
||||||
|
$exit_status,
|
||||||
|
0,
|
||||||
|
'...exit status 0'
|
||||||
|
);
|
||||||
|
|
||||||
# #############################################################################
|
# #############################################################################
|
||||||
# Done.
|
# Done.
|
||||||
# #############################################################################
|
# #############################################################################
|
||||||
|
Reference in New Issue
Block a user