summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mongo/db/read_concern_mongod.cpp2
-rw-r--r--src/mongo/db/write_concern.cpp21
-rw-r--r--src/mongo/db/write_concern_options.cpp8
-rw-r--r--src/mongo/s/commands/cluster_write_cmd.cpp8
4 files changed, 10 insertions, 29 deletions
diff --git a/src/mongo/db/read_concern_mongod.cpp b/src/mongo/db/read_concern_mongod.cpp
index 64777ec1e4e..cba89dd67e5 100644
--- a/src/mongo/db/read_concern_mongod.cpp
+++ b/src/mongo/db/read_concern_mongod.cpp
@@ -181,7 +181,7 @@ Status makeNoopWriteIfNeeded(OperationContext* opCtx,
<< 1 << "maxClusterTime" << clusterTime.asTimestamp() << "data"
<< BSON("noop write for afterClusterTime read concern" << 1)
<< WriteConcernOptions::kWriteConcernField
- << WriteConcernOptions::kInternalWriteDefault),
+ << WriteConcernOptions::Acknowledged),
onRemoteCmdScheduled,
onRemoteCmdComplete);
diff --git a/src/mongo/db/write_concern.cpp b/src/mongo/db/write_concern.cpp
index a84ef25d594..8febdc098ed 100644
--- a/src/mongo/db/write_concern.cpp
+++ b/src/mongo/db/write_concern.cpp
@@ -142,24 +142,9 @@ StatusWith<WriteConcernOptions> extractWriteConcern(OperationContext* opCtx,
}
}
- if (!clientSuppliedWriteConcern &&
- serverGlobalParams.clusterRole.isExclusivelyConfigSvrRole() &&
- !opCtx->getClient()->isInDirectClient() &&
- (opCtx->getClient()->session() &&
- (opCtx->getClient()->session()->getTags() & transport::Session::kInternalClient)) &&
- !opCtx->inMultiDocumentTransaction()) {
- // Upconvert the writeConcern of any incoming requests from internal connections (i.e.,
- // from other nodes in the cluster) to "majority." This protects against internal code that
- // does not specify writeConcern when writing to the config server.
- writeConcern = WriteConcernOptions{
- WriteConcernOptions::kMajority, WriteConcernOptions::SyncMode::UNSET, Seconds(30)};
- writeConcern.getProvenance().setSource(
- ReadWriteConcernProvenance::Source::internalWriteDefault);
- } else {
- Status wcStatus = validateWriteConcern(opCtx, writeConcern);
- if (!wcStatus.isOK()) {
- return wcStatus;
- }
+ Status wcStatus = validateWriteConcern(opCtx, writeConcern);
+ if (!wcStatus.isOK()) {
+ return wcStatus;
}
return writeConcern;
diff --git a/src/mongo/db/write_concern_options.cpp b/src/mongo/db/write_concern_options.cpp
index 8f4723a475e..7682f388f7d 100644
--- a/src/mongo/db/write_concern_options.cpp
+++ b/src/mongo/db/write_concern_options.cpp
@@ -70,9 +70,11 @@ const BSONObj WriteConcernOptions::Acknowledged(BSON("w" << W_NORMAL));
const BSONObj WriteConcernOptions::Unacknowledged(BSON("w" << W_NONE));
const BSONObj WriteConcernOptions::Majority(BSON("w" << WriteConcernOptions::kMajority));
-// The "kInternalWriteDefault" write concern, used by internal operations, is deliberately empty (no
-// 'w' or 'wtimeout' specified). This allows internal operations to specify a write concern, while
-// still allowing it to be either w:1 or automatically upconverted to w:majority on configsvrs.
+// The "kInternalWriteDefault" write concern used by internal operations, is deliberately empty (no
+// 'w' or 'wtimeout' specified). We require that all internal operations explicitly specify a write
+// concern, so "kInternalWriteDefault" allows internal operations to explicitly specify a write
+// concern, without counting as a "client-supplied write concern" and instead still using the
+// "default constructed WC" ({w:1})
const BSONObj WriteConcernOptions::kInternalWriteDefault;
constexpr Seconds WriteConcernOptions::kWriteConcernTimeoutSystem;
diff --git a/src/mongo/s/commands/cluster_write_cmd.cpp b/src/mongo/s/commands/cluster_write_cmd.cpp
index 2343ce2c6d6..3d75dcc9eaf 100644
--- a/src/mongo/s/commands/cluster_write_cmd.cpp
+++ b/src/mongo/s/commands/cluster_write_cmd.cpp
@@ -511,13 +511,7 @@ bool ClusterWriteCmd::InvocationBase::runImpl(OperationContext* opCtx,
// The batched request will only have WC if it was supplied by the client. Otherwise, the
// batched request should use the WC from the opCtx.
if (!batchedRequest.hasWriteConcern()) {
- if (opCtx->getWriteConcern().usedDefaultConstructedWC) {
- // Pass writeConcern: {}, rather than {w: 1, wtimeout: 0}, so as to not override the
- // configsvr w:majority upconvert.
- batchedRequest.setWriteConcern(BSONObj());
- } else {
- batchedRequest.setWriteConcern(opCtx->getWriteConcern().toBSON());
- }
+ batchedRequest.setWriteConcern(opCtx->getWriteConcern().toBSON());
}
// Write ops are never allowed to have writeConcern inside transactions. Normally