Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-26662

buf_read_page_background() is blocking on LRU eviction

    XMLWordPrintable

    Details

      Description

      I noticed this while debugging a fix of MDEV-26445 by running the test innodb.undo_truncate:

      10.5 699de65d5e1cda0b8c6a994f8513e97804b1a7ad with some changes

      #9  0x000055af0cd10286 in buf_flush_LRU_list_batch (n=<synthetic pointer>, max=32) at /mariadb/10.5m/storage/innobase/buf/buf0flu.cc:1332
      #10 buf_do_LRU_batch (max=32) at /mariadb/10.5m/storage/innobase/buf/buf0flu.cc:1380
      #11 buf_flush_LRU (max_n=32) at /mariadb/10.5m/storage/innobase/buf/buf0flu.cc:1704
      #12 0x000055af0cd1357d in buf_LRU_get_free_block (have_mutex=have_mutex@entry=false) at /mariadb/10.5m/storage/innobase/buf/buf0lru.cc:499
      #13 0x000055af0cd13d4f in buf_page_init_for_read (unzip=false, zip_size=0, page_id={m_id = 326417514774}, mode=132) at /mariadb/10.5m/storage/innobase/buf/buf0rea.cc:110
      #14 buf_read_page_low (err=0x7f825810545c, space=0x7f81b01354f0, sync=false, mode=132, page_id={m_id = 326417514774}, zip_size=0, unzip=false) at /mariadb/10.5m/storage/innobase/buf/buf0rea.cc:309
      #15 0x000055af0cd14c16 in buf_read_page_background (space=space@entry=0x7f81b01354f0, page_id={m_id = 326417514774}, zip_size=<optimized out>) at /mariadb/10.5m/storage/innobase/buf/buf0rea.cc:506
      #16 0x000055af0ccf02c0 in btr_cur_prefetch_siblings (block=0x7f8258d7eac0, index=<optimized out>) at /mariadb/10.5m/storage/innobase/include/buf0types.h:127
      

      While this is executing, another thread is waiting as well:

      #3  0x000055af0cd1343e in buf_LRU_get_free_block (have_mutex=have_mutex@entry=false) at /mariadb/10.5m/storage/innobase/buf/buf0lru.cc:458
      #4  0x000055af0cd13d4f in buf_page_init_for_read (unzip=false, zip_size=0, page_id={m_id = 322122547570}, mode=132) at /mariadb/10.5m/storage/innobase/buf/buf0rea.cc:110
      #5  buf_read_page_low (err=0x7f825815045c, space=0x7f81b005d490, sync=false, mode=132, page_id={m_id = 322122547570}, zip_size=0, unzip=false) at /mariadb/10.5m/storage/innobase/buf/buf0rea.cc:309
      #6  0x000055af0cd14c16 in buf_read_page_background (space=space@entry=0x7f81b005d490, page_id={m_id = 322122547570}, zip_size=<optimized out>) at /mariadb/10.5m/storage/innobase/buf/buf0rea.cc:506
      #7  0x000055af0ccf02c0 in btr_cur_prefetch_siblings (block=0x7f8258d703c0, index=<optimized out>) at /mariadb/10.5m/storage/innobase/include/buf0types.h:127
      

      This prefetch could be detrimental to performance when we have a small buffer pool.

      Possible fix: Allow buf_page_init_for_read() to instantly fail if a buffer pool block is not immediately available when initiating a background read.

      The performance of any fix would of course have to be evaluaed carefully on different types of storage (ranging from HDD to NVMe).

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              marko Marko Mäkelä
              Reporter:
              marko Marko Mäkelä
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:

                  Git Integration