summaryrefslogtreecommitdiff
path: root/src/mongo/db/write_concern.cpp
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2013-12-03 12:17:49 -0500
committerEliot Horowitz <eliot@10gen.com>2013-12-03 21:24:56 -0500
commite836e71b13e091ed06defa87b91c49e5f720c72f (patch)
tree454a5b25fede8985e55f740ec0bbf4adf60c0333 /src/mongo/db/write_concern.cpp
parent6915fce7fa2609b8214c4fc211465d5e005f3017 (diff)
downloadmongo-e836e71b13e091ed06defa87b91c49e5f720c72f.tar.gz
SERVER-11665: make write concern semantics match 2.4
Diffstat (limited to 'src/mongo/db/write_concern.cpp')
-rw-r--r--src/mongo/db/write_concern.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/mongo/db/write_concern.cpp b/src/mongo/db/write_concern.cpp
index e6605c1d92c..1853d50618d 100644
--- a/src/mongo/db/write_concern.cpp
+++ b/src/mongo/db/write_concern.cpp
@@ -134,9 +134,9 @@ namespace mongo {
// now wait for replication
- if ( writeConcern.wNumNodes <= 0 &&
+ if ( writeConcern.wNumNodes <= 1 &&
writeConcern.wMode.empty() ) {
- // w settings, all done
+ // no desired replication check
return Status::OK();
}
@@ -153,7 +153,9 @@ namespace mongo {
return Status::OK();
}
result->err = "norepl";
- return Status( ErrorCodes::BadValue, "unknown w mode for config servers" );
+ return Status( ErrorCodes::BadValue,
+ str::stream() << "unknown w mode for config servers "
+ << "(" << writeConcern.wMode << ")" );
}
if ( !anyReplEnabled() ) {
@@ -162,12 +164,18 @@ namespace mongo {
if ( writeConcern.wNumNodes > 1 ) {
result->err = "norepl";
- return Status( ErrorCodes::BadValue, "no replication and asked for w > 1" );
+ // TODO
+ //return Status( ErrorCodes::BadValue,
+ //str::stream() << "no replication and asked for w > 1 "
+ //<< "(" << writeConcern.wNumNodes << ")" );
+ return Status::OK();
}
if ( !writeConcern.wMode.empty() &&
writeConcern.wMode != "majority" ) {
result->err = "norepl";
- return Status( ErrorCodes::BadValue, "no replication and asked for w with a mode" );
+ // TODO
+ //return Status( ErrorCodes::BadValue, "no replication and asked for w with a mode" );
+ return Status::OK();
}
// asked for w <= 1 or w=majority