[DOCS-7810] Replica set lastHeartbeat documentation is incorrect Created: 05/May/16  Updated: 30/Oct/23  Resolved: 09/Oct/17

Status: Closed
Project: Documentation
Component/s: manual
Affects Version/s: None
Fix Version/s: Server_Docs_20231030

Type: Bug Priority: Major - P3
Reporter: Kevin Adistambha Assignee: Nicholas Larew
Resolution: Done Votes: 0
Labels: groom
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
backports SERVER-50038 [mongostat] difference between pingMs... Closed
Duplicate
is duplicated by DOCS-10879 Description of lastHeartbeat and last... Closed
Related
Participants:
Days since reply: 6 years, 18 weeks, 2 days ago

 Description   

The manual at https://docs.mongodb.org/manual/reference/command/replSetGetStatus/#replSetGetStatus.members[n].lastHeartbeat states that:

The lastHeartbeat value provides an ISODate formatted date and time of the transmission time of last heartbeat received from this member. Compare this value to the value of the date and lastHeartBeatRecv field to track latency between these members.

If there are two nodes A and B and we are at node A, my understanding of this sentence is:

  • lastHeartbeat means the timestamp when the heartbeat was sent from B to A
  • lastHeartbeatRecv means the timestamp when B's heartbeat reply was received by A

However this is incorrect, as my testing seems to show that lastHeartbeat keeps increasing in value and seems to track the current time, while lastHeartbeatRecv is showing the time node B replies to the heartbeat request from A.

Therefore, the manual is incorrect: lastHeartbeat is apparently the timestamp when node A sends a heartbeat to node B.

Note: The source code in src/mongo/db/repl/member_heartbeat_data.h also shows an incorrect comment.



 Comments   
Comment by Githook User [ 09/Oct/17 ]

Author:

{'email': 'nick.larew@10gen.com', 'name': 'Nick Larew', 'username': 'nlarew'}

Message: DOCS-7810: Fixed replSetGetStatus lastHeartbeat and lastHeartbeatRecv descriptions

Signed-off-by: kay <kay.kim@10gen.com>
Branch: v3.2
https://github.com/mongodb/docs/commit/5712eb44d51abae774656dd8152e6e1a94c50edf

Comment by Githook User [ 09/Oct/17 ]

Author:

{'email': 'nick.larew@10gen.com', 'name': 'Nick Larew', 'username': 'nlarew'}

Message: DOCS-7810: Fixed replSetGetStatus lastHeartbeat and lastHeartbeatRecv descriptions

Signed-off-by: kay <kay.kim@10gen.com>
Branch: v3.4
https://github.com/mongodb/docs/commit/b37c33ea1f4555c8715d05a1c72e7238a2b435ce

Comment by Githook User [ 09/Oct/17 ]

Author:

{'email': 'nick.larew@10gen.com', 'name': 'Nick Larew', 'username': 'nlarew'}

Message: DOCS-7810: Fixed replSetGetStatus lastHeartbeat and lastHeartbeatRecv descriptions

Signed-off-by: kay <kay.kim@10gen.com>
Branch: master
https://github.com/mongodb/docs/commit/f698904de359f3ce7566f76e52182e09a5dd72f6

Comment by Nicholas Larew [ 04/Oct/17 ]

Per discussion w/ Spencer Brody,

A = node on which replSetGetStatus is run
B = another member of the replica set

lastHearbeatRecv => the last time A received a heartbeat request from B
lastHeartBeat => the last time A received a response from B to a heartbeat request sent by A

Generated at Thu Feb 08 07:55:03 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.