[SERVER-26112] singleBatch can return incomplete results in a sharded environment Created: 14/Sep/16  Updated: 19/Nov/16  Resolved: 13/Oct/16

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 3.2.9
Fix Version/s: 3.4.0-rc1

Type: Bug Priority: Major - P3
Reporter: Chris Harris Assignee: Maria van Keulen
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:

In a sharded environment, insert more than 101 documents with the same value for the shard key into a collection. Issuing a find command which includes the parameter singleBatch:true to a mongos will not return any results to the client. Issuing the command with singleBatch:true removed will return 101 documents as expected.

mongos> sh.shardCollection('test.foo',{x:1})
{ "collectionsharded" : "test.foo", "ok" : 1 }
mongos> for(i = 1; i < 250; i++){ db.foo.insert({x:0});}
WriteResult({ "nInserted" : 1 })
mongos>
mongos> db.foo.runCommand({find:"foo", filter:{x:0}, skip:101, singleBatch: true}).cursor.firstBatch.length
0
mongos> db.foo.runCommand({find:"foo", filter:{x:0}, skip:101}).cursor.firstBatch.length
101

Sprint: Query 2016-10-10, Query 2016-10-31
Participants:

 Description   

In a sharded environment, mongos will pass along the singleBatch:true parameter to the mongod shards. This results in no cursor being sent back to mongos. If mongos is unable to fill the result set requested by the client using the documents returned by the initial batches from the shards then incomplete results will be returned to the client since there are no cursors to issue `getMore` commands against.



 Comments   
Comment by Githook User [ 13/Oct/16 ]

Author:

{u'username': u'mvankeulen94', u'name': u'Maria van Keulen', u'email': u'maria.vankeulen@mongodb.com'}

Message: SERVER-26112 Always forward singleBatch=false to shards
Branch: master
https://github.com/mongodb/mongo/commit/071e96c37db036cc81449048fb43341ab59912a4

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