mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-09 17:09:20 +00:00
Print info about slaves found. Print --progress when waiting for new table to replicate to slaves.
This commit is contained in:
@@ -8031,8 +8031,22 @@ sub main {
|
||||
},
|
||||
);
|
||||
PTDEBUG && _d(scalar @$slaves, 'slaves found');
|
||||
if ( scalar @$slaves ) {
|
||||
print "Found " . scalar(@$slaves) . " slaves:\n";
|
||||
foreach my $cxn ( @$slaves ) {
|
||||
print " " . $cxn->name() . "\n";
|
||||
}
|
||||
}
|
||||
elsif ( ($o->get('recursion-method') || '') ne 'none') {
|
||||
print "No slaves found. See --recursion-method if host "
|
||||
. $cxn->name() . " has slaves.\n";
|
||||
}
|
||||
else {
|
||||
print "Ignoring all slaves because --recursion-method=none "
|
||||
. "was specified\n";
|
||||
}
|
||||
|
||||
if ( $o->get('check-slave-lag') ) {
|
||||
if ( my $dsn = $o->get('check-slave-lag') ) {
|
||||
PTDEBUG && _d('Will use --check-slave-lag to check for slave lag');
|
||||
my $cxn = $make_cxn->(
|
||||
dsn_string => $o->get('check-slave-lag'),
|
||||
@@ -8044,6 +8058,16 @@ sub main {
|
||||
PTDEBUG && _d('Will check slave lag on all slaves');
|
||||
$slave_lag_cxns = $slaves;
|
||||
}
|
||||
if ( $slave_lag_cxns && scalar @$slave_lag_cxns ) {
|
||||
print "Will check slave lag on:\n";
|
||||
foreach my $cxn ( @$slave_lag_cxns ) {
|
||||
print " " . $cxn->name() . "\n";
|
||||
}
|
||||
}
|
||||
else {
|
||||
print "Not checking slave lag because no slaves were found "
|
||||
. "and --check-slave-lag was not specified.\n";
|
||||
}
|
||||
|
||||
# #####################################################################
|
||||
# Check for replication filters.
|
||||
@@ -8513,14 +8537,36 @@ sub main {
|
||||
}
|
||||
};
|
||||
|
||||
for my $slave (@$slaves) {
|
||||
PTDEBUG && _d('Waiting until', $slave->name(),
|
||||
'replicates the table');
|
||||
sleep 0.5 while ! $tp->check_table(
|
||||
dbh => $slave->dbh(),
|
||||
db => $new_tbl->{db},
|
||||
tbl => $new_tbl->{tbl}
|
||||
);
|
||||
if ( $slaves && scalar @$slaves ) {
|
||||
foreach my $slave (@$slaves) {
|
||||
my ($pr, $pr_first_report);
|
||||
if ( $o->get('progress') ) {
|
||||
$pr = new Progress(
|
||||
jobsize => scalar @$slaves,
|
||||
spec => $o->get('progress'),
|
||||
name => "Waiting for " . $slave->name(),
|
||||
);
|
||||
$pr_first_report = sub {
|
||||
print "Waiting forever for new table $new_tbl->{name} to replicate "
|
||||
. "to " . $slave->name() . "...\n";
|
||||
};
|
||||
}
|
||||
$pr->start() if $pr;
|
||||
my $has_table = 0;
|
||||
while ( !$has_table ) {
|
||||
$has_table = $tp->check_table(
|
||||
dbh => $slave->dbh(),
|
||||
db => $new_tbl->{db},
|
||||
tbl => $new_tbl->{tbl}
|
||||
);
|
||||
last if $has_table;
|
||||
$pr->update(
|
||||
sub { return 0; },
|
||||
first_report => $pr_first_report,
|
||||
) if $pr;
|
||||
sleep 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# --plugin hook
|
||||
|
Reference in New Issue
Block a user