mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-29 09:32:47 +00:00
Updates per Daniel's review
This commit is contained in:
@@ -4790,14 +4790,19 @@ eval {
|
||||
};
|
||||
|
||||
sub version_check {
|
||||
my $args = pop @_;
|
||||
my (@instances) = @_;
|
||||
my %args = @_;
|
||||
my @instances = $args{instances} ? @{ $args{instances} } : ();
|
||||
|
||||
if (exists $ENV{PERCONA_VERSION_CHECK} && !$ENV{PERCONA_VERSION_CHECK}) {
|
||||
print STDERR '--version-check is disabled by the PERCONA_VERSION_CHECK ',
|
||||
warn '--version-check is disabled by the PERCONA_VERSION_CHECK ',
|
||||
"environment variable.\n\n";
|
||||
return;
|
||||
}
|
||||
|
||||
$args{protocol} ||= 'https';
|
||||
my @protocols = $args{protocol} eq 'auto'
|
||||
? qw(https http)
|
||||
: $args{protocol};
|
||||
|
||||
my $instances_to_check = [];
|
||||
my $time = int(time());
|
||||
@@ -4812,15 +4817,11 @@ sub version_check {
|
||||
($time_to_check, $instances_to_check)
|
||||
= time_to_check($check_time_file, \@instances, $time);
|
||||
if ( !$time_to_check ) {
|
||||
print STDERR 'It is not time to --version-check again; ',
|
||||
warn 'It is not time to --version-check again; ',
|
||||
"only 1 check per day.\n\n";
|
||||
return;
|
||||
}
|
||||
|
||||
$args->{protocol} ||= 'https';
|
||||
my @protocols = $args->{protocol} ne 'https' && $args->{protocol} ne 'http'
|
||||
? qw(https http)
|
||||
: $args->{protocol};
|
||||
my $advice;
|
||||
my $e;
|
||||
for my $protocol ( @protocols ) {
|
||||
@@ -4863,7 +4864,7 @@ sub pingback {
|
||||
|
||||
my ($instances, $ua, $vc) = @args{qw(instances ua VersionCheck)};
|
||||
|
||||
$ua ||= HTTPMicro->new( timeout => 2 );
|
||||
$ua ||= HTTPMicro->new( timeout => 5 );
|
||||
$vc ||= VersionCheck->new();
|
||||
|
||||
my $response = $ua->request('GET', $url);
|
||||
@@ -5079,6 +5080,21 @@ sub encode_client_response {
|
||||
return $client_response;
|
||||
}
|
||||
|
||||
sub validate_options {
|
||||
my ($o) = @_;
|
||||
|
||||
return if !$o->got('version-check');
|
||||
|
||||
my $value = $o->get('version-check');
|
||||
my @values = split /, /,
|
||||
$o->read_para_after(__FILE__, qr/MAGIC_version_check/);
|
||||
chomp(@values);
|
||||
|
||||
return if grep { $value eq $_ } @values;
|
||||
$o->save_error("--version-check invalud value $value. Accepted values are "
|
||||
. join(", ", @values[0..$#values-1]) . " and $values[-1]" );
|
||||
}
|
||||
|
||||
sub _d {
|
||||
my ($package, undef, $line) = caller 0;
|
||||
@_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }
|
||||
@@ -5223,6 +5239,8 @@ sub main {
|
||||
$o->save_error("--bulk-delete is meaningless with --limit 1");
|
||||
}
|
||||
|
||||
Pingback::validate_options($o);
|
||||
|
||||
}
|
||||
|
||||
if ( $bulk_del || $o->get('bulk-insert') ) {
|
||||
@@ -5622,9 +5640,11 @@ sub main {
|
||||
# ########################################################################
|
||||
if ( $o->get('version-check') ne 'off' && (!$o->has('quiet') || !$o->get('quiet')) ) {
|
||||
Pingback::version_check(
|
||||
{ dbh => $src->{dbh}, dsn => $src->{dsn} },
|
||||
( $dst ? { dbh => $dst->{dbh}, dsn => $dst->{dsn} } : () ),
|
||||
{ protocol => $o->get('version-check') },
|
||||
instances => [
|
||||
{ dbh => $src->{dbh}, dsn => $src->{dsn} },
|
||||
( $dst ? { dbh => $dst->{dbh}, dsn => $dst->{dsn} } : () ),
|
||||
],
|
||||
protocol => $o->get('version-check'),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -7060,9 +7080,15 @@ Show version and exit.
|
||||
type: string; default: off
|
||||
|
||||
Send program versions to Percona and print suggested upgrades and problems.
|
||||
Possible values for --version-check:
|
||||
|
||||
Accepted values are https, http, off, and auto -- The latter tries both https
|
||||
and http, in that order. Keep in mind that 'https' might fail if
|
||||
=for comment ignore-pt-internal-value
|
||||
MAGIC_version_check
|
||||
|
||||
https, http, auto, off
|
||||
|
||||
C<auto> first tries using C<https>, and resolts to C<http> if that fails.
|
||||
Keep in mind that C<https> might not be available if
|
||||
C<IO::Socket::SSL> is not installed on your system, although
|
||||
C<--version-check http> should work everywhere.
|
||||
|
||||
|
@@ -1573,7 +1573,9 @@ sub is_cluster_node {
|
||||
PTDEBUG && _d($sql);
|
||||
my $row = $self->{dbh}->selectrow_arrayref($sql);
|
||||
PTDEBUG && _d(defined $row ? @$row : 'undef');
|
||||
$self->{is_cluster_node} = $row && $row->[0] ? 1 : 0;
|
||||
$self->{is_cluster_node} = $row && $row->[1]
|
||||
? ($row->[1] eq 'ON' || $row->[1] eq '1')
|
||||
: 0;
|
||||
|
||||
return $self->{is_cluster_node};
|
||||
}
|
||||
@@ -3938,14 +3940,19 @@ eval {
|
||||
};
|
||||
|
||||
sub version_check {
|
||||
my $args = pop @_;
|
||||
my (@instances) = @_;
|
||||
my %args = @_;
|
||||
my @instances = $args{instances} ? @{ $args{instances} } : ();
|
||||
|
||||
if (exists $ENV{PERCONA_VERSION_CHECK} && !$ENV{PERCONA_VERSION_CHECK}) {
|
||||
print STDERR '--version-check is disabled by the PERCONA_VERSION_CHECK ',
|
||||
warn '--version-check is disabled by the PERCONA_VERSION_CHECK ',
|
||||
"environment variable.\n\n";
|
||||
return;
|
||||
}
|
||||
|
||||
$args{protocol} ||= 'https';
|
||||
my @protocols = $args{protocol} eq 'auto'
|
||||
? qw(https http)
|
||||
: $args{protocol};
|
||||
|
||||
my $instances_to_check = [];
|
||||
my $time = int(time());
|
||||
@@ -3960,15 +3967,11 @@ sub version_check {
|
||||
($time_to_check, $instances_to_check)
|
||||
= time_to_check($check_time_file, \@instances, $time);
|
||||
if ( !$time_to_check ) {
|
||||
print STDERR 'It is not time to --version-check again; ',
|
||||
warn 'It is not time to --version-check again; ',
|
||||
"only 1 check per day.\n\n";
|
||||
return;
|
||||
}
|
||||
|
||||
$args->{protocol} ||= 'https';
|
||||
my @protocols = $args->{protocol} ne 'https' && $args->{protocol} ne 'http'
|
||||
? qw(https http)
|
||||
: $args->{protocol};
|
||||
my $advice;
|
||||
my $e;
|
||||
for my $protocol ( @protocols ) {
|
||||
@@ -4011,7 +4014,7 @@ sub pingback {
|
||||
|
||||
my ($instances, $ua, $vc) = @args{qw(instances ua VersionCheck)};
|
||||
|
||||
$ua ||= HTTPMicro->new( timeout => 2 );
|
||||
$ua ||= HTTPMicro->new( timeout => 5 );
|
||||
$vc ||= VersionCheck->new();
|
||||
|
||||
my $response = $ua->request('GET', $url);
|
||||
@@ -4227,6 +4230,21 @@ sub encode_client_response {
|
||||
return $client_response;
|
||||
}
|
||||
|
||||
sub validate_options {
|
||||
my ($o) = @_;
|
||||
|
||||
return if !$o->got('version-check');
|
||||
|
||||
my $value = $o->get('version-check');
|
||||
my @values = split /, /,
|
||||
$o->read_para_after(__FILE__, qr/MAGIC_version_check/);
|
||||
chomp(@values);
|
||||
|
||||
return if grep { $value eq $_ } @values;
|
||||
$o->save_error("--version-check invalud value $value. Accepted values are "
|
||||
. join(", ", @values[0..$#values-1]) . " and $values[-1]" );
|
||||
}
|
||||
|
||||
sub _d {
|
||||
my ($package, undef, $line) = caller 0;
|
||||
@_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }
|
||||
@@ -4279,6 +4297,7 @@ sub main {
|
||||
if ( @ARGV < 1 ) {
|
||||
$o->save_error("Specify at least one file or DSN on the command line");
|
||||
}
|
||||
Pingback::validate_options($o);
|
||||
}
|
||||
|
||||
$o->usage_or_errors();
|
||||
@@ -4355,8 +4374,8 @@ sub main {
|
||||
# ########################################################################
|
||||
if ( $o->get('version-check') ne 'off' && (!$o->has('quiet') || !$o->get('quiet')) ) {
|
||||
Pingback::version_check(
|
||||
map({ +{ dbh => $_->dbh, dsn => $_->dsn } } @cxn),
|
||||
{ protocol => $o->get('version-check') },
|
||||
instances => [ map({ +{ dbh => $_->dbh, dsn => $_->dsn } } @cxn) ],
|
||||
protocol => $o->get('version-check'),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4643,9 +4662,15 @@ Show version and exit.
|
||||
type: string; default: off
|
||||
|
||||
Send program versions to Percona and print suggested upgrades and problems.
|
||||
Possible values for --version-check:
|
||||
|
||||
Accepted values are https, http, off, and auto -- The latter tries both https
|
||||
and http, in that order. Keep in mind that 'https' might fail if
|
||||
=for comment ignore-pt-internal-value
|
||||
MAGIC_version_check
|
||||
|
||||
https, http, auto, off
|
||||
|
||||
C<auto> first tries using C<https>, and resolts to C<http> if that fails.
|
||||
Keep in mind that C<https> might not be available if
|
||||
C<IO::Socket::SSL> is not installed on your system, although
|
||||
C<--version-check http> should work everywhere.
|
||||
|
||||
|
@@ -3382,14 +3382,19 @@ eval {
|
||||
};
|
||||
|
||||
sub version_check {
|
||||
my $args = pop @_;
|
||||
my (@instances) = @_;
|
||||
my %args = @_;
|
||||
my @instances = $args{instances} ? @{ $args{instances} } : ();
|
||||
|
||||
if (exists $ENV{PERCONA_VERSION_CHECK} && !$ENV{PERCONA_VERSION_CHECK}) {
|
||||
print STDERR '--version-check is disabled by the PERCONA_VERSION_CHECK ',
|
||||
warn '--version-check is disabled by the PERCONA_VERSION_CHECK ',
|
||||
"environment variable.\n\n";
|
||||
return;
|
||||
}
|
||||
|
||||
$args{protocol} ||= 'https';
|
||||
my @protocols = $args{protocol} eq 'auto'
|
||||
? qw(https http)
|
||||
: $args{protocol};
|
||||
|
||||
my $instances_to_check = [];
|
||||
my $time = int(time());
|
||||
@@ -3404,15 +3409,11 @@ sub version_check {
|
||||
($time_to_check, $instances_to_check)
|
||||
= time_to_check($check_time_file, \@instances, $time);
|
||||
if ( !$time_to_check ) {
|
||||
print STDERR 'It is not time to --version-check again; ',
|
||||
warn 'It is not time to --version-check again; ',
|
||||
"only 1 check per day.\n\n";
|
||||
return;
|
||||
}
|
||||
|
||||
$args->{protocol} ||= 'https';
|
||||
my @protocols = $args->{protocol} ne 'https' && $args->{protocol} ne 'http'
|
||||
? qw(https http)
|
||||
: $args->{protocol};
|
||||
my $advice;
|
||||
my $e;
|
||||
for my $protocol ( @protocols ) {
|
||||
@@ -3455,7 +3456,7 @@ sub pingback {
|
||||
|
||||
my ($instances, $ua, $vc) = @args{qw(instances ua VersionCheck)};
|
||||
|
||||
$ua ||= HTTPMicro->new( timeout => 2 );
|
||||
$ua ||= HTTPMicro->new( timeout => 5 );
|
||||
$vc ||= VersionCheck->new();
|
||||
|
||||
my $response = $ua->request('GET', $url);
|
||||
@@ -3671,6 +3672,21 @@ sub encode_client_response {
|
||||
return $client_response;
|
||||
}
|
||||
|
||||
sub validate_options {
|
||||
my ($o) = @_;
|
||||
|
||||
return if !$o->got('version-check');
|
||||
|
||||
my $value = $o->get('version-check');
|
||||
my @values = split /, /,
|
||||
$o->read_para_after(__FILE__, qr/MAGIC_version_check/);
|
||||
chomp(@values);
|
||||
|
||||
return if grep { $value eq $_ } @values;
|
||||
$o->save_error("--version-check invalud value $value. Accepted values are "
|
||||
. join(", ", @values[0..$#values-1]) . " and $values[-1]" );
|
||||
}
|
||||
|
||||
sub _d {
|
||||
my ($package, undef, $line) = caller 0;
|
||||
@_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }
|
||||
@@ -3793,6 +3809,8 @@ sub main {
|
||||
$o->save_error("--dest requires a 't' (table) part");
|
||||
}
|
||||
|
||||
Pingback::validate_options($o);
|
||||
|
||||
# Avoid running forever with zero second interval.
|
||||
if ( $o->get('run-time') && !$o->get('interval') ) {
|
||||
$o->set('interval', 1);
|
||||
@@ -3864,9 +3882,11 @@ sub main {
|
||||
# ########################################################################
|
||||
if ( $o->get('version-check') ne 'off' && (!$o->has('quiet') || !$o->get('quiet')) ) {
|
||||
Pingback::version_check(
|
||||
{ dbh => $dbh, dsn => $source_dsn },
|
||||
($dest_dsn ? { dbh => $dest_dsn, dsn => $dest_dsn } : ()),
|
||||
{ protocol => $o->get('version-check') },
|
||||
instances => [
|
||||
{ dbh => $dbh, dsn => $source_dsn },
|
||||
($dest_dsn ? { dbh => $dest_dsn, dsn => $dest_dsn } : ()),
|
||||
],
|
||||
protocol => $o->get('version-check'),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4557,9 +4577,15 @@ Show version and exit.
|
||||
type: string; default: off
|
||||
|
||||
Send program versions to Percona and print suggested upgrades and problems.
|
||||
Possible values for --version-check:
|
||||
|
||||
Accepted values are https, http, off, and auto -- The latter tries both https
|
||||
and http, in that order. Keep in mind that 'https' might fail if
|
||||
=for comment ignore-pt-internal-value
|
||||
MAGIC_version_check
|
||||
|
||||
https, http, auto, off
|
||||
|
||||
C<auto> first tries using C<https>, and resolts to C<http> if that fails.
|
||||
Keep in mind that C<https> might not be available if
|
||||
C<IO::Socket::SSL> is not installed on your system, although
|
||||
C<--version-check http> should work everywhere.
|
||||
|
||||
|
@@ -4493,14 +4493,19 @@ eval {
|
||||
};
|
||||
|
||||
sub version_check {
|
||||
my $args = pop @_;
|
||||
my (@instances) = @_;
|
||||
my %args = @_;
|
||||
my @instances = $args{instances} ? @{ $args{instances} } : ();
|
||||
|
||||
if (exists $ENV{PERCONA_VERSION_CHECK} && !$ENV{PERCONA_VERSION_CHECK}) {
|
||||
print STDERR '--version-check is disabled by the PERCONA_VERSION_CHECK ',
|
||||
warn '--version-check is disabled by the PERCONA_VERSION_CHECK ',
|
||||
"environment variable.\n\n";
|
||||
return;
|
||||
}
|
||||
|
||||
$args{protocol} ||= 'https';
|
||||
my @protocols = $args{protocol} eq 'auto'
|
||||
? qw(https http)
|
||||
: $args{protocol};
|
||||
|
||||
my $instances_to_check = [];
|
||||
my $time = int(time());
|
||||
@@ -4515,15 +4520,11 @@ sub version_check {
|
||||
($time_to_check, $instances_to_check)
|
||||
= time_to_check($check_time_file, \@instances, $time);
|
||||
if ( !$time_to_check ) {
|
||||
print STDERR 'It is not time to --version-check again; ',
|
||||
warn 'It is not time to --version-check again; ',
|
||||
"only 1 check per day.\n\n";
|
||||
return;
|
||||
}
|
||||
|
||||
$args->{protocol} ||= 'https';
|
||||
my @protocols = $args->{protocol} ne 'https' && $args->{protocol} ne 'http'
|
||||
? qw(https http)
|
||||
: $args->{protocol};
|
||||
my $advice;
|
||||
my $e;
|
||||
for my $protocol ( @protocols ) {
|
||||
@@ -4566,7 +4567,7 @@ sub pingback {
|
||||
|
||||
my ($instances, $ua, $vc) = @args{qw(instances ua VersionCheck)};
|
||||
|
||||
$ua ||= HTTPMicro->new( timeout => 2 );
|
||||
$ua ||= HTTPMicro->new( timeout => 5 );
|
||||
$vc ||= VersionCheck->new();
|
||||
|
||||
my $response = $ua->request('GET', $url);
|
||||
@@ -4782,6 +4783,21 @@ sub encode_client_response {
|
||||
return $client_response;
|
||||
}
|
||||
|
||||
sub validate_options {
|
||||
my ($o) = @_;
|
||||
|
||||
return if !$o->got('version-check');
|
||||
|
||||
my $value = $o->get('version-check');
|
||||
my @values = split /, /,
|
||||
$o->read_para_after(__FILE__, qr/MAGIC_version_check/);
|
||||
chomp(@values);
|
||||
|
||||
return if grep { $value eq $_ } @values;
|
||||
$o->save_error("--version-check invalud value $value. Accepted values are "
|
||||
. join(", ", @values[0..$#values-1]) . " and $values[-1]" );
|
||||
}
|
||||
|
||||
sub _d {
|
||||
my ($package, undef, $line) = caller 0;
|
||||
@_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }
|
||||
@@ -4835,6 +4851,7 @@ sub main {
|
||||
if ( !$o->get('columns-regex') ) {
|
||||
$o->save_error("A regex pattern for --column-regex must be specified");
|
||||
}
|
||||
Pingback::validate_options($o);
|
||||
}
|
||||
|
||||
$o->usage_or_errors();
|
||||
@@ -4843,7 +4860,7 @@ sub main {
|
||||
# Do the version-check
|
||||
# ########################################################################
|
||||
if ( $o->get('version-check') ne 'off' && (!$o->has('quiet') || !$o->get('quiet')) ) {
|
||||
Pingback::version_check({ protocol => $o->get('version-check') });
|
||||
Pingback::version_check(protocol => $o->get('version-check'));
|
||||
}
|
||||
|
||||
# ########################################################################
|
||||
@@ -5437,9 +5454,15 @@ Show version and exit.
|
||||
type: string; default: off
|
||||
|
||||
Send program versions to Percona and print suggested upgrades and problems.
|
||||
Possible values for --version-check:
|
||||
|
||||
Accepted values are https, http, off, and auto -- The latter tries both https
|
||||
and http, in that order. Keep in mind that 'https' might fail if
|
||||
=for comment ignore-pt-internal-value
|
||||
MAGIC_version_check
|
||||
|
||||
https, http, auto, off
|
||||
|
||||
C<auto> first tries using C<https>, and resolts to C<http> if that fails.
|
||||
Keep in mind that C<https> might not be available if
|
||||
C<IO::Socket::SSL> is not installed on your system, although
|
||||
C<--version-check http> should work everywhere.
|
||||
|
||||
|
@@ -4306,14 +4306,19 @@ eval {
|
||||
};
|
||||
|
||||
sub version_check {
|
||||
my $args = pop @_;
|
||||
my (@instances) = @_;
|
||||
my %args = @_;
|
||||
my @instances = $args{instances} ? @{ $args{instances} } : ();
|
||||
|
||||
if (exists $ENV{PERCONA_VERSION_CHECK} && !$ENV{PERCONA_VERSION_CHECK}) {
|
||||
print STDERR '--version-check is disabled by the PERCONA_VERSION_CHECK ',
|
||||
warn '--version-check is disabled by the PERCONA_VERSION_CHECK ',
|
||||
"environment variable.\n\n";
|
||||
return;
|
||||
}
|
||||
|
||||
$args{protocol} ||= 'https';
|
||||
my @protocols = $args{protocol} eq 'auto'
|
||||
? qw(https http)
|
||||
: $args{protocol};
|
||||
|
||||
my $instances_to_check = [];
|
||||
my $time = int(time());
|
||||
@@ -4328,15 +4333,11 @@ sub version_check {
|
||||
($time_to_check, $instances_to_check)
|
||||
= time_to_check($check_time_file, \@instances, $time);
|
||||
if ( !$time_to_check ) {
|
||||
print STDERR 'It is not time to --version-check again; ',
|
||||
warn 'It is not time to --version-check again; ',
|
||||
"only 1 check per day.\n\n";
|
||||
return;
|
||||
}
|
||||
|
||||
$args->{protocol} ||= 'https';
|
||||
my @protocols = $args->{protocol} ne 'https' && $args->{protocol} ne 'http'
|
||||
? qw(https http)
|
||||
: $args->{protocol};
|
||||
my $advice;
|
||||
my $e;
|
||||
for my $protocol ( @protocols ) {
|
||||
@@ -4379,7 +4380,7 @@ sub pingback {
|
||||
|
||||
my ($instances, $ua, $vc) = @args{qw(instances ua VersionCheck)};
|
||||
|
||||
$ua ||= HTTPMicro->new( timeout => 2 );
|
||||
$ua ||= HTTPMicro->new( timeout => 5 );
|
||||
$vc ||= VersionCheck->new();
|
||||
|
||||
my $response = $ua->request('GET', $url);
|
||||
@@ -4595,6 +4596,21 @@ sub encode_client_response {
|
||||
return $client_response;
|
||||
}
|
||||
|
||||
sub validate_options {
|
||||
my ($o) = @_;
|
||||
|
||||
return if !$o->got('version-check');
|
||||
|
||||
my $value = $o->get('version-check');
|
||||
my @values = split /, /,
|
||||
$o->read_para_after(__FILE__, qr/MAGIC_version_check/);
|
||||
chomp(@values);
|
||||
|
||||
return if grep { $value eq $_ } @values;
|
||||
$o->save_error("--version-check invalud value $value. Accepted values are "
|
||||
. join(", ", @values[0..$#values-1]) . " and $values[-1]" );
|
||||
}
|
||||
|
||||
sub _d {
|
||||
my ($package, undef, $line) = caller 0;
|
||||
@_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }
|
||||
@@ -4652,7 +4668,8 @@ sub main {
|
||||
|
||||
my $dp = $o->DSNParser();
|
||||
$dp->prop('set-vars', $o->get('set-vars'));
|
||||
|
||||
Pingback::validate_options($o);
|
||||
|
||||
$o->usage_or_errors();
|
||||
|
||||
# ########################################################################
|
||||
@@ -4684,8 +4701,8 @@ sub main {
|
||||
# ########################################################################
|
||||
if ( $o->get('version-check') ne 'off' && (!$o->has('quiet') || !$o->get('quiet')) ) {
|
||||
Pingback::version_check(
|
||||
{dbh => $dbh, dsn => $dsn},
|
||||
{ protocol => $o->get('version-check') },
|
||||
instances => [ {dbh => $dbh, dsn => $dsn} ],
|
||||
protocol => $o->get('version-check'),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -5192,9 +5209,15 @@ Show version and exit.
|
||||
type: string; default: off
|
||||
|
||||
Send program versions to Percona and print suggested upgrades and problems.
|
||||
Possible values for --version-check:
|
||||
|
||||
Accepted values are https, http, off, and auto -- The latter tries both https
|
||||
and http, in that order. Keep in mind that 'https' might fail if
|
||||
=for comment ignore-pt-internal-value
|
||||
MAGIC_version_check
|
||||
|
||||
https, http, auto, off
|
||||
|
||||
C<auto> first tries using C<https>, and resolts to C<http> if that fails.
|
||||
Keep in mind that C<https> might not be available if
|
||||
C<IO::Socket::SSL> is not installed on your system, although
|
||||
C<--version-check http> should work everywhere.
|
||||
|
||||
|
50
bin/pt-find
50
bin/pt-find
@@ -3146,14 +3146,19 @@ eval {
|
||||
};
|
||||
|
||||
sub version_check {
|
||||
my $args = pop @_;
|
||||
my (@instances) = @_;
|
||||
my %args = @_;
|
||||
my @instances = $args{instances} ? @{ $args{instances} } : ();
|
||||
|
||||
if (exists $ENV{PERCONA_VERSION_CHECK} && !$ENV{PERCONA_VERSION_CHECK}) {
|
||||
print STDERR '--version-check is disabled by the PERCONA_VERSION_CHECK ',
|
||||
warn '--version-check is disabled by the PERCONA_VERSION_CHECK ',
|
||||
"environment variable.\n\n";
|
||||
return;
|
||||
}
|
||||
|
||||
$args{protocol} ||= 'https';
|
||||
my @protocols = $args{protocol} eq 'auto'
|
||||
? qw(https http)
|
||||
: $args{protocol};
|
||||
|
||||
my $instances_to_check = [];
|
||||
my $time = int(time());
|
||||
@@ -3168,15 +3173,11 @@ sub version_check {
|
||||
($time_to_check, $instances_to_check)
|
||||
= time_to_check($check_time_file, \@instances, $time);
|
||||
if ( !$time_to_check ) {
|
||||
print STDERR 'It is not time to --version-check again; ',
|
||||
warn 'It is not time to --version-check again; ',
|
||||
"only 1 check per day.\n\n";
|
||||
return;
|
||||
}
|
||||
|
||||
$args->{protocol} ||= 'https';
|
||||
my @protocols = $args->{protocol} ne 'https' && $args->{protocol} ne 'http'
|
||||
? qw(https http)
|
||||
: $args->{protocol};
|
||||
my $advice;
|
||||
my $e;
|
||||
for my $protocol ( @protocols ) {
|
||||
@@ -3219,7 +3220,7 @@ sub pingback {
|
||||
|
||||
my ($instances, $ua, $vc) = @args{qw(instances ua VersionCheck)};
|
||||
|
||||
$ua ||= HTTPMicro->new( timeout => 2 );
|
||||
$ua ||= HTTPMicro->new( timeout => 5 );
|
||||
$vc ||= VersionCheck->new();
|
||||
|
||||
my $response = $ua->request('GET', $url);
|
||||
@@ -3435,6 +3436,21 @@ sub encode_client_response {
|
||||
return $client_response;
|
||||
}
|
||||
|
||||
sub validate_options {
|
||||
my ($o) = @_;
|
||||
|
||||
return if !$o->got('version-check');
|
||||
|
||||
my $value = $o->get('version-check');
|
||||
my @values = split /, /,
|
||||
$o->read_para_after(__FILE__, qr/MAGIC_version_check/);
|
||||
chomp(@values);
|
||||
|
||||
return if grep { $value eq $_ } @values;
|
||||
$o->save_error("--version-check invalud value $value. Accepted values are "
|
||||
. join(", ", @values[0..$#values-1]) . " and $values[-1]" );
|
||||
}
|
||||
|
||||
sub _d {
|
||||
my ($package, undef, $line) = caller 0;
|
||||
@_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }
|
||||
@@ -3751,6 +3767,8 @@ sub main {
|
||||
$o->save_error("--server-id regex doesn't capture digits with (\\d+)");
|
||||
}
|
||||
|
||||
Pingback::validate_options($o);
|
||||
|
||||
$o->usage_or_errors();
|
||||
|
||||
# Interpolate strings for printf and exec. At the same time discover whether
|
||||
@@ -3852,8 +3870,8 @@ sub main {
|
||||
# ########################################################################
|
||||
if ( $o->get('version-check') ne 'off' && (!$o->has('quiet') || !$o->get('quiet')) ) {
|
||||
Pingback::version_check(
|
||||
{dbh => $dbh, dsn => $dsn},
|
||||
{protocol => $o->get('version-check')},
|
||||
instances => [{dbh => $dbh, dsn => $dsn}],
|
||||
protocol => $o->get('version-check'),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4310,9 +4328,15 @@ Show version and exit.
|
||||
type: string; default: off
|
||||
|
||||
Send program versions to Percona and print suggested upgrades and problems.
|
||||
Possible values for --version-check:
|
||||
|
||||
Accepted values are https, http, off, and auto -- The latter tries both https
|
||||
and http, in that order. Keep in mind that 'https' might fail if
|
||||
=for comment ignore-pt-internal-value
|
||||
MAGIC_version_check
|
||||
|
||||
https, http, auto, off
|
||||
|
||||
C<auto> first tries using C<https>, and resolts to C<http> if that fails.
|
||||
Keep in mind that C<https> might not be available if
|
||||
C<IO::Socket::SSL> is not installed on your system, although
|
||||
C<--version-check http> should work everywhere.
|
||||
|
||||
|
@@ -3086,14 +3086,19 @@ eval {
|
||||
};
|
||||
|
||||
sub version_check {
|
||||
my $args = pop @_;
|
||||
my (@instances) = @_;
|
||||
my %args = @_;
|
||||
my @instances = $args{instances} ? @{ $args{instances} } : ();
|
||||
|
||||
if (exists $ENV{PERCONA_VERSION_CHECK} && !$ENV{PERCONA_VERSION_CHECK}) {
|
||||
print STDERR '--version-check is disabled by the PERCONA_VERSION_CHECK ',
|
||||
warn '--version-check is disabled by the PERCONA_VERSION_CHECK ',
|
||||
"environment variable.\n\n";
|
||||
return;
|
||||
}
|
||||
|
||||
$args{protocol} ||= 'https';
|
||||
my @protocols = $args{protocol} eq 'auto'
|
||||
? qw(https http)
|
||||
: $args{protocol};
|
||||
|
||||
my $instances_to_check = [];
|
||||
my $time = int(time());
|
||||
@@ -3108,15 +3113,11 @@ sub version_check {
|
||||
($time_to_check, $instances_to_check)
|
||||
= time_to_check($check_time_file, \@instances, $time);
|
||||
if ( !$time_to_check ) {
|
||||
print STDERR 'It is not time to --version-check again; ',
|
||||
warn 'It is not time to --version-check again; ',
|
||||
"only 1 check per day.\n\n";
|
||||
return;
|
||||
}
|
||||
|
||||
$args->{protocol} ||= 'https';
|
||||
my @protocols = $args->{protocol} ne 'https' && $args->{protocol} ne 'http'
|
||||
? qw(https http)
|
||||
: $args->{protocol};
|
||||
my $advice;
|
||||
my $e;
|
||||
for my $protocol ( @protocols ) {
|
||||
@@ -3159,7 +3160,7 @@ sub pingback {
|
||||
|
||||
my ($instances, $ua, $vc) = @args{qw(instances ua VersionCheck)};
|
||||
|
||||
$ua ||= HTTPMicro->new( timeout => 2 );
|
||||
$ua ||= HTTPMicro->new( timeout => 5 );
|
||||
$vc ||= VersionCheck->new();
|
||||
|
||||
my $response = $ua->request('GET', $url);
|
||||
@@ -3375,6 +3376,21 @@ sub encode_client_response {
|
||||
return $client_response;
|
||||
}
|
||||
|
||||
sub validate_options {
|
||||
my ($o) = @_;
|
||||
|
||||
return if !$o->got('version-check');
|
||||
|
||||
my $value = $o->get('version-check');
|
||||
my @values = split /, /,
|
||||
$o->read_para_after(__FILE__, qr/MAGIC_version_check/);
|
||||
chomp(@values);
|
||||
|
||||
return if grep { $value eq $_ } @values;
|
||||
$o->save_error("--version-check invalud value $value. Accepted values are "
|
||||
. join(", ", @values[0..$#values-1]) . " and $values[-1]" );
|
||||
}
|
||||
|
||||
sub _d {
|
||||
my ($package, undef, $line) = caller 0;
|
||||
@_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }
|
||||
@@ -3447,6 +3463,8 @@ sub main {
|
||||
if ( $dst_dsn && !$dst_dsn->{t} ) {
|
||||
$o->save_error("--dest requires a 't' (table) part");
|
||||
}
|
||||
|
||||
Pingback::validate_options($o);
|
||||
}
|
||||
|
||||
$o->usage_or_errors();
|
||||
@@ -3509,9 +3527,11 @@ sub main {
|
||||
# ########################################################################
|
||||
if ( $o->get('version-check') ne 'off' && (!$o->has('quiet') || !$o->get('quiet')) ) {
|
||||
Pingback::version_check(
|
||||
{ dbh => $dbh, dsn => $src_dsn },
|
||||
($dst_dbh ? { dbh => $dst_dbh, dsn => $dst_dsn } : ()),
|
||||
{ protocol => $o->get('version-check') },
|
||||
instances => [
|
||||
{ dbh => $dbh, dsn => $src_dsn },
|
||||
($dst_dbh ? { dbh => $dst_dbh, dsn => $dst_dsn } : ())
|
||||
],
|
||||
protocol => $o->get('version-check'),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -3804,9 +3824,15 @@ Show version and exit.
|
||||
type: string; default: off
|
||||
|
||||
Send program versions to Percona and print suggested upgrades and problems.
|
||||
Possible values for --version-check:
|
||||
|
||||
Accepted values are https, http, off, and auto -- The latter tries both https
|
||||
and http, in that order. Keep in mind that 'https' might fail if
|
||||
=for comment ignore-pt-internal-value
|
||||
MAGIC_version_check
|
||||
|
||||
https, http, auto, off
|
||||
|
||||
C<auto> first tries using C<https>, and resolts to C<http> if that fails.
|
||||
Keep in mind that C<https> might not be available if
|
||||
C<IO::Socket::SSL> is not installed on your system, although
|
||||
C<--version-check http> should work everywhere.
|
||||
|
||||
|
@@ -4230,14 +4230,19 @@ eval {
|
||||
};
|
||||
|
||||
sub version_check {
|
||||
my $args = pop @_;
|
||||
my (@instances) = @_;
|
||||
my %args = @_;
|
||||
my @instances = $args{instances} ? @{ $args{instances} } : ();
|
||||
|
||||
if (exists $ENV{PERCONA_VERSION_CHECK} && !$ENV{PERCONA_VERSION_CHECK}) {
|
||||
print STDERR '--version-check is disabled by the PERCONA_VERSION_CHECK ',
|
||||
warn '--version-check is disabled by the PERCONA_VERSION_CHECK ',
|
||||
"environment variable.\n\n";
|
||||
return;
|
||||
}
|
||||
|
||||
$args{protocol} ||= 'https';
|
||||
my @protocols = $args{protocol} eq 'auto'
|
||||
? qw(https http)
|
||||
: $args{protocol};
|
||||
|
||||
my $instances_to_check = [];
|
||||
my $time = int(time());
|
||||
@@ -4252,15 +4257,11 @@ sub version_check {
|
||||
($time_to_check, $instances_to_check)
|
||||
= time_to_check($check_time_file, \@instances, $time);
|
||||
if ( !$time_to_check ) {
|
||||
print STDERR 'It is not time to --version-check again; ',
|
||||
warn 'It is not time to --version-check again; ',
|
||||
"only 1 check per day.\n\n";
|
||||
return;
|
||||
}
|
||||
|
||||
$args->{protocol} ||= 'https';
|
||||
my @protocols = $args->{protocol} ne 'https' && $args->{protocol} ne 'http'
|
||||
? qw(https http)
|
||||
: $args->{protocol};
|
||||
my $advice;
|
||||
my $e;
|
||||
for my $protocol ( @protocols ) {
|
||||
@@ -4303,7 +4304,7 @@ sub pingback {
|
||||
|
||||
my ($instances, $ua, $vc) = @args{qw(instances ua VersionCheck)};
|
||||
|
||||
$ua ||= HTTPMicro->new( timeout => 2 );
|
||||
$ua ||= HTTPMicro->new( timeout => 5 );
|
||||
$vc ||= VersionCheck->new();
|
||||
|
||||
my $response = $ua->request('GET', $url);
|
||||
@@ -4519,6 +4520,21 @@ sub encode_client_response {
|
||||
return $client_response;
|
||||
}
|
||||
|
||||
sub validate_options {
|
||||
my ($o) = @_;
|
||||
|
||||
return if !$o->got('version-check');
|
||||
|
||||
my $value = $o->get('version-check');
|
||||
my @values = split /, /,
|
||||
$o->read_para_after(__FILE__, qr/MAGIC_version_check/);
|
||||
chomp(@values);
|
||||
|
||||
return if grep { $value eq $_ } @values;
|
||||
$o->save_error("--version-check invalud value $value. Accepted values are "
|
||||
. join(", ", @values[0..$#values-1]) . " and $values[-1]" );
|
||||
}
|
||||
|
||||
sub _d {
|
||||
my ($package, undef, $line) = caller 0;
|
||||
@_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }
|
||||
@@ -4620,6 +4636,8 @@ sub main {
|
||||
$o->save_error("Invalid --recursion-method: $EVAL_ERROR")
|
||||
}
|
||||
|
||||
Pingback::validate_options($o);
|
||||
|
||||
$o->usage_or_errors();
|
||||
|
||||
# ########################################################################
|
||||
@@ -4971,7 +4989,10 @@ sub main {
|
||||
# Do the version-check
|
||||
# ########################################################################
|
||||
if ( $o->get('version-check') ne 'off' && (!$o->has('quiet') || !$o->get('quiet')) ) {
|
||||
Pingback::version_check({dbh => $dbh, dsn => $dsn}, { protocol => $o->get('version-check') });
|
||||
Pingback::version_check(
|
||||
instances => [ {dbh => $dbh, dsn => $dsn} ],
|
||||
protocol => $o->get('version-check'),
|
||||
);
|
||||
}
|
||||
|
||||
# ########################################################################
|
||||
@@ -5706,9 +5727,15 @@ Show version and exit.
|
||||
type: string; default: off
|
||||
|
||||
Send program versions to Percona and print suggested upgrades and problems.
|
||||
Possible values for --version-check:
|
||||
|
||||
Accepted values are https, http, off, and auto -- The latter tries both https
|
||||
and http, in that order. Keep in mind that 'https' might fail if
|
||||
=for comment ignore-pt-internal-value
|
||||
MAGIC_version_check
|
||||
|
||||
https, http, auto, off
|
||||
|
||||
C<auto> first tries using C<https>, and resolts to C<http> if that fails.
|
||||
Keep in mind that C<https> might not be available if
|
||||
C<IO::Socket::SSL> is not installed on your system, although
|
||||
C<--version-check http> should work everywhere.
|
||||
|
||||
|
@@ -5812,14 +5812,19 @@ eval {
|
||||
};
|
||||
|
||||
sub version_check {
|
||||
my $args = pop @_;
|
||||
my (@instances) = @_;
|
||||
my %args = @_;
|
||||
my @instances = $args{instances} ? @{ $args{instances} } : ();
|
||||
|
||||
if (exists $ENV{PERCONA_VERSION_CHECK} && !$ENV{PERCONA_VERSION_CHECK}) {
|
||||
print STDERR '--version-check is disabled by the PERCONA_VERSION_CHECK ',
|
||||
warn '--version-check is disabled by the PERCONA_VERSION_CHECK ',
|
||||
"environment variable.\n\n";
|
||||
return;
|
||||
}
|
||||
|
||||
$args{protocol} ||= 'https';
|
||||
my @protocols = $args{protocol} eq 'auto'
|
||||
? qw(https http)
|
||||
: $args{protocol};
|
||||
|
||||
my $instances_to_check = [];
|
||||
my $time = int(time());
|
||||
@@ -5834,15 +5839,11 @@ sub version_check {
|
||||
($time_to_check, $instances_to_check)
|
||||
= time_to_check($check_time_file, \@instances, $time);
|
||||
if ( !$time_to_check ) {
|
||||
print STDERR 'It is not time to --version-check again; ',
|
||||
warn 'It is not time to --version-check again; ',
|
||||
"only 1 check per day.\n\n";
|
||||
return;
|
||||
}
|
||||
|
||||
$args->{protocol} ||= 'https';
|
||||
my @protocols = $args->{protocol} ne 'https' && $args->{protocol} ne 'http'
|
||||
? qw(https http)
|
||||
: $args->{protocol};
|
||||
my $advice;
|
||||
my $e;
|
||||
for my $protocol ( @protocols ) {
|
||||
@@ -5885,7 +5886,7 @@ sub pingback {
|
||||
|
||||
my ($instances, $ua, $vc) = @args{qw(instances ua VersionCheck)};
|
||||
|
||||
$ua ||= HTTPMicro->new( timeout => 2 );
|
||||
$ua ||= HTTPMicro->new( timeout => 5 );
|
||||
$vc ||= VersionCheck->new();
|
||||
|
||||
my $response = $ua->request('GET', $url);
|
||||
@@ -6101,6 +6102,21 @@ sub encode_client_response {
|
||||
return $client_response;
|
||||
}
|
||||
|
||||
sub validate_options {
|
||||
my ($o) = @_;
|
||||
|
||||
return if !$o->got('version-check');
|
||||
|
||||
my $value = $o->get('version-check');
|
||||
my @values = split /, /,
|
||||
$o->read_para_after(__FILE__, qr/MAGIC_version_check/);
|
||||
chomp(@values);
|
||||
|
||||
return if grep { $value eq $_ } @values;
|
||||
$o->save_error("--version-check invalud value $value. Accepted values are "
|
||||
. join(", ", @values[0..$#values-1]) . " and $values[-1]" );
|
||||
}
|
||||
|
||||
sub _d {
|
||||
my ($package, undef, $line) = caller 0;
|
||||
@_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }
|
||||
@@ -6170,6 +6186,8 @@ sub main {
|
||||
. "--save-results-database DSN");
|
||||
}
|
||||
}
|
||||
|
||||
Pingback::validate_options($o);
|
||||
}
|
||||
|
||||
$o->usage_or_errors();
|
||||
@@ -6315,9 +6333,11 @@ sub main {
|
||||
# ########################################################################
|
||||
if ( $o->get('version-check') ne 'off' && (!$o->has('quiet') || !$o->get('quiet')) ) {
|
||||
Pingback::version_check(
|
||||
{ dbh => $dbh, dsn => $dsn },
|
||||
($res_dbh ? { dbh => $res_dbh, dsn => $res_dsn } : ()),
|
||||
{ protocol => $o->get('version-check') },
|
||||
instances => [
|
||||
{ dbh => $dbh, dsn => $dsn },
|
||||
($res_dbh ? { dbh => $res_dbh, dsn => $res_dsn } : ())
|
||||
],
|
||||
protocol => $o->get('version-check'),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -7235,9 +7255,15 @@ Show version and exit.
|
||||
type: string; default: off
|
||||
|
||||
Send program versions to Percona and print suggested upgrades and problems.
|
||||
Possible values for --version-check:
|
||||
|
||||
Accepted values are https, http, off, and auto -- The latter tries both https
|
||||
and http, in that order. Keep in mind that 'https' might fail if
|
||||
=for comment ignore-pt-internal-value
|
||||
MAGIC_version_check
|
||||
|
||||
https, http, auto, off
|
||||
|
||||
C<auto> first tries using C<https>, and resolts to C<http> if that fails.
|
||||
Keep in mind that C<https> might not be available if
|
||||
C<IO::Socket::SSL> is not installed on your system, although
|
||||
C<--version-check http> should work everywhere.
|
||||
|
||||
|
54
bin/pt-kill
54
bin/pt-kill
@@ -4804,7 +4804,9 @@ sub is_cluster_node {
|
||||
PTDEBUG && _d($sql);
|
||||
my $row = $self->{dbh}->selectrow_arrayref($sql);
|
||||
PTDEBUG && _d(defined $row ? @$row : 'undef');
|
||||
$self->{is_cluster_node} = $row && $row->[0] ? 1 : 0;
|
||||
$self->{is_cluster_node} = $row && $row->[1]
|
||||
? ($row->[1] eq 'ON' || $row->[1] eq '1')
|
||||
: 0;
|
||||
|
||||
return $self->{is_cluster_node};
|
||||
}
|
||||
@@ -5821,14 +5823,19 @@ eval {
|
||||
};
|
||||
|
||||
sub version_check {
|
||||
my $args = pop @_;
|
||||
my (@instances) = @_;
|
||||
my %args = @_;
|
||||
my @instances = $args{instances} ? @{ $args{instances} } : ();
|
||||
|
||||
if (exists $ENV{PERCONA_VERSION_CHECK} && !$ENV{PERCONA_VERSION_CHECK}) {
|
||||
print STDERR '--version-check is disabled by the PERCONA_VERSION_CHECK ',
|
||||
warn '--version-check is disabled by the PERCONA_VERSION_CHECK ',
|
||||
"environment variable.\n\n";
|
||||
return;
|
||||
}
|
||||
|
||||
$args{protocol} ||= 'https';
|
||||
my @protocols = $args{protocol} eq 'auto'
|
||||
? qw(https http)
|
||||
: $args{protocol};
|
||||
|
||||
my $instances_to_check = [];
|
||||
my $time = int(time());
|
||||
@@ -5843,15 +5850,11 @@ sub version_check {
|
||||
($time_to_check, $instances_to_check)
|
||||
= time_to_check($check_time_file, \@instances, $time);
|
||||
if ( !$time_to_check ) {
|
||||
print STDERR 'It is not time to --version-check again; ',
|
||||
warn 'It is not time to --version-check again; ',
|
||||
"only 1 check per day.\n\n";
|
||||
return;
|
||||
}
|
||||
|
||||
$args->{protocol} ||= 'https';
|
||||
my @protocols = $args->{protocol} ne 'https' && $args->{protocol} ne 'http'
|
||||
? qw(https http)
|
||||
: $args->{protocol};
|
||||
my $advice;
|
||||
my $e;
|
||||
for my $protocol ( @protocols ) {
|
||||
@@ -5894,7 +5897,7 @@ sub pingback {
|
||||
|
||||
my ($instances, $ua, $vc) = @args{qw(instances ua VersionCheck)};
|
||||
|
||||
$ua ||= HTTPMicro->new( timeout => 2 );
|
||||
$ua ||= HTTPMicro->new( timeout => 5 );
|
||||
$vc ||= VersionCheck->new();
|
||||
|
||||
my $response = $ua->request('GET', $url);
|
||||
@@ -6110,6 +6113,21 @@ sub encode_client_response {
|
||||
return $client_response;
|
||||
}
|
||||
|
||||
sub validate_options {
|
||||
my ($o) = @_;
|
||||
|
||||
return if !$o->got('version-check');
|
||||
|
||||
my $value = $o->get('version-check');
|
||||
my @values = split /, /,
|
||||
$o->read_para_after(__FILE__, qr/MAGIC_version_check/);
|
||||
chomp(@values);
|
||||
|
||||
return if grep { $value eq $_ } @values;
|
||||
$o->save_error("--version-check invalud value $value. Accepted values are "
|
||||
. join(", ", @values[0..$#values-1]) . " and $values[-1]" );
|
||||
}
|
||||
|
||||
sub _d {
|
||||
my ($package, undef, $line) = caller 0;
|
||||
@_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }
|
||||
@@ -6193,6 +6211,8 @@ sub main {
|
||||
$o->save_error("Invalid value for --victims: $victims");
|
||||
}
|
||||
|
||||
Pingback::validate_options($o);
|
||||
|
||||
$o->usage_or_errors();
|
||||
|
||||
# ########################################################################
|
||||
@@ -6475,8 +6495,8 @@ sub main {
|
||||
# ########################################################################
|
||||
if ( $o->get('version-check') ne 'off' && (!$o->has('quiet') || !$o->get('quiet')) ) {
|
||||
Pingback::version_check(
|
||||
($dbh ? { dbh => $dbh, dsn => $cxn->dsn() } : ()),
|
||||
{ protocol => $o->get('version-check') },
|
||||
instances => [ ($dbh ? { dbh => $dbh, dsn => $cxn->dsn() } : ()) ],
|
||||
protocol => $o->get('version-check'),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -7210,9 +7230,15 @@ Show version and exit.
|
||||
type: string; default: off
|
||||
|
||||
Send program versions to Percona and print suggested upgrades and problems.
|
||||
Possible values for --version-check:
|
||||
|
||||
Accepted values are https, http, off, and auto -- The latter tries both https
|
||||
and http, in that order. Keep in mind that 'https' might fail if
|
||||
=for comment ignore-pt-internal-value
|
||||
MAGIC_version_check
|
||||
|
||||
https, http, auto, off
|
||||
|
||||
C<auto> first tries using C<https>, and resolts to C<http> if that fails.
|
||||
Keep in mind that C<https> might not be available if
|
||||
C<IO::Socket::SSL> is not installed on your system, although
|
||||
C<--version-check http> should work everywhere.
|
||||
|
||||
|
@@ -3434,7 +3434,9 @@ sub is_cluster_node {
|
||||
PTDEBUG && _d($sql);
|
||||
my $row = $self->{dbh}->selectrow_arrayref($sql);
|
||||
PTDEBUG && _d(defined $row ? @$row : 'undef');
|
||||
$self->{is_cluster_node} = $row && $row->[0] ? 1 : 0;
|
||||
$self->{is_cluster_node} = $row && $row->[1]
|
||||
? ($row->[1] eq 'ON' || $row->[1] eq '1')
|
||||
: 0;
|
||||
|
||||
return $self->{is_cluster_node};
|
||||
}
|
||||
@@ -6843,14 +6845,19 @@ eval {
|
||||
};
|
||||
|
||||
sub version_check {
|
||||
my $args = pop @_;
|
||||
my (@instances) = @_;
|
||||
my %args = @_;
|
||||
my @instances = $args{instances} ? @{ $args{instances} } : ();
|
||||
|
||||
if (exists $ENV{PERCONA_VERSION_CHECK} && !$ENV{PERCONA_VERSION_CHECK}) {
|
||||
print STDERR '--version-check is disabled by the PERCONA_VERSION_CHECK ',
|
||||
warn '--version-check is disabled by the PERCONA_VERSION_CHECK ',
|
||||
"environment variable.\n\n";
|
||||
return;
|
||||
}
|
||||
|
||||
$args{protocol} ||= 'https';
|
||||
my @protocols = $args{protocol} eq 'auto'
|
||||
? qw(https http)
|
||||
: $args{protocol};
|
||||
|
||||
my $instances_to_check = [];
|
||||
my $time = int(time());
|
||||
@@ -6865,15 +6872,11 @@ sub version_check {
|
||||
($time_to_check, $instances_to_check)
|
||||
= time_to_check($check_time_file, \@instances, $time);
|
||||
if ( !$time_to_check ) {
|
||||
print STDERR 'It is not time to --version-check again; ',
|
||||
warn 'It is not time to --version-check again; ',
|
||||
"only 1 check per day.\n\n";
|
||||
return;
|
||||
}
|
||||
|
||||
$args->{protocol} ||= 'https';
|
||||
my @protocols = $args->{protocol} ne 'https' && $args->{protocol} ne 'http'
|
||||
? qw(https http)
|
||||
: $args->{protocol};
|
||||
my $advice;
|
||||
my $e;
|
||||
for my $protocol ( @protocols ) {
|
||||
@@ -6916,7 +6919,7 @@ sub pingback {
|
||||
|
||||
my ($instances, $ua, $vc) = @args{qw(instances ua VersionCheck)};
|
||||
|
||||
$ua ||= HTTPMicro->new( timeout => 2 );
|
||||
$ua ||= HTTPMicro->new( timeout => 5 );
|
||||
$vc ||= VersionCheck->new();
|
||||
|
||||
my $response = $ua->request('GET', $url);
|
||||
@@ -7132,6 +7135,21 @@ sub encode_client_response {
|
||||
return $client_response;
|
||||
}
|
||||
|
||||
sub validate_options {
|
||||
my ($o) = @_;
|
||||
|
||||
return if !$o->got('version-check');
|
||||
|
||||
my $value = $o->get('version-check');
|
||||
my @values = split /, /,
|
||||
$o->read_para_after(__FILE__, qr/MAGIC_version_check/);
|
||||
chomp(@values);
|
||||
|
||||
return if grep { $value eq $_ } @values;
|
||||
$o->save_error("--version-check invalud value $value. Accepted values are "
|
||||
. join(", ", @values[0..$#values-1]) . " and $values[-1]" );
|
||||
}
|
||||
|
||||
sub _d {
|
||||
my ($package, undef, $line) = caller 0;
|
||||
@_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }
|
||||
@@ -7281,6 +7299,8 @@ sub main {
|
||||
$o->save_error("Invalid --recursion-method: $EVAL_ERROR")
|
||||
}
|
||||
|
||||
Pingback::validate_options($o);
|
||||
|
||||
$o->usage_or_errors();
|
||||
|
||||
if ( $o->get('quiet') ) {
|
||||
@@ -7536,9 +7556,9 @@ sub main {
|
||||
# ########################################################################
|
||||
if ( $o->get('version-check') ne 'off' && (!$o->has('quiet') || !$o->get('quiet')) ) {
|
||||
Pingback::version_check(
|
||||
map({ +{ dbh => $_->dbh(), dsn => $_->dsn() } }
|
||||
$cxn, ($slaves ? @$slaves : ())),
|
||||
{ protocol => $o->get('version-check') },
|
||||
instances => [ map({ +{ dbh => $_->dbh(), dsn => $_->dsn() } }
|
||||
$cxn, ($slaves ? @$slaves : ())) ],
|
||||
protocol => $o->get('version-check'),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -9873,9 +9893,15 @@ Show version and exit.
|
||||
type: string; default: off
|
||||
|
||||
Send program versions to Percona and print suggested upgrades and problems.
|
||||
Possible values for --version-check:
|
||||
|
||||
Accepted values are https, http, off, and auto -- The latter tries both https
|
||||
and http, in that order. Keep in mind that 'https' might fail if
|
||||
=for comment ignore-pt-internal-value
|
||||
MAGIC_version_check
|
||||
|
||||
https, http, auto, off
|
||||
|
||||
C<auto> first tries using C<https>, and resolts to C<http> if that fails.
|
||||
Keep in mind that C<https> might not be available if
|
||||
C<IO::Socket::SSL> is not installed on your system, although
|
||||
C<--version-check http> should work everywhere.
|
||||
|
||||
|
@@ -6997,14 +6997,19 @@ eval {
|
||||
};
|
||||
|
||||
sub version_check {
|
||||
my $args = pop @_;
|
||||
my (@instances) = @_;
|
||||
my %args = @_;
|
||||
my @instances = $args{instances} ? @{ $args{instances} } : ();
|
||||
|
||||
if (exists $ENV{PERCONA_VERSION_CHECK} && !$ENV{PERCONA_VERSION_CHECK}) {
|
||||
print STDERR '--version-check is disabled by the PERCONA_VERSION_CHECK ',
|
||||
warn '--version-check is disabled by the PERCONA_VERSION_CHECK ',
|
||||
"environment variable.\n\n";
|
||||
return;
|
||||
}
|
||||
|
||||
$args{protocol} ||= 'https';
|
||||
my @protocols = $args{protocol} eq 'auto'
|
||||
? qw(https http)
|
||||
: $args{protocol};
|
||||
|
||||
my $instances_to_check = [];
|
||||
my $time = int(time());
|
||||
@@ -7019,15 +7024,11 @@ sub version_check {
|
||||
($time_to_check, $instances_to_check)
|
||||
= time_to_check($check_time_file, \@instances, $time);
|
||||
if ( !$time_to_check ) {
|
||||
print STDERR 'It is not time to --version-check again; ',
|
||||
warn 'It is not time to --version-check again; ',
|
||||
"only 1 check per day.\n\n";
|
||||
return;
|
||||
}
|
||||
|
||||
$args->{protocol} ||= 'https';
|
||||
my @protocols = $args->{protocol} ne 'https' && $args->{protocol} ne 'http'
|
||||
? qw(https http)
|
||||
: $args->{protocol};
|
||||
my $advice;
|
||||
my $e;
|
||||
for my $protocol ( @protocols ) {
|
||||
@@ -7070,7 +7071,7 @@ sub pingback {
|
||||
|
||||
my ($instances, $ua, $vc) = @args{qw(instances ua VersionCheck)};
|
||||
|
||||
$ua ||= HTTPMicro->new( timeout => 2 );
|
||||
$ua ||= HTTPMicro->new( timeout => 5 );
|
||||
$vc ||= VersionCheck->new();
|
||||
|
||||
my $response = $ua->request('GET', $url);
|
||||
@@ -7286,6 +7287,21 @@ sub encode_client_response {
|
||||
return $client_response;
|
||||
}
|
||||
|
||||
sub validate_options {
|
||||
my ($o) = @_;
|
||||
|
||||
return if !$o->got('version-check');
|
||||
|
||||
my $value = $o->get('version-check');
|
||||
my @values = split /, /,
|
||||
$o->read_para_after(__FILE__, qr/MAGIC_version_check/);
|
||||
chomp(@values);
|
||||
|
||||
return if grep { $value eq $_ } @values;
|
||||
$o->save_error("--version-check invalud value $value. Accepted values are "
|
||||
. join(", ", @values[0..$#values-1]) . " and $values[-1]" );
|
||||
}
|
||||
|
||||
sub _d {
|
||||
my ($package, undef, $line) = caller 0;
|
||||
@_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }
|
||||
@@ -7363,6 +7379,8 @@ sub main {
|
||||
$o->save_error("Invalid --group-by value. Valid values are: "
|
||||
. "rule_id, query_id, none");
|
||||
}
|
||||
|
||||
Pingback::validate_options($o);
|
||||
}
|
||||
|
||||
$o->usage_or_errors();
|
||||
@@ -7694,9 +7712,11 @@ sub main {
|
||||
# ########################################################################
|
||||
if ( $o->get('version-check') ne 'off' && (!$o->has('quiet') || !$o->get('quiet')) ) {
|
||||
Pingback::version_check(
|
||||
($review_dbh ? { dbh => $review_dbh, dsn => $review_dsn } : ()),
|
||||
($dbh ? { dbh => $dbh, dsn => $dsn } : ()),
|
||||
{ protocol => $o->get('version-check') },
|
||||
instances => [
|
||||
($review_dbh ? { dbh => $review_dbh, dsn => $review_dsn } : ()),
|
||||
($dbh ? { dbh => $dbh, dsn => $dsn } : ()),
|
||||
],
|
||||
protocol => $o->get('version-check'),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -8472,9 +8492,15 @@ Show version and exit.
|
||||
type: string; default: off
|
||||
|
||||
Send program versions to Percona and print suggested upgrades and problems.
|
||||
Possible values for --version-check:
|
||||
|
||||
Accepted values are https, http, off, and auto -- The latter tries both https
|
||||
and http, in that order. Keep in mind that 'https' might fail if
|
||||
=for comment ignore-pt-internal-value
|
||||
MAGIC_version_check
|
||||
|
||||
https, http, auto, off
|
||||
|
||||
C<auto> first tries using C<https>, and resolts to C<http> if that fails.
|
||||
Keep in mind that C<https> might not be available if
|
||||
C<IO::Socket::SSL> is not installed on your system, although
|
||||
C<--version-check http> should work everywhere.
|
||||
|
||||
|
@@ -12927,14 +12927,19 @@ eval {
|
||||
};
|
||||
|
||||
sub version_check {
|
||||
my $args = pop @_;
|
||||
my (@instances) = @_;
|
||||
my %args = @_;
|
||||
my @instances = $args{instances} ? @{ $args{instances} } : ();
|
||||
|
||||
if (exists $ENV{PERCONA_VERSION_CHECK} && !$ENV{PERCONA_VERSION_CHECK}) {
|
||||
print STDERR '--version-check is disabled by the PERCONA_VERSION_CHECK ',
|
||||
warn '--version-check is disabled by the PERCONA_VERSION_CHECK ',
|
||||
"environment variable.\n\n";
|
||||
return;
|
||||
}
|
||||
|
||||
$args{protocol} ||= 'https';
|
||||
my @protocols = $args{protocol} eq 'auto'
|
||||
? qw(https http)
|
||||
: $args{protocol};
|
||||
|
||||
my $instances_to_check = [];
|
||||
my $time = int(time());
|
||||
@@ -12949,15 +12954,11 @@ sub version_check {
|
||||
($time_to_check, $instances_to_check)
|
||||
= time_to_check($check_time_file, \@instances, $time);
|
||||
if ( !$time_to_check ) {
|
||||
print STDERR 'It is not time to --version-check again; ',
|
||||
warn 'It is not time to --version-check again; ',
|
||||
"only 1 check per day.\n\n";
|
||||
return;
|
||||
}
|
||||
|
||||
$args->{protocol} ||= 'https';
|
||||
my @protocols = $args->{protocol} ne 'https' && $args->{protocol} ne 'http'
|
||||
? qw(https http)
|
||||
: $args->{protocol};
|
||||
my $advice;
|
||||
my $e;
|
||||
for my $protocol ( @protocols ) {
|
||||
@@ -13000,7 +13001,7 @@ sub pingback {
|
||||
|
||||
my ($instances, $ua, $vc) = @args{qw(instances ua VersionCheck)};
|
||||
|
||||
$ua ||= HTTPMicro->new( timeout => 2 );
|
||||
$ua ||= HTTPMicro->new( timeout => 5 );
|
||||
$vc ||= VersionCheck->new();
|
||||
|
||||
my $response = $ua->request('GET', $url);
|
||||
@@ -13216,6 +13217,21 @@ sub encode_client_response {
|
||||
return $client_response;
|
||||
}
|
||||
|
||||
sub validate_options {
|
||||
my ($o) = @_;
|
||||
|
||||
return if !$o->got('version-check');
|
||||
|
||||
my $value = $o->get('version-check');
|
||||
my @values = split /, /,
|
||||
$o->read_para_after(__FILE__, qr/MAGIC_version_check/);
|
||||
chomp(@values);
|
||||
|
||||
return if grep { $value eq $_ } @values;
|
||||
$o->save_error("--version-check invalud value $value. Accepted values are "
|
||||
. join(", ", @values[0..$#values-1]) . " and $values[-1]" );
|
||||
}
|
||||
|
||||
sub _d {
|
||||
my ($package, undef, $line) = caller 0;
|
||||
@_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }
|
||||
@@ -13363,6 +13379,8 @@ sub main {
|
||||
$o->save_error($EVAL_ERROR);
|
||||
}
|
||||
|
||||
Pingback::validate_options($o);
|
||||
|
||||
$o->usage_or_errors();
|
||||
|
||||
# ########################################################################
|
||||
@@ -14575,10 +14593,12 @@ sub main {
|
||||
# ########################################################################
|
||||
if ( $o->get('version-check') ne 'off' && (!$o->has('quiet') || !$o->get('quiet')) ) {
|
||||
Pingback::version_check(
|
||||
($qv_dbh ? { dbh => $qv_dbh, dsn => $review_dsn } : ()),
|
||||
($ps_dbh ? { dbh => $ps_dbh, dsn => $ps_dsn } : ()),
|
||||
($ex_dbh ? { dbh => $ex_dbh, dsn => $ex_dsn } : ()),
|
||||
{ protocol => $o->get('version-check') },
|
||||
instances => [
|
||||
($qv_dbh ? { dbh => $qv_dbh, dsn => $review_dsn } : ()),
|
||||
($ps_dbh ? { dbh => $ps_dbh, dsn => $ps_dsn } : ()),
|
||||
($ex_dbh ? { dbh => $ex_dbh, dsn => $ex_dsn } : ())
|
||||
],
|
||||
protocol => $o->get('version-check'),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -16967,9 +16987,15 @@ Show version and exit.
|
||||
type: string; default: off
|
||||
|
||||
Send program versions to Percona and print suggested upgrades and problems.
|
||||
Possible values for --version-check:
|
||||
|
||||
Accepted values are https, http, off, and auto -- The latter tries both https
|
||||
and http, in that order. Keep in mind that 'https' might fail if
|
||||
=for comment ignore-pt-internal-value
|
||||
MAGIC_version_check
|
||||
|
||||
https, http, auto, off
|
||||
|
||||
C<auto> first tries using C<https>, and resolts to C<http> if that fails.
|
||||
Keep in mind that C<https> might not be available if
|
||||
C<IO::Socket::SSL> is not installed on your system, although
|
||||
C<--version-check http> should work everywhere.
|
||||
|
||||
|
@@ -3495,14 +3495,19 @@ eval {
|
||||
};
|
||||
|
||||
sub version_check {
|
||||
my $args = pop @_;
|
||||
my (@instances) = @_;
|
||||
my %args = @_;
|
||||
my @instances = $args{instances} ? @{ $args{instances} } : ();
|
||||
|
||||
if (exists $ENV{PERCONA_VERSION_CHECK} && !$ENV{PERCONA_VERSION_CHECK}) {
|
||||
print STDERR '--version-check is disabled by the PERCONA_VERSION_CHECK ',
|
||||
warn '--version-check is disabled by the PERCONA_VERSION_CHECK ',
|
||||
"environment variable.\n\n";
|
||||
return;
|
||||
}
|
||||
|
||||
$args{protocol} ||= 'https';
|
||||
my @protocols = $args{protocol} eq 'auto'
|
||||
? qw(https http)
|
||||
: $args{protocol};
|
||||
|
||||
my $instances_to_check = [];
|
||||
my $time = int(time());
|
||||
@@ -3517,15 +3522,11 @@ sub version_check {
|
||||
($time_to_check, $instances_to_check)
|
||||
= time_to_check($check_time_file, \@instances, $time);
|
||||
if ( !$time_to_check ) {
|
||||
print STDERR 'It is not time to --version-check again; ',
|
||||
warn 'It is not time to --version-check again; ',
|
||||
"only 1 check per day.\n\n";
|
||||
return;
|
||||
}
|
||||
|
||||
$args->{protocol} ||= 'https';
|
||||
my @protocols = $args->{protocol} ne 'https' && $args->{protocol} ne 'http'
|
||||
? qw(https http)
|
||||
: $args->{protocol};
|
||||
my $advice;
|
||||
my $e;
|
||||
for my $protocol ( @protocols ) {
|
||||
@@ -3568,7 +3569,7 @@ sub pingback {
|
||||
|
||||
my ($instances, $ua, $vc) = @args{qw(instances ua VersionCheck)};
|
||||
|
||||
$ua ||= HTTPMicro->new( timeout => 2 );
|
||||
$ua ||= HTTPMicro->new( timeout => 5 );
|
||||
$vc ||= VersionCheck->new();
|
||||
|
||||
my $response = $ua->request('GET', $url);
|
||||
@@ -3784,6 +3785,21 @@ sub encode_client_response {
|
||||
return $client_response;
|
||||
}
|
||||
|
||||
sub validate_options {
|
||||
my ($o) = @_;
|
||||
|
||||
return if !$o->got('version-check');
|
||||
|
||||
my $value = $o->get('version-check');
|
||||
my @values = split /, /,
|
||||
$o->read_para_after(__FILE__, qr/MAGIC_version_check/);
|
||||
chomp(@values);
|
||||
|
||||
return if grep { $value eq $_ } @values;
|
||||
$o->save_error("--version-check invalud value $value. Accepted values are "
|
||||
. join(", ", @values[0..$#values-1]) . " and $values[-1]" );
|
||||
}
|
||||
|
||||
sub _d {
|
||||
my ($package, undef, $line) = caller 0;
|
||||
@_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }
|
||||
@@ -3847,6 +3863,8 @@ sub main {
|
||||
$o->set('run-time', max($o->get('run-time'), 1));
|
||||
}
|
||||
|
||||
Pingback::validate_options($o);
|
||||
|
||||
$o->usage_or_errors();
|
||||
|
||||
# #######################################################################
|
||||
@@ -3905,9 +3923,11 @@ sub main {
|
||||
? $master_dsn
|
||||
: { h => $status->{master_host}, P => $status->{master_port} };
|
||||
Pingback::version_check(
|
||||
{ dbh => $slave_dbh, dsn => $slave_dsn },
|
||||
{ dbh => $master_dbh, dsn => $tmp_master_dsn },
|
||||
{ protocol => $o->get('version-check') },
|
||||
instances => [
|
||||
{ dbh => $slave_dbh, dsn => $slave_dsn },
|
||||
{ dbh => $master_dbh, dsn => $tmp_master_dsn }
|
||||
],
|
||||
protocol => $o->get('version-check'),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4387,9 +4407,15 @@ Show version and exit.
|
||||
type: string; default: off
|
||||
|
||||
Send program versions to Percona and print suggested upgrades and problems.
|
||||
Possible values for --version-check:
|
||||
|
||||
Accepted values are https, http, off, and auto -- The latter tries both https
|
||||
and http, in that order. Keep in mind that 'https' might fail if
|
||||
=for comment ignore-pt-internal-value
|
||||
MAGIC_version_check
|
||||
|
||||
https, http, auto, off
|
||||
|
||||
C<auto> first tries using C<https>, and resolts to C<http> if that fails.
|
||||
Keep in mind that C<https> might not be available if
|
||||
C<IO::Socket::SSL> is not installed on your system, although
|
||||
C<--version-check http> should work everywhere.
|
||||
|
||||
|
@@ -4118,14 +4118,19 @@ eval {
|
||||
};
|
||||
|
||||
sub version_check {
|
||||
my $args = pop @_;
|
||||
my (@instances) = @_;
|
||||
my %args = @_;
|
||||
my @instances = $args{instances} ? @{ $args{instances} } : ();
|
||||
|
||||
if (exists $ENV{PERCONA_VERSION_CHECK} && !$ENV{PERCONA_VERSION_CHECK}) {
|
||||
print STDERR '--version-check is disabled by the PERCONA_VERSION_CHECK ',
|
||||
warn '--version-check is disabled by the PERCONA_VERSION_CHECK ',
|
||||
"environment variable.\n\n";
|
||||
return;
|
||||
}
|
||||
|
||||
$args{protocol} ||= 'https';
|
||||
my @protocols = $args{protocol} eq 'auto'
|
||||
? qw(https http)
|
||||
: $args{protocol};
|
||||
|
||||
my $instances_to_check = [];
|
||||
my $time = int(time());
|
||||
@@ -4140,15 +4145,11 @@ sub version_check {
|
||||
($time_to_check, $instances_to_check)
|
||||
= time_to_check($check_time_file, \@instances, $time);
|
||||
if ( !$time_to_check ) {
|
||||
print STDERR 'It is not time to --version-check again; ',
|
||||
warn 'It is not time to --version-check again; ',
|
||||
"only 1 check per day.\n\n";
|
||||
return;
|
||||
}
|
||||
|
||||
$args->{protocol} ||= 'https';
|
||||
my @protocols = $args->{protocol} ne 'https' && $args->{protocol} ne 'http'
|
||||
? qw(https http)
|
||||
: $args->{protocol};
|
||||
my $advice;
|
||||
my $e;
|
||||
for my $protocol ( @protocols ) {
|
||||
@@ -4191,7 +4192,7 @@ sub pingback {
|
||||
|
||||
my ($instances, $ua, $vc) = @args{qw(instances ua VersionCheck)};
|
||||
|
||||
$ua ||= HTTPMicro->new( timeout => 2 );
|
||||
$ua ||= HTTPMicro->new( timeout => 5 );
|
||||
$vc ||= VersionCheck->new();
|
||||
|
||||
my $response = $ua->request('GET', $url);
|
||||
@@ -4407,6 +4408,21 @@ sub encode_client_response {
|
||||
return $client_response;
|
||||
}
|
||||
|
||||
sub validate_options {
|
||||
my ($o) = @_;
|
||||
|
||||
return if !$o->got('version-check');
|
||||
|
||||
my $value = $o->get('version-check');
|
||||
my @values = split /, /,
|
||||
$o->read_para_after(__FILE__, qr/MAGIC_version_check/);
|
||||
chomp(@values);
|
||||
|
||||
return if grep { $value eq $_ } @values;
|
||||
$o->save_error("--version-check invalud value $value. Accepted values are "
|
||||
. join(", ", @values[0..$#values-1]) . " and $values[-1]" );
|
||||
}
|
||||
|
||||
sub _d {
|
||||
my ($package, undef, $line) = caller 0;
|
||||
@_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }
|
||||
@@ -4482,6 +4498,8 @@ sub main {
|
||||
$o->save_error("Invalid --recursion-method: $EVAL_ERROR")
|
||||
}
|
||||
|
||||
Pingback::validate_options($o);
|
||||
|
||||
$o->usage_or_errors();
|
||||
|
||||
# ########################################################################
|
||||
@@ -4588,8 +4606,8 @@ sub main {
|
||||
# ########################################################################
|
||||
if ( $o->get('version-check') ne 'off' && (!$o->has('quiet') || !$o->get('quiet')) ) {
|
||||
Pingback::version_check(
|
||||
{ dbh => $dbh, dsn => $dsn }, @servers_to_watch,
|
||||
{ protocol => $o->get('version-check') },
|
||||
instances => [ { dbh => $dbh, dsn => $dsn }, @servers_to_watch ],
|
||||
protocol => $o->get('version-check'),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -5306,9 +5324,15 @@ Show version and exit.
|
||||
type: string; default: off
|
||||
|
||||
Send program versions to Percona and print suggested upgrades and problems.
|
||||
Possible values for --version-check:
|
||||
|
||||
Accepted values are https, http, off, and auto -- The latter tries both https
|
||||
and http, in that order. Keep in mind that 'https' might fail if
|
||||
=for comment ignore-pt-internal-value
|
||||
MAGIC_version_check
|
||||
|
||||
https, http, auto, off
|
||||
|
||||
C<auto> first tries using C<https>, and resolts to C<http> if that fails.
|
||||
Keep in mind that C<https> might not be available if
|
||||
C<IO::Socket::SSL> is not installed on your system, although
|
||||
C<--version-check http> should work everywhere.
|
||||
|
||||
|
@@ -1047,14 +1047,19 @@ eval {
|
||||
};
|
||||
|
||||
sub version_check {
|
||||
my $args = pop @_;
|
||||
my (@instances) = @_;
|
||||
my %args = @_;
|
||||
my @instances = $args{instances} ? @{ $args{instances} } : ();
|
||||
|
||||
if (exists $ENV{PERCONA_VERSION_CHECK} && !$ENV{PERCONA_VERSION_CHECK}) {
|
||||
print STDERR '--version-check is disabled by the PERCONA_VERSION_CHECK ',
|
||||
warn '--version-check is disabled by the PERCONA_VERSION_CHECK ',
|
||||
"environment variable.\n\n";
|
||||
return;
|
||||
}
|
||||
|
||||
$args{protocol} ||= 'https';
|
||||
my @protocols = $args{protocol} eq 'auto'
|
||||
? qw(https http)
|
||||
: $args{protocol};
|
||||
|
||||
my $instances_to_check = [];
|
||||
my $time = int(time());
|
||||
@@ -1069,15 +1074,11 @@ sub version_check {
|
||||
($time_to_check, $instances_to_check)
|
||||
= time_to_check($check_time_file, \@instances, $time);
|
||||
if ( !$time_to_check ) {
|
||||
print STDERR 'It is not time to --version-check again; ',
|
||||
warn 'It is not time to --version-check again; ',
|
||||
"only 1 check per day.\n\n";
|
||||
return;
|
||||
}
|
||||
|
||||
$args->{protocol} ||= 'https';
|
||||
my @protocols = $args->{protocol} ne 'https' && $args->{protocol} ne 'http'
|
||||
? qw(https http)
|
||||
: $args->{protocol};
|
||||
my $advice;
|
||||
my $e;
|
||||
for my $protocol ( @protocols ) {
|
||||
@@ -1120,7 +1121,7 @@ sub pingback {
|
||||
|
||||
my ($instances, $ua, $vc) = @args{qw(instances ua VersionCheck)};
|
||||
|
||||
$ua ||= HTTPMicro->new( timeout => 2 );
|
||||
$ua ||= HTTPMicro->new( timeout => 5 );
|
||||
$vc ||= VersionCheck->new();
|
||||
|
||||
my $response = $ua->request('GET', $url);
|
||||
@@ -1336,6 +1337,21 @@ sub encode_client_response {
|
||||
return $client_response;
|
||||
}
|
||||
|
||||
sub validate_options {
|
||||
my ($o) = @_;
|
||||
|
||||
return if !$o->got('version-check');
|
||||
|
||||
my $value = $o->get('version-check');
|
||||
my @values = split /, /,
|
||||
$o->read_para_after(__FILE__, qr/MAGIC_version_check/);
|
||||
chomp(@values);
|
||||
|
||||
return if grep { $value eq $_ } @values;
|
||||
$o->save_error("--version-check invalud value $value. Accepted values are "
|
||||
. join(", ", @values[0..$#values-1]) . " and $values[-1]" );
|
||||
}
|
||||
|
||||
sub _d {
|
||||
my ($package, undef, $line) = caller 0;
|
||||
@_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }
|
||||
@@ -8361,6 +8377,8 @@ sub main {
|
||||
$o->save_error("Invalid --recursion-method: $EVAL_ERROR")
|
||||
}
|
||||
|
||||
Pingback::validate_options($o);
|
||||
|
||||
$o->usage_or_errors();
|
||||
|
||||
# ########################################################################
|
||||
@@ -8814,9 +8832,11 @@ sub main {
|
||||
# ########################################################################
|
||||
if ( $o->get('version-check') ne 'off' && (!$o->has('quiet') || !$o->get('quiet')) ) {
|
||||
Pingback::version_check(
|
||||
{ dbh => $master_dbh, dsn => $master_dsn },
|
||||
map({ +{ dbh => $_->dbh(), dsn => $_->dsn() } } @$slaves),
|
||||
{ protocol => $o->get('version-check') },
|
||||
instances => [
|
||||
{ dbh => $master_dbh, dsn => $master_dsn },
|
||||
map({ +{ dbh => $_->dbh(), dsn => $_->dsn() } } @$slaves)
|
||||
],
|
||||
protocol => $o->get('version-check'),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -11157,9 +11177,15 @@ Show version and exit.
|
||||
type: string; default: off
|
||||
|
||||
Send program versions to Percona and print suggested upgrades and problems.
|
||||
Possible values for --version-check:
|
||||
|
||||
Accepted values are https, http, off, and auto -- The latter tries both https
|
||||
and http, in that order. Keep in mind that 'https' might fail if
|
||||
=for comment ignore-pt-internal-value
|
||||
MAGIC_version_check
|
||||
|
||||
https, http, auto, off
|
||||
|
||||
C<auto> first tries using C<https>, and resolts to C<http> if that fails.
|
||||
Keep in mind that C<https> might not be available if
|
||||
C<IO::Socket::SSL> is not installed on your system, although
|
||||
C<--version-check http> should work everywhere.
|
||||
|
||||
|
@@ -99,7 +99,6 @@ sub new {
|
||||
'default' => 1,
|
||||
'cumulative' => 1,
|
||||
'negatable' => 1,
|
||||
'value_is_optional' => 1,
|
||||
);
|
||||
|
||||
my $self = {
|
||||
@@ -341,10 +340,9 @@ sub _parse_specs {
|
||||
$opt->{short} = undef;
|
||||
}
|
||||
|
||||
$opt->{is_negatable} = $opt->{spec} =~ m/!/ ? 1 : 0;
|
||||
$opt->{is_cumulative} = $opt->{spec} =~ m/\+/ ? 1 : 0;
|
||||
$opt->{optional_value} = $opt->{spec} =~ m/:/ ? 1 : 0;
|
||||
$opt->{is_required} = $opt->{desc} =~ m/required/ ? 1 : 0;
|
||||
$opt->{is_negatable} = $opt->{spec} =~ m/!/ ? 1 : 0;
|
||||
$opt->{is_cumulative} = $opt->{spec} =~ m/\+/ ? 1 : 0;
|
||||
$opt->{is_required} = $opt->{desc} =~ m/required/ ? 1 : 0;
|
||||
|
||||
$opt->{group} ||= 'default';
|
||||
$self->{groups}->{ $opt->{group} }->{$long} = 1;
|
||||
@@ -480,7 +478,7 @@ sub _set_option {
|
||||
if ( $opt->{is_cumulative} ) {
|
||||
$opt->{value}++;
|
||||
}
|
||||
elsif ( !($opt->{optional_value} && !$val) ) {
|
||||
else {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
$opt->{got} = 1;
|
||||
@@ -1021,12 +1019,11 @@ sub _parse_size {
|
||||
sub _parse_attribs {
|
||||
my ( $self, $option, $attribs ) = @_;
|
||||
my $types = $self->{types};
|
||||
my $eq = $attribs->{'value_is_optional'} ? ':' : '=';
|
||||
return $option
|
||||
. ($attribs->{'short form'} ? '|' . $attribs->{'short form'} : '' )
|
||||
. ($attribs->{'negatable'} ? '!' : '' )
|
||||
. ($attribs->{'cumulative'} ? '+' : '' )
|
||||
. ($attribs->{'type'} ? $eq . $types->{$attribs->{type}} : '' );
|
||||
. ($attribs->{'type'} ? '=' . $types->{$attribs->{type}} : '' );
|
||||
}
|
||||
|
||||
sub _parse_synopsis {
|
||||
@@ -9229,14 +9226,19 @@ eval {
|
||||
};
|
||||
|
||||
sub version_check {
|
||||
my $args = pop @_;
|
||||
my (@instances) = @_;
|
||||
my %args = @_;
|
||||
my @instances = $args{instances} ? @{ $args{instances} } : ();
|
||||
|
||||
if (exists $ENV{PERCONA_VERSION_CHECK} && !$ENV{PERCONA_VERSION_CHECK}) {
|
||||
print STDERR '--version-check is disabled by the PERCONA_VERSION_CHECK ',
|
||||
warn '--version-check is disabled by the PERCONA_VERSION_CHECK ',
|
||||
"environment variable.\n\n";
|
||||
return;
|
||||
}
|
||||
|
||||
$args{protocol} ||= 'https';
|
||||
my @protocols = $args{protocol} eq 'auto'
|
||||
? qw(https http)
|
||||
: $args{protocol};
|
||||
|
||||
my $instances_to_check = [];
|
||||
my $time = int(time());
|
||||
@@ -9251,22 +9253,28 @@ sub version_check {
|
||||
($time_to_check, $instances_to_check)
|
||||
= time_to_check($check_time_file, \@instances, $time);
|
||||
if ( !$time_to_check ) {
|
||||
print STDERR 'It is not time to --version-check again; ',
|
||||
warn 'It is not time to --version-check again; ',
|
||||
"only 1 check per day.\n\n";
|
||||
return;
|
||||
}
|
||||
|
||||
my $protocol = $args->{protocol} || 'https';
|
||||
my $advice = pingback(
|
||||
url => $ENV{PERCONA_VERSION_CHECK_URL} || "$protocol://v.percona.com",
|
||||
instances => $instances_to_check,
|
||||
protocol => $args->{protocol},
|
||||
);
|
||||
my $advice;
|
||||
my $e;
|
||||
for my $protocol ( @protocols ) {
|
||||
$advice = eval { pingback(
|
||||
url => $ENV{PERCONA_VERSION_CHECK_URL} || "$protocol://v.percona.com",
|
||||
instances => $instances_to_check,
|
||||
protocol => $protocol,
|
||||
) };
|
||||
last if !$advice && !$EVAL_ERROR;
|
||||
$e ||= $EVAL_ERROR;
|
||||
}
|
||||
if ( $advice ) {
|
||||
print "# Percona suggests these upgrades:\n";
|
||||
print join("\n", map { "# * $_" } @$advice), "\n\n";
|
||||
}
|
||||
else {
|
||||
die $e if $e;
|
||||
print "# No suggestions at this time.\n\n";
|
||||
($ENV{PTVCDEBUG} || PTDEBUG )
|
||||
&& _d('--version-check worked, but there were no suggestions');
|
||||
@@ -9292,7 +9300,7 @@ sub pingback {
|
||||
|
||||
my ($instances, $ua, $vc) = @args{qw(instances ua VersionCheck)};
|
||||
|
||||
$ua ||= HTTPMicro->new( timeout => 2 );
|
||||
$ua ||= HTTPMicro->new( timeout => 5 );
|
||||
$vc ||= VersionCheck->new();
|
||||
|
||||
my $response = $ua->request('GET', $url);
|
||||
@@ -9508,6 +9516,21 @@ sub encode_client_response {
|
||||
return $client_response;
|
||||
}
|
||||
|
||||
sub validate_options {
|
||||
my ($o) = @_;
|
||||
|
||||
return if !$o->got('version-check');
|
||||
|
||||
my $value = $o->get('version-check');
|
||||
my @values = split /, /,
|
||||
$o->read_para_after(__FILE__, qr/MAGIC_version_check/);
|
||||
chomp(@values);
|
||||
|
||||
return if grep { $value eq $_ } @values;
|
||||
$o->save_error("--version-check invalud value $value. Accepted values are "
|
||||
. join(", ", @values[0..$#values-1]) . " and $values[-1]" );
|
||||
}
|
||||
|
||||
sub _d {
|
||||
my ($package, undef, $line) = caller 0;
|
||||
@_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }
|
||||
@@ -9655,6 +9678,8 @@ sub main {
|
||||
$o->save_error("Invalid --recursion-method: $EVAL_ERROR")
|
||||
}
|
||||
|
||||
Pingback::validate_options($o);
|
||||
|
||||
$o->usage_or_errors();
|
||||
|
||||
# ########################################################################
|
||||
@@ -9766,7 +9791,10 @@ sub main {
|
||||
} @dsns;
|
||||
|
||||
if ( $o->get('version-check') ne 'off' && (!$o->has('quiet') || !$o->get('quiet')) ) {
|
||||
Pingback::version_check(@instances, { protocol => $o->get('version-check') });
|
||||
Pingback::version_check(
|
||||
instances => [@instances],
|
||||
protocol => $o->get('version-check'),
|
||||
);
|
||||
}
|
||||
|
||||
map { $_->disconnect } @vc_dbhs; # disconnect dbh created for version check
|
||||
@@ -12281,9 +12309,15 @@ Show version and exit.
|
||||
type: string; default: off
|
||||
|
||||
Send program versions to Percona and print suggested upgrades and problems.
|
||||
Possible values for --version-check:
|
||||
|
||||
Accepted values are https, http, off, and auto -- The latter tries both https
|
||||
and http, in that order. Keep in mind that 'https' might fail if
|
||||
=for comment ignore-pt-internal-value
|
||||
MAGIC_version_check
|
||||
|
||||
https, http, auto, off
|
||||
|
||||
C<auto> first tries using C<https>, and resolts to C<http> if that fails.
|
||||
Keep in mind that C<https> might not be available if
|
||||
C<IO::Socket::SSL> is not installed on your system, although
|
||||
C<--version-check http> should work everywhere.
|
||||
|
||||
|
@@ -11294,14 +11294,19 @@ eval {
|
||||
};
|
||||
|
||||
sub version_check {
|
||||
my $args = pop @_;
|
||||
my (@instances) = @_;
|
||||
my %args = @_;
|
||||
my @instances = $args{instances} ? @{ $args{instances} } : ();
|
||||
|
||||
if (exists $ENV{PERCONA_VERSION_CHECK} && !$ENV{PERCONA_VERSION_CHECK}) {
|
||||
print STDERR '--version-check is disabled by the PERCONA_VERSION_CHECK ',
|
||||
warn '--version-check is disabled by the PERCONA_VERSION_CHECK ',
|
||||
"environment variable.\n\n";
|
||||
return;
|
||||
}
|
||||
|
||||
$args{protocol} ||= 'https';
|
||||
my @protocols = $args{protocol} eq 'auto'
|
||||
? qw(https http)
|
||||
: $args{protocol};
|
||||
|
||||
my $instances_to_check = [];
|
||||
my $time = int(time());
|
||||
@@ -11316,15 +11321,11 @@ sub version_check {
|
||||
($time_to_check, $instances_to_check)
|
||||
= time_to_check($check_time_file, \@instances, $time);
|
||||
if ( !$time_to_check ) {
|
||||
print STDERR 'It is not time to --version-check again; ',
|
||||
warn 'It is not time to --version-check again; ',
|
||||
"only 1 check per day.\n\n";
|
||||
return;
|
||||
}
|
||||
|
||||
$args->{protocol} ||= 'https';
|
||||
my @protocols = $args->{protocol} ne 'https' && $args->{protocol} ne 'http'
|
||||
? qw(https http)
|
||||
: $args->{protocol};
|
||||
my $advice;
|
||||
my $e;
|
||||
for my $protocol ( @protocols ) {
|
||||
@@ -11367,7 +11368,7 @@ sub pingback {
|
||||
|
||||
my ($instances, $ua, $vc) = @args{qw(instances ua VersionCheck)};
|
||||
|
||||
$ua ||= HTTPMicro->new( timeout => 2 );
|
||||
$ua ||= HTTPMicro->new( timeout => 5 );
|
||||
$vc ||= VersionCheck->new();
|
||||
|
||||
my $response = $ua->request('GET', $url);
|
||||
@@ -11583,6 +11584,21 @@ sub encode_client_response {
|
||||
return $client_response;
|
||||
}
|
||||
|
||||
sub validate_options {
|
||||
my ($o) = @_;
|
||||
|
||||
return if !$o->got('version-check');
|
||||
|
||||
my $value = $o->get('version-check');
|
||||
my @values = split /, /,
|
||||
$o->read_para_after(__FILE__, qr/MAGIC_version_check/);
|
||||
chomp(@values);
|
||||
|
||||
return if grep { $value eq $_ } @values;
|
||||
$o->save_error("--version-check invalud value $value. Accepted values are "
|
||||
. join(", ", @values[0..$#values-1]) . " and $values[-1]" );
|
||||
}
|
||||
|
||||
sub _d {
|
||||
my ($package, undef, $line) = caller 0;
|
||||
@_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }
|
||||
@@ -11676,6 +11692,8 @@ sub main {
|
||||
$o->save_error('Specify at least one host DSN');
|
||||
}
|
||||
|
||||
Pingback::validate_options($o);
|
||||
|
||||
$o->usage_or_errors();
|
||||
|
||||
if ( $o->get('explain-hosts') ) {
|
||||
@@ -11939,8 +11957,8 @@ sub main {
|
||||
# ########################################################################
|
||||
if ( $o->get('version-check') ne 'off' && (!$o->has('quiet') || !$o->get('quiet')) ) {
|
||||
Pingback::version_check(
|
||||
map({ +{ dbh => $_->{dbh}, dsn => $_->{dsn} } } @$hosts),
|
||||
{ protocol => $o->get('version-check') },
|
||||
instances => [ map({ +{ dbh => $_->{dbh}, dsn => $_->{dsn} } } @$hosts) ],
|
||||
protocol => $o->get('version-check'),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -12877,9 +12895,15 @@ Show version and exit.
|
||||
type: string; default: off
|
||||
|
||||
Send program versions to Percona and print suggested upgrades and problems.
|
||||
Possible values for --version-check:
|
||||
|
||||
Accepted values are https, http, off, and auto -- The latter tries both https
|
||||
and http, in that order. Keep in mind that 'https' might fail if
|
||||
=for comment ignore-pt-internal-value
|
||||
MAGIC_version_check
|
||||
|
||||
https, http, auto, off
|
||||
|
||||
C<auto> first tries using C<https>, and resolts to C<http> if that fails.
|
||||
Keep in mind that C<https> might not be available if
|
||||
C<IO::Socket::SSL> is not installed on your system, although
|
||||
C<--version-check http> should work everywhere.
|
||||
|
||||
|
@@ -4407,14 +4407,19 @@ eval {
|
||||
};
|
||||
|
||||
sub version_check {
|
||||
my $args = pop @_;
|
||||
my (@instances) = @_;
|
||||
my %args = @_;
|
||||
my @instances = $args{instances} ? @{ $args{instances} } : ();
|
||||
|
||||
if (exists $ENV{PERCONA_VERSION_CHECK} && !$ENV{PERCONA_VERSION_CHECK}) {
|
||||
print STDERR '--version-check is disabled by the PERCONA_VERSION_CHECK ',
|
||||
warn '--version-check is disabled by the PERCONA_VERSION_CHECK ',
|
||||
"environment variable.\n\n";
|
||||
return;
|
||||
}
|
||||
|
||||
$args{protocol} ||= 'https';
|
||||
my @protocols = $args{protocol} eq 'auto'
|
||||
? qw(https http)
|
||||
: $args{protocol};
|
||||
|
||||
my $instances_to_check = [];
|
||||
my $time = int(time());
|
||||
@@ -4429,15 +4434,11 @@ sub version_check {
|
||||
($time_to_check, $instances_to_check)
|
||||
= time_to_check($check_time_file, \@instances, $time);
|
||||
if ( !$time_to_check ) {
|
||||
print STDERR 'It is not time to --version-check again; ',
|
||||
warn 'It is not time to --version-check again; ',
|
||||
"only 1 check per day.\n\n";
|
||||
return;
|
||||
}
|
||||
|
||||
$args->{protocol} ||= 'https';
|
||||
my @protocols = $args->{protocol} ne 'https' && $args->{protocol} ne 'http'
|
||||
? qw(https http)
|
||||
: $args->{protocol};
|
||||
my $advice;
|
||||
my $e;
|
||||
for my $protocol ( @protocols ) {
|
||||
@@ -4480,7 +4481,7 @@ sub pingback {
|
||||
|
||||
my ($instances, $ua, $vc) = @args{qw(instances ua VersionCheck)};
|
||||
|
||||
$ua ||= HTTPMicro->new( timeout => 2 );
|
||||
$ua ||= HTTPMicro->new( timeout => 5 );
|
||||
$vc ||= VersionCheck->new();
|
||||
|
||||
my $response = $ua->request('GET', $url);
|
||||
@@ -4696,6 +4697,21 @@ sub encode_client_response {
|
||||
return $client_response;
|
||||
}
|
||||
|
||||
sub validate_options {
|
||||
my ($o) = @_;
|
||||
|
||||
return if !$o->got('version-check');
|
||||
|
||||
my $value = $o->get('version-check');
|
||||
my @values = split /, /,
|
||||
$o->read_para_after(__FILE__, qr/MAGIC_version_check/);
|
||||
chomp(@values);
|
||||
|
||||
return if grep { $value eq $_ } @values;
|
||||
$o->save_error("--version-check invalud value $value. Accepted values are "
|
||||
. join(", ", @values[0..$#values-1]) . " and $values[-1]" );
|
||||
}
|
||||
|
||||
sub _d {
|
||||
my ($package, undef, $line) = caller 0;
|
||||
@_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }
|
||||
@@ -4752,6 +4768,8 @@ sub main {
|
||||
}
|
||||
}
|
||||
|
||||
Pingback::validate_options($o);
|
||||
|
||||
$o->usage_or_errors();
|
||||
|
||||
# #########################################################################
|
||||
@@ -4828,8 +4846,8 @@ sub main {
|
||||
# ########################################################################
|
||||
if ( $o->get('version-check') ne 'off' && (!$o->has('quiet') || !$o->get('quiet')) ) {
|
||||
Pingback::version_check(
|
||||
($dbh ? { dbh => $dbh, dsn => $dsn } : ()),
|
||||
{ protocol => $o->get('version-check') },
|
||||
instances => [ ($dbh ? { dbh => $dbh, dsn => $dsn } : ()) ],
|
||||
protocol => $o->get('version-check'),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -5661,9 +5679,15 @@ Show version and exit.
|
||||
type: string; default: off
|
||||
|
||||
Send program versions to Percona and print suggested upgrades and problems.
|
||||
Possible values for --version-check:
|
||||
|
||||
Accepted values are https, http, off, and auto -- The latter tries both https
|
||||
and http, in that order. Keep in mind that 'https' might fail if
|
||||
=for comment ignore-pt-internal-value
|
||||
MAGIC_version_check
|
||||
|
||||
https, http, auto, off
|
||||
|
||||
C<auto> first tries using C<https>, and resolts to C<http> if that fails.
|
||||
Keep in mind that C<https> might not be available if
|
||||
C<IO::Socket::SSL> is not installed on your system, although
|
||||
C<--version-check http> should work everywhere.
|
||||
|
||||
|
Reference in New Issue
Block a user