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

PHP getLastError wrong when Sharding

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Blocker - P1 Blocker - P1
    • None
    • Affects Version/s: 2.2.0
    • Component/s: Querying
    • None
    • Environment:
      Ubuntu
    • Linux

      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?

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

              Created:
              Updated:
              Resolved: