Skip to content
  • Aditya A's avatar
    4b714c44
    Bug #21133329 HANGING "SYSTEM LOCK" WHEN EXECUTING "FLUSH TABLE ... FOR EXPORT" · 4b714c44
    Aditya A authored
    
    PROBLEM
    -------
    
    1. ibuf_contarct_in background() function is trying to merge
       all pages related to a certain table (which contains no record).
       while in background heavy DML operations are happening.
    2. When contracting the pages in ibuf_merge_space() we call
       ibuf_get_merge_pages() to get the pages to be merged.This function
       call returns the volume ( in bytes) of pages to be merged.
    3. In our case , the returned volume is zero since there are no pages
       to be merged ,but we increment the volume returned by 1 .
    4. This volume is returned to ibuf_contract_in_background() which
       assumes that some pages have been merged and doesn't break the loop
       It doesn't check if any pages have been merged but assumes that since
       volume is non zero some pages are merged and waits for it to reach
       sum_pages and gets stuck in this loop
    
    FIX
    ---
    
    1) The reason we increment the volume by 1 ,is because the function
       is supposed to return zero only if the ibuf tree is empty.
    2) To fix this we first have delinked the ibuf_merge_space() from the loop
       present in ibuf_contarct_in background() , it is independently called
       during quisec and returns number of pages merged instead of the size.
    3) Also as part of this fix we have backported Bug19724300 to make used of space_id
       instead of table id.
    
        Bug#19724300 REMOVE TABLE LOOKUPS FROM THE CHANGE BUFFER
    
        When exporting a tablespace, InnoDB needs to merge all buffered changes to
        that tablespace. However, the API for that is using the table_id, and we are
        performing unnecessary table lookups in the change buffer. The lookups should
        never fail (there is dead code), because MDL will be preventing a concurrent
        ALTER/TRUNCATE/DROP TABLE while the export operation is pending.
    
        ibuf_get_table(): Remove.
    
        ibuf_merge(): Replace table_id with space_id.
    
        ibuf_contract(): Call ibuf_merge_pages() directly.
    
        ibuf_merge_in_background(): Renamed from ibuf_contract_in_background().
        Replace table_id with space_id.
    
    [#rb12209 AND #rb6890  approved by jimmy ]
    4b714c44
    Bug #21133329 HANGING "SYSTEM LOCK" WHEN EXECUTING "FLUSH TABLE ... FOR EXPORT"
    Aditya A authored
    
    PROBLEM
    -------
    
    1. ibuf_contarct_in background() function is trying to merge
       all pages related to a certain table (which contains no record).
       while in background heavy DML operations are happening.
    2. When contracting the pages in ibuf_merge_space() we call
       ibuf_get_merge_pages() to get the pages to be merged.This function
       call returns the volume ( in bytes) of pages to be merged.
    3. In our case , the returned volume is zero since there are no pages
       to be merged ,but we increment the volume returned by 1 .
    4. This volume is returned to ibuf_contract_in_background() which
       assumes that some pages have been merged and doesn't break the loop
       It doesn't check if any pages have been merged but assumes that since
       volume is non zero some pages are merged and waits for it to reach
       sum_pages and gets stuck in this loop
    
    FIX
    ---
    
    1) The reason we increment the volume by 1 ,is because the function
       is supposed to return zero only if the ibuf tree is empty.
    2) To fix this we first have delinked the ibuf_merge_space() from the loop
       present in ibuf_contarct_in background() , it is independently called
       during quisec and returns number of pages merged instead of the size.
    3) Also as part of this fix we have backported Bug19724300 to make used of space_id
       instead of table id.
    
        Bug#19724300 REMOVE TABLE LOOKUPS FROM THE CHANGE BUFFER
    
        When exporting a tablespace, InnoDB needs to merge all buffered changes to
        that tablespace. However, the API for that is using the table_id, and we are
        performing unnecessary table lookups in the change buffer. The lookups should
        never fail (there is dead code), because MDL will be preventing a concurrent
        ALTER/TRUNCATE/DROP TABLE while the export operation is pending.
    
        ibuf_get_table(): Remove.
    
        ibuf_merge(): Replace table_id with space_id.
    
        ibuf_contract(): Call ibuf_merge_pages() directly.
    
        ibuf_merge_in_background(): Renamed from ibuf_contract_in_background().
        Replace table_id with space_id.
    
    [#rb12209 AND #rb6890  approved by jimmy ]
Loading