summaryrefslogtreecommitdiff
path: root/client/parallel.cpp
diff options
context:
space:
mode:
authorAntonin Kral <a.kral@bobek.cz>2012-05-10 06:57:54 +0200
committerAntonin Kral <a.kral@bobek.cz>2012-05-10 06:57:54 +0200
commit61619b3142c1de8f60f91964ff2656054d4f11a6 (patch)
treed3aaf9d1e70cac8efa0856e5b5ba39e2fb9dc526 /client/parallel.cpp
parenteaaa7b30c99b89b5483e0a372bb73fe8c8695185 (diff)
downloadmongodb-61619b3142c1de8f60f91964ff2656054d4f11a6.tar.gz
Imported 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{