Update MasterSlave in all tools and add "none" to --recursion-method docs. Tools pass their tests.

This commit is contained in:
Daniel Nichter
2012-05-17 08:54:36 -06:00
parent e969d8d9f7
commit 392f74fc60
7 changed files with 51 additions and 5 deletions
+10 -1
View File
@@ -73,6 +73,9 @@ sub get_slaves {
dsn_table_dsn => $dsn_table_dsn,
);
}
elsif ( $method =~ m/none/i ) {
PTDEBUG && _d('Not getting to slaves');
}
else {
die "Invalid --recursion-method: $method. Valid values are: "
. "dsn=DSN, hosts, or processlist.\n";
@@ -87,6 +90,11 @@ sub recurse_to_slaves {
my $dp = $args->{dsn_parser};
my $dsn = $args->{dsn};
if ( lc($args->{method} || '') eq 'none' ) {
PTDEBUG && _d('Not recursing to slaves');
return;
}
my $dbh;
eval {
$dbh = $args->{dbh} || $dp->get_dbh(
@@ -4131,9 +4139,10 @@ Preferred recursion method used to find slaves.
Possible methods are:
METHOD USES
=========== ================
=========== ==================
processlist SHOW PROCESSLIST
hosts SHOW SLAVE HOSTS
none Do not find slaves
The processlist method is preferred because SHOW SLAVE HOSTS is not reliable.
However, the hosts method is required if the server uses a non-standard
+9
View File
@@ -2901,6 +2901,9 @@ sub get_slaves {
dsn_table_dsn => $dsn_table_dsn,
);
}
elsif ( $method =~ m/none/i ) {
PTDEBUG && _d('Not getting to slaves');
}
else {
die "Invalid --recursion-method: $method. Valid values are: "
. "dsn=DSN, hosts, or processlist.\n";
@@ -2915,6 +2918,11 @@ sub recurse_to_slaves {
my $dp = $args->{dsn_parser};
my $dsn = $args->{dsn};
if ( lc($args->{method} || '') eq 'none' ) {
PTDEBUG && _d('Not recursing to slaves');
return;
}
my $dbh;
eval {
$dbh = $args->{dbh} || $dp->get_dbh(
@@ -7295,6 +7303,7 @@ Preferred recursion method for discovering replicas. Possible methods are:
processlist SHOW PROCESSLIST
hosts SHOW SLAVE HOSTS
dsn=DSN DSNs from a table
none Do not find slaves
The processlist method is the default, because SHOW SLAVE HOSTS is not
reliable. However, the hosts method can work better if the server uses a
+10 -1
View File
@@ -1454,6 +1454,9 @@ sub get_slaves {
dsn_table_dsn => $dsn_table_dsn,
);
}
elsif ( $method =~ m/none/i ) {
PTDEBUG && _d('Not getting to slaves');
}
else {
die "Invalid --recursion-method: $method. Valid values are: "
. "dsn=DSN, hosts, or processlist.\n";
@@ -1468,6 +1471,11 @@ sub recurse_to_slaves {
my $dp = $args->{dsn_parser};
my $dsn = $args->{dsn};
if ( lc($args->{method} || '') eq 'none' ) {
PTDEBUG && _d('Not recursing to slaves');
return;
}
my $dbh;
eval {
$dbh = $args->{dbh} || $dp->get_dbh(
@@ -3048,9 +3056,10 @@ Preferred recursion method used to find slaves.
Possible methods are:
METHOD USES
=========== ================
=========== ==================
processlist SHOW PROCESSLIST
hosts SHOW SLAVE HOSTS
none Do not find slaves
The processlist method is preferred because SHOW SLAVE HOSTS is not reliable.
However, the hosts method is required if the server uses a non-standard
+10 -1
View File
@@ -1614,6 +1614,9 @@ sub get_slaves {
dsn_table_dsn => $dsn_table_dsn,
);
}
elsif ( $method =~ m/none/i ) {
PTDEBUG && _d('Not getting to slaves');
}
else {
die "Invalid --recursion-method: $method. Valid values are: "
. "dsn=DSN, hosts, or processlist.\n";
@@ -1628,6 +1631,11 @@ sub recurse_to_slaves {
my $dp = $args->{dsn_parser};
my $dsn = $args->{dsn};
if ( lc($args->{method} || '') eq 'none' ) {
PTDEBUG && _d('Not recursing to slaves');
return;
}
my $dbh;
eval {
$dbh = $args->{dbh} || $dp->get_dbh(
@@ -3179,9 +3187,10 @@ Preferred recursion method used to find slaves.
Possible methods are:
METHOD USES
=========== ================
=========== ==================
processlist SHOW PROCESSLIST
hosts SHOW SLAVE HOSTS
none Do not find slaves
The processlist method is preferred because SHOW SLAVE HOSTS is not reliable.
However, the hosts method is required if the server uses a non-standard
+1
View File
@@ -8240,6 +8240,7 @@ Preferred recursion method for discovering replicas. Possible methods are:
processlist SHOW PROCESSLIST
hosts SHOW SLAVE HOSTS
dsn=DSN DSNs from a table
none Do not find slaves
The processlist method is the default, because SHOW SLAVE HOSTS is not
reliable. However, the hosts method can work better if the server uses a
+10 -1
View File
@@ -5924,6 +5924,9 @@ sub get_slaves {
dsn_table_dsn => $dsn_table_dsn,
);
}
elsif ( $method =~ m/none/i ) {
PTDEBUG && _d('Not getting to slaves');
}
else {
die "Invalid --recursion-method: $method. Valid values are: "
. "dsn=DSN, hosts, or processlist.\n";
@@ -5938,6 +5941,11 @@ sub recurse_to_slaves {
my $dp = $args->{dsn_parser};
my $dsn = $args->{dsn};
if ( lc($args->{method} || '') eq 'none' ) {
PTDEBUG && _d('Not recursing to slaves');
return;
}
my $dbh;
eval {
$dbh = $args->{dbh} || $dp->get_dbh(
@@ -10050,9 +10058,10 @@ Preferred recursion method used to find slaves.
Possible methods are:
METHOD USES
=========== ================
=========== ==================
processlist SHOW PROCESSLIST
hosts SHOW SLAVE HOSTS
none Do not find slaves
The processlist method is preferred because SHOW SLAVE HOSTS is not reliable.
However, the hosts method is required if the server uses a non-standard
+1 -1
View File
@@ -51,7 +51,7 @@ unlike($output, qr/Table 'test.t' doesn't exist'/, 'It is not busted');
ok(-f '/tmp/pt-slave-restart.pid', 'PID file created');
ok(-f '/tmp/pt-slave-restart.log', 'Log file created');
my ($pid) = $output =~ /\s+(\d+)\s+/;
my ($pid) = $output =~ /^\s+\d+\s+(\d+)\s+/;
$output = `cat /tmp/pt-slave-restart.pid`;
is($output, $pid, 'PID file has correct PID');