diff --git a/db/query.cpp b/db/query.cpp index 52306cab85e..874dfedbb4d 100644 --- a/db/query.cpp +++ b/db/query.cpp @@ -552,7 +552,7 @@ namespace mongo { b << "cursor" << c->toString() << "indexBounds" << c->prettyIndexBounds(); b.done(); } - void noteScan( Cursor *c, long long nscanned, long long nscannedObjects, int n, bool scanAndOrder, int millis, bool hint ) { + void noteScan( Cursor *c, long long nscanned, long long nscannedObjects, int n, bool scanAndOrder, int millis, bool hint, int nYields ) { if ( _i == 1 ) { _c.reset( new BSONArrayBuilder() ); *_c << _b->obj(); @@ -571,6 +571,8 @@ namespace mongo { *_b << "scanAndOrder" << true; *_b << "millis" << millis; + + *_b << "nYields" << nYields; *_b << "indexBounds" << c->prettyIndexBounds(); @@ -616,6 +618,7 @@ namespace mongo { _nscanned(0), _oldNscanned(0), _nscannedObjects(0), _oldNscannedObjects(0), _n(0), _oldN(0), + _nYields(), _chunkMatcher(shardingState.getChunkMatcher(pq.ns())), _inMemSort(false), _saveClientCursor(false), @@ -660,6 +663,7 @@ namespace mongo { } virtual void recoverFromYield() { + ++_nYields; if ( _findingStartCursor.get() ) { _findingStartCursor->recoverFromYield(); } else { @@ -808,7 +812,7 @@ namespace mongo { _saveClientCursor = true; if ( _pq.isExplain()) { - _eb.noteScan( _c.get(), _nscanned, _nscannedObjects, _n, scanAndOrderRequired(), _curop.elapsedMillis(), useHints && !_pq.getHint().eoo() ); + _eb.noteScan( _c.get(), _nscanned, _nscannedObjects, _n, scanAndOrderRequired(), _curop.elapsedMillis(), useHints && !_pq.getHint().eoo(), _nYields ); } else { _response.appendData( _buf.buf(), _buf.len() ); _buf.decouple(); @@ -871,6 +875,8 @@ namespace mongo { int _n; // found so far int _oldN; + int _nYields; + MatchDetails _details; ChunkMatcherPtr _chunkMatcher;