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

PHP getLastError wrong when Sharding

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker - P1
    • Resolution: Duplicate
    • Affects Version/s: 2.2.0
    • Fix Version/s: None
    • Component/s: Querying
    • Labels:
      None
    • Environment:
      Ubuntu
    • Operating System:
      Linux

      Description

      getLastError returning old/wrong/no data. The code that we are running works 100% when not sharded.

      We have a 3 shard setup, each shard with 3 servers in a replica set. 3 config servers and 1 mongos running on the application server.

      All querys are using safemode.

      After going an update with a query that would match 0 documents the following is returned via getLastError()

      "singleShard":"Set_01\/db1.test.co.uk,db5.test.co.uk,db9.test.co.uk",
      "updatedExisting":true,
      "n":1,
      "lastOp":

      { "sec":1352302481, "inc":2 }

      ,
      "connectionId":1392,
      "err":null,
      "ok":1

      However, no documents will have been updated so n=1 should be wrong as well as updatedExsisting.

      When using a query that does match a document ( and does successfully update), occasionally we will get the following from getLastError()

      "singleShard":"Set_02\/db2.test.co.uk,db6.test.co.uk,db7.test.co.uk",
      "n":0,
      "lastOp":

      { "sec":1352295232, "inc":31 }

      ,
      "connectionId":239,
      "err":null,
      "ok":1,
      "writeback":

      { "$id":"509a633f0000000000000048" }

      ,
      "instanceIdent":"mongo-01",
      "updatedExisting":true,
      "writebackGLE":{
      "singleShard":"Set_02\/db2.test.co.uk,db6.test.co.uk,db7.test.co.uk",
      "n":0,
      "lastOp":

      { "sec":1352295232, "inc":31 }

      ,
      "connectionId":239,
      "err":null,
      "ok":1
      },
      "initialGLEHost":"Set_01\/db1.test.co.uk,db5.test.co.uk,db9.test.co.uk"

      "lastOp" is sometimes the same, if that means anything?

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              kristina Kristina Chodorow
              Reporter:
              dwayne@geekbeach.com Dwayne Bull
              Participants:
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: