mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-10 13:11:32 +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 @configs; # MySQLConfig objects
|
||||
my @config_names; # Human-readable names for those ^ objs
|
||||
my @cxn;
|
||||
foreach my $config_src ( @ARGV ) {
|
||||
if ( -f $config_src ) {
|
||||
PTDEBUG && _d('Config source', $config_src, 'is a file');
|
||||
@@ -4054,6 +4055,7 @@ sub main {
|
||||
%common_modules,
|
||||
);
|
||||
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')) ) {
|
||||
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
|
||||
# ########################################################################
|
||||
|
||||
# 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')) ) {
|
||||
Pingback::version_check(
|
||||
map {
|
||||
+{
|
||||
dbh => $_->{dbh} || get_cxn($_, %args),
|
||||
dsn => $_,
|
||||
}
|
||||
} @dsns
|
||||
);
|
||||
Pingback::version_check(@instances);
|
||||
}
|
||||
|
||||
map { $_->disconnect } @vc_dbhs; # disconnect dbh created for version check
|
||||
|
||||
# ########################################################################
|
||||
# Sync!
|
||||
# ########################################################################
|
||||
|
Reference in New Issue
Block a user