mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-11 21:51:21 +00:00
fixes pt-table-checksum and pt-osc rounding low max-load thresholds to same as starting value - issue 1253872
This commit is contained in:
@@ -8,8 +8,9 @@ BEGIN {
|
||||
|
||||
use strict;
|
||||
use warnings FATAL => 'all';
|
||||
use POSIX qw( ceil floor );
|
||||
use English qw(-no_match_vars);
|
||||
use Test::More tests => 17;
|
||||
use Test::More tests => 22;
|
||||
|
||||
use MySQLStatusWaiter;
|
||||
use PerconaTest;
|
||||
@@ -19,6 +20,7 @@ my @checked = ();
|
||||
my $slept = 0;
|
||||
my @vals = ();
|
||||
|
||||
|
||||
sub oktorun {
|
||||
return $oktorun;
|
||||
}
|
||||
@@ -162,6 +164,94 @@ is(
|
||||
"Slept until values low enough"
|
||||
);
|
||||
|
||||
# ############################################################################
|
||||
# Initial vals + 20% plus ceiling option
|
||||
# ############################################################################
|
||||
|
||||
@vals = (
|
||||
# initial check for existence
|
||||
{ Threads_connected => 9, },
|
||||
{ Threads_running => 4, },
|
||||
|
||||
# first check, no wait
|
||||
{ Threads_connected => 1, },
|
||||
{ Threads_running => 1, },
|
||||
|
||||
# second check, wait
|
||||
{ Threads_connected => 11, }, # too high
|
||||
{ Threads_running => 5, }, # too high
|
||||
|
||||
# third check, wait
|
||||
{ Threads_connected => 11, }, # too high
|
||||
{ Threads_running => 4, },
|
||||
|
||||
# fourth check, wait
|
||||
{ Threads_connected => 10, },
|
||||
{ Threads_running => 5, }, # too high
|
||||
|
||||
# fifth check, no wait
|
||||
{ Threads_connected => 10, },
|
||||
{ Threads_running => 4, },
|
||||
);
|
||||
|
||||
$oktorun = 1;
|
||||
|
||||
$sw = new MySQLStatusWaiter(
|
||||
oktorun => \&oktorun,
|
||||
get_status => \&get_status,
|
||||
sleep => \&sleep,
|
||||
ceiling => 'true',
|
||||
max_spec => [qw(Threads_connected Threads_running)],
|
||||
);
|
||||
|
||||
is_deeply(
|
||||
$sw->max_values(),
|
||||
{
|
||||
Threads_connected => ceil(9 + (9 * 0.20)),
|
||||
Threads_running => ceil(4 + (4 * 0.20)),
|
||||
},
|
||||
"Using Ceiling: Initial values = ceil(val+20%)"
|
||||
);
|
||||
|
||||
# first check
|
||||
@checked = ();
|
||||
$slept = 0;
|
||||
$sw->wait();
|
||||
|
||||
is_deeply(
|
||||
\@checked,
|
||||
[qw(Threads_connected Threads_running)],
|
||||
"Using Ceiling: Checked both vars"
|
||||
);
|
||||
|
||||
is(
|
||||
$slept,
|
||||
0,
|
||||
"Using Ceiling: Vals not too high, did not sleep"
|
||||
);
|
||||
|
||||
# second through fifth checks
|
||||
@checked = ();
|
||||
$slept = 0;
|
||||
$sw->wait();
|
||||
|
||||
is_deeply(
|
||||
\@checked,
|
||||
[qw(
|
||||
Threads_connected Threads_running
|
||||
Threads_connected Threads_running
|
||||
Threads_connected Threads_running
|
||||
Threads_connected Threads_running
|
||||
)],
|
||||
"Using Ceiling: Rechecked all variables"
|
||||
);
|
||||
|
||||
is(
|
||||
$slept,
|
||||
3,
|
||||
"Using Ceiling: Slept until values low enough"
|
||||
);
|
||||
|
||||
# ############################################################################
|
||||
# Use static vals.
|
||||
# ############################################################################
|
||||
|
Reference in New Issue
Block a user