Fix cache_eviction_target_strategy_dirty stat in eviction

XMLWordPrintableJSON

    • Storage Engines, Storage Engines - Transactions
    • SE Transactions - 2025-05-23, SE Transactions - 2025-06-06
    • 5

      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:
            Linh Tran
            Reporter:
            Ravi Giri
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: