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

Oplog entries contain repeated fields ($set)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical - P2
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.2.4, 2.4.0-rc0
    • Component/s: Replication
    • Labels:
      None
    • Operating System:
      ALL

      Description

      if a change occurs we need to be careful about backward compatibility / mixing of versions with replication, which is common.

      Jason Toffaletti to mongodb-user
      show details 4:42 AM (4 hours ago)
      I started up a mongod v1.4.4 with --master and ran some multi-field
      updates like this from mongo shell:

      > db.test2.update(

      {thing:'stuff'}

      , {$set:

      {stuff:14}

      , $inc:{version:1}})

      While doing this I have a pymongo 1.5.1 script running a tailable
      cursor on local.oplog.$main, printing out results:

      update {u'o2':

      {u'_id': ObjectId('4c610b301a632ffb5161c3e8')}

      , u'ns':
      u'test.test2', u'ts': Timestamp(1281428434, 1), u'o': {u'$set':
      {u'version': 2.0}}, u'op': u'u'}
      update {u'o2':

      {u'_id': ObjectId('4c610b301a632ffb5161c3e8')}

      , u'ns':
      u'test.test2', u'ts': Timestamp(1281428450, 1), u'o': {u'$set':
      {u'version': 3.0}}, u'op': u'u'}
      update {u'o2':

      {u'_id': ObjectId('4c610b301a632ffb5161c3e8')}

      , u'ns':
      u'test.test2', u'ts': Timestamp(1281428586, 1), u'o': {u'$set':
      {u'version': 4.0}}, u'op': u'u'}

      This is strange, the "o" field only shows the update to version. What
      does mongo shell show?

      > db['oplog.$main'].find(

      {op:"u"}

      )
      { "ts" :

      { "t" : 1281428434000, "i" : 1 }

      , "op" : "u", "ns" :
      "test.test2", "o2" :

      { "_id" : ObjectId("4c610b301a632ffb5161c3e8") }

      ,
      "o" : { "$set" :

      { "stuff" : 1 }

      , "$set" :

      { "stuff" : 1 }

      } }
      { "ts" :

      { "t" : 1281428450000, "i" : 1 }

      , "op" : "u", "ns" :
      "test.test2", "o2" :

      { "_id" : ObjectId("4c610b301a632ffb5161c3e8") }

      ,
      "o" : { "$set" :

      { "stuff" : 1346 }

      , "$set" :

      { "stuff" : 1346 }

      } }
      { "ts" :

      { "t" : 1281428586000, "i" : 1 }

      , "op" : "u", "ns" :
      "test.test2", "o2" :

      { "_id" : ObjectId("4c610b301a632ffb5161c3e8") }

      ,
      "o" : { "$set" :

      { "stuff" : 14 }

      , "$set" :

      { "stuff" : 14 }

      } }

      Wait, what? This doesn't have the version update, but shows the $set
      twice. I know mongod replication works, so I must be doing something
      wrong?

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              eliot Eliot Horowitz
              Reporter:
              dwight_10gen Dwight Merriman
              Participants:
              Votes:
              2 Vote for this issue
              Watchers:
              10 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: