diff options
Diffstat (limited to 'src/mongo/db/repl/primary_only_service.cpp')
| -rw-r--r-- | src/mongo/db/repl/primary_only_service.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/mongo/db/repl/primary_only_service.cpp b/src/mongo/db/repl/primary_only_service.cpp index 24e3b534aef..6a093ac6490 100644 --- a/src/mongo/db/repl/primary_only_service.cpp +++ b/src/mongo/db/repl/primary_only_service.cpp @@ -38,6 +38,7 @@ #include "mongo/db/auth/authorization_session.h" #include "mongo/db/catalog_raii.h" #include "mongo/db/client.h" +#include "mongo/db/concurrency/write_conflict_exception.h" #include "mongo/db/dbdirectclient.h" #include "mongo/db/ops/write_ops.h" #include "mongo/db/repl/repl_client_info.h" @@ -536,8 +537,8 @@ PrimaryOnlyService::getOrCreateInstance(OperationContext* opCtx, BSONObj initial return {newInstance, true}; } -std::pair<boost::optional<std::shared_ptr<PrimaryOnlyService::Instance>>, bool> -PrimaryOnlyService::lookupInstance(OperationContext* opCtx, const InstanceID& id) { +boost::optional<std::shared_ptr<PrimaryOnlyService::Instance>> PrimaryOnlyService::lookupInstance( + OperationContext* opCtx, const InstanceID& id) { // If this operation is holding any database locks, then it must have opted into getting // interrupted at stepdown to prevent deadlocks. invariant(!opCtx->lockState()->isLocked() || opCtx->shouldAlwaysInterruptAtStepDownOrUp() || @@ -547,7 +548,7 @@ PrimaryOnlyService::lookupInstance(OperationContext* opCtx, const InstanceID& id _waitForStateNotRebuilding(opCtx, lk); if (_state == State::kShutdown || _state == State::kPaused) { - return {boost::none, true}; + return boost::none; } if (_state == State::kRebuildFailed) { uassertStatusOK(_rebuildStatus); @@ -557,10 +558,10 @@ PrimaryOnlyService::lookupInstance(OperationContext* opCtx, const InstanceID& id auto it = _activeInstances.find(id); if (it == _activeInstances.end()) { - return {boost::none, false}; + return boost::none; } - return {it->second.getInstance(), false}; + return it->second.getInstance(); } std::vector<std::shared_ptr<PrimaryOnlyService::Instance>> PrimaryOnlyService::getAllInstances( |
