diff options
author | William Schultz <william.schultz@mongodb.com> | 2018-12-21 16:33:35 -0500 |
---|---|---|
committer | William Schultz <william.schultz@mongodb.com> | 2018-12-21 16:43:58 -0500 |
commit | f15556ae1ba4f78d2823d54e38d7025c7e9ca4fb (patch) | |
tree | 74207795633775a6cd080534c0ea29693bc9a682 /src/mongo/db/read_concern.h | |
parent | 7b85fb049b087fbcb04d6f356a0f7bee9ef48190 (diff) | |
download | mongo-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/read_concern.h')
-rw-r--r-- | src/mongo/db/read_concern.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/mongo/db/read_concern.h b/src/mongo/db/read_concern.h index bbbf09a2255..07dc133a244 100644 --- a/src/mongo/db/read_concern.h +++ b/src/mongo/db/read_concern.h @@ -41,6 +41,7 @@ template <typename T> class StatusWith; namespace repl { class ReadConcernArgs; +class SpeculativeMajorityReadInfo; } @@ -61,4 +62,13 @@ extern MONGO_DECLARE_SHIM((OperationContext * opCtx, */ extern MONGO_DECLARE_SHIM((OperationContext * opCtx)->Status) waitForLinearizableReadConcern; +/** + * Waits to satisfy a "speculative" majority read. + * + * This method must only be called if the operation is a speculative majority read. + */ +extern MONGO_DECLARE_SHIM((OperationContext * opCtx, + repl::SpeculativeMajorityReadInfo speculativeReadInfo) + ->Status) waitForSpeculativeMajorityReadConcern; + } // namespace mongo |