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

Shards: getLastError waits 1 second to respond after insert with invalid shard key

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.2.0-rc1
    • Affects Version/s: 2.1.2
    • Component/s: Sharding
    • None
    • Environment:
      osx 10.7.4
    • OS X

      With a sharded setup, enable sharding on a collection:

      > db.runCommand( { shardcollection : "test.testshard", key :

      { name : 1, age: 1 }

      } )
      > use test
      > db.testshard.insert(

      { age: 1 }

      )

        • Actual behavior:

      ... one second later ...

      "tried to insert object with no valid shard key for

      { name: 1.0, age: 1.0 }

      :

      { _id: ObjectId('4ff1ecd2118f035ab2938dad'), age: 1.0 }

      "

        • Expected behavior:

      The error message should respond immediately.

      These delays "stack up"; e.g. for each invalid document inserted, the delayed response increases by one second. So, with a nodejs program, 6 parallel inserts (followed by getLastError) means waiting for 6 seconds to get the error response.

            Assignee:
            greg_10gen Greg Studer
            Reporter:
            aheckmann Aaron Heckmann
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: