summaryrefslogtreecommitdiff
path: root/client/parallel.cpp
diff options
context:
space:
mode:
authorAntonin Kral <a.kral@bobek.cz>2012-05-10 06:57:57 +0200
committerAntonin Kral <a.kral@bobek.cz>2012-05-10 06:57:57 +0200
commit8813daaab256108f7aa6300875e8562d031f2c2f (patch)
tree06daade9022f76b2775d23f4613817365a2ded99 /client/parallel.cpp
parentd72a59184a3d51b17b30ed20fe656421bd4d2248 (diff)
parent61619b3142c1de8f60f91964ff2656054d4f11a6 (diff)
downloadmongodb-8813daaab256108f7aa6300875e8562d031f2c2f.tar.gz
Merge tag 'upstream/2.0.5'
Upstream version 2.0.5
Diffstat (limited to 'client/parallel.cpp')
-rw-r--r--client/parallel.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/client/parallel.cpp b/client/parallel.cpp
index 3a33eb5..d7975a6 100644
--- a/client/parallel.cpp
+++ b/client/parallel.cpp
@@ -503,7 +503,19 @@ namespace mongo {
0 , // nToSkip
_fields.isEmpty() ? 0 : &_fields , // fieldsToReturn
_options ,
- _batchSize == 0 ? 0 : _batchSize + _needToSkip // batchSize
+ // NtoReturn is weird.
+ // If zero, it means use default size, so we do that for all cursors
+ // If positive, it's the batch size (we don't want this cursor limiting results), tha
+ // done at a higher level
+ // If negative, it's the batch size, but we don't create a cursor - so we don't want
+ // to create a child cursor either.
+ // Either way, if non-zero, we want to pull back the batch size + the skip amount as
+ // quickly as possible. Potentially, for a cursor on a single shard or if we keep be
+ // chunks, we can actually add the skip value into the cursor and/or make some assump
+ // return value size ( (batch size + skip amount) / num_servers ).
+ _batchSize == 0 ? 0 :
+ ( _batchSize > 0 ? _batchSize + _needToSkip :
+ _batchSize - _needToSkip ) // batchSize
) );
try{