@@ -191,10 +191,11 @@ DList::evictionLoop() {
191
191
: 0 ,
192
192
};
193
193
const auto min_eviction = ResourceUsage{0 , 0 };
194
- if (eviction_target. AnyGTZero ()) {
194
+ const auto evicted =
195
195
tryEvict (eviction_target, min_eviction, eviction_config_.cache_cell_unaccessed_survival_time .count () > 0 );
196
+ if (evicted.AnyGTZero ()) {
197
+ notifyWaitingRequests ();
196
198
}
197
- notifyWaitingRequests ();
198
199
}
199
200
}
200
201
@@ -326,7 +327,7 @@ DList::tryEvict(const ResourceUsage& expected_eviction, const ResourceUsage& min
326
327
}
327
328
if (!size_to_evict.AnyGTZero ()) {
328
329
// Do not spam log during eviction loop.
329
- if (!evict_expired_items) {
330
+ if (!evict_expired_items && expected_eviction. AnyGTZero () ) {
330
331
LOG_DEBUG (
331
332
" [MCL] No items can be evicted, expected_eviction {}, "
332
333
" min_eviction {}, giving up eviction. Current usage: {}" ,
@@ -378,21 +379,9 @@ DList::tryEvict(const ResourceUsage& expected_eviction, const ResourceUsage& min
378
379
});
379
380
380
381
LOG_TRACE (" [MCL] Logically evicted size: {}" , size_to_evict.ToString ());
382
+ cachinglayer::monitor::cache_evicted_bytes_total (StorageType::MEMORY).Increment (size_to_evict.memory_bytes );
383
+ cachinglayer::monitor::cache_evicted_bytes_total (StorageType::DISK).Increment (size_to_evict.file_bytes );
381
384
382
- switch (size_to_evict.storage_type ()) {
383
- case StorageType::MEMORY:
384
- cachinglayer::monitor::cache_evicted_bytes_total (StorageType::MEMORY).Increment (size_to_evict.memory_bytes );
385
- break ;
386
- case StorageType::DISK:
387
- cachinglayer::monitor::cache_evicted_bytes_total (StorageType::DISK).Increment (size_to_evict.file_bytes );
388
- break ;
389
- case StorageType::MIXED:
390
- cachinglayer::monitor::cache_evicted_bytes_total (StorageType::MEMORY).Increment (size_to_evict.memory_bytes );
391
- cachinglayer::monitor::cache_evicted_bytes_total (StorageType::DISK).Increment (size_to_evict.file_bytes );
392
- break ;
393
- default :
394
- ThrowInfo (ErrorCode::UnexpectedError, " Unknown StorageType" );
395
- }
396
385
return size_to_evict;
397
386
}
398
387
0 commit comments