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

GetLastError on sharded cluster can report incorrect result

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 2.2.3, 2.3.2
    • 1.8.3, 2.2.0, 2.2.1
    • Write Ops
    • Fully Compatible
    • ALL

    Description

      Steps:

      1. Insert object into shard (successfully)
      2. Update object by _id (WriteResult writeResult = dbCollection.update(query, update, false, false, WriteConcern.SAFE)
      query looks like: {_id : XYZ}
      update looks like: {$set : {foo : bar, foo2 : bar2}}
      3. Object is updated

      WriteResult:

      { 
         writeResult =   { 
            "serverUsed":"127.0.0.1:27017/myDB", 
            "singleShard":"ReplSet3/ec2-xxxx.compute-1.amazonaws.com:27018,ec2-xxxx.compute-1.amazonaws.com:27018,ec2-xxxx.compute-1.amazonaws.com:27018", 
      =>    "n":0, 
            "lastOp":5686019109100191745, 
            "connectionId":1524, 
            "err":null, 
            "ok":1.0, 
      =>    "updatedExisting":true, 
            "wtime":0, 
            "writebackGLE": { 
               "singleShard":"ReplSet3/ec2-xxxx.compute-1.amazonaws.com:27018,ec2-xxxx.compute-1.amazonaws.com:27018,ec2-xxxx.comput1.amazonaws.com:27018", 
               "n":0, 
               "lastOp":5686019109100191745, 
               "connectionId":1524, 
               "err":null, 
               "ok":1.0 
            }, 
            "initialGLEHost":"ReplSet1/ec2-xxxx.compute-1.amazonaws.com:27018,ec2-xxxx.compute-1.amazonaws.com:27018,ec2-xxxx.compute1.amazonaws.com:27018" 
         } 

      This is very hard to reproduce since it is very intermittent. Maybe somebody has an vague idea about the exact situation when this might occur. One thing to note is that step 1 and 2 are executed very quickly.

      I had created a thread in the forum: http://groups.google.com/group/mongodb-user/browse_thread/thread/d1ca7e977dc7455b/973cab27e21df385?lnk=gst&q=smigfu#973cab27e21df385

      Attachments

        1. noUpdateButN1.js
          2 kB
        2. noUpdateButN1inAnotherCollection.js
          2 kB
        3. shTest.js
          2 kB

        Activity

          People

            eliot Eliot Horowitz (Inactive)
            smigfu Philipp Marx
            Votes:
            3 Vote for this issue
            Watchers:
            17 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: