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

Investigate the right way to wait for prefetch readers to drain

    • Storage Engines
    • 5
    • 2024-05-28 - FOLLOW ON SPRINT
    • v8.0

      WT-12324 added the following code to __wt_conn_prefetch_clear_tree:

          /*
           * We guarantee that no dhandle enters the prefetch busy state while we wait. This is because we
           * hold the lock while draining, and the lock is required when taking from the queue.
           */
          if (dhandle != NULL)
              while (((WT_BTREE *)dhandle->handle)->prefetch_busy > 0)
                  __wt_yield();
      

      This is currently done while holding the prefetch_lock lock. This might seem unnecessary as we can do it in two separate steps instead:

      • Empty the queue while holding the locks so no one interacts with the queue (push/pull)
      • Then, we can wait for readers still interacting with refs from a btree that has now evict_disabled > 0.
      • This raises the following question, the drain code waits using the dhandle from the current session. What about the others prefetch workers? If __wt_conn_prefetch_clear_tree has all set to true, we should wait for all readers from all the different sessions. That makes me think that the drain code might be at the wrong pace. Or we should execute it only if all is false.

            Assignee:
            monica.ng@mongodb.com Monica Ng
            Reporter:
            etienne.petrel@mongodb.com Etienne Petrel
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: