summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mongo/client/dbclient_rs.cpp2
-rw-r--r--src/mongo/db/repl/primary_only_service.cpp7
-rw-r--r--src/mongo/executor/task_executor.cpp3
3 files changed, 7 insertions, 5 deletions
diff --git a/src/mongo/client/dbclient_rs.cpp b/src/mongo/client/dbclient_rs.cpp
index 86f35c50ef6..0359251d9fa 100644
--- a/src/mongo/client/dbclient_rs.cpp
+++ b/src/mongo/client/dbclient_rs.cpp
@@ -1054,7 +1054,7 @@ std::pair<rpc::UniqueReply, DBClientBase*> DBClientReplicaSet::runCommandWithTar
}
uasserted(ErrorCodes::HostNotFound,
- str::stream() << "Could not satisfy $readPreference of '" << readPref.toString()
+ str::stream() << "Could not satisfy $readPreference of '" << rpShared->toString()
<< "' while attempting to run command " << request.getCommandName());
}
diff --git a/src/mongo/db/repl/primary_only_service.cpp b/src/mongo/db/repl/primary_only_service.cpp
index 3ced9e74647..ed9b93b9a09 100644
--- a/src/mongo/db/repl/primary_only_service.cpp
+++ b/src/mongo/db/repl/primary_only_service.cpp
@@ -95,10 +95,11 @@ PrimaryOnlyServiceRegistry* PrimaryOnlyServiceRegistry::get(ServiceContext* serv
}
void PrimaryOnlyServiceRegistry::registerService(std::unique_ptr<PrimaryOnlyService> service) {
- auto [_, inserted] = _services.emplace(service->getServiceName(), std::move(service));
+ auto name = service->getServiceName();
+ auto [_, inserted] = _services.emplace(name, std::move(service));
invariant(inserted,
- str::stream() << "Attempted to register PrimaryOnlyService ("
- << service->getServiceName() << ") that is already registered");
+ str::stream() << "Attempted to register PrimaryOnlyService (" << name
+ << ") that is already registered");
}
PrimaryOnlyService* PrimaryOnlyServiceRegistry::lookupService(StringData serviceName) {
diff --git a/src/mongo/executor/task_executor.cpp b/src/mongo/executor/task_executor.cpp
index e2937372613..f784515c9cc 100644
--- a/src/mongo/executor/task_executor.cpp
+++ b/src/mongo/executor/task_executor.cpp
@@ -44,7 +44,8 @@ void TaskExecutor::schedule(OutOfLineExecutor::Task func) {
// The callback was not scheduled or moved from, it is still valid. Run it inline to inform
// it of the error. Construct a CallbackArgs for it, only CallbackArgs::status matters here.
CallbackArgs args(this, {}, statusWithCallback.getStatus(), nullptr);
- cb(args);
+ invariant(cb); // NOLINT(bugprone-use-after-move)
+ cb(args); // NOLINT(bugprone-use-after-move)
}
}