summaryrefslogtreecommitdiff
path: root/src/mongo/db/concurrency
diff options
context:
space:
mode:
authorDavid Storch <david.storch@10gen.com>2016-07-15 11:51:51 -0400
committerDavid Storch <david.storch@10gen.com>2016-07-19 22:35:21 -0400
commit0b32158c9cb44b31078ca923ef5c8fff755c952a (patch)
tree302e341c01510bb788778464e1a2d76a3eba72d4 /src/mongo/db/concurrency
parenteec4aba58d98c168fd55e8a00eb60e0184e13d98 (diff)
downloadmongo-0b32158c9cb44b31078ca923ef5c8fff755c952a.tar.gz
SERVER-23990 move StringData hashing to StringData::ComparatorInterface
This allows strings to be hashed in a collation-aware fashion.
Diffstat (limited to 'src/mongo/db/concurrency')
-rw-r--r--src/mongo/db/concurrency/lock_manager.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/mongo/db/concurrency/lock_manager.cpp b/src/mongo/db/concurrency/lock_manager.cpp
index 4ac5300ef8c..6653f5d0288 100644
--- a/src/mongo/db/concurrency/lock_manager.cpp
+++ b/src/mongo/db/concurrency/lock_manager.cpp
@@ -32,6 +32,7 @@
#include "mongo/db/concurrency/lock_manager.h"
+#include "mongo/base/simple_string_data_comparator.h"
#include "mongo/bson/bsonobjbuilder.h"
#include "mongo/config.h"
#include "mongo/db/concurrency/locker.h"
@@ -1105,22 +1106,20 @@ void DeadlockDetector::_processNextNode(const UnprocessedNode& node) {
// ResourceId
//
-static const StringData::Hasher stringDataHashFunction = StringData::Hasher();
-
uint64_t ResourceId::fullHash(ResourceType type, uint64_t hashId) {
return (static_cast<uint64_t>(type) << (64 - resourceTypeBits)) +
(hashId & (std::numeric_limits<uint64_t>::max() >> resourceTypeBits));
}
ResourceId::ResourceId(ResourceType type, StringData ns)
- : _fullHash(fullHash(type, stringDataHashFunction(ns))) {
+ : _fullHash(fullHash(type, SimpleStringDataComparator::kInstance.hash(ns))) {
#ifdef MONGO_CONFIG_DEBUG_BUILD
_nsCopy = ns.toString();
#endif
}
ResourceId::ResourceId(ResourceType type, const string& ns)
- : _fullHash(fullHash(type, stringDataHashFunction(ns))) {
+ : _fullHash(fullHash(type, SimpleStringDataComparator::kInstance.hash(ns))) {
#ifdef MONGO_CONFIG_DEBUG_BUILD
_nsCopy = ns;
#endif