summaryrefslogtreecommitdiff
path: root/src/mongo/db/read_write_concern_defaults.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/read_write_concern_defaults.cpp')
-rw-r--r--src/mongo/db/read_write_concern_defaults.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/mongo/db/read_write_concern_defaults.cpp b/src/mongo/db/read_write_concern_defaults.cpp
index 183805cf64d..c982ef78bda 100644
--- a/src/mongo/db/read_write_concern_defaults.cpp
+++ b/src/mongo/db/read_write_concern_defaults.cpp
@@ -161,6 +161,23 @@ RWConcernDefault ReadWriteConcernDefaults::generateNewCWRWCToBeSavedOnDisk(
return rwc;
}
+bool ReadWriteConcernDefaults::isCWWCSet(OperationContext* opCtx) {
+ // TODO (SERVER-57042): Call getDefault() instead and return writeConcernSource == KGlobal.
+ auto cached = _getDefaultCWRWCFromDisk(opCtx);
+ if (!cached) {
+ return false;
+ }
+
+ auto wc = cached.get().getDefaultWriteConcern();
+ if (!wc) {
+ return false;
+ }
+
+ // CWWC should have "usedDefault" flag set to false, as this flag only set to true if the
+ // default constructed WC is used.
+ return !wc.get().usedDefault;
+}
+
void ReadWriteConcernDefaults::observeDirectWriteToConfigSettings(OperationContext* opCtx,
BSONElement idElem,
boost::optional<BSONObj> newDoc) {