[SERVER-6282] Shards: getLastError waits 1 second to respond after insert with invalid shard key Created: 02/Jul/12  Updated: 11/Jul/16  Resolved: 30/Jul/12

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 2.1.2
Fix Version/s: 2.2.0-rc1

Type: Bug Priority: Major - P3
Reporter: Aaron Heckmann Assignee: Greg Studer
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

osx 10.7.4


Operating System: OS X
Participants:

 Description   

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.



 Comments   
Comment by auto [ 30/Jul/12 ]

Author:

{u'date': u'2012-07-05T12:05:10-07:00', u'email': u'greg@10gen.com', u'name': u'Greg Studer'}

Message: SERVER-6282 wait-doubling backoff for local mongos errors requiring config server access
Branch: master
https://github.com/mongodb/mongo/commit/424df087f9256b85e7b3a9b31d36518081ff2875

Comment by Greg Studer [ 05/Jul/12 ]

This is sort-of works-as-designed, in that inserting with an invalid shard key can DOS the config server now that we're handling this case correctly (there's no way to know that the data in the config server hasn't changed in the meantime without checking).

Discussing less immediately impactful behavior now.

Generated at Thu Feb 08 03:11:15 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.