diff --git a/bin/pt-table-checksum b/bin/pt-table-checksum index 47ba81e7..6049d866 100755 --- a/bin/pt-table-checksum +++ b/bin/pt-table-checksum @@ -9363,9 +9363,11 @@ sub main { if ( $cluster_name_for{$master_cxn} ) { if ( !@$slaves ) { - die $master_cxn->name() . " is a cluster node but no other nodes " - . "or regular replicas were found. Use --recursion-method=dsn " - . "to specify the other nodes in the cluster.\n"; + if ( ($o->get('recursion-method')->[0] || '') ne 'none' ) { + die $master_cxn->name() . " is a cluster node but no other nodes " + . "or regular replicas were found. Use --recursion-method=dsn " + . "to specify the other nodes in the cluster.\n"; + } } # Make sure the master and all node are in the same cluster. @@ -12240,9 +12242,13 @@ DSNs are ordered by C, but C and C are otherwise ignored. The C column contains a replica DSN like it would be given on the command line, for example: C<"h=replica_host,u=repl_user,p=repl_pass">. -The C method prevents the tool from connecting to any replicas. -This effectively disables all the L<"REPLICA CHECKS"> because there will -not be any replicas to check. Therefore, this method is not recommended. +The C method makes the tool ignore all slaves and cluster nodes. This +method is not recommended because it effectively disables the +L<"REPLICA CHECKS"> and no differences can be found. It is useful, however, if +you only need to write checksums on the master or a single cluster node. The +safer alternative is C<--no-replicate-check>: the tool finds replicas and +cluster nodes, performs the L<"REPLICA CHECKS">, but does not check for +differences. See L<"--[no]replicate-check">. =item --replicate diff --git a/t/pt-table-checksum/pxc.t b/t/pt-table-checksum/pxc.t index 35b0e759..614e0036 100644 --- a/t/pt-table-checksum/pxc.t +++ b/t/pt-table-checksum/pxc.t @@ -81,6 +81,17 @@ like( "Dies if no other nodes are found" ); + +($output, $exit_status) = full_output( + sub { pt_table_checksum::main(@args, '--recursion-method', 'none') }, + stderr => 1, +); + +ok ( + $output =~ qr/WARNING/i && !$exit_status, + "Warns but doesn't die if --recursion-method=none - issue #1373937" +); + for my $args ( ["using recusion-method=dsn", '--recursion-method', "dsn=$node1_dsn,D=dsns,t=dsns"], ["using recursion-method=cluster", '--recursion-method', 'cluster'] @@ -232,7 +243,7 @@ for my $args ( # Wait for the slave to apply the binlogs from node1 (its master). # Then change it so it's not consistent. PerconaTest::wait_for_table($slave_dbh, 'test.t'); - $sb->wait_for_slaves('cslave1'); + $sb->wait_for_slaves(master => 'node1', slave => 'cslave1'); $slave_dbh->do("update test.t set c='zebra' where c='z'"); $output = output(