mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 09:32:32 +01:00
SERVER-1771 include yield count in explain
This commit is contained in:
parent
9607ad40ce
commit
b70150a83b
10
db/query.cpp
10
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;
|
||||
|
Loading…
Reference in New Issue
Block a user