summaryrefslogtreecommitdiff
path: root/src/mongo/db/write_concern_options.h
diff options
context:
space:
mode:
authormatt dannenberg <matt.dannenberg@10gen.com>2016-01-05 10:29:01 -0500
committermatt dannenberg <matt.dannenberg@10gen.com>2016-02-04 11:22:18 -0500
commit2c2e6a38f559f25559c2b24eff51511c6fbc4a5b (patch)
tree56ea15031ee21b8cb269d2ce6c7bb5b5235c97ed /src/mongo/db/write_concern_options.h
parenta818421d4f60b61ef81830af396deb1a3bb998de (diff)
downloadmongo-2c2e6a38f559f25559c2b24eff51511c6fbc4a5b.tar.gz
SERVER-22276 SERVER-22277 implement "j" flag in write concern apply to secondary as well as primary
Diffstat (limited to 'src/mongo/db/write_concern_options.h')
-rw-r--r--src/mongo/db/write_concern_options.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/mongo/db/write_concern_options.h b/src/mongo/db/write_concern_options.h
index 1bac963f16f..5acc54e5294 100644
--- a/src/mongo/db/write_concern_options.h
+++ b/src/mongo/db/write_concern_options.h
@@ -37,7 +37,7 @@ class Status;
struct WriteConcernOptions {
public:
- enum SyncMode { NONE, FSYNC, JOURNAL };
+ enum class SyncMode { UNSET, NONE, FSYNC, JOURNAL };
static const int kNoTimeout = 0;
static const int kNoWaiting = -1;
@@ -51,6 +51,9 @@ public:
WriteConcernOptions() {
reset();
+ // We set syncMode to NONE to avoid having an UNSET syncMode in default WriteConcernOptions
+ // since that can cause invariants to trigger.
+ syncMode = SyncMode::NONE;
}
WriteConcernOptions(int numNodes, SyncMode sync, int timeout);
@@ -94,7 +97,7 @@ public:
bool validForConfigServers() const;
void reset() {
- syncMode = NONE;
+ syncMode = SyncMode::UNSET;
wNumNodes = 0;
wMode = "";
wTimeout = 0;