File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -1777,6 +1777,9 @@ class CacheAllocator : public CacheBase {
17771777 while (evictions < batch && itr) {
17781778
17791779 Item* candidate = itr.get ();
1780+ if (candidate == NULL ) {
1781+ break ;
1782+ }
17801783 // for chained items, the ownership of the parent can change. We try to
17811784 // evict what we think as parent and see if the eviction of parent
17821785 // recycles the child we intend to.
@@ -1820,14 +1823,13 @@ class CacheAllocator : public CacheBase {
18201823 releaseBackToAllocator (itemToRelease, RemoveContext::kEviction ,
18211824 /* isNascent */ movedToNextTier, candidate);
18221825
1826+ } else {
1827+ // evict failed - let's quit with what we have
1828+ break ;
18231829 }
18241830
1825- // If we destroyed the itr to possibly evict and failed, we restart
1826- // from the beginning again
1827- if (!itr) {
1828- itr.resetToBegin ();
1829- }
18301831 }
1832+
18311833 // Invalidate iterator since later on we may use this mmContainer
18321834 // again, which cannot be done unless we drop this iterator
18331835 itr.destroy ();
Original file line number Diff line number Diff line change 3131#include " cachelib/allocator/NvmAdmissionPolicy.h"
3232#include " cachelib/allocator/PoolOptimizeStrategy.h"
3333#include " cachelib/allocator/RebalanceStrategy.h"
34+ #include " cachelib/allocator/BackgroundEvictorStrategy.h"
3435#include " cachelib/allocator/Util.h"
3536#include " cachelib/common/EventInterface.h"
3637#include " cachelib/common/Throttler.h"
You can’t perform that action at this time.
0 commit comments