diff options
author | Matt Broadstone <mbroadst@mongodb.com> | 2023-04-18 10:52:03 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2023-04-18 12:09:05 +0000 |
commit | 7cc71f7d5f29a5850a4d186b9554df3dcb407117 (patch) | |
tree | 068faa351ea01c29118b09a0b84b82d119c5e141 /src/mongo/client | |
parent | 87824ece4511770a9a3d34b89cf544de7596dd77 (diff) | |
download | mongo-7cc71f7d5f29a5850a4d186b9554df3dcb407117.tar.gz |
SERVER-76222 Avoid temporary allocations of DatabaseName
Diffstat (limited to 'src/mongo/client')
-rw-r--r-- | src/mongo/client/dbclient_rs.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/mongo/client/dbclient_rs.cpp b/src/mongo/client/dbclient_rs.cpp index 368b1534ccb..b6b28375246 100644 --- a/src/mongo/client/dbclient_rs.cpp +++ b/src/mongo/client/dbclient_rs.cpp @@ -211,7 +211,7 @@ bool _isSecondaryCommand(StringData commandName, const BSONObj& commandArgs) { } // Internal implementation of isSecondaryQuery, takes previously-parsed read preference -bool _isSecondaryQuery(const string& ns, +bool _isSecondaryQuery(StringData ns, const BSONObj& filter, const ReadPreferenceSetting& readPref) { // If the read pref is primary only, this is not a secondary query @@ -502,8 +502,8 @@ std::unique_ptr<DBClientCursor> DBClientReplicaSet::find(FindCommandRequest find const ReadPreferenceSetting& readPref, ExhaustMode exhaustMode) { invariant(findRequest.getNamespaceOrUUID().nss()); - const std::string nss = findRequest.getNamespaceOrUUID().nss()->ns().toString(); - if (_isSecondaryQuery(nss, findRequest.toBSON(BSONObj{}), readPref)) { + const StringData ns = findRequest.getNamespaceOrUUID().nss()->ns(); + if (_isSecondaryQuery(ns, findRequest.toBSON(BSONObj{}), readPref)) { LOGV2_DEBUG(5951202, 3, "dbclient_rs query using secondary or tagged node selection", |