summaryrefslogtreecommitdiff
path: root/src/mongo/db/service_entry_point_common.h
diff options
context:
space:
mode:
authorWilliam Schultz <william.schultz@mongodb.com>2018-12-21 16:33:35 -0500
committerWilliam Schultz <william.schultz@mongodb.com>2018-12-21 16:43:58 -0500
commitf15556ae1ba4f78d2823d54e38d7025c7e9ca4fb (patch)
tree74207795633775a6cd080534c0ea29693bc9a682 /src/mongo/db/service_entry_point_common.h
parent7b85fb049b087fbcb04d6f356a0f7bee9ef48190 (diff)
downloadmongo-f15556ae1ba4f78d2823d54e38d7025c7e9ca4fb.tar.gz
SERVER-37560 Add core functionality for speculative majority reads
This patch adds functionality for "speculative" majority reads. These are reads that can satisfy "majority" read concern guarantees without support from the storage engine for reading from a historical snapshot. Queries of this nature will, by default, wait on the most recent lastApplied optime to majority commit after they complete, but before returning to the client. They can also optionally set a custom optime T to wait on, if they know that they did not read any data that reflects the effects of operations newer than optime T.
Diffstat (limited to 'src/mongo/db/service_entry_point_common.h')
-rw-r--r--src/mongo/db/service_entry_point_common.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mongo/db/service_entry_point_common.h b/src/mongo/db/service_entry_point_common.h
index 66d395b75e1..bb23dac8c6a 100644
--- a/src/mongo/db/service_entry_point_common.h
+++ b/src/mongo/db/service_entry_point_common.h
@@ -64,6 +64,14 @@ struct ServiceEntryPointCommon {
virtual void waitForReadConcern(OperationContext* opCtx,
const CommandInvocation* invocation,
const OpMsgRequest& request) const = 0;
+ /**
+ * Waits to satisfy a speculative majority read, if necessary.
+ *
+ * Speculative reads block after a query has executed to ensure that any data read satisfies
+ * the appropriate durability properties e.g. "majority" read concern. If the operation is
+ * not a speculative read, then this method does nothing.
+ */
+ virtual void waitForSpeculativeMajorityReadConcern(OperationContext* opCtx) const = 0;
virtual void waitForWriteConcern(OperationContext* opCtx,
const CommandInvocation* invocation,
const repl::OpTime& lastOpBeforeRun,