summaryrefslogtreecommitdiff
path: root/src/mongo/db/db_raii.cpp
diff options
context:
space:
mode:
authorSophia Tan <sophia_tll@hotmail.com>2022-07-06 17:04:19 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-07-06 18:31:40 +0000
commitbab8a18eea2c606f9e05d0c064f90670bf36d327 (patch)
treeef8e08edde9bc427726d706cfdcadf8938099f06 /src/mongo/db/db_raii.cpp
parent3c0fa7f6f17837575cb7a3628e244cec8f50da5f (diff)
downloadmongo-bab8a18eea2c606f9e05d0c064f90670bf36d327.tar.gz
SERVER-65488 Change OldClientContext ctor to take in NamespaceString
Diffstat (limited to 'src/mongo/db/db_raii.cpp')
-rw-r--r--src/mongo/db/db_raii.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/mongo/db/db_raii.cpp b/src/mongo/db/db_raii.cpp
index 86490bc9e36..9fd6cd273cb 100644
--- a/src/mongo/db/db_raii.cpp
+++ b/src/mongo/db/db_raii.cpp
@@ -885,11 +885,11 @@ AutoGetCollectionForReadCommandLockFree::AutoGetCollectionForReadCommandLockFree
}
}
-OldClientContext::OldClientContext(OperationContext* opCtx, const std::string& ns, bool doVersion)
+OldClientContext::OldClientContext(OperationContext* opCtx,
+ const NamespaceString& nss,
+ bool doVersion)
: _opCtx(opCtx) {
- // TODO SERVER-65488 Grab the DatabaseName from the NamespaceString passed in
- const auto db = nsToDatabaseSubstring(ns);
- const DatabaseName dbName(boost::none, db);
+ const auto dbName = nss.dbName();
_db = DatabaseHolder::get(opCtx)->getDb(opCtx, dbName);
if (!_db) {
@@ -906,14 +906,13 @@ OldClientContext::OldClientContext(OperationContext* opCtx, const std::string& n
case dbDelete: // path, so no need to check them here as well
break;
default:
- CollectionShardingState::get(_opCtx, NamespaceString(ns))
- ->checkShardVersionOrThrow(_opCtx);
+ CollectionShardingState::get(_opCtx, nss)->checkShardVersionOrThrow(_opCtx);
break;
}
}
stdx::lock_guard<Client> lk(*_opCtx->getClient());
- currentOp->enter_inlock(ns.c_str(),
+ currentOp->enter_inlock(nss.toString().c_str(),
CollectionCatalog::get(opCtx)->getDatabaseProfileLevel(_db->name()));
}