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

Fail update restore eviction if no new updates were written

    • Type: Icon: Build Failure Build Failure
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • WT10.0.0, 4.4.0-rc13, 4.7.0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • 3
    • Storage - Ra 2020-07-13

      WiredTiger has a mode of eviction that will restore updates that can't be evicted in the cache as a last step. There are some pathological cases where we successfully complete an eviction, but restore all of the updates at the end.

      There is no use in doing that eviction in the first place - it requires exclusive access to the page, but doesn't reduce the amount of cache pressure. We should track when an update-restore eviction happens without any net benefit, and avoid retrying that eviction again until it's likely to have a different outcome.

      We used to have functionality that did that, but it was removed when durable history was implemented. The check should look something like:

      @@ -193,6 +193,19 @@ __reconcile(WT_SESSION_IMPL *session, WT_REF *ref, WT_SALVAGE_COOKIE *salvage, u
         if (F_ISSET(r, WT_REC_EVICT) && !WT_IS_HS(btree))
           __wt_cache_update_hs_score(session, r->updates_seen, r->updates_unstable);
       
      +  /*
      +   * If eviction didn't use any updates and didn't split or delete the page, it didn't make
      +   * progress. Give up rather than silently succeeding in doing no work: this way threads know to
      +   * back off forced eviction rather than spinning.
      +   */
      +  WT_STAT_CONN_INCR(session, cache_eviction_point_a);
      +  if (/* false && */ F_ISSET(r, WT_REC_EVICT) && !WT_PAGE_IS_INTERNAL(r->page) && r->multi_next == 1 &&
      +      !r->update_used) {
      +    WT_STAT_CONN_INCR(session, cache_eviction_point_f);
      +    //__wt_verbose(session, WT_VERB_ERROR_RETURNS, "%s: %d Error: %d", __func__, __LINE__, EBUSY);
      +    ret = EBUSY;
      +  }
      @@ -386,6 +386,10 @@ __wt_rec_upd_select(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_INSERT *ins, v
           return (__wt_set_return(session, EBUSY));
         }
       
      +  /* If an update was selected, record that we're making progress. */
      +  if (upd != NULL)
      +    r->update_used = true;
      +
      

      It might need to be enhanced to handle the case where timestamps aren't being used more elegantly (see WT-6484).

            Assignee:
            alex.cameron@mongodb.com Alex Cameron (Inactive)
            Reporter:
            alexander.gorrod@mongodb.com Alexander Gorrod
            Votes:
            0 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved: