Skip to content

Commit 18592c1

Browse files
committed
some other fixes
1 parent 43c1383 commit 18592c1

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/Storages/Cache/ObjectStorageListObjectsCache.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include <Storages/Cache/ObjectStorageListObjectsCache.h>
2+
#include <boost/functional/hash.hpp>
23

34
namespace DB
45
{
@@ -146,7 +147,12 @@ bool ObjectStorageListObjectsCache::Key::operator==(const Key & other) const
146147

147148
size_t ObjectStorageListObjectsCache::KeyHasher::operator()(const Key & key) const
148149
{
149-
return std::hash<String>()(key.prefix) + std::hash<String>()(key.bucket);
150+
std::size_t seed = 0;
151+
152+
hash_combine(seed, std::hash<String>()(key.bucket));
153+
hash_combine(seed, std::hash<String>()(key.prefix));
154+
155+
return seed;
150156
}
151157

152158
bool ObjectStorageListObjectsCache::IsStale::operator()(const Key & key) const
@@ -160,7 +166,7 @@ size_t ObjectStorageListObjectsCache::WeightFunction::operator()(const Value & v
160166

161167
for (const auto & object : value)
162168
{
163-
weight += object->relative_path.size() + sizeof(ObjectMetadata);
169+
weight += object->relative_path.capacity() + sizeof(ObjectMetadata);
164170
}
165171

166172
return weight;

0 commit comments

Comments
 (0)