summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Polato <paolo.polato@mongodb.com>2022-09-29 07:21:15 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-09-29 08:18:38 +0000
commitf02d19996ec911d128642565ddcfbce5ae079956 (patch)
treecacc6baf7e99a497e35db9dd92e2547ab4efb4c8
parent29fdc94ccd63df4fd673e5fc09f1efe32a03e709 (diff)
downloadmongo-f02d19996ec911d128642565ddcfbce5ae079956.tar.gz
SERVER-69931 Adapt existing checks to allow distributed transactions into the config DB through the Internal Transactions API
-rw-r--r--src/mongo/db/write_concern.cpp3
-rw-r--r--src/mongo/s/commands/strategy.cpp3
2 files changed, 4 insertions, 2 deletions
diff --git a/src/mongo/db/write_concern.cpp b/src/mongo/db/write_concern.cpp
index d552e4e4ad1..f6caaad89d0 100644
--- a/src/mongo/db/write_concern.cpp
+++ b/src/mongo/db/write_concern.cpp
@@ -146,7 +146,8 @@ StatusWith<WriteConcernOptions> extractWriteConcern(OperationContext* opCtx,
serverGlobalParams.clusterRole == ClusterRole::ConfigServer &&
!opCtx->getClient()->isInDirectClient() &&
(opCtx->getClient()->session() &&
- (opCtx->getClient()->session()->getTags() & transport::Session::kInternalClient))) {
+ (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.
diff --git a/src/mongo/s/commands/strategy.cpp b/src/mongo/s/commands/strategy.cpp
index e4d3993e61c..89949b35360 100644
--- a/src/mongo/s/commands/strategy.cpp
+++ b/src/mongo/s/commands/strategy.cpp
@@ -80,6 +80,7 @@
#include "mongo/s/cluster_commands_helpers.h"
#include "mongo/s/commands/cluster_explain.h"
#include "mongo/s/grid.h"
+#include "mongo/s/is_mongos.h"
#include "mongo/s/load_balancer_support.h"
#include "mongo/s/mongos_topology_coordinator.h"
#include "mongo/s/query/cluster_cursor_manager.h"
@@ -595,7 +596,7 @@ void ParseAndRunCommand::_parseCommand() {
// TODO SERVER-28756: Change allowTransactionsOnConfigDatabase to true once we fix the bug
// where the mongos custom write path incorrectly drops the client's txnNumber.
- auto allowTransactionsOnConfigDatabase = false;
+ auto allowTransactionsOnConfigDatabase = !isMongos();
validateSessionOptions(*_osi, command->getName(), nss, allowTransactionsOnConfigDatabase);
_wc.emplace(uassertStatusOK(WriteConcernOptions::extractWCFromCommand(request.body)));