diff options
author | Aaron <aaron@10gen.com> | 2012-02-20 21:35:58 -0800 |
---|---|---|
committer | Aaron <aaron@10gen.com> | 2012-02-24 22:49:15 -0800 |
commit | ec0bc442b4bea1eb2eb241240d357138ac590176 (patch) | |
tree | 55b0652a76277739a148580c18f4d3cbfdeaccd3 /src | |
parent | c8ff3791143b2bc34c6d61e5b15e5e7a69f5da27 (diff) | |
download | mongo-ec0bc442b4bea1eb2eb241240d357138ac590176.tar.gz |
SERVER-4150 commenting
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/explain.h | 6 | ||||
-rw-r--r-- | src/mongo/db/ops/query.cpp | 164 | ||||
-rw-r--r-- | src/mongo/db/queryoptimizercursorimpl.cpp | 1 |
3 files changed, 89 insertions, 82 deletions
diff --git a/src/mongo/db/explain.h b/src/mongo/db/explain.h index 324e3a061a2..380e712dde1 100644 --- a/src/mongo/db/explain.h +++ b/src/mongo/db/explain.h @@ -22,6 +22,12 @@ namespace mongo { + /** + * Note: by default we filter out allPlans and oldPlan in the shell's + * explain() function. If you add any recursive structures, make sure to + * edit the JS to make sure everything gets filtered. + */ + class DurationTimer { public: DurationTimer() : _running( true ), _duration() {} diff --git a/src/mongo/db/ops/query.cpp b/src/mongo/db/ops/query.cpp index 7061faedfb5..5922ef1f54d 100644 --- a/src/mongo/db/ops/query.cpp +++ b/src/mongo/db/ops/query.cpp @@ -226,87 +226,87 @@ namespace mongo { return qr; } - class ExplainBuilder { - // Note: by default we filter out allPlans and oldPlan in the shell's - // explain() function. If you add any recursive structures, make sure to - // edit the JS to make sure everything gets filtered. - public: - ExplainBuilder() : _i() {} - void ensureStartScan() { - if ( !_a.get() ) { - _a.reset( new BSONArrayBuilder() ); - } - } - void noteCursor( Cursor *c ) { - BSONObjBuilder b( _a->subobjStart() ); - 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, int nYields , int nChunkSkips , bool indexOnly ) { - if ( _i == 1 ) { - _c.reset( new BSONArrayBuilder() ); - *_c << _b->obj(); - } - if ( _i == 0 ) { - _b.reset( new BSONObjBuilder() ); - } - else { - _b.reset( new BSONObjBuilder( _c->subobjStart() ) ); - } - *_b << "cursor" << c->toString(); - _b->appendNumber( "nscanned", nscanned ); - _b->appendNumber( "nscannedObjects", nscannedObjects ); - *_b << "n" << n; - - if ( scanAndOrder ) - *_b << "scanAndOrder" << true; - - *_b << "millis" << millis; - - *_b << "nYields" << nYields; - *_b << "nChunkSkips" << nChunkSkips; - *_b << "isMultiKey" << c->isMultiKey(); - *_b << "indexOnly" << indexOnly; - - *_b << "indexBounds" << c->prettyIndexBounds(); - - c->explainDetails( *_b ); - - if ( !hint ) { - *_b << "allPlans" << _a->arr(); - } - if ( _i != 0 ) { - _b->done(); - } - _a.reset( 0 ); - ++_i; - } - BSONObj finishWithSuffix( long long nscanned, long long nscannedObjects, int n, int millis, const BSONObj &suffix ) { - if ( _i > 1 ) { - BSONObjBuilder b; - b << "clauses" << _c->arr(); - b.appendNumber( "nscanned", nscanned ); - b.appendNumber( "nscannedObjects", nscannedObjects ); - b << "n" << n; - b << "millis" << millis; - b.appendElements( suffix ); - return b.obj(); - } - else { - stringstream host; - host << getHostNameCached() << ":" << cmdLine.port; - *_b << "server" << host.str(); - _b->appendElements( suffix ); - return _b->obj(); - } - } - private: - auto_ptr< BSONArrayBuilder > _a; - auto_ptr< BSONObjBuilder > _b; - auto_ptr< BSONArrayBuilder > _c; - int _i; - }; +// class ExplainBuilder { +// // Note: by default we filter out allPlans and oldPlan in the shell's +// // explain() function. If you add any recursive structures, make sure to +// // edit the JS to make sure everything gets filtered. +// public: +// ExplainBuilder() : _i() {} +// void ensureStartScan() { +// if ( !_a.get() ) { +// _a.reset( new BSONArrayBuilder() ); +// } +// } +// void noteCursor( Cursor *c ) { +// BSONObjBuilder b( _a->subobjStart() ); +// 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, int nYields , int nChunkSkips , bool indexOnly ) { +// if ( _i == 1 ) { +// _c.reset( new BSONArrayBuilder() ); +// *_c << _b->obj(); +// } +// if ( _i == 0 ) { +// _b.reset( new BSONObjBuilder() ); +// } +// else { +// _b.reset( new BSONObjBuilder( _c->subobjStart() ) ); +// } +// *_b << "cursor" << c->toString(); +// _b->appendNumber( "nscanned", nscanned ); +// _b->appendNumber( "nscannedObjects", nscannedObjects ); +// *_b << "n" << n; +// +// if ( scanAndOrder ) +// *_b << "scanAndOrder" << true; +// +// *_b << "millis" << millis; +// +// *_b << "nYields" << nYields; +// *_b << "nChunkSkips" << nChunkSkips; +// *_b << "isMultiKey" << c->isMultiKey(); +// *_b << "indexOnly" << indexOnly; +// +// *_b << "indexBounds" << c->prettyIndexBounds(); +// +// c->explainDetails( *_b ); +// +// if ( !hint ) { +// *_b << "allPlans" << _a->arr(); +// } +// if ( _i != 0 ) { +// _b->done(); +// } +// _a.reset( 0 ); +// ++_i; +// } +// BSONObj finishWithSuffix( long long nscanned, long long nscannedObjects, int n, int millis, const BSONObj &suffix ) { +// if ( _i > 1 ) { +// BSONObjBuilder b; +// b << "clauses" << _c->arr(); +// b.appendNumber( "nscanned", nscanned ); +// b.appendNumber( "nscannedObjects", nscannedObjects ); +// b << "n" << n; +// b << "millis" << millis; +// b.appendElements( suffix ); +// return b.obj(); +// } +// else { +// stringstream host; +// host << getHostNameCached() << ":" << cmdLine.port; +// *_b << "server" << host.str(); +// _b->appendElements( suffix ); +// return _b->obj(); +// } +// } +// private: +// auto_ptr< BSONArrayBuilder > _a; +// auto_ptr< BSONObjBuilder > _b; +// auto_ptr< BSONArrayBuilder > _c; +// int _i; +// }; // Implements database 'query' requests using the query optimizer's QueryOp interface class UserQueryOp : public QueryOp { @@ -975,7 +975,7 @@ namespace mongo { } if ( _buf.len() > 0 ) { result.appendData( _buf.buf(), _buf.len() ); - _buf.decouple(); // only decouple here ok? + _buf.decouple(); } return _bufferedMatches; } diff --git a/src/mongo/db/queryoptimizercursorimpl.cpp b/src/mongo/db/queryoptimizercursorimpl.cpp index 918a2eedbb9..3e2cb62fa82 100644 --- a/src/mongo/db/queryoptimizercursorimpl.cpp +++ b/src/mongo/db/queryoptimizercursorimpl.cpp @@ -84,6 +84,7 @@ namespace mongo { << "'" ); } + // TODO set numWanted? _c = qp().newCursor(); // The QueryOptimizerCursor::prepareToTouchEarlierIterate() implementation requires _c->prepareToYield() to work. |