summaryrefslogtreecommitdiff
path: root/src/mongo/db/query/find_common.h
diff options
context:
space:
mode:
authorMartin Neupauer <martin.neupauer@mongodb.com>2017-11-15 15:38:14 -0500
committerMartin Neupauer <martin.neupauer@mongodb.com>2017-12-12 15:49:15 -0500
commitb79e5f04ffc79b5892f89c22b9e5f26a297b1185 (patch)
treeba924a0eb8e03751f3dd95a4461e53f877ceba19 /src/mongo/db/query/find_common.h
parent847104b8775af27762b35ff99da0d78511c01376 (diff)
downloadmongo-b79e5f04ffc79b5892f89c22b9e5f26a297b1185.tar.gz
SERVER-31684 Fix unexpected "operation exceeded time limit" errors
The changestream queries used an operation context deadline to track a wait time before returning EOF. This occasionaly interfered with normal operation deadlines leading to unexpected errors.
Diffstat (limited to 'src/mongo/db/query/find_common.h')
-rw-r--r--src/mongo/db/query/find_common.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/mongo/db/query/find_common.h b/src/mongo/db/query/find_common.h
index 657554a0d94..0e83e3cb546 100644
--- a/src/mongo/db/query/find_common.h
+++ b/src/mongo/db/query/find_common.h
@@ -27,10 +27,30 @@
*/
#include "mongo/bson/bsonobj.h"
+#include "mongo/db/operation_context.h"
#include "mongo/util/fail_point_service.h"
namespace mongo {
+/**
+ * The state associated with tailable cursors.
+ */
+struct AwaitDataState {
+ /**
+ * The deadline for how long we wait on the tail of capped collection before returning IS_EOF.
+ */
+ Date_t waitForInsertsDeadline;
+
+ /**
+ * If true, when no results are available from a plan, then instead of returning immediately,
+ * the system should wait up to the length of the operation deadline for data to be inserted
+ * which causes results to become available.
+ */
+ bool shouldWaitForInserts;
+};
+
+extern const OperationContext::Decoration<AwaitDataState> awaitDataState;
+
class BSONObj;
class QueryRequest;