484
484
bool filledBuffer = false;
487
Client::Context ctx( _ns );
488
scoped_spinlock lk( _trackerLocks );
489
set<DiskLoc>::iterator i = _cloneLocs.begin();
490
for ( ; i!=_cloneLocs.end(); ++i ) {
491
if (tracker.ping()) // should I yield?
495
BSONObj o = dl.obj();
497
// use the builder size instead of accumulating 'o's size so that we take into consideration
498
// the overhead of BSONArray indices
499
if ( a.len() + o.objsize() + 1024 > BSONObjMaxUserSize ) {
500
filledBuffer = true; // break out of outer while loop
486
auto_ptr<RWLockRecursive::Shared> fileLock;
487
Record* recordToTouch = NULL;
491
Client::Context ctx( _ns ); // ReadContext?
492
scoped_spinlock lk( _trackerLocks );
493
set<DiskLoc>::iterator i = _cloneLocs.begin();
494
for ( ; i!=_cloneLocs.end(); ++i ) {
495
if (tracker.ping()) // should I yield?
499
Record* r = dl.rec();
500
if ( ! r->likelyInPhysicalMemory() ) {
501
fileLock.reset( new RWLockRecursive::Shared( MongoFile::mmmutex) );
506
BSONObj o = dl.obj();
508
// use the builder size instead of accumulating 'o's size so that we take into consideration
509
// the overhead of BSONArray indices
510
if ( a.len() + o.objsize() + 1024 > BSONObjMaxUserSize ) {
511
filledBuffer = true; // break out of outer while loop
507
518
_cloneLocs.erase( _cloneLocs.begin() , i );
509
520
if ( _cloneLocs.empty() || filledBuffer )
523
if ( recordToTouch ) {
524
// its safe to touch here because we have a LockMongoFilesShared
525
// we can't do where we get the lock because we would have to unlock the main readlock and tne _trackerLocks
526
// simpler to handle this out there
527
recordToTouch->touch();
528
recordToTouch = NULL;
513
534
result.appendArray( "objects" , a.arr() );