Skip to content

Commit f125282

Browse files
Marko Miticmeta-codesync[bot]
authored andcommitted
Plumb recoverEvictionPolicy through Navy config layers
Summary: Wires the recoverEvictionPolicy flag from BlockCache::Config through the CacheLib Navy configuration layers so consumers can enable it. Config plumbing chain: - BlockCacheConfig (NavyConfig.h): setter/getter/member - BlockCacheProto (Factory.h): virtual interface - BlockCacheProtoImpl (Factory.cpp): implementation - NavySetup.cpp: bridges BlockCacheConfig to BlockCacheProto This is a pure plumbing change — no behavior change without a consumer setting the flag. Reviewed By: rlyerly Differential Revision: D100237072 fbshipit-source-id: 2e02357ddd8a68cae82adc061dfa99a9de4cf436
1 parent b1dea9c commit f125282

4 files changed

Lines changed: 19 additions & 0 deletions

File tree

cachelib/allocator/nvmcache/NavyConfig.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,11 @@ class BlockCacheConfig {
555555
return *this;
556556
}
557557

558+
BlockCacheConfig& setRecoverEvictionPolicy(bool enable) noexcept {
559+
recoverEvictionPolicy_ = enable;
560+
return *this;
561+
}
562+
558563
BlockCacheConfig& setAllocatorCount(uint32_t numAllocators) noexcept {
559564
allocatorsPerPriority_ = {numAllocators};
560565
return *this;
@@ -617,6 +622,8 @@ class BlockCacheConfig {
617622

618623
bool isCleanRegionFastPath() const { return cleanRegionFastPath_; }
619624

625+
bool isRecoverEvictionPolicy() const { return recoverEvictionPolicy_; }
626+
620627
bool isCombinedEntryBlockEnabled() const { return useCombinedEntryBlock_; }
621628

622629
const BlockCacheReinsertionConfig& getReinsertionConfig() const {
@@ -668,6 +675,9 @@ class BlockCacheConfig {
668675
// Retry immediately if clean regions are empty and reclaims are in-flight.
669676
bool cleanRegionFastPath_{false};
670677

678+
// Whether to persist and recover eviction policy ordering across restarts.
679+
bool recoverEvictionPolicy_{false};
680+
671681
// Whether to use Combined entry block (For index entries and small sized
672682
// items).
673683
// Only FixedSizeIndex will support this and it doesn't work with

cachelib/allocator/nvmcache/NavySetup.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@ uint64_t setupBlockCache(const navy::BlockCacheConfig& blockCacheConfig,
180180
blockCacheConfig.isRegionManagerFlushAsync());
181181

182182
blockCache->setCleanRegionFastPath(blockCacheConfig.isCleanRegionFastPath());
183+
blockCache->setRecoverEvictionPolicy(
184+
blockCacheConfig.isRecoverEvictionPolicy());
183185
blockCache->setUseCombinedEntryBlock(
184186
blockCacheConfig.isCombinedEntryBlockEnabled());
185187
blockCache->setNumAllocatorsPerPriority(

cachelib/navy/Factory.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,10 @@ class BlockCacheProtoImpl final : public BlockCacheProto {
135135
config_.cleanRegionFastPath = enable;
136136
}
137137

138+
void setRecoverEvictionPolicy(bool enable) override {
139+
config_.recoverEvictionPolicy = enable;
140+
}
141+
138142
void setUseCombinedEntryBlock(bool useCombinedEntryBlock) override {
139143
config_.useCombinedEntryBlock = useCombinedEntryBlock;
140144
}

cachelib/navy/Factory.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ class BlockCacheProto {
9595
// (Optional) Enable the clean region fast path in getCleanRegion().
9696
virtual void setCleanRegionFastPath(bool enable) = 0;
9797

98+
// (Optional) Persist and recover eviction policy ordering across restarts.
99+
virtual void setRecoverEvictionPolicy(bool enable) = 0;
100+
98101
// (Optional) Set if the combined entry block is enabled.
99102
virtual void setUseCombinedEntryBlock(bool useCombinedEntryBlock) = 0;
100103

0 commit comments

Comments
 (0)