diff options
author | William Schultz <william.schultz@mongodb.com> | 2018-11-14 16:11:03 -0500 |
---|---|---|
committer | William Schultz <william.schultz@mongodb.com> | 2018-11-14 16:17:44 -0500 |
commit | a6a0ca1ae81b34aab14a9c9a2a3d4a6ec7be66ba (patch) | |
tree | 18ddc6ff8413c2dccb528522cbd828b811994e55 /src/mongo/db/commands/pipeline_command.cpp | |
parent | c1d4e0b8e1a4c197aac2530259f78eb88fb4acd3 (diff) | |
download | mongo-a6a0ca1ae81b34aab14a9c9a2a3d4a6ec7be66ba.tar.gz |
SERVER-37560 Add API for allowing commands to support speculative majority reads
This patch lays the groundwork for allowing read queries to take advantage of "speculative" majority reads, which is a mechanism for satisfying majority read guarantees without storage engine support for reading from a historical snapshot. This patch adds a flag on the ReadConcernArgs object to indicate whether a query should use the speculative behavior, and it also adds a method to the CommandInvocation interface that allows commands to optionally support speculative majority reads. The intention is to initially only utilize this behavior for change stream queries i.e. 'aggregate' and 'find' commands, but the feature is, in theory, generic.
Diffstat (limited to 'src/mongo/db/commands/pipeline_command.cpp')
-rw-r--r-- | src/mongo/db/commands/pipeline_command.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mongo/db/commands/pipeline_command.cpp b/src/mongo/db/commands/pipeline_command.cpp index 90b3a2367e5..8d55c05861c 100644 --- a/src/mongo/db/commands/pipeline_command.cpp +++ b/src/mongo/db/commands/pipeline_command.cpp @@ -80,6 +80,11 @@ public: !AggregationRequest::parseNs(_dbName, _request.body).isCollectionlessAggregateNS(); } + bool allowsSpeculativeMajorityReads() const override { + // TODO (SERVER-37560): Support this for change stream queries. + return false; + } + void run(OperationContext* opCtx, rpc::ReplyBuilderInterface* reply) override { const auto aggregationRequest = uassertStatusOK( AggregationRequest::parseFromBSON(_dbName, _request.body, boost::none)); |