diff options
| author | Lucas de Castro Borges <lucas@gnuabordo.com.br> | 2025-02-11 15:07:35 -0300 |
|---|---|---|
| committer | Lucas de Castro Borges <lucas@gnuabordo.com.br> | 2025-02-11 15:07:35 -0300 |
| commit | 4cb8841196d0625dfa3825aa326f071cd27c7b8b (patch) | |
| tree | 1682a647d4463397c119183369ae6f750d5fdcff /src/mongo/db/repl/primary_only_service.cpp | |
| parent | aa03c6362cbaa767638e6eed9b031d86dd2643d1 (diff) | |
| parent | 8f0827553e09872941945a093b647a4211a9db7f (diff) | |
Update upstream source from tag 'upstream/6.0.0'master
Update to upstream version '6.0.0'
with Debian dir 5604a80ec1c96ca76f25f40d78e6ef855abec322
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( |
