Uploaded image for project: 'WiredTiger'
  1. WiredTiger
  2. WT-11813

Fix cache_eviction_target_strategy_dirty stat in eviction

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Cache and eviction
    • Labels:
    • Storage Engines
    • StorEng - Defined Pipeline

      While investigating WT-11300 I found that we update the stat cache_eviction_target_strategy_dirty when WT_CACHE_EVICT_UPDATES is set which is misleading because there are 2 other cache evict states which is WT_CACHE_EVICT_DIRTY and WT_CACHE_EVICT_CLEAN.

      My suggestion is to have a different stat for each cache eviction state, now in WiredTiger we have the below stats.

      • cache_eviction_target_strategy_clean -> WT_CACHE_EVICT_CLEAN
      • cache_eviction_target_strategy_dirty -> WT_CACHE_EVICT_DIRTY
         
        This ticket is created to introduce a new stat or rename the stat cache_eviction_target_strategy_both_clean_and_dirty to cache_eviction_target_strategy_updates and update the code like below.
      diff --git a/src/evict/evict_lru.c b/src/evict/evict_lru.c
      index d8906e464..c396b04ee 100644
      --- a/src/evict/evict_lru.c
      +++ b/src/evict/evict_lru.c
      @@ -1825,13 +1825,14 @@ __evict_walk_tree(WT_SESSION_IMPL *session, WT_EVICT_QUEUE *queue, u_int max_ent
            * only looking for dirty pages, search the tree for longer.
            */
           min_pages = 10 * (uint64_t)target_pages;
      -    if (!F_ISSET(cache, WT_CACHE_EVICT_DIRTY | WT_CACHE_EVICT_UPDATES))
      -        WT_STAT_CONN_INCR(session, cache_eviction_target_strategy_clean);
      -    else if (!F_ISSET(cache, WT_CACHE_EVICT_CLEAN)) {
      +    if (F_ISSET(cache, WT_CACHE_EVICT_DIRTY)){
               min_pages *= 10;
               WT_STAT_CONN_INCR(session, cache_eviction_target_strategy_dirty);
      -    } else
      -        WT_STAT_CONN_INCR(session, cache_eviction_target_strategy_both_clean_and_dirty);
      +    } else if (F_ISSET(cache, WT_CACHE_EVICT_CLEAN)) {
      +        WT_STAT_CONN_INCR(session, cache_eviction_target_strategy_clean);
      +    } else if (F_ISSET(cache, WT_CACHE_EVICT_UPDATES))
      +        WT_STAT_CONN_INCR(session, cache_eviction_target_strategy_updates);
      
      

            Assignee:
            backlog-server-storage-engines [DO NOT USE] Backlog - Storage Engines Team
            Reporter:
            ravi.giri@mongodb.com Ravi Giri
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: