summaryrefslogtreecommitdiff
path: root/src/mongo/db/db_raii.h
diff options
context:
space:
mode:
authorLouis Williams <louis.williams@mongodb.com>2018-03-20 13:18:07 -0400
committerLouis Williams <louis.williams@mongodb.com>2018-04-13 10:48:56 -0400
commit10bcc73a75ac857c290c3af6a3f89a45c4867043 (patch)
treeee4612c4807e4232f3242589f2d70bd9e6cbf4ab /src/mongo/db/db_raii.h
parent235858ceee5d209d5e10579b79cfdc3bad7ff877 (diff)
downloadmongo-10bcc73a75ac857c290c3af6a3f89a45c4867043.tar.gz
SERVER-34192 Allow secondary reads during batch applications
Diffstat (limited to 'src/mongo/db/db_raii.h')
-rw-r--r--src/mongo/db/db_raii.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/mongo/db/db_raii.h b/src/mongo/db/db_raii.h
index c20968be550..63d8524d637 100644
--- a/src/mongo/db/db_raii.h
+++ b/src/mongo/db/db_raii.h
@@ -105,9 +105,28 @@ public:
}
private:
+ // If this field is set, the reader will not take the ParallelBatchWriterMode lock and conflict
+ // with secondary batch application. This stays in scope with the _autoColl so that locks are
+ // taken and released in the right order.
+ boost::optional<ShouldNotConflictWithSecondaryBatchApplicationBlock>
+ _shouldNotConflictWithSecondaryBatchApplicationBlock;
+
// This field is optional, because the code to wait for majority committed snapshot needs to
// release locks in order to block waiting
boost::optional<AutoGetCollection> _autoColl;
+
+ // Returns true if we should read from the local snapshot (last applied timestamp) on a
+ // secondary.
+ bool _shouldDoSecondaryLocalSnapshotRead(OperationContext* opCtx,
+ const NamespaceString& nss,
+ repl::ReadConcernLevel readConcernLevel) const;
+
+ // Returns true if the minSnapshot causes conflicting catalog changes for the provided read
+ // concern level or lastAppliedTimestamp.
+ bool _conflictingCatalogChanges(OperationContext* opCtx,
+ repl::ReadConcernLevel readConcernLevel,
+ boost::optional<Timestamp> minSnapshot,
+ boost::optional<Timestamp> lastAppliedTimestamp) const;
};
/**