[SERVER-1823] db.slaves.find() and rs.status() reporting different values of date of last sync Created: 21/Sep/10  Updated: 12/Jul/16  Resolved: 16/Jan/11

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 1.6.2
Fix Version/s: 1.7.4

Type: Bug Priority: Minor - P4
Reporter: Alvin Richards (Inactive) Assignee: Dwight Merriman
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Operating System: ALL
Participants:

 Description   

Problem:

Customer had accidentally set the clocktime of a secondary member of a replicate set to a date in 2030.

When they performed a rs.status() they saw

rs.status()
{
"set" : "set1",
"date" : "Sat Sep 21 2030 14:15:14 GMT+0000 (UTC)",
"myState" : 2,
"members" : [

{ "_id" : 0, "name" : "rs1a:27018", "health" : 1, "state" : 1, "uptime" : 347973, "lastHeartbeat" : "Sat Sep 21 2030 14:15:13 GMT+0000 (UTC)" }

,

{ "_id" : 1, "name" : "rs1b:27018", "health" : 1, "state" : 2, "self" : true }

],
"ok" : 1
}

The date being reported was "Sat Sep 21 2030 14:15:14 GMT+0000 (UTC)" (date and last hearbeat), which was the clocktime set on the machine.

However, looking further into the issue there seems to be a difference in what was being recording. A query to db.slaves.find() gave

{ "_id" : ObjectId("4c8e86f0c2aec46f3455b99a"), "host" : "10.121.14.4", "ns" : "local.oplog.rs", "syncedTo" :

{ "t" : 1285085434000, "i" : 30 }

}

The syncedTo of 1285085434000 equals
Tue Sep 21 2010 09:10:34 GMT-0700 (PDT)

Workaround:
To correct the problem

  • shutdown mongo on the secondary with the wrong clock time
  • change the clock time
  • restart mongod

Solution:
It appears that rs.status() is reporting the clocktime on the node its run but db.slaves.find() reports the clocktime on the master.

Business Case:
User Experience



 Comments   
Comment by Eliot Horowitz (Inactive) [ 16/Jan/11 ]

we added sync time to rs.status()

Comment by Dwight Merriman [ 22/Sep/10 ]

i need to make status show how up to date a node is

lastheartbeat is last time it checked 'are you alive' and does not reflect its data freshness

Comment by Alvin Richards (Inactive) [ 21/Sep/10 ]

Reproduce:

  • Get two machines and setup a Replica Set. Set the clocktime on both machines to now
  • Insert into the Primary and ensure that data is being replicated to the secondary
  • Show down the Secondary
  • Move the clocktime of the secondary forward (e.g. to 2030)
  • Bring the Secondary up
  • Ensure that data is still being propergated
  • Run rs.status() on the secondary and note the timestamp is the secodnaries clocktime (e.g. 2030)
  • Run db.slaves.find() on the master and see the regular clocktime (e..g now).
Generated at Thu Feb 08 02:58:09 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.