• Thirunarayanan Balathandayuthapani's avatar
    MDEV-28699 Shrink temporary tablespaces without restart · c507678b
    Thirunarayanan Balathandayuthapani authored
    - Introduced the variable "innodb_truncate_temporary_tablespace_now"
    to shrink the temporary tablespace.
    
    Steps for shrinking the temporary tablespace:
    
    1) Find the last used extent in temporary tablespace
    by iterating through the BITMAP in extent descriptor pages
    
    2) If the last used extent is lesser than user specified size
    then set desired target size to user specified size
    
    3) Store the page contents of "to be modified" extent
    descriptor pages, latches the "to be modified" extent
    descriptor pages and check for buffer pool memory availability
    
    4) Update the FSP_SIZE and FSP_FREE_LIMIT in header page
    
    5) Remove the "to be truncated" pages from FSP_FREE and
    FSP_FREE_FRAG list
    
    6) Reset the bitmap in the last descriptor pages for the
    "to be truncated" pages.
    
    7) Clear the freed range in temporary tablespace which
    are to be truncated.
    
    8) Evict the "to be truncated" temporary tablespace pages
    from LRU list.
    
    9) In case of multiple files, calculate the truncated last
    file size and do truncation in last file
    
    10) Commit the mini-transaction for shrinking the tablespace
    c507678b
ha_innodb.cc 607 KB