mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-12-19 01:09:21 +08:00
Fix for 1086259: pt-kill in non-daemon mode logs timestamps incorrectly
This commit is contained in:
@@ -6782,7 +6782,7 @@ sub log_to_table {
|
|||||||
my ($log, $query, $pl, $processlist_columns)
|
my ($log, $query, $pl, $processlist_columns)
|
||||||
= @args{qw( log query proclist columns )};
|
= @args{qw( log query proclist columns )};
|
||||||
|
|
||||||
my $ts = Transformers::ts(localtime);
|
my $ts = Transformers::ts(time());
|
||||||
my $reasons = join "\n", map {
|
my $reasons = join "\n", map {
|
||||||
defined($_) ? $_ : "Unkown reason"
|
defined($_) ? $_ : "Unkown reason"
|
||||||
} @{ $pl->{_reasons_for_matching}->{$query} };
|
} @{ $pl->{_reasons_for_matching}->{$query} };
|
||||||
|
|||||||
@@ -28,9 +28,6 @@ my $dbh = $sb->get_dbh_for('master');
|
|||||||
if ( !$dbh ) {
|
if ( !$dbh ) {
|
||||||
plan skip_all => 'Cannot connect to sandbox master';
|
plan skip_all => 'Cannot connect to sandbox master';
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
plan tests => 21;
|
|
||||||
}
|
|
||||||
|
|
||||||
my $output;
|
my $output;
|
||||||
my $cnf='/tmp/12345/my.sandbox.cnf';
|
my $cnf='/tmp/12345/my.sandbox.cnf';
|
||||||
@@ -189,6 +186,21 @@ $dbh->do($sql);
|
|||||||
}
|
}
|
||||||
|
|
||||||
my $result = shift @$results;
|
my $result = shift @$results;
|
||||||
|
|
||||||
|
# This returns a string ala 2012-12-04T17:47:52
|
||||||
|
my $current_ts = Transformers::ts(time());
|
||||||
|
# Use whatever format MySQL is using
|
||||||
|
($current_ts) = $dbh->selectrow_array(qq{SELECT TIMESTAMP('$current_ts')});
|
||||||
|
|
||||||
|
# Chop off the minutes & seconds. If the rest of the date is right,
|
||||||
|
# this is unlikely to be broken.
|
||||||
|
substr($current_ts, -5, 5, "");
|
||||||
|
like(
|
||||||
|
$result->{timestamp},
|
||||||
|
qr/\A\Q$current_ts\E.{5}\Z/,
|
||||||
|
"Bug 1086259: pt-kill in non-daemon mode logs timestamps incorrectly"
|
||||||
|
);
|
||||||
|
|
||||||
my $against = {
|
my $against = {
|
||||||
user => 'msandbox',
|
user => 'msandbox',
|
||||||
host => 'localhost',
|
host => 'localhost',
|
||||||
@@ -320,4 +332,5 @@ PerconaTest::wait_until(
|
|||||||
# #############################################################################
|
# #############################################################################
|
||||||
$sb->wipe_clean($dbh);
|
$sb->wipe_clean($dbh);
|
||||||
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
|
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
|
||||||
|
done_testing;
|
||||||
exit;
|
exit;
|
||||||
|
|||||||
Reference in New Issue
Block a user