mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-10 21:19:59 +00:00
Fix version check instances in pt-config-diff and pt-table-sync.
This commit is contained in:
@@ -4028,6 +4028,7 @@ sub main {
|
|||||||
my $last_dsn;
|
my $last_dsn;
|
||||||
my @configs; # MySQLConfig objects
|
my @configs; # MySQLConfig objects
|
||||||
my @config_names; # Human-readable names for those ^ objs
|
my @config_names; # Human-readable names for those ^ objs
|
||||||
|
my @cxn;
|
||||||
foreach my $config_src ( @ARGV ) {
|
foreach my $config_src ( @ARGV ) {
|
||||||
if ( -f $config_src ) {
|
if ( -f $config_src ) {
|
||||||
PTDEBUG && _d('Config source', $config_src, 'is a file');
|
PTDEBUG && _d('Config source', $config_src, 'is a file');
|
||||||
@@ -4054,6 +4055,7 @@ sub main {
|
|||||||
%common_modules,
|
%common_modules,
|
||||||
);
|
);
|
||||||
push @config_names, $cxn->name();
|
push @config_names, $cxn->name();
|
||||||
|
push @cxn, $cxn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4077,7 +4079,7 @@ sub main {
|
|||||||
# ########################################################################
|
# ########################################################################
|
||||||
if ( $o->get('version-check') && (!$o->has('quiet') || !$o->get('quiet')) ) {
|
if ( $o->get('version-check') && (!$o->has('quiet') || !$o->get('quiet')) ) {
|
||||||
Pingback::version_check(
|
Pingback::version_check(
|
||||||
map { +{ dbh => $_->{dbh}, dsn => $_->{dsn} } } @configs
|
map { +{ dbh => $_->dbh, dsn => $_->dsn } } @cxn
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -9533,17 +9533,29 @@ sub main {
|
|||||||
# ########################################################################
|
# ########################################################################
|
||||||
# Do the version-check
|
# Do the version-check
|
||||||
# ########################################################################
|
# ########################################################################
|
||||||
|
|
||||||
|
# This tool has way too many dbhs and doesn't use Cxn, so we have to
|
||||||
|
# manually disconnect them else they'll throw a warning. Also, it
|
||||||
|
# creates some dbh late, so here we need to create a dbh and then
|
||||||
|
# disconnect it only if we created it, i.e. don't disconnect the few
|
||||||
|
# dbh created early by the tool.
|
||||||
|
my @vc_dbhs;
|
||||||
|
my @instances = map {
|
||||||
|
my $dsn = $_;
|
||||||
|
my $dbh = $dsn->{dbh};
|
||||||
|
if ( !$dbh ) {
|
||||||
|
$dbh = get_cxn($dsn, %modules);
|
||||||
|
push @vc_dbhs, $dbh; # disconnect this dbh after version check
|
||||||
|
}
|
||||||
|
+{ dbh => $dbh, dsn => $dsn }
|
||||||
|
} @dsns;
|
||||||
|
|
||||||
if ( $o->get('version-check') && (!$o->has('quiet') || !$o->get('quiet')) ) {
|
if ( $o->get('version-check') && (!$o->has('quiet') || !$o->get('quiet')) ) {
|
||||||
Pingback::version_check(
|
Pingback::version_check(@instances);
|
||||||
map {
|
|
||||||
+{
|
|
||||||
dbh => $_->{dbh} || get_cxn($_, %args),
|
|
||||||
dsn => $_,
|
|
||||||
}
|
|
||||||
} @dsns
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
map { $_->disconnect } @vc_dbhs; # disconnect dbh created for version check
|
||||||
|
|
||||||
# ########################################################################
|
# ########################################################################
|
||||||
# Sync!
|
# Sync!
|
||||||
# ########################################################################
|
# ########################################################################
|
||||||
|
Reference in New Issue
Block a user