summaryrefslogtreecommitdiff
path: root/src/mongo/db/s/collection_sharding_state.cpp
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2018-05-16 11:46:25 -0400
committerKaloian Manassiev <kaloian.manassiev@mongodb.com>2018-05-24 13:18:27 -0400
commitcb0393248d26e21e69efde15d9d3965293ead29b (patch)
treefe79feb8446c70c438fd6f6c7bd261a4cb9d7612 /src/mongo/db/s/collection_sharding_state.cpp
parent2a0465739025e561711180939a76a8c366c2f155 (diff)
downloadmongo-cb0393248d26e21e69efde15d9d3965293ead29b.tar.gz
SERVER-34632 Use alias for the callback of CatalogCacheLoader::getChunksSince
Also use StringMap in CollectionShardingState instead of std::unordered_map.
Diffstat (limited to 'src/mongo/db/s/collection_sharding_state.cpp')
-rw-r--r--src/mongo/db/s/collection_sharding_state.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/mongo/db/s/collection_sharding_state.cpp b/src/mongo/db/s/collection_sharding_state.cpp
index 424ce3ce548..d457d260f09 100644
--- a/src/mongo/db/s/collection_sharding_state.cpp
+++ b/src/mongo/db/s/collection_sharding_state.cpp
@@ -46,6 +46,7 @@
#include "mongo/executor/thread_pool_task_executor.h"
#include "mongo/s/stale_exception.h"
#include "mongo/util/log.h"
+#include "mongo/util/string_map.h"
namespace mongo {
namespace {
@@ -114,9 +115,9 @@ public:
auto it = _collections.find(ns);
if (it == _collections.end()) {
- auto inserted = _collections.emplace(
+ auto inserted = _collections.try_emplace(
ns,
- std::make_unique<CollectionShardingState>(get.owner(this), NamespaceString(ns)));
+ std::make_shared<CollectionShardingState>(get.owner(this), NamespaceString(ns)));
invariant(inserted.second);
it = std::move(inserted.first);
}
@@ -156,8 +157,7 @@ public:
private:
mutable stdx::mutex _mutex;
- using CollectionsMap =
- stdx::unordered_map<std::string, std::unique_ptr<CollectionShardingState>>;
+ using CollectionsMap = StringMap<std::shared_ptr<CollectionShardingState>>;
CollectionsMap _collections;
};