summaryrefslogtreecommitdiff
path: root/src/mongo/db/curop.h
diff options
context:
space:
mode:
authorAndy Schwerin <schwerin@mongodb.com>2016-04-14 09:58:12 -0400
committerAndy Schwerin <schwerin@mongodb.com>2016-05-23 10:27:00 -0400
commitc9aac9d6eaba6ef2eb8903f07e997b594e88addc (patch)
treeb8222b86f1de0a352048dd269f547fe31f4dc13c /src/mongo/db/curop.h
parentfb052c13742deab981c7ba729dad36e33bdd7393 (diff)
downloadmongo-c9aac9d6eaba6ef2eb8903f07e997b594e88addc.tar.gz
SERVER-18277 Track operation deadlines in OperationContext, not CurOp.
This also unifies the implementations of checkForInterrupt and checkForInterruptNoAssert.
Diffstat (limited to 'src/mongo/db/curop.h')
-rw-r--r--src/mongo/db/curop.h84
1 files changed, 1 insertions, 83 deletions
diff --git a/src/mongo/db/curop.h b/src/mongo/db/curop.h
index 80606c276c8..7a357b42d9b 100644
--- a/src/mongo/db/curop.h
+++ b/src/mongo/db/curop.h
@@ -254,36 +254,6 @@ public:
}
//
- // Methods for controlling CurOp "max time".
- //
-
- /**
- * Sets the amount of time operation this should be allowed to run, units of microseconds.
- * The special value 0 is "allow to run indefinitely".
- */
- void setMaxTimeMicros(uint64_t maxTimeMicros);
-
- /**
- * Returns true if a time limit has been set on this operation, and false otherwise.
- */
- bool isMaxTimeSet() const;
-
- /**
- * Checks whether this operation has been running longer than its time limit. Returns
- * false if not, or if the operation has no time limit.
- */
- bool maxTimeHasExpired();
-
- /**
- * Returns the number of microseconds remaining for this operation's time limit, or the
- * special value 0 if the operation has no time limit.
- *
- * Calling this method is more expensive than calling its sibling "maxTimeHasExpired()",
- * since an accurate measure of remaining time needs to be calculated.
- */
- uint64_t getRemainingMaxTimeMicros() const;
-
- //
// Methods for getting/setting elapsed time. Note that the observed elapsed time may be
// negative, if the system time has been reset during the course of this operation.
//
@@ -440,58 +410,6 @@ private:
// so this should be 30000 in that case
long long _expectedLatencyMs{0};
- // Time limit for this operation. 0 if the operation has no time limit.
- uint64_t _maxTimeMicros{0u};
-
std::string _planSummary;
-
- /** Nested class that implements tracking of a time limit for a CurOp object. */
- class MaxTimeTracker {
- MONGO_DISALLOW_COPYING(MaxTimeTracker);
-
- public:
- /** Newly-constructed MaxTimeTracker objects have the time limit disabled. */
- MaxTimeTracker() = default;
-
- /** Returns whether or not time tracking is enabled. */
- bool isEnabled() const {
- return _enabled;
- }
-
- /**
- * Enables time tracking. The time limit is set to be "durationMicros" microseconds
- * from "startEpochMicros" (units of microseconds since the epoch).
- *
- * "durationMicros" must be nonzero.
- */
- void setTimeLimit(uint64_t startEpochMicros, uint64_t durationMicros);
-
- /**
- * Checks whether the time limit has been hit. Returns false if not, or if time
- * tracking is disabled.
- */
- bool checkTimeLimit();
-
- /**
- * Returns the number of microseconds remaining for the time limit, or the special
- * value 0 if time tracking is disabled.
- *
- * Calling this method is more expensive than calling its sibling "checkInterval()",
- * since an accurate measure of remaining time needs to be calculated.
- */
- uint64_t getRemainingMicros() const;
-
- private:
- // Whether or not time tracking is enabled for this operation.
- bool _enabled{false};
-
- // Point in time at which the time limit is hit. Units of microseconds since the
- // epoch.
- uint64_t _targetEpochMicros{0};
-
- // Approximate point in time at which the time limit is hit. Units of milliseconds
- // since the server process was started.
- int64_t _approxTargetServerMillis{0};
- } _maxTimeTracker;
};
-}
+} // namespace mongo