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

cannot perform an in-place update on oplog

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Duplicate
    • Affects Version/s: 2.6.1
    • Fix Version/s: None
    • Component/s: Write Ops
    • Labels:
      None
    • Operating System:
      ALL

      Description

      Can make updates on capped collections, including without Id index, but on oplog.rs in local:

      db.getSiblingDB("local").oplog.rs.find({ "ts" : Timestamp(1401418539, 1), "h" : NumberLong("-4571530663222791900")})
      { "ts" : Timestamp(1401418539, 1), "h" : NumberLong("-4571530663222791900"), "v" : 2, "op" : "i", "ns" : "blog.docs", "o" : { "_id" : ObjectId("5387f32bad47a6460bac5994"), "docId" : 999 } }
      > db.getSiblingDB("local").oplog.rs.update({ "ts" : Timestamp(1401418539, 1), "h" : NumberLong("-4571530663222791900")},
      {$set:{op:"c"}})
      WriteResult({
      	"nMatched" : 0,
      	"nUpserted" : 0,
      	"nModified" : 0,
      	"writeError" : {
      		"code" : 10003,
      		"errmsg" : "failing update: objects in a capped ns cannot grow"
      	}
      })
      > db.getSiblingDB("local").oplog.rs.update({ "ts" : Timestamp(1401418539, 1), "h" : NumberLong("-4571530663222791900")},
      {$inc:{v:1}})
      WriteResult({
      	"nMatched" : 0,
      	"nUpserted" : 0,
      	"nModified" : 0,
      	"writeError" : {
      		"code" : 10003,
      		"errmsg" : "failing update: objects in a capped ns cannot grow"
      	}
      })
      > db.getSiblingDB("local").oplog.rs.update({ "ts" : Timestamp(1401418539, 1), "h" : NumberLong("-4571530663222791900")},
      {$inc:{"o.docId":1}})
      WriteResult({
      	"nMatched" : 0,
      	"nUpserted" : 0,
      	"nModified" : 0,
      	"writeError" : {
      		"code" : 10003,
      		"errmsg" : "failing update: objects in a capped ns cannot grow"
      	}
      })

      As it turns out, if I shrink the new doc by A LOT I can get it in (but not shrinking by a little). So somewhere there's a calculation that's maybe adding ts and h twice or something like that.

      /* shrink by 15 bytes and it doesn't fit still */
      db.getSiblingDB("local").oplog.rs.update({ "ts" : Timestamp(1401418539, 1), "h" : NumberLong("-4571530663222791900")},{ "ts" : Timestamp(1401418539, 1), "h" : NumberLong("-4571530663222791900"), "v" : NumberInt(2), "op" : "i", "ns" : "b.d", "o" : { "_id" : NumberInt(0), "doc1" : NumberLong(999) } })
      WriteResult({
      	"nMatched" : 0,
      	"nUpserted" : 0,
      	"nModified" : 0,
      	"writeError" : {
      		"code" : 10003,
      		"errmsg" : "failing update: objects in a capped ns cannot grow"
      	}
      })
      /* shrink by 16 bytes and it "fits" */
      db.getSiblingDB("local").oplog.rs.update({ "ts" : Timestamp(1401418539, 1), "h" : NumberLong("-4571530663222791900")},
        { "ts" : Timestamp(1401418539, 1), "h" : NumberLong("-4571530663222791900"), "v" : NumberInt(2), "op" : "i", "ns" : "b.d", "o" : { "_id" : NumberInt(0), "doc": NumberLong(888) } })
      WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 })

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                1 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: