diff options
author | Jack Mulrow <jack.mulrow@mongodb.com> | 2019-12-17 22:55:38 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-12-17 22:55:38 +0000 |
commit | ceeb1a0402e2d0f6f0f55808c16a90e8b30f106c (patch) | |
tree | 85ed681451e9abd58212bc22f640415feaa74701 /src/mongo/db/read_write_concern_defaults.h | |
parent | 61241bedf571481a89525ac26d311d3fed4108d6 (diff) | |
download | mongo-ceeb1a0402e2d0f6f0f55808c16a90e8b30f106c.tar.gz |
SERVER-43720 Make RWCDefaults commands persist the defaults
Diffstat (limited to 'src/mongo/db/read_write_concern_defaults.h')
-rw-r--r-- | src/mongo/db/read_write_concern_defaults.h | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/mongo/db/read_write_concern_defaults.h b/src/mongo/db/read_write_concern_defaults.h index 001f9b5da77..2f296a5a0df 100644 --- a/src/mongo/db/read_write_concern_defaults.h +++ b/src/mongo/db/read_write_concern_defaults.h @@ -58,6 +58,9 @@ public: static constexpr StringData readConcernFieldName = ReadConcern::kReadConcernFieldName; static constexpr StringData writeConcernFieldName = WriteConcern::kWriteConcernField; + // The _id of the persisted default read/write concern document. + static constexpr StringData kPersistedDocumentId = "ReadWriteConcernDefaults"_sd; + static ReadWriteConcernDefaults& get(ServiceContext* service); static ReadWriteConcernDefaults& get(ServiceContext& service); static void create(ServiceContext* service, LookupFn lookupFn); @@ -79,14 +82,15 @@ public: static void checkSuitabilityAsDefault(const WriteConcern& wc); /** - * Interface when an admin has run the command to change the defaults. + * Generates a new read and write concern default to be persisted on disk, without updating the + * cached value. * At least one of the `rc` or `wc` params must be set. * Will generate and use a new epoch and setTime for the updated defaults, which are returned. * Validates the supplied read and write concerns can serve as defaults. */ - RWConcernDefault setConcerns(OperationContext* opCtx, - const boost::optional<ReadConcern>& rc, - const boost::optional<WriteConcern>& wc); + RWConcernDefault generateNewConcerns(OperationContext* opCtx, + const boost::optional<ReadConcern>& rc, + const boost::optional<WriteConcern>& wc); /** * Invalidates the cached RWC defaults, causing them to be refreshed. @@ -111,7 +115,6 @@ public: private: enum class Type { kReadWriteConcernEntry }; - void _setDefault(RWConcernDefault&& rwc); boost::optional<RWConcernDefault> _getDefault(OperationContext* opCtx); class Cache : public DistCache<Type, RWConcernDefault> { |