Add failling test for bug 1103221. Add --utc option, not implemented yet.

This commit is contained in:
Daniel Nichter
2013-01-22 16:22:59 -07:00
parent c1f284d648
commit ca8fc5e47e
2 changed files with 36 additions and 1 deletions

View File

@@ -5863,6 +5863,16 @@ short form: -u; type: string
User for login if not current user. User for login if not current user.
=item --utc
Ignore system time zones and use only UTC. By default pt-heartbeat does
not check or adjust for different system or MySQL time zones which can
cause the tool to compute the lag incorrectly. Specifying this option is
a good idea because it ensures that the tool works correctly regardless of
time zones, but it also makes the tool backwards-incompatible with
pt-heartbeat 2.1.7 and older (unless the older version of pt-heartbeat
is running on a system that uses UTC).
=item --version =item --version
Show version and exit. Show version and exit.

View File

@@ -89,7 +89,7 @@ PerconaTest::wait_for_table($slave1_dbh, 'test.heartbeat', 'server_id=12345');
my $slave1_dsn = $sb->dsn_for('slave1'); my $slave1_dsn = $sb->dsn_for('slave1');
# Using full_output here to work around a Perl bug: Only the first explicit # Using full_output here to work around a Perl bug: Only the first explicit
# tzset works. # tzset works.
($output) = full_output(sub { ($output) = output(sub {
local $ENV{TZ} = '-09:00'; local $ENV{TZ} = '-09:00';
tzset(); tzset();
pt_heartbeat::main($slave1_dsn, qw(--database test --table heartbeat), pt_heartbeat::main($slave1_dsn, qw(--database test --table heartbeat),
@@ -107,6 +107,31 @@ like(
stop_all_instances(); stop_all_instances();
# #############################################################################
# pt-heartbeat 2.1.8 doesn't use precision/sub-second timestamps
# https://bugs.launchpad.net/percona-toolkit/+bug/1103221
# #############################################################################
$master_dbh->do('truncate table test.heartbeat');
$sb->wait_for_slaves;
my $master_dsn = $sb->dsn_for('master');
($output) = output(
sub {
pt_heartbeat::main($master_dsn, qw(--database test --update),
qw(--run-time 1))
},
);
my ($row) = $master_dbh->selectrow_hashref('select * from test.heartbeat');
like(
$row->{ts},
qr/\d{4}-\d\d-\d\dT\d+:\d+:\d+\.\d+/,
"Hi-res timestamp (bug 1103221)"
);
# ############################################################################ # ############################################################################
# Done. # Done.
# ############################################################################ # ############################################################################