diff options
Diffstat (limited to 'src/mongo/db/curop.h')
| -rw-r--r-- | src/mongo/db/curop.h | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/src/mongo/db/curop.h b/src/mongo/db/curop.h index cdc5e4f20d7..673fcf1c0df 100644 --- a/src/mongo/db/curop.h +++ b/src/mongo/db/curop.h @@ -239,6 +239,7 @@ public: boost::optional<long long> mongotCursorId{boost::none}; boost::optional<long long> msWaitingForMongot{boost::none}; long long mongotBatchNum = 0; + BSONObj mongotCountVal = BSONObj(); bool hasSortStage{false}; // true if the query plan involves an in-memory sort @@ -263,13 +264,17 @@ public: boost::optional<uint32_t> queryHash; // Has a value if this operation is a query. True if the execution tree for the find part of the - // query was built using the classic query engine, false if it was built in SBE. + // query was built exclusively using the classic query engine, false if any part was built using + // SBE. boost::optional<bool> classicEngineUsed; // Has a value if this operation is an aggregation query. True if `DocumentSources` were // involved in the execution tree for this query, false if they were not. boost::optional<bool> documentSourceUsed; + // Indicates whether this operation used the common query framework (CQF). + bool cqfUsed{false}; + // Details of any error (whether from an exception or a command returning failure). Status errInfo = Status::OK(); @@ -295,7 +300,7 @@ public: AdditiveMetrics additiveMetrics; // Stores storage statistics. - std::shared_ptr<StorageStats> storageStats; + std::unique_ptr<StorageStats> storageStats; bool waitingForFlowControl{false}; @@ -580,12 +585,12 @@ public: * This method is separate from startRemoteOpWait because operation types that do record * remoteOpWait, such as a getMore of a sharded aggregation, should always include the * remoteOpWait field even if its value is zero. An operation should call - * enableRecordRemoteOpWait() to declare that it wants to report remoteOpWait, and call + * ensureRecordRemoteOpWait() to declare that it wants to report remoteOpWait, and call * startRemoteOpWaitTimer()/stopRemoteOpWaitTimer() to measure the time. * * This timer uses the same clock source as elapsedTimeTotal(). */ - void enableRecordRemoteOpWait() { + void ensureRecordRemoteOpWait() { if (!_debug.remoteOpWaitTime) { _debug.remoteOpWaitTime.emplace(0); } @@ -594,10 +599,15 @@ public: /** * Starts the remoteOpWait timer. * - * Does nothing if enableRecordRemoteOpWait() was not called. + * Does nothing if ensureRecordRemoteOpWait() was not called or the current operation was not + * marked as started. */ void startRemoteOpWaitTimer() { - invariant(isStarted()); + // There are some commands that send remote operations but do not mark the current operation + // as started. We do not record remote op wait time for those commands. + if (!isStarted()) { + return; + } invariant(!isDone()); invariant(!isPaused()); invariant(!_remoteOpStartTime); @@ -609,10 +619,15 @@ public: /** * Stops the remoteOpWait timer. * - * Does nothing if enableRecordRemoteOpWait() was not called. + * Does nothing if ensureRecordRemoteOpWait() was not called or the current operation was not + * marked as started. */ void stopRemoteOpWaitTimer() { - invariant(isStarted()); + // There are some commands that send remote operations but do not mark the current operation + // as started. We do not record remote op wait time for those commands. + if (!isStarted()) { + return; + } invariant(!isDone()); invariant(!isPaused()); if (_debug.remoteOpWaitTime) { |
