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

Refine condition to exit "__wti_evict_app_assist_worker" with "busy" flag set

    • Storage Engines
    • 3
    • StorEng - Defined Pipeline

      When the "busy" flag for the __wti_evict_app_assist_worker function is set, it's supposed to ensure that some minimal eviction is done so that there is cache space for a read operation.

      1. This condition should also exit if (busy && pct_full < 100.0).

              /* See if eviction is still needed. */
              if (!__wt_evict_needed(session, busy, readonly, &pct_full) ||
                (pct_full < 100.0 &&
                  (__wt_atomic_loadv64(&evict->eviction_progress) > initial_progress + max_progress)))
                  break;
      

      Rationale: if we're busy, it's fine to deem the work done as soon as there is any free space available.

      2. This should make sure that pct_full < 100.0.

              /* Evict a page. */
              ret = __evict_page(session, false);
              if (ret == 0) {
                  /* If the caller holds resources, we can stop after a successful eviction. */
                  if (busy)
                      break;
      

      Rationale: the space freed up by a single page eviction may not bring pct_full below 100.

      In fact, the "if (busy) break;" thing in (2) might not even be required if (1) is done since this check will be done in the next loop iteration.

      Note that this change will require a thorough testing to ensure that it doesn't introduce any regressions.

            Assignee:
            backlog-server-storage-engines [DO NOT USE] Backlog - Storage Engines Team
            Reporter:
            y.ershov@mongodb.com Yury Ershov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: