Skip to content

Commit 341a94b

Browse files
committed
Small fixes
1 parent a6d8868 commit 341a94b

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

cachelib/allocator/CacheAllocator-inl.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1996,7 +1996,7 @@ std::vector<std::string> CacheAllocator<CacheTrait>::dumpEvictionIterator(
19961996
}
19971997

19981998
// Always evict from the lowest layer.
1999-
auto tid = numTiers - 1;
1999+
int tid = numTiers - 1;
20002000

20012001
if (static_cast<size_t>(tid) >= mmContainers_.size() ||
20022002
static_cast<size_t>(pid) >= mmContainers_[tid].size() ||
@@ -2008,7 +2008,7 @@ std::vector<std::string> CacheAllocator<CacheTrait>::dumpEvictionIterator(
20082008
std::vector<std::string> content;
20092009

20102010
size_t i = 0;
2011-
while (i < numItems) {
2011+
while (i < numItems && tid >= 0) {
20122012
auto& mm = *mmContainers_[tid][pid][cid];
20132013
auto evictItr = mm.getEvictionIterator();
20142014
while (evictItr && i < numItems) {
@@ -3668,7 +3668,8 @@ bool CacheAllocator<CacheTrait>::cleanupStrayShmSegments(
36683668
// Any other concurrent process can not be attached to the segments or
36693669
// even if it does, we want to mark it for destruction.
36703670
ShmManager::removeByName(cacheDir, detail::kShmInfoName, posix);
3671-
ShmManager::removeByName(cacheDir, detail::kShmCacheName, posix);
3671+
ShmManager::removeByName(cacheDir, detail::kShmCacheName
3672+
+ std::to_string(0), posix);
36723673
ShmManager::removeByName(cacheDir, detail::kShmHashTableName, posix);
36733674
ShmManager::removeByName(cacheDir, detail::kShmChainedItemHashTableName,
36743675
posix);

cachelib/allocator/tests/TestBase-inl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ void AllocatorTest<AllocatorT>::testShmIsRemoved(
312312
ASSERT_FALSE(AllocatorT::ShmManager::segmentExists(
313313
config.getCacheDir(), detail::kShmHashTableName, config.usePosixShm));
314314
ASSERT_FALSE(AllocatorT::ShmManager::segmentExists(
315-
config.getCacheDir(), detail::kShmCacheName, config.usePosixShm));
315+
config.getCacheDir(), detail::kShmCacheName + std::to_string(0), config.usePosixShm));
316316
ASSERT_FALSE(AllocatorT::ShmManager::segmentExists(
317317
config.getCacheDir(), detail::kShmChainedItemHashTableName,
318318
config.usePosixShm));
@@ -326,7 +326,7 @@ void AllocatorTest<AllocatorT>::testShmIsNotRemoved(
326326
ASSERT_TRUE(AllocatorT::ShmManager::segmentExists(
327327
config.getCacheDir(), detail::kShmHashTableName, config.usePosixShm));
328328
ASSERT_TRUE(AllocatorT::ShmManager::segmentExists(
329-
config.getCacheDir(), detail::kShmCacheName, config.usePosixShm));
329+
config.getCacheDir(), detail::kShmCacheName + std::to_string(0), config.usePosixShm));
330330
ASSERT_TRUE(AllocatorT::ShmManager::segmentExists(
331331
config.getCacheDir(), detail::kShmChainedItemHashTableName,
332332
config.usePosixShm));

0 commit comments

Comments
 (0)