mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-08 11:07:58 +00:00
more format printf and GetOpt::Long fixes
This commit is contained in:
@@ -6140,10 +6140,16 @@ sub main {
|
||||
my $limit = max(@$frames);
|
||||
|
||||
# 2.00s [ 0.05s, 0.01s, 0.00s ]
|
||||
my $format = ($hires_ts ? '%.2f' : '%4d') . "s "
|
||||
. "[ " . join(", ", map { "%5.2fs" } @$frames) . " ]"
|
||||
. ($o->get('print-master-server-id') ? " %d" : '')
|
||||
. "\n";
|
||||
my $format = ($hires_ts ? '%1$.2f' : '%1$4d') . "s [ ";
|
||||
my $findex = 2;
|
||||
foreach (@$frames) {
|
||||
$format .= $findex > 2 ? ', ' : '';
|
||||
$format .= '%'.$findex.'$5.2fs';
|
||||
$findex++;
|
||||
}
|
||||
$format .= " ]";
|
||||
$format .= ($o->get('print-master-server-id') ? ' %'.$findex.'$d' : '')
|
||||
. "\n";
|
||||
|
||||
# ########################################################################
|
||||
# Monitor or update the heartbeat table.
|
||||
@@ -6278,10 +6284,12 @@ sub check_delay {
|
||||
push @sths, [ $dsn, $sth ];
|
||||
}
|
||||
|
||||
my $format_delay = ($args{hires_ts} ? '%.2f' : '%d')
|
||||
. ($o->get('print-master-server-id') ? " %d" : "")
|
||||
my $format_delay = ($args{hires_ts} ? '%1$.2f' : '%1$d')
|
||||
. ($o->get('print-master-server-id') ? ' %2$d' : "")
|
||||
. "\n";
|
||||
my $format_host = '%1$-20s '.($args{hires_ts} ? '%2$.2f' : '%2$d')
|
||||
. ($o->get('print-master-server-id') ? ' %3$d' : "")
|
||||
. "\n";
|
||||
my $format_host = "%-20s $format_delay";
|
||||
|
||||
# Before hi-res ts, we could check all slaves at one interval, assuming
|
||||
# the checks were fast, i.e. able to be done within one interval. But
|
||||
|
@@ -46,7 +46,7 @@ my $r = $slave_dbh->selectrow_hashref('show slave status');
|
||||
like($r->{last_error}, qr/Table 'test.t' doesn't exist'/, 'It is busted');
|
||||
|
||||
# Start an instance
|
||||
diag(`$trunk/bin/pt-slave-restart --max-sleep .25 -h 127.0.0.1 -P 12346 -u msandbox -p msandbox --daemonize --pid /tmp/pt-slave-restart.pid --log /tmp/pt-slave-restart.log`);
|
||||
diag(`$trunk/bin/pt-slave-restart --max-sleep 0.25 -h 127.0.0.1 -P 12346 -u msandbox -p msandbox --daemonize --pid /tmp/pt-slave-restart.pid --log /tmp/pt-slave-restart.log`);
|
||||
my $output = `ps x | grep 'pt-slave-restart \-\-max\-sleep ' | grep -v grep | grep -v pt-slave-restart.t`;
|
||||
like($output, qr/pt-slave-restart --max/, 'It lives');
|
||||
|
||||
@@ -93,7 +93,7 @@ like(
|
||||
);
|
||||
|
||||
# Start an instance
|
||||
$output = `$trunk/bin/pt-slave-restart --max-sleep .25 -h 127.0.0.1 -P 12346 -u msandbox -p msandbox --error-text "doesn't exist" --run-time 1s 2>&1`;
|
||||
$output = `$trunk/bin/pt-slave-restart --max-sleep 0.25 -h 127.0.0.1 -P 12346 -u msandbox -p msandbox --error-text "doesn't exist" --run-time 1s 2>&1`;
|
||||
unlike(
|
||||
$output,
|
||||
qr/Error does not match/,
|
||||
@@ -104,7 +104,7 @@ unlike(
|
||||
# Issue 391: Add --pid option to all scripts
|
||||
# ###########################################################################
|
||||
`touch /tmp/pt-script.pid`;
|
||||
$output = `$trunk/bin/pt-slave-restart --max-sleep .25 -h 127.0.0.1 -P 12346 -u msandbox -p msandbox --pid /tmp/pt-script.pid 2>&1`;
|
||||
$output = `$trunk/bin/pt-slave-restart --max-sleep 0.25 -h 127.0.0.1 -P 12346 -u msandbox -p msandbox --pid /tmp/pt-script.pid 2>&1`;
|
||||
like(
|
||||
$output,
|
||||
qr{PID file /tmp/pt-script.pid already exists},
|
||||
|
@@ -357,7 +357,7 @@ like(
|
||||
$output = output(
|
||||
sub { $exit_status = pt_table_checksum::main(
|
||||
qw(--user msandbox --pass msandbox),
|
||||
qw(-S /tmp/12345/mysql_sandbox12345.sock --set-vars innodb_lock_wait_timeout=3 --run-time 5)) },
|
||||
qw(-S /tmp/12345/mysql_sandbox12345.sock --set-vars innodb_lock_wait_timeout=3 --run-time 8)) },
|
||||
stderr => 1,
|
||||
);
|
||||
|
||||
|
@@ -44,7 +44,7 @@ $exit_status = pt_table_checksum::main(@args,
|
||||
my $t = time - $t0;
|
||||
|
||||
ok(
|
||||
$t >= 1.0 && $t <= 2.5 + $ENV{'PERCONA_SLOW_BOX'}*3,
|
||||
$t >= 1.0 && $t <= ($ENV{PERCONA_SLOW_BOX} ? 5.5 : 2.5),
|
||||
"Ran in roughly --run-time 1 second"
|
||||
) or diag("Actual run time: $t");
|
||||
|
||||
|
Reference in New Issue
Block a user