mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-10 05:00:45 +00:00
Add $ENV{PERCONA_VERSION_CHECK}=0 to PerconaTest so tests don't version-check. Implement v-c in half the tools. Make util/update-modules clean up its temp files.
This commit is contained in:
@@ -4728,6 +4728,7 @@ sub _touch {
|
|||||||
sysopen my $fh, $file, O_WRONLY|O_CREAT|O_NONBLOCK
|
sysopen my $fh, $file, O_WRONLY|O_CREAT|O_NONBLOCK
|
||||||
or die "Cannot create $file : $!";
|
or die "Cannot create $file : $!";
|
||||||
close $fh or die "Cannot close $file : $!";
|
close $fh or die "Cannot close $file : $!";
|
||||||
|
utime(undef, undef, $file);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub encode_client_response {
|
sub encode_client_response {
|
||||||
@@ -4801,7 +4802,7 @@ my @beginning_of_txn;
|
|||||||
my $q = new Quoter;
|
my $q = new Quoter;
|
||||||
|
|
||||||
sub main {
|
sub main {
|
||||||
@ARGV = @_; # set global ARGV for this package
|
local @ARGV = @_; # set global ARGV for this package
|
||||||
|
|
||||||
# Reset global vars else tests, which run this tool as a module,
|
# Reset global vars else tests, which run this tool as a module,
|
||||||
# may encounter weird results.
|
# may encounter weird results.
|
||||||
@@ -5287,6 +5288,14 @@ sub main {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ########################################################################
|
||||||
|
# Do the version-check
|
||||||
|
# ########################################################################
|
||||||
|
if ( $o->get('version-check') && ($o->has('quiet') && !$o->get('quiet')) ) {
|
||||||
|
Pingback::version_check($src->{dbh});
|
||||||
|
return 0 if $ENV{PTVCDEBUG} && PTDEBUG;
|
||||||
|
}
|
||||||
|
|
||||||
# ########################################################################
|
# ########################################################################
|
||||||
# Start archiving.
|
# Start archiving.
|
||||||
# ########################################################################
|
# ########################################################################
|
||||||
|
@@ -3887,7 +3887,7 @@ use Percona::Toolkit;
|
|||||||
use constant PTDEBUG => $ENV{PTDEBUG} || 0;
|
use constant PTDEBUG => $ENV{PTDEBUG} || 0;
|
||||||
|
|
||||||
sub main {
|
sub main {
|
||||||
@ARGV = @_; # set global ARGV for this package
|
local @ARGV = @_; # set global ARGV for this package
|
||||||
|
|
||||||
# ########################################################################
|
# ########################################################################
|
||||||
# Get configuration information.
|
# Get configuration information.
|
||||||
@@ -3971,6 +3971,14 @@ sub main {
|
|||||||
$daemon->make_PID_file();
|
$daemon->make_PID_file();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ########################################################################
|
||||||
|
# Do the version-check
|
||||||
|
# ########################################################################
|
||||||
|
if ( $o->get('version-check') && ($o->has('quiet') && !$o->get('quiet')) ) {
|
||||||
|
Pingback::version_check($configs[0]->{dbh});
|
||||||
|
return 0 if $ENV{PTVCDEBUG} && PTDEBUG;
|
||||||
|
}
|
||||||
|
|
||||||
# #########################################################################
|
# #########################################################################
|
||||||
# Diff the given configs.
|
# Diff the given configs.
|
||||||
# #########################################################################
|
# #########################################################################
|
||||||
|
@@ -3392,7 +3392,7 @@ my %is_proc_info = (
|
|||||||
);
|
);
|
||||||
|
|
||||||
sub main {
|
sub main {
|
||||||
@ARGV = @_; # set global ARGV for this package
|
local @ARGV = @_; # set global ARGV for this package
|
||||||
|
|
||||||
my $q = new Quoter();
|
my $q = new Quoter();
|
||||||
|
|
||||||
@@ -3439,7 +3439,7 @@ sub main {
|
|||||||
$o->usage_or_errors();
|
$o->usage_or_errors();
|
||||||
|
|
||||||
# ########################################################################
|
# ########################################################################
|
||||||
# Start working.
|
# Connect to MySQL and set up the --dest, if any.
|
||||||
# ########################################################################
|
# ########################################################################
|
||||||
my $dbh = get_cxn($source_dsn, 1);
|
my $dbh = get_cxn($source_dsn, 1);
|
||||||
my $dest_dbh;
|
my $dest_dbh;
|
||||||
@@ -3481,7 +3481,9 @@ sub main {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ########################################################################
|
||||||
# Daemonize only after (potentially) asking for passwords for --ask-pass.
|
# Daemonize only after (potentially) asking for passwords for --ask-pass.
|
||||||
|
# ########################################################################
|
||||||
my $daemon;
|
my $daemon;
|
||||||
if ( $o->get('daemonize') ) {
|
if ( $o->get('daemonize') ) {
|
||||||
$daemon = new Daemon(o=>$o);
|
$daemon = new Daemon(o=>$o);
|
||||||
@@ -3494,6 +3496,17 @@ sub main {
|
|||||||
$daemon->make_PID_file();
|
$daemon->make_PID_file();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ########################################################################
|
||||||
|
# Do the version-check
|
||||||
|
# ########################################################################
|
||||||
|
if ( $o->get('version-check') && ($o->has('quiet') && !$o->get('quiet')) ) {
|
||||||
|
Pingback::version_check($dbh);
|
||||||
|
return 0 if $ENV{PTVCDEBUG} && PTDEBUG;
|
||||||
|
}
|
||||||
|
|
||||||
|
# ########################################################################
|
||||||
|
# Start looking for and logging deadlocks.
|
||||||
|
# ########################################################################
|
||||||
my $last_fingerprint = '';
|
my $last_fingerprint = '';
|
||||||
|
|
||||||
$oktorun = 1;
|
$oktorun = 1;
|
||||||
|
@@ -4483,7 +4483,17 @@ sub main {
|
|||||||
|
|
||||||
$o->usage_or_errors();
|
$o->usage_or_errors();
|
||||||
|
|
||||||
|
# ########################################################################
|
||||||
|
# Do the version-check
|
||||||
|
# ########################################################################
|
||||||
|
if ( $o->get('version-check') && ($o->has('quiet') && !$o->get('quiet')) ) {
|
||||||
|
Pingback::version_check();
|
||||||
|
return 0 if $ENV{PTVCDEBUG} && PTDEBUG;
|
||||||
|
}
|
||||||
|
|
||||||
|
# ########################################################################
|
||||||
# Interactive mode. Delegate to DiskstatsMenu::run_interactive
|
# Interactive mode. Delegate to DiskstatsMenu::run_interactive
|
||||||
|
# ########################################################################
|
||||||
my $diskstats = new DiskstatsMenu();
|
my $diskstats = new DiskstatsMenu();
|
||||||
return $diskstats->run_interactive(
|
return $diskstats->run_interactive(
|
||||||
OptionParser => $o,
|
OptionParser => $o,
|
||||||
|
@@ -4304,7 +4304,7 @@ my $hdr_width = $max_width - 2; # for '# '
|
|||||||
my $hdr_fmt = "# %-${hdr_width}s\n";
|
my $hdr_fmt = "# %-${hdr_width}s\n";
|
||||||
|
|
||||||
sub main {
|
sub main {
|
||||||
@ARGV = @_; # set global ARGV for this package
|
local @ARGV = @_; # set global ARGV for this package
|
||||||
|
|
||||||
my %summary = ( 'Total Indexes' => 0 );
|
my %summary = ( 'Total Indexes' => 0 );
|
||||||
my %seen_tbl;
|
my %seen_tbl;
|
||||||
@@ -4348,6 +4348,14 @@ sub main {
|
|||||||
my $dbh = $dp->get_dbh($dp->get_cxn_params($dsn),
|
my $dbh = $dp->get_dbh($dp->get_cxn_params($dsn),
|
||||||
{ AutoCommit => 1, });
|
{ AutoCommit => 1, });
|
||||||
|
|
||||||
|
# ########################################################################
|
||||||
|
# Do the version-check
|
||||||
|
# ########################################################################
|
||||||
|
if ( $o->get('version-check') && ($o->has('quiet') && !$o->get('quiet')) ) {
|
||||||
|
Pingback::version_check($dbh);
|
||||||
|
return 0 if $ENV{PTVCDEBUG} && PTDEBUG;
|
||||||
|
}
|
||||||
|
|
||||||
# #######################################################################
|
# #######################################################################
|
||||||
# Do the main work.
|
# Do the main work.
|
||||||
# #######################################################################
|
# #######################################################################
|
||||||
|
10
bin/pt-find
10
bin/pt-find
@@ -3395,7 +3395,7 @@ my @stored_code_tests = qw(
|
|||||||
);
|
);
|
||||||
|
|
||||||
sub main {
|
sub main {
|
||||||
@ARGV = @_; # set global ARGV for this package
|
local @ARGV = @_; # set global ARGV for this package
|
||||||
|
|
||||||
# ########################################################################
|
# ########################################################################
|
||||||
# Get configuration information.
|
# Get configuration information.
|
||||||
@@ -3516,6 +3516,14 @@ sub main {
|
|||||||
|
|
||||||
# Discover if we need to get stored code. Need dbh to do this.
|
# Discover if we need to get stored code. Need dbh to do this.
|
||||||
my $need_stored_code = grep { $o->got($_); } @stored_code_tests;
|
my $need_stored_code = grep { $o->got($_); } @stored_code_tests;
|
||||||
|
|
||||||
|
# ########################################################################
|
||||||
|
# Do the version-check
|
||||||
|
# ########################################################################
|
||||||
|
if ( $o->get('version-check') && ($o->has('quiet') && !$o->get('quiet')) ) {
|
||||||
|
Pingback::version_check($dbh);
|
||||||
|
return 0 if $ENV{PTVCDEBUG} && PTDEBUG;
|
||||||
|
}
|
||||||
|
|
||||||
# ########################################################################
|
# ########################################################################
|
||||||
# Go do it.
|
# Go do it.
|
||||||
|
@@ -3049,7 +3049,8 @@ Transformers->import(qw(parse_timestamp));
|
|||||||
my $oktorun;
|
my $oktorun;
|
||||||
|
|
||||||
sub main {
|
sub main {
|
||||||
@ARGV = @_; # set global ARGV for this package
|
local @ARGV = @_; # set global ARGV for this package
|
||||||
|
$oktorun = 1;
|
||||||
|
|
||||||
# ########################################################################
|
# ########################################################################
|
||||||
# Get configuration information.
|
# Get configuration information.
|
||||||
@@ -3125,7 +3126,9 @@ sub main {
|
|||||||
$ins_sth = $dst_dbh->prepare($sql);
|
$ins_sth = $dst_dbh->prepare($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ########################################################################
|
||||||
# Daemonize only after (potentially) asking for passwords for --ask-pass.
|
# Daemonize only after (potentially) asking for passwords for --ask-pass.
|
||||||
|
# ########################################################################
|
||||||
my $daemon;
|
my $daemon;
|
||||||
if ( $o->get('daemonize') ) {
|
if ( $o->get('daemonize') ) {
|
||||||
$daemon = new Daemon(o=>$o);
|
$daemon = new Daemon(o=>$o);
|
||||||
@@ -3138,7 +3141,17 @@ sub main {
|
|||||||
$daemon->make_PID_file();
|
$daemon->make_PID_file();
|
||||||
}
|
}
|
||||||
|
|
||||||
$oktorun = 1;
|
# ########################################################################
|
||||||
|
# Do the version-check
|
||||||
|
# ########################################################################
|
||||||
|
if ( $o->get('version-check') && ($o->has('quiet') && !$o->get('quiet')) ) {
|
||||||
|
Pingback::version_check($dbh);
|
||||||
|
return 0 if $ENV{PTVCDEBUG} && PTDEBUG;
|
||||||
|
}
|
||||||
|
|
||||||
|
# ########################################################################
|
||||||
|
# Start finding and logging foreign key errors.
|
||||||
|
# ########################################################################
|
||||||
while ( # Quit if:
|
while ( # Quit if:
|
||||||
($start == $end || $now < $end) # time is exceeded
|
($start == $end || $now < $end) # time is exceeded
|
||||||
&& $oktorun # or instructed to quit
|
&& $oktorun # or instructed to quit
|
||||||
|
@@ -4229,7 +4229,7 @@ my @dbhs; # Holds slave DBHs if --recurse
|
|||||||
my @sths; # Holds [$host, $sth] if --recurse
|
my @sths; # Holds [$host, $sth] if --recurse
|
||||||
|
|
||||||
sub main {
|
sub main {
|
||||||
@ARGV = @_; # set global ARGV for this package
|
local @ARGV = @_; # set global ARGV for this package
|
||||||
|
|
||||||
# Reset all global vars between test runs else weird things happen.
|
# Reset all global vars between test runs else weird things happen.
|
||||||
@dbhs = ();
|
@dbhs = ();
|
||||||
@@ -4637,6 +4637,14 @@ sub main {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ########################################################################
|
||||||
|
# Do the version-check
|
||||||
|
# ########################################################################
|
||||||
|
if ( $o->get('version-check') && ($o->has('quiet') && !$o->get('quiet')) ) {
|
||||||
|
Pingback::version_check($dbh);
|
||||||
|
return 0 if $ENV{PTVCDEBUG} && PTDEBUG;
|
||||||
|
}
|
||||||
|
|
||||||
# ########################################################################
|
# ########################################################################
|
||||||
# Setup moving averages for --frames.
|
# Setup moving averages for --frames.
|
||||||
# ########################################################################
|
# ########################################################################
|
||||||
|
@@ -5812,7 +5812,7 @@ Transformers->import(qw(make_checksum));
|
|||||||
my $oktorun = 1;
|
my $oktorun = 1;
|
||||||
|
|
||||||
sub main {
|
sub main {
|
||||||
@ARGV = @_; # set global ARGV for this package
|
local @ARGV = @_; # set global ARGV for this package
|
||||||
|
|
||||||
$oktorun = 1;
|
$oktorun = 1;
|
||||||
|
|
||||||
@@ -5979,6 +5979,14 @@ sub main {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ########################################################################
|
||||||
|
# Do the version-check
|
||||||
|
# ########################################################################
|
||||||
|
if ( $o->get('version-check') && ($o->has('quiet') && !$o->get('quiet')) ) {
|
||||||
|
Pingback::version_check($dbh);
|
||||||
|
return 0 if $ENV{PTVCDEBUG} && PTDEBUG;
|
||||||
|
}
|
||||||
|
|
||||||
# ########################################################################
|
# ########################################################################
|
||||||
# Populate the IndexUsage object with indexes. Also get a list of all
|
# Populate the IndexUsage object with indexes. Also get a list of all
|
||||||
|
10
bin/pt-kill
10
bin/pt-kill
@@ -5818,7 +5818,7 @@ my $o;
|
|||||||
# ########################################################################
|
# ########################################################################
|
||||||
|
|
||||||
sub main {
|
sub main {
|
||||||
@ARGV = @_; # set global ARGV for this package
|
local @ARGV = @_; # set global ARGV for this package
|
||||||
|
|
||||||
# ########################################################################
|
# ########################################################################
|
||||||
# Get configuration information.
|
# Get configuration information.
|
||||||
@@ -6129,6 +6129,14 @@ sub main {
|
|||||||
$daemon->make_PID_file();
|
$daemon->make_PID_file();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ########################################################################
|
||||||
|
# Do the version-check
|
||||||
|
# ########################################################################
|
||||||
|
if ( $o->get('version-check') && ($o->has('quiet') && !$o->get('quiet')) ) {
|
||||||
|
Pingback::version_check($dbh);
|
||||||
|
return 0 if $ENV{PTVCDEBUG} && PTDEBUG;
|
||||||
|
}
|
||||||
|
|
||||||
# ########################################################################
|
# ########################################################################
|
||||||
# Start working.
|
# Start working.
|
||||||
# ########################################################################
|
# ########################################################################
|
||||||
|
@@ -6830,7 +6830,7 @@ $OUTPUT_AUTOFLUSH = 1;
|
|||||||
|
|
||||||
sub main {
|
sub main {
|
||||||
# Reset global vars else tests will fail.
|
# Reset global vars else tests will fail.
|
||||||
@ARGV = @_;
|
local @ARGV = @_;
|
||||||
$oktorun = 1;
|
$oktorun = 1;
|
||||||
@drop_trigger_sqls = ();
|
@drop_trigger_sqls = ();
|
||||||
|
|
||||||
@@ -7015,6 +7015,14 @@ sub main {
|
|||||||
die "This tool requires MySQL 5.0.10 or newer.\n";
|
die "This tool requires MySQL 5.0.10 or newer.\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ########################################################################
|
||||||
|
# Do the version-check
|
||||||
|
# ########################################################################
|
||||||
|
if ( $o->get('version-check') && ($o->has('quiet') && !$o->get('quiet')) ) {
|
||||||
|
Pingback::version_check($cxn->dbh());
|
||||||
|
return 0 if $ENV{PTVCDEBUG} && PTDEBUG;
|
||||||
|
}
|
||||||
|
|
||||||
# ########################################################################
|
# ########################################################################
|
||||||
# Setup lag and load monitors.
|
# Setup lag and load monitors.
|
||||||
# ########################################################################
|
# ########################################################################
|
||||||
|
@@ -7001,7 +7001,7 @@ use sigtrap 'handler', \&sig_int, 'normal-signals';
|
|||||||
my $oktorun = 1; # global for sig handler
|
my $oktorun = 1; # global for sig handler
|
||||||
|
|
||||||
sub main {
|
sub main {
|
||||||
@ARGV = @_; # set global ARGV for this package
|
local @ARGV = @_; # set global ARGV for this package
|
||||||
|
|
||||||
my %seen_id; # already printed rule info (advice)
|
my %seen_id; # already printed rule info (advice)
|
||||||
my %seen_fingerprint; # already seen queries
|
my %seen_fingerprint; # already seen queries
|
||||||
@@ -7356,6 +7356,14 @@ sub main {
|
|||||||
$daemon->make_PID_file();
|
$daemon->make_PID_file();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ########################################################################
|
||||||
|
# Do the version-check
|
||||||
|
# ########################################################################
|
||||||
|
if ( $o->get('version-check') && ($o->has('quiet') && !$o->get('quiet')) ) {
|
||||||
|
Pingback::version_check($dbh);
|
||||||
|
return 0 if $ENV{PTVCDEBUG} && PTDEBUG;
|
||||||
|
}
|
||||||
|
|
||||||
# #########################################################################
|
# #########################################################################
|
||||||
# Do it!
|
# Do it!
|
||||||
# #########################################################################
|
# #########################################################################
|
||||||
|
@@ -81,6 +81,10 @@ eval {
|
|||||||
|
|
||||||
our $can_load_data = can_load_data();
|
our $can_load_data = can_load_data();
|
||||||
|
|
||||||
|
# We do not want every test doing the version-check;
|
||||||
|
# that would be quite slow.
|
||||||
|
$ENV{PERCONA_VERSION_CHECK} = 0;
|
||||||
|
|
||||||
our $dsn_opts = [
|
our $dsn_opts = [
|
||||||
{
|
{
|
||||||
key => 'A',
|
key => 'A',
|
||||||
|
@@ -120,6 +120,7 @@ update_tool_header() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
cat $tool_file-header $tool_file-code > $tool_file
|
cat $tool_file-header $tool_file-code > $tool_file
|
||||||
|
[ $? -eq 0 ] && rm $tool_file-header $tool_file-code
|
||||||
}
|
}
|
||||||
|
|
||||||
# ############################################################################
|
# ############################################################################
|
||||||
|
Reference in New Issue
Block a user