diff --git a/fdbserver/EncryptKeyProxy.actor.cpp b/fdbserver/EncryptKeyProxy.actor.cpp index 20c0116fc7..22e1dbf1e8 100644 --- a/fdbserver/EncryptKeyProxy.actor.cpp +++ b/fdbserver/EncryptKeyProxy.actor.cpp @@ -154,17 +154,6 @@ public: } }; -struct pair_hash { - template <class T1, class T2> - std::size_t operator()(const std::pair<T1, T2>& pair) const { - auto hash1 = std::hash<T1>{}(pair.first); - auto hash2 = std::hash<T2>{}(pair.second); - - // Equal hashes XOR would be ZERO. - return hash1 == hash2 ? hash1 : hash1 ^ hash2; - } -}; - ACTOR Future<Void> getCipherKeysByBaseCipherKeyIds(Reference<EncryptKeyProxyData> ekpProxyData, KmsConnectorInterface kmsConnectorInf, EKPGetBaseCipherKeysByIdsRequest req) { @@ -179,7 +168,9 @@ ACTOR Future<Void> getCipherKeysByBaseCipherKeyIds(Reference<EncryptKeyProxyData // Dedup the requested pair<baseCipherId, encryptDomainId> // TODO: endpoint serialization of std::unordered_set isn't working at the moment - std::unordered_set<std::pair<EncryptCipherBaseKeyId, EncryptCipherDomainId>, pair_hash> dedupedCipherIds; + std::unordered_set<std::pair<EncryptCipherBaseKeyId, EncryptCipherDomainId>, + boost::hash<std::pair<EncryptCipherBaseKeyId, EncryptCipherDomainId>>> + dedupedCipherIds; for (const auto& item : req.baseCipherIds) { dedupedCipherIds.emplace(item); } diff --git a/flow/BlobCipher.h b/flow/BlobCipher.h index 75a4e8b947..7db574d60b 100644 --- a/flow/BlobCipher.h +++ b/flow/BlobCipher.h @@ -233,20 +233,12 @@ private: // required encryption key, however, CPs/SSs cache-miss would result in RPC to // EncryptKeyServer to refresh the desired encryption key. -struct pair_hash { - template <class T1, class T2> - std::size_t operator()(const std::pair<T1, T2>& pair) const { - auto hash1 = std::hash<T1>{}(pair.first); - auto hash2 = std::hash<T2>{}(pair.second); - - // Equal hashes XOR would be ZERO. - return hash1 == hash2 ? hash1 : hash1 ^ hash2; - } -}; using BlobCipherKeyIdCacheKey = std::pair<EncryptCipherBaseKeyId, EncryptCipherRandomSalt>; -using BlobCipherKeyIdCacheMap = std::unordered_map<BlobCipherKeyIdCacheKey, Reference<BlobCipherKey>, pair_hash>; +using BlobCipherKeyIdCacheKeyHash = boost::hash<BlobCipherKeyIdCacheKey>; +using BlobCipherKeyIdCacheMap = + std::unordered_map<BlobCipherKeyIdCacheKey, Reference<BlobCipherKey>, BlobCipherKeyIdCacheKeyHash>; using BlobCipherKeyIdCacheMapCItr = - std::unordered_map<BlobCipherKeyIdCacheKey, Reference<BlobCipherKey>, pair_hash>::const_iterator; + std::unordered_map<BlobCipherKeyIdCacheKey, Reference<BlobCipherKey>, BlobCipherKeyIdCacheKeyHash>::const_iterator; struct BlobCipherKeyIdCache : ReferenceCounted<BlobCipherKeyIdCache> { public: