Default value of --recursion-method, "processlist,hosts" is actually same as "processlist"

Bug #1438641 reported by tsubasa tanaka
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona Toolkit moved to https://jira.percona.com/projects/PT
Confirmed
Undecided
Unassigned

Bug Description

Option of recursion-method's implicit default value is "processlist,hosts", but that just check only by "SHOW PROCESSLIST".

In lib/MasterSlave.pm,

240 sub find_slave_hosts {
241 my ( $self, $dsn_parser, $dbh, $dsn, $methods ) = @_;
242
243 PTDEBUG && _d('Looking for slaves on', $dsn_parser->as_string($dsn),
244 'using methods', @$methods);
245
246 my @slaves;
247 METHOD:
248 foreach my $method ( @$methods ) {
249 my $find_slaves = "_find_slaves_by_$method";
250 PTDEBUG && _d('Finding slaves with', $find_slaves);
251 @slaves = $self->$find_slaves($dsn_parser, $dbh, $dsn);
252 last METHOD if @slaves;
253 }
254
255 PTDEBUG && _d('Found', scalar(@slaves), 'slaves');
256 return @slaves;
257 }

At first, line:248 calls _find_slaves_by_processlist, "SHOW PROCESSLIST" always returns slave's hostname.
After that, line:252, @slaves has always value, thus "hosts" in @methods will never process even when slave uses non-standard port and @slaves from "processlist" in @methods can't use.

Revision history for this message
tsubasa tanaka (yoku0825) wrote :

Indeed, document says "The processlist method is the default, because SHOW SLAVE HOSTS is not reliable.", but default-value "processlist,hosts" made me misunderstanding the tool picks slaves both of "processlist" and "hosts".

And there may be no case when SHOW PROCESSLIST doesn't return nothing(Binlog Dump thread is not there) and SHOW SLAVE HOSTS returns something.
Default value should be just "processlist".

Revision history for this message
Nilnandan Joshi (nilnandan-joshi) wrote :

Verified with code and doc. it might be a feature request to only try hosts if processlist does not allow to find/connect.

sub find_slave_hosts {
   my ( $self, $dsn_parser, $dbh, $dsn, $methods ) = @_;

   PTDEBUG && _d('Looking for slaves on', $dsn_parser->as_string($dsn),
      'using methods', @$methods);

   my @slaves;
   METHOD:
   foreach my $method ( @$methods ) {
      my $find_slaves = "_find_slaves_by_$method";
      PTDEBUG && _d('Finding slaves with', $find_slaves);
      @slaves = $self->$find_slaves($dsn_parser, $dbh, $dsn);
      last METHOD if @slaves;
   }

   PTDEBUG && _d('Found', scalar(@slaves), 'slaves');
   return @slaves;
}

http://www.percona.com/doc/percona-toolkit/2.2/pt-table-checksum.html#cmdoption-pt-table-checksum--recursion-method

--recursion-method
type: array; default: processlist,hosts

"The processlist method is the default, because SHOW SLAVE HOSTS is not reliable. However, if the server uses a non-standard port (not 3306), then the hosts method becomes the default because it works better in this case."

Changed in percona-toolkit:
status: New → Confirmed
Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PT-1276

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.