diff options
Diffstat (limited to 'src/mongo/db/query/find.cpp')
-rw-r--r-- | src/mongo/db/query/find.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/mongo/db/query/find.cpp b/src/mongo/db/query/find.cpp index 2fec699721d..9e9ebb32fb6 100644 --- a/src/mongo/db/query/find.cpp +++ b/src/mongo/db/query/find.cpp @@ -478,9 +478,13 @@ Message getMore(OperationContext* txn, *exhaust = cc->queryOptions() & QueryOption_Exhaust; - // If the getmore had a time limit, remaining time is "rolled over" back to the - // cursor (for use by future getmore ops). - cc->setLeftoverMaxTimeMicros(txn->getRemainingMaxTimeMicros()); + // We assume that cursors created through a DBDirectClient are always used from their + // original OperationContext, so we do not need to move time to and from the cursor. + if (!txn->getClient()->isInDirectClient()) { + // If the getmore had a time limit, remaining time is "rolled over" back to the + // cursor (for use by future getmore ops). + cc->setLeftoverMaxTimeMicros(txn->getRemainingMaxTimeMicros()); + } } } @@ -689,9 +693,13 @@ std::string runQuery(OperationContext* txn, cc->setPos(numResults); - // If the query had a time limit, remaining time is "rolled over" to the cursor (for - // use by future getmore ops). - cc->setLeftoverMaxTimeMicros(txn->getRemainingMaxTimeMicros()); + // We assume that cursors created through a DBDirectClient are always used from their + // original OperationContext, so we do not need to move time to and from the cursor. + if (!txn->getClient()->isInDirectClient()) { + // If the query had a time limit, remaining time is "rolled over" to the cursor (for + // use by future getmore ops). + cc->setLeftoverMaxTimeMicros(txn->getRemainingMaxTimeMicros()); + } endQueryOp(txn, collection, *cc->getExecutor(), numResults, ccId); } else { |