summaryrefslogtreecommitdiff
path: root/src/mongo/db/write_concern_options.cpp
diff options
context:
space:
mode:
authorKevin Pulo <kevin.pulo@mongodb.com>2019-12-20 02:20:39 +0000
committerevergreen <evergreen@mongodb.com>2019-12-20 02:20:39 +0000
commit8bf0a1988427e970c965994c629997a2a357dcd1 (patch)
tree01630147a3e49113ad95fb076eefc782508bbcd2 /src/mongo/db/write_concern_options.cpp
parent432f78a8316dcac41ea3085faa0d8c1afad450ff (diff)
downloadmongo-8bf0a1988427e970c965994c629997a2a357dcd1.tar.gz
SERVER-44538 Add read/write concern fields to logging/profiling
Diffstat (limited to 'src/mongo/db/write_concern_options.cpp')
-rw-r--r--src/mongo/db/write_concern_options.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/mongo/db/write_concern_options.cpp b/src/mongo/db/write_concern_options.cpp
index cb4a2b13cf1..0df85b5ed93 100644
--- a/src/mongo/db/write_concern_options.cpp
+++ b/src/mongo/db/write_concern_options.cpp
@@ -101,6 +101,8 @@ StatusWith<WriteConcernOptions> WriteConcernOptions::parse(const BSONObj& obj) {
BSONElement wEl;
int wTimeout = 0;
+ WriteConcernOptions writeConcern;
+
for (auto e : obj) {
const auto fieldName = e.fieldNameStringData();
if (fieldName == kJFieldName) {
@@ -108,16 +110,20 @@ StatusWith<WriteConcernOptions> WriteConcernOptions::parse(const BSONObj& obj) {
if (!jEl.isNumber() && jEl.type() != Bool) {
return Status(ErrorCodes::FailedToParse, "j must be numeric or a boolean value");
}
+ writeConcern.usedDefault = false;
} else if (fieldName == kFSyncFieldName) {
fsyncEl = e;
if (!fsyncEl.isNumber() && fsyncEl.type() != Bool) {
return Status(ErrorCodes::FailedToParse,
"fsync must be numeric or a boolean value");
}
+ writeConcern.usedDefault = false;
} else if (fieldName == kWFieldName) {
wEl = e;
+ writeConcern.usedDefault = false;
} else if (fieldName == kWTimeoutFieldName) {
wTimeout = e.numberInt();
+ writeConcern.usedDefault = false;
} else if (fieldName == kWElectionIdFieldName) {
// Ignore.
} else if (fieldName == kWOpTimeFieldName) {
@@ -136,8 +142,6 @@ StatusWith<WriteConcernOptions> WriteConcernOptions::parse(const BSONObj& obj) {
return Status(ErrorCodes::FailedToParse, "fsync and j options cannot be used together");
}
- WriteConcernOptions writeConcern;
-
if (j) {
writeConcern.syncMode = SyncMode::JOURNAL;
} else if (fsync) {