diff options
author | Hari Khalsa <hkhalsa@mongodb.com> | 2014-09-16 16:23:08 -0400 |
---|---|---|
committer | Hari Khalsa <hkhalsa@mongodb.com> | 2014-09-18 16:40:26 -0400 |
commit | 10f6f87c696ad742fa8f68d382531141104083f1 (patch) | |
tree | 7b01b74c6bac1a9d3a562388ba52707a8f4e1dde /src/mongo/db/clientcursor.cpp | |
parent | b94e1e4a6a4c4a583dff33e5147e1091d144b3f1 (diff) | |
download | mongo-10f6f87c696ad742fa8f68d382531141104083f1.tar.gz |
SERVER-14668 stash recovery unit with ClientCursor
Diffstat (limited to 'src/mongo/db/clientcursor.cpp')
-rw-r--r-- | src/mongo/db/clientcursor.cpp | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/src/mongo/db/clientcursor.cpp b/src/mongo/db/clientcursor.cpp index ca661a0bfdf..17315bf566c 100644 --- a/src/mongo/db/clientcursor.cpp +++ b/src/mongo/db/clientcursor.cpp @@ -72,7 +72,9 @@ namespace mongo { ClientCursor::ClientCursor(const Collection* collection, PlanExecutor* exec, int qopts, const BSONObj query) : _collection( collection ), - _countedYet( false ) { + _countedYet( false ), + _unownedRU(NULL) { + _exec.reset(exec); _ns = exec->ns(); _query = query; @@ -87,7 +89,8 @@ namespace mongo { : _ns(collection->ns().ns()), _collection(collection), _countedYet( false ), - _queryOptions(QueryOption_NoCursorTimeout) { + _queryOptions(QueryOption_NoCursorTimeout), + _unownedRU(NULL) { init(); } @@ -176,6 +179,30 @@ namespace mongo { } // + // Storage engine state for getMore. + // + + void ClientCursor::setUnownedRecoveryUnit(RecoveryUnit* ru) { + invariant(!_unownedRU); + invariant(!_ownedRU.get()); + _unownedRU = ru; + } + + RecoveryUnit* ClientCursor::getUnownedRecoveryUnit() const { + return _unownedRU; + } + + void ClientCursor::setOwnedRecoveryUnit(RecoveryUnit* ru) { + invariant(!_unownedRU); + invariant(!_ownedRU.get()); + _ownedRU.reset(ru); + } + + RecoveryUnit* ClientCursor::releaseOwnedRecoveryUnit() { + return _ownedRU.release(); + } + + // // Pin methods // TODO: Simplify when we kill Cursor. In particular, once we've pinned a CC, it won't be // deleted from underneath us, so we can save the pointer and ignore the ID. |