diff options
author | Randolph Tan <randolph@10gen.com> | 2016-06-22 14:31:55 -0400 |
---|---|---|
committer | Randolph Tan <randolph@10gen.com> | 2016-06-24 17:32:19 -0400 |
commit | 4d14ddf06f49ff55c90451dcff2da1a6edcaf366 (patch) | |
tree | f12b599389fdee66d8feeb3c57db23f0cad88419 /src/mongo/db | |
parent | 587afac9ca7ff084aeb8bf74e98ecb9688b3afdb (diff) | |
download | mongo-4d14ddf06f49ff55c90451dcff2da1a6edcaf366.tar.gz |
SERVER-24701 Add option to set writeConcern for ShardingCatalogClient write ops
Diffstat (limited to 'src/mongo/db')
-rw-r--r-- | src/mongo/db/write_concern.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/mongo/db/write_concern.cpp b/src/mongo/db/write_concern.cpp index 9956f833d78..1fbb5b9d827 100644 --- a/src/mongo/db/write_concern.cpp +++ b/src/mongo/db/write_concern.cpp @@ -121,8 +121,13 @@ Status validateWriteConcern(OperationContext* txn, << writeConcern.toBSON().toString()); } - if (replMode == repl::ReplicationCoordinator::modeReplSet && !isLocalDb && - writeConcern.wMode.empty()) { + if (replMode == repl::ReplicationCoordinator::modeReplSet && + // Allow writes performed within the server to have a write concern of { w: 1 }. + // This is so commands have the option to skip waiting for replication if they are + // holding locks (ex. addShardToZone). This also allows commands that perform + // multiple writes to batch the wait at the end. + !txn->getClient()->isInDirectClient() && + !isLocalDb && writeConcern.wMode.empty()) { invariant(writeConcern.wNumNodes == 1); return Status( ErrorCodes::BadValue, |