From bc0b19fd6df42983a3c265fe8c6015439c9878b2 Mon Sep 17 00:00:00 2001 From: Moustafa Maher Date: Wed, 28 Jul 2021 00:48:41 +0000 Subject: SERVER-58898 Prevent writing to local db from waiting for writeConcern --- src/mongo/db/service_entry_point_mongod.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/mongo/db/service_entry_point_mongod.cpp b/src/mongo/db/service_entry_point_mongod.cpp index 00fbaea5764..71be1d02ba4 100644 --- a/src/mongo/db/service_entry_point_mongod.cpp +++ b/src/mongo/db/service_entry_point_mongod.cpp @@ -114,6 +114,13 @@ public: const CommandInvocation* invocation, const repl::OpTime& lastOpBeforeRun, BSONObjBuilder& commandResponseBuilder) const override { + + // Prevent waiting for writeConcern if the command is changing an unreplicated namespace. + invariant(invocation); + if (!invocation->ns().isReplicated()) { + return; + } + auto lastOpAfterRun = repl::ReplClientInfo::forClient(opCtx->getClient()).getLastOp(); auto waitForWriteConcernAndAppendStatus = [&]() { -- cgit v1.2.1