summaryrefslogtreecommitdiff
path: root/src/mongo/db/s/collection_sharding_state.cpp
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2018-07-15 18:30:30 -0400
committerKaloian Manassiev <kaloian.manassiev@mongodb.com>2018-07-16 11:01:02 -0400
commit884d232473dca72e0872f0e540d4c3108c1e0b3d (patch)
tree17bf7b042e9303d1baf2d52db1798561e49bd62e /src/mongo/db/s/collection_sharding_state.cpp
parentfe684a8532270444b123b0593f7d8c20ce36af6c (diff)
downloadmongo-884d232473dca72e0872f0e540d4c3108c1e0b3d.tar.gz
SERVER-36054 Get rid of unused methods from CollectionShardingState
Diffstat (limited to 'src/mongo/db/s/collection_sharding_state.cpp')
-rw-r--r--src/mongo/db/s/collection_sharding_state.cpp20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/mongo/db/s/collection_sharding_state.cpp b/src/mongo/db/s/collection_sharding_state.cpp
index 440430712fe..0889934258d 100644
--- a/src/mongo/db/s/collection_sharding_state.cpp
+++ b/src/mongo/db/s/collection_sharding_state.cpp
@@ -110,14 +110,13 @@ public:
static const ServiceContext::Decoration<CollectionShardingStateMap> get;
- CollectionShardingState& getOrCreate(const std::string& ns) {
+ CollectionShardingState& getOrCreate(const NamespaceString& nss) {
stdx::lock_guard<stdx::mutex> lg(_mutex);
- auto it = _collections.find(ns);
+ auto it = _collections.find(nss.ns());
if (it == _collections.end()) {
auto inserted = _collections.try_emplace(
- ns,
- std::make_shared<CollectionShardingState>(get.owner(this), NamespaceString(ns)));
+ nss.ns(), std::make_shared<CollectionShardingState>(get.owner(this), nss));
invariant(inserted.second);
it = std::move(inserted.first);
}
@@ -143,9 +142,9 @@ public:
}
private:
- mutable stdx::mutex _mutex;
-
using CollectionsMap = StringMap<std::shared_ptr<CollectionShardingState>>;
+
+ stdx::mutex _mutex;
CollectionsMap _collections;
};
@@ -161,16 +160,11 @@ CollectionShardingState::CollectionShardingState(ServiceContext* sc, NamespaceSt
CollectionShardingState* CollectionShardingState::get(OperationContext* opCtx,
const NamespaceString& nss) {
- return CollectionShardingState::get(opCtx, nss.ns());
-}
-
-CollectionShardingState* CollectionShardingState::get(OperationContext* opCtx,
- const std::string& ns) {
// Collection lock must be held to have a reference to the collection's sharding state
- dassert(opCtx->lockState()->isCollectionLockedForMode(ns, MODE_IS));
+ dassert(opCtx->lockState()->isCollectionLockedForMode(nss.ns(), MODE_IS));
auto& collectionsMap = CollectionShardingStateMap::get(opCtx->getServiceContext());
- return &collectionsMap.getOrCreate(ns);
+ return &collectionsMap.getOrCreate(nss);
}
void CollectionShardingState::report(OperationContext* opCtx, BSONObjBuilder* builder) {