summaryrefslogtreecommitdiff
path: root/s/d_split.cpp
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2010-09-15 22:04:39 -0400
committerEliot Horowitz <eliot@10gen.com>2010-09-15 22:04:39 -0400
commit85cdf5bfed44e1119b91a3e95a3f7b13c77fad0a (patch)
tree3d5c2e38fa56fd93a0f11b83c0db44f497e82390 /s/d_split.cpp
parent87d78a3ac45f38cc0b512b0c49d4cce6f9102a10 (diff)
downloadmongo-85cdf5bfed44e1119b91a3e95a3f7b13c77fad0a.tar.gz
yield on medianKey
Diffstat (limited to 's/d_split.cpp')
-rw-r--r--s/d_split.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/s/d_split.cpp b/s/d_split.cpp
index 9fcd632dec9..8665101d636 100644
--- a/s/d_split.cpp
+++ b/s/d_split.cpp
@@ -66,8 +66,22 @@ namespace mongo {
int num = 0;
NamespaceDetails *d = nsdetails(ns);
int idxNo = d->idxNo(*id);
- for( BtreeCursor c( d, idxNo, *id, min, max, false, 1 ); c.ok(); c.advance(), ++num );
+
+ // only yielding on firt half for now
+ // after this it should be in ram, so 2nd should be fast
+ {
+ shared_ptr<Cursor> c( new BtreeCursor( d, idxNo, *id, min, max, false, 1 ) );
+ scoped_ptr<ClientCursor> cc( new ClientCursor( QueryOption_NoCursorTimeout , c , ns ) );
+ while ( c->ok() ){
+ num++;
+ c->advance();
+ if ( ! cc->yieldSometimes() )
+ break;
+ }
+ }
+
num /= 2;
+
BtreeCursor c( d, idxNo, *id, min, max, false, 1 );
for( ; num; c.advance(), --num );