summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/replication_coordinator_impl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/repl/replication_coordinator_impl.cpp')
-rw-r--r--src/mongo/db/repl/replication_coordinator_impl.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/mongo/db/repl/replication_coordinator_impl.cpp b/src/mongo/db/repl/replication_coordinator_impl.cpp
index d4bd43a16ff..58a6127b885 100644
--- a/src/mongo/db/repl/replication_coordinator_impl.cpp
+++ b/src/mongo/db/repl/replication_coordinator_impl.cpp
@@ -94,6 +94,7 @@
#include "mongo/db/shutdown_in_progress_quiesce_info.h"
#include "mongo/db/storage/control/journal_flusher.h"
#include "mongo/db/storage/storage_options.h"
+#include "mongo/db/transaction/transaction_participant.h"
#include "mongo/db/vector_clock.h"
#include "mongo/db/vector_clock_mutable.h"
#include "mongo/db/write_concern.h"
@@ -6343,5 +6344,14 @@ SplitPrepareSessionManager* ReplicationCoordinatorImpl::getSplitPrepareSessionMa
return &_splitSessionManager;
}
+bool ReplicationCoordinatorImpl::isRetryableWrite(OperationContext* opCtx) const {
+ if (!opCtx->writesAreReplicated() || !opCtx->isRetryableWrite()) {
+ return false;
+ }
+ auto txnParticipant = TransactionParticipant::get(opCtx);
+ return txnParticipant &&
+ (!opCtx->inMultiDocumentTransaction() || txnParticipant.transactionIsOpen());
+}
+
} // namespace repl
} // namespace mongo