pt-heartbeat reports a wrong result when in different timezone

Bug #1338010 reported by Paul Namuag
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona Toolkit moved to https://jira.percona.com/projects/PT
Invalid
Undecided
Unassigned

Bug Description

Ran command below,

# pt-heartbeat --defaults-file=/home/analytics/.my.cnf -D test --check --master-server-id 3
10800.00

and SHOW SLAVE STATUS shows,

mysql> show slave status \G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 162.254.24.244
Master_User: replication
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000757
Read_Master_Log_Pos: 464086795
Relay_Log_File: relay-bin.002018
Relay_Log_Pos: 451959067
Relay_Master_Log_File: mysql-bin.000757
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 464086795
Relay_Log_Space: 451959217
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 3
1 row in set (0.00 sec)

Timezones:
they report the same time, but in different time zones
slave: Fri Jul 4 22:48:23 EDT 2014
master: Fri Jul 4 19:48:31 PDT 2014

After changing the timezones:
master Fri Jul 4 20:07:48 PDT 2014
slave Fri Jul 4 20:07:39 PDT 2014

# pt-heartbeat --defaults-file=/home/analytics/.my.cnf -D test --check --master-server-id 3
0.00

Solution: pt-hearbeat might be able to detect if the timezone are different against each other, else provide a workaround or could also be a warning regarding this issue.

Tags: pt-heartbeat
tags: added: pt-heartbeat
Revision history for this message
Frank Cizmich (frank-cizmich) wrote :

Hello Paul,

pt-hearbeat has an option for this.

From the docs:

====================
--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.

    If used, this option must be used for all pt-heartbeat instances: --update, --monitor, --check, etc. You should probably set the option in a --config file. Mixing this option with pt-heartbeat instances not using this option will cause false-positive lag readings due to different time zones (unless all your systems are set to use UTC, in which case this option isn’t required).
====================

Revision history for this message
Frank Cizmich (frank-cizmich) wrote :

I'm changing status of this to invalid due to the existing --utc option.
Might consider including a warning in documentation though.

Changed in percona-toolkit:
status: New → Invalid
Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PT-1231

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.