summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands/dbhash.cpp
diff options
context:
space:
mode:
authorGeert Bosch <geert@mongodb.com>2019-04-17 16:18:22 -0400
committerGeert Bosch <geert@mongodb.com>2019-04-26 16:18:38 -0400
commit8cbbba49935f632e876037f9f2d9eecc779eb96a (patch)
treef1b4416f63dd87ed97223751c2c0d4eff4063628 /src/mongo/db/commands/dbhash.cpp
parent93dd23880759430872510ef0b539e746192e44e2 (diff)
downloadmongo-8cbbba49935f632e876037f9f2d9eecc779eb96a.tar.gz
SERVER-40724 Change namespace arguments to use NamespaceString
Diffstat (limited to 'src/mongo/db/commands/dbhash.cpp')
-rw-r--r--src/mongo/db/commands/dbhash.cpp18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/mongo/db/commands/dbhash.cpp b/src/mongo/db/commands/dbhash.cpp
index db939ea91b6..20e14103f79 100644
--- a/src/mongo/db/commands/dbhash.cpp
+++ b/src/mongo/db/commands/dbhash.cpp
@@ -262,7 +262,7 @@ public:
}
// Compute the hash for this collection.
- std::string hash = _hashCollection(opCtx, db, collNss.toString());
+ std::string hash = _hashCollection(opCtx, db, collNss);
collectionToHashMap[collNss.coll().toString()] = hash;
@@ -308,13 +308,9 @@ public:
}
private:
- std::string _hashCollection(OperationContext* opCtx,
- Database* db,
- const std::string& fullCollectionName) {
+ std::string _hashCollection(OperationContext* opCtx, Database* db, const NamespaceString& nss) {
- NamespaceString ns(fullCollectionName);
-
- Collection* collection = db->getCollection(opCtx, ns);
+ Collection* collection = db->getCollection(opCtx, nss);
invariant(collection);
boost::optional<Lock::CollectionLock> collLock;
@@ -324,7 +320,7 @@ private:
// intent mode. We need to also acquire the collection lock in intent mode to ensure
// reading from the consistent snapshot doesn't overlap with any catalog operations on
// the collection.
- invariant(opCtx->lockState()->isCollectionLockedForMode(ns, MODE_IS));
+ invariant(opCtx->lockState()->isCollectionLockedForMode(nss, MODE_IS));
auto minSnapshot = collection->getMinimumVisibleSnapshot();
auto mySnapshot = opCtx->recoveryUnit()->getPointInTimeReadTimestamp();
@@ -357,9 +353,9 @@ private:
InternalPlanner::IXSCAN_FETCH);
} else if (collection->isCapped()) {
exec = InternalPlanner::collectionScan(
- opCtx, fullCollectionName, collection, PlanExecutor::NO_YIELD);
+ opCtx, nss.ns(), collection, PlanExecutor::NO_YIELD);
} else {
- log() << "can't find _id index for: " << fullCollectionName;
+ log() << "can't find _id index for: " << nss;
return "no _id _index";
}
@@ -375,7 +371,7 @@ private:
n++;
}
if (PlanExecutor::IS_EOF != state) {
- warning() << "error while hashing, db dropped? ns=" << fullCollectionName;
+ warning() << "error while hashing, db dropped? ns=" << nss;
uasserted(34371,
"Plan executor error while running dbHash command: " +
WorkingSetCommon::toStatusString(c));