diff --git a/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp b/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp
|
index 45a54c4d35..e4914f7027 100644
|
--- a/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp
|
+++ b/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp
|
@@ -457,11 +457,17 @@ Status ReplicationCoordinatorExternalStateImpl::initializeReplSetStorage(Operati
|
// Permit writing to the oplog before we step up to primary.
|
AllowNonLocalWritesBlock allowNonLocalWrites(opCtx);
|
Lock::GlobalWrite globalWrite(opCtx);
|
- WriteUnitOfWork wuow(opCtx);
|
- Helpers::putSingleton(opCtx, configCollectionName, config);
|
- const auto msgObj = BSON("msg" << kInitiatingSetMsg);
|
- _service->getOpObserver()->onOpMessage(opCtx, msgObj);
|
- wuow.commit();
|
+ {
|
+ WriteUnitOfWork wuow(opCtx);
|
+ Helpers::putSingleton(opCtx, configCollectionName, config);
|
+ wuow.commit();
|
+ }
|
+ {
|
+ WriteUnitOfWork wuow(opCtx);
|
+ const auto msgObj = BSON("msg" << kInitiatingSetMsg);
|
+ _service->getOpObserver()->onOpMessage(opCtx, msgObj);
|
+ wuow.commit();
|
+ }
|
});
|
|
// ReplSetTest assumes that immediately after the replSetInitiate command returns, it can
|