Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-1823

db.slaves.find() and rs.status() reporting different values of date of last sync

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 1.7.4
    • Affects Version/s: 1.6.2
    • Component/s: None
    • None
    • ALL

      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

            Assignee:
            dwight@mongodb.com Dwight Merriman
            Reporter:
            alvin Alvin Richards (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: