summaryrefslogtreecommitdiff
path: root/src/mongo/db/clientcursor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/clientcursor.cpp')
-rw-r--r--src/mongo/db/clientcursor.cpp24
1 files changed, 11 insertions, 13 deletions
diff --git a/src/mongo/db/clientcursor.cpp b/src/mongo/db/clientcursor.cpp
index 708a2bc38f7..70003c2da2b 100644
--- a/src/mongo/db/clientcursor.cpp
+++ b/src/mongo/db/clientcursor.cpp
@@ -77,17 +77,16 @@ long long ClientCursor::totalOpen() {
return cursorStatsOpen.get();
}
-ClientCursor::ClientCursor(const ClientCursorParams& params,
+ClientCursor::ClientCursor(ClientCursorParams&& params,
CursorManager* cursorManager,
CursorId cursorId)
: _cursorid(cursorId),
- _ns(params.ns),
+ _nss(std::move(params.nss)),
_isReadCommitted(params.isReadCommitted),
_cursorManager(cursorManager),
- _query(params.query),
- _queryOptions(params.qopts),
- _isAggCursor(params.isAggCursor) {
- _exec.reset(params.exec);
+ _originatingCommand(params.originatingCommandObj),
+ _queryOptions(params.queryOptions),
+ _exec(std::move(params.exec)) {
init();
}
@@ -95,7 +94,7 @@ ClientCursor::ClientCursor(const Collection* collection,
CursorManager* cursorManager,
CursorId cursorId)
: _cursorid(cursorId),
- _ns(collection->ns().ns()),
+ _nss(collection->ns()),
_cursorManager(cursorManager),
_queryOptions(QueryOption_NoCursorTimeout) {
init();
@@ -106,10 +105,9 @@ void ClientCursor::init() {
cursorStatsOpen.increment();
- if (_queryOptions & QueryOption_NoCursorTimeout) {
+ if (isNoTimeout()) {
// cursors normally timeout after an inactivity period to prevent excess memory use
// setting this prevents timeout of the cursor in question.
- _isNoTimeout = true;
cursorStatsOpenNoTimeout.increment();
}
}
@@ -120,7 +118,7 @@ ClientCursor::~ClientCursor() {
invariant(!_cursorManager);
cursorStatsOpen.decrement();
- if (_isNoTimeout) {
+ if (isNoTimeout()) {
cursorStatsOpenNoTimeout.decrement();
}
}
@@ -138,7 +136,7 @@ void ClientCursor::kill() {
bool ClientCursor::shouldTimeout(int millis) {
_idleAgeMillis += millis;
- if (_isNoTimeout || _isPinned) {
+ if (isNoTimeout() || _isPinned) {
return false;
}
return _idleAgeMillis > cursorTimeoutMillis.load();
@@ -152,7 +150,7 @@ void ClientCursor::updateSlaveLocation(OperationContext* opCtx) {
if (_slaveReadTill.isNull())
return;
- verify(str::startsWith(_ns.c_str(), "local.oplog."));
+ verify(_nss.isOplog());
Client* c = opCtx->getClient();
verify(c);
@@ -221,7 +219,7 @@ void ClientCursorPin::release() {
if (!_cursor->_cursorManager) {
// The ClientCursor was killed while we had it. Therefore, it is our responsibility to
- // kill it.
+ // delete it.
deleteUnderlying();
} else {
// Unpin the cursor under the collection cursor manager lock.