summaryrefslogtreecommitdiff
path: root/s
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2011-05-04 14:03:25 -0400
committerEliot Horowitz <eliot@10gen.com>2011-05-04 14:09:48 -0400
commit56080a9fa4d93bde5e41aa17381a8aed9cc3ab35 (patch)
tree0f61abbb83df3c874e2829fcc9795b3706139e96 /s
parent0eb1da57a2d6a7d2038726109c9e46a361fb5a53 (diff)
downloadmongo-56080a9fa4d93bde5e41aa17381a8aed9cc3ab35.tar.gz
can't use scoped_ptr with ClientCursor
Diffstat (limited to 's')
-rw-r--r--s/d_migrate.cpp7
-rw-r--r--s/d_split.cpp16
2 files changed, 14 insertions, 9 deletions
diff --git a/s/d_migrate.cpp b/s/d_migrate.cpp
index c184f2b9c5a..09700c9b1dc 100644
--- a/s/d_migrate.cpp
+++ b/s/d_migrate.cpp
@@ -430,9 +430,9 @@ namespace mongo {
return false;
}
- scoped_ptr<ClientCursor> cc( new ClientCursor( QueryOption_NoCursorTimeout ,
- shared_ptr<Cursor>( BtreeCursor::make( d , d->idxNo(*idx) , *idx , min , max , false , 1 ) ) ,
- _ns ) );
+ auto_ptr<ClientCursor> cc( new ClientCursor( QueryOption_NoCursorTimeout ,
+ shared_ptr<Cursor>( BtreeCursor::make( d , d->idxNo(*idx) , *idx , min , max , false , 1 ) ) ,
+ _ns ) );
// use the average object size to estimate how many objects a full chunk would carry
// do that while traversing the chunk's range using the sharding index, below
@@ -464,6 +464,7 @@ namespace mongo {
// we can afford to yield here because any change to the base data that we might miss is already being
// queued and will be migrated in the 'transferMods' stage
if ( ! cc->yieldSometimes() ) {
+ cc.release();
break;
}
diff --git a/s/d_split.cpp b/s/d_split.cpp
index d76a81d01fa..6311a166c80 100644
--- a/s/d_split.cpp
+++ b/s/d_split.cpp
@@ -78,12 +78,14 @@ namespace mongo {
// after this it should be in ram, so 2nd should be fast
{
shared_ptr<Cursor> c( BtreeCursor::make( d, idxNo, *id, min, max, false, 1 ) );
- scoped_ptr<ClientCursor> cc( new ClientCursor( QueryOption_NoCursorTimeout , c , ns ) );
+ auto_ptr<ClientCursor> cc( new ClientCursor( QueryOption_NoCursorTimeout , c , ns ) );
while ( c->ok() ) {
num++;
c->advance();
- if ( ! cc->yieldSometimes() )
+ if ( ! cc->yieldSometimes() ) {
+ cc.release();
break;
+ }
}
}
@@ -177,7 +179,7 @@ namespace mongo {
BtreeCursor * bc = BtreeCursor::make( d , d->idxNo(*idx) , *idx , min , max , false , 1 );
shared_ptr<Cursor> c( bc );
- scoped_ptr<ClientCursor> cc( new ClientCursor( QueryOption_NoCursorTimeout , c , ns ) );
+ auto_ptr<ClientCursor> cc( new ClientCursor( QueryOption_NoCursorTimeout , c , ns ) );
if ( ! cc->ok() ) {
// range is empty
return true;
@@ -218,8 +220,10 @@ namespace mongo {
}
cc->advance();
- if ( ! cc->yieldSometimes() )
+ if ( ! cc->yieldSometimes() ) {
+ cc.release();
break;
+ }
}
return true;
@@ -371,7 +375,7 @@ namespace mongo {
BtreeCursor * bc = BtreeCursor::make( d , d->idxNo(*idx) , *idx , min , max , false , 1 );
shared_ptr<Cursor> c( bc );
- scoped_ptr<ClientCursor> cc( new ClientCursor( QueryOption_NoCursorTimeout , c , ns ) );
+ auto_ptr<ClientCursor> cc( new ClientCursor( QueryOption_NoCursorTimeout , c , ns ) );
if ( ! cc->ok() ) {
errmsg = "can't open a cursor for splitting (desired range is possibly empty)";
return false;
@@ -421,7 +425,7 @@ namespace mongo {
// don't use the btree cursor pointer to acces keys beyond this point but ok
// to use it for format the keys we've got already
-
+ cc.release();
break;
}
}