mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-09 07:30:02 +00:00
more format printf and GetOpt::Long fixes
This commit is contained in:
@@ -6140,10 +6140,16 @@ sub main {
|
|||||||
my $limit = max(@$frames);
|
my $limit = max(@$frames);
|
||||||
|
|
||||||
# 2.00s [ 0.05s, 0.01s, 0.00s ]
|
# 2.00s [ 0.05s, 0.01s, 0.00s ]
|
||||||
my $format = ($hires_ts ? '%.2f' : '%4d') . "s "
|
my $format = ($hires_ts ? '%1$.2f' : '%1$4d') . "s [ ";
|
||||||
. "[ " . join(", ", map { "%5.2fs" } @$frames) . " ]"
|
my $findex = 2;
|
||||||
. ($o->get('print-master-server-id') ? " %d" : '')
|
foreach (@$frames) {
|
||||||
. "\n";
|
$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.
|
# Monitor or update the heartbeat table.
|
||||||
@@ -6278,10 +6284,12 @@ sub check_delay {
|
|||||||
push @sths, [ $dsn, $sth ];
|
push @sths, [ $dsn, $sth ];
|
||||||
}
|
}
|
||||||
|
|
||||||
my $format_delay = ($args{hires_ts} ? '%.2f' : '%d')
|
my $format_delay = ($args{hires_ts} ? '%1$.2f' : '%1$d')
|
||||||
. ($o->get('print-master-server-id') ? " %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";
|
. "\n";
|
||||||
my $format_host = "%-20s $format_delay";
|
|
||||||
|
|
||||||
# Before hi-res ts, we could check all slaves at one interval, assuming
|
# 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
|
# 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');
|
like($r->{last_error}, qr/Table 'test.t' doesn't exist'/, 'It is busted');
|
||||||
|
|
||||||
# Start an instance
|
# 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`;
|
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');
|
like($output, qr/pt-slave-restart --max/, 'It lives');
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@ like(
|
|||||||
);
|
);
|
||||||
|
|
||||||
# Start an instance
|
# 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(
|
unlike(
|
||||||
$output,
|
$output,
|
||||||
qr/Error does not match/,
|
qr/Error does not match/,
|
||||||
@@ -104,7 +104,7 @@ unlike(
|
|||||||
# Issue 391: Add --pid option to all scripts
|
# Issue 391: Add --pid option to all scripts
|
||||||
# ###########################################################################
|
# ###########################################################################
|
||||||
`touch /tmp/pt-script.pid`;
|
`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(
|
like(
|
||||||
$output,
|
$output,
|
||||||
qr{PID file /tmp/pt-script.pid already exists},
|
qr{PID file /tmp/pt-script.pid already exists},
|
||||||
|
@@ -357,7 +357,7 @@ like(
|
|||||||
$output = output(
|
$output = output(
|
||||||
sub { $exit_status = pt_table_checksum::main(
|
sub { $exit_status = pt_table_checksum::main(
|
||||||
qw(--user msandbox --pass msandbox),
|
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,
|
stderr => 1,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@@ -44,7 +44,7 @@ $exit_status = pt_table_checksum::main(@args,
|
|||||||
my $t = time - $t0;
|
my $t = time - $t0;
|
||||||
|
|
||||||
ok(
|
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"
|
"Ran in roughly --run-time 1 second"
|
||||||
) or diag("Actual run time: $t");
|
) or diag("Actual run time: $t");
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user