Skip to content

Commit bebb2fa

Browse files
igchorbyrnedj
authored andcommitted
Fix moving for slab release
1 parent 785ce7b commit bebb2fa

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

cachelib/allocator/CacheAllocator-inl.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,7 +1315,6 @@ void CacheAllocator<CacheTrait>::moveRegularItemWithSync(
13151315
// ??? util::LatencyTracker tracker{stats_.evictRegularLatency_};
13161316

13171317
XDCHECK_EQ(newItemHdl->getSize(), oldItem.getSize());
1318-
XDCHECK_NE(getTierId(oldItem), getTierId(*newItemHdl));
13191318

13201319
// take care of the flags before we expose the item to be accessed. this
13211320
// will ensure that when another thread removes the item from RAM, we issue
@@ -1359,7 +1358,6 @@ void CacheAllocator<CacheTrait>::moveRegularItemWithSync(
13591358
auto& newContainer = getMMContainer(*newItemHdl);
13601359
auto mmContainerAdded = newContainer.add(*newItemHdl);
13611360
XDCHECK(mmContainerAdded);
1362-
13631361

13641362
// no one can add or remove chained items at this point
13651363
if (oldItem.hasChainedItem()) {
@@ -3188,9 +3186,14 @@ bool CacheAllocator<CacheTrait>::tryMovingForSlabRelease(
31883186
? moveChainedItem(oldItem.asChainedItem(), newItemHdl)
31893187
: moveRegularItem(oldItem, newItemHdl);
31903188
} else {
3191-
// TODO: add support for chained items
3192-
moveRegularItemWithSync(oldItem, newItemHdl);
3193-
return true;
3189+
if (oldItem.isChainedItem() || oldItem.hasChainedItem()) {
3190+
// TODO: add support for chained items
3191+
return false;
3192+
} else {
3193+
moveRegularItemWithSync(oldItem, newItemHdl);
3194+
removeFromMMContainer(oldItem);
3195+
return true;
3196+
}
31943197
}
31953198
}
31963199

0 commit comments

Comments
 (0)