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

Grab a snapshot when perfoming eviction a under read-uncommited reader application thread

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
    • Storage Engines
    • 5
    • StorEng - Defined Pipeline, 2024-03-05 - Claronald

      When a wiredtiger system gets too overfilled with cache, application threads are pulled into eviction to help free up some space in the cache. Since application threads usually has snapshots, we either use the current given transaction snapshot or we refresh the snapshot temporarily for the time of eviction. From the investigation WT-12349, we have found that an application thread that has read-uncomitted isolation level gets pulled into eviction, the application thread does not have a snapshot. In this case we default into the else statement show here:

          /* Eviction thread doing eviction. */
          if (is_eviction_thread)
              /*
               * Eviction threads do not need to pin anything in the cache. We have an exclusive lock for
               * the page being evicted so we are sure that the page will always be there while it is
               * being processed. Therefore, we use snapshot API that doesn't publish shared IDs to the
               * outside world.
               */
              __wt_txn_bump_snapshot(session);
          else if (use_snapshot_for_app_thread) {
              /*
               * If we couldn't make progress with the application thread's existing snapshot, save the
               * existing snapshot and refresh to acquire a new one. Then try eviction again. Once the
               * application threads are done with eviction, the application thread's snapshot is switched
               * back to the original.
               */
              if (F_ISSET(session->txn, WT_TXN_REFRESH_SNAPSHOT)) {
                  WT_RET(__wt_txn_snapshot_save_and_refresh(session));
                  is_application_thread_snapshot_refreshed = true;
                  WT_STAT_CONN_INCR(session, application_evict_snapshot_refreshed);
              }
      
              LF_SET(WT_REC_APP_EVICTION_SNAPSHOT);
          } else if (!WT_SESSION_BTREE_SYNC(session))
              LF_SET(WT_REC_VISIBLE_ALL);
      

      Reconciliation should not generally operate within the transaction context of an application thread. The ticket here involves making read-uncommitted readers temporarily take a snapshot when it is pulled into eviction.

            Assignee:
            jie.chen@mongodb.com Jie Chen
            Reporter:
            jie.chen@mongodb.com Jie Chen
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: