diff options
-rw-r--r-- | src/mongo/db/repl_index_build_state.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/mongo/db/repl_index_build_state.cpp b/src/mongo/db/repl_index_build_state.cpp index 9048112a6dd..eb81219fa95 100644 --- a/src/mongo/db/repl_index_build_state.cpp +++ b/src/mongo/db/repl_index_build_state.cpp @@ -175,7 +175,8 @@ void ReplIndexBuildState::abortForShutdown(OperationContext* opCtx) { void ReplIndexBuildState::onOplogAbort(OperationContext* opCtx, const NamespaceString& nss) const { auto replCoord = repl::ReplicationCoordinator::get(opCtx); - bool isPrimary = replCoord->canAcceptWritesFor(opCtx, nss); + bool isPrimary = replCoord->canAcceptWritesFor(opCtx, nss) && + !replCoord->getSettings().shouldRecoverFromOplogAsStandalone(); invariant(!isPrimary, str::stream() << "Index build: " << buildUUID); stdx::unique_lock<Latch> lk(_mutex); |