summaryrefslogtreecommitdiff
path: root/src/mongo/db/clientcursor.h
diff options
context:
space:
mode:
authorAndy Schwerin <schwerin@mongodb.com>2016-05-02 10:55:01 -0400
committerAndy Schwerin <schwerin@mongodb.com>2016-05-23 10:28:31 -0400
commit2e627487ef0475c46143b5f57d3e7c3d3027d5dc (patch)
tree7ad552be9a3cae113bc3cfd9df0faea78aa50e24 /src/mongo/db/clientcursor.h
parentc9aac9d6eaba6ef2eb8903f07e997b594e88addc (diff)
downloadmongo-2e627487ef0475c46143b5f57d3e7c3d3027d5dc.tar.gz
SERVER-18277 Track elapsed time on cursors using microsecond resolution on OperationContext.
This completes the mechanics of moving max-time tracking to OperationContext and switching the checkForInterrupt checks to use the service context's fast clock source, while tracking the amount of execution time remaining on a cursor with microsecond granularity to ensure that remaining execution time always declines, even for very brief operations on cursors. This patch does not complete the transition from wait_for waiting to wait_until waiting in all places that do waiting based on operation deadlines.
Diffstat (limited to 'src/mongo/db/clientcursor.h')
-rw-r--r--src/mongo/db/clientcursor.h21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/mongo/db/clientcursor.h b/src/mongo/db/clientcursor.h
index b0244aeb8f7..673fd92bf06 100644
--- a/src/mongo/db/clientcursor.h
+++ b/src/mongo/db/clientcursor.h
@@ -135,10 +135,23 @@ public:
return _idleAgeMillis;
}
- uint64_t getLeftoverMaxTimeMicros() const {
+ /**
+ * Returns the amount of time execution time available to this cursor. Only valid at the
+ * beginning of a getMore request, and only really for use by the maxTime tracking code.
+ *
+ * Microseconds::max() == infinity, values less than 1 mean no time left.
+ */
+ Microseconds getLeftoverMaxTimeMicros() const {
return _leftoverMaxTimeMicros;
}
- void setLeftoverMaxTimeMicros(uint64_t leftoverMaxTimeMicros) {
+
+ /**
+ * Sets the amount of execution time available to this cursor. This is only called when an
+ * operation that uses a cursor is finishing, to update its remaining time.
+ *
+ * Microseconds::max() == infinity, values less than 1 mean no time left.
+ */
+ void setLeftoverMaxTimeMicros(Microseconds leftoverMaxTimeMicros) {
_leftoverMaxTimeMicros = leftoverMaxTimeMicros;
}
@@ -248,8 +261,8 @@ private:
// How long has the cursor been idle?
int _idleAgeMillis;
- // TODO: Document.
- uint64_t _leftoverMaxTimeMicros;
+ // Unused maxTime budget for this cursor.
+ Microseconds _leftoverMaxTimeMicros = Microseconds::max();
//
// The underlying execution machinery.