diff options
author | Spencer T Brody <spencer@10gen.com> | 2012-08-07 15:52:51 -0400 |
---|---|---|
committer | Spencer T Brody <spencer@10gen.com> | 2012-08-08 16:47:45 -0400 |
commit | 797654e85cb58cc8fa6310be3b619bb3f568c784 (patch) | |
tree | 110c481b57f59a9c2d9faabdc1031018348daae1 /src/mongo/client/parallel.cpp | |
parent | f7fdee2e22b37c20a2999fe579111f0fb1f5eb91 (diff) | |
download | mongo-797654e85cb58cc8fa6310be3b619bb3f568c784.tar.gz |
Check result object of command for stale config in ParallelSortClusteredCursor. SERVER-6684 SERVER-6685
Diffstat (limited to 'src/mongo/client/parallel.cpp')
-rw-r--r-- | src/mongo/client/parallel.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/mongo/client/parallel.cpp b/src/mongo/client/parallel.cpp index b6b9bc1981b..a2badf085c0 100644 --- a/src/mongo/client/parallel.cpp +++ b/src/mongo/client/parallel.cpp @@ -96,6 +96,17 @@ namespace mongo { BSONObj o = cursor->next(); throw UserException( o["code"].numberInt() , o["$err"].String() ); } + + BSONObj res = cursor->peekFirst(); + // For backwards compatibility with v2.0 mongods because in 2.0 commands that care about + // versioning (like the count command) will return with the stale config error code, but + // don't set the ShardConfigStale result flag on the cursor. + // NOTE: This could potentially cause problems if the user's document has a "code" field. + // TODO: This should probably be removed for 2.3, as we'll no longer need to support running + // with a 2.0 mongod. + if ( res.hasField( "code" ) && res["code"].Number() == SendStaleConfigCode ) { + throw RecvStaleConfigException( "ClusteredCursor::_checkCursor", res ); + } } auto_ptr<DBClientCursor> ClusteredCursor::query( const string& server , int num , BSONObj extra , int skipLeft , bool lazy ) { |