• Marko Mäkelä's avatar
    MDEV-21512 InnoDB may hang due to SPATIAL INDEX · 457ce97e
    Marko Mäkelä authored
    MySQL 5.7.29 includes the following fix:
    Bug #30287668 INNODB: A LONG SEMAPHORE WAIT
    mysql/mysql-server@5cdbb22b51cf2b35dbdf5666a251ffbec2f84dec
    
    There is no test case. It seems that the problem could occur when
    a spatial index is large and peculiar enough so that multiple R-tree
    leaf pages will have the exactly same maximum bounding rectangle (MBR).
    
    The commit message suggests that the hang can occur when R-tree
    non-leaf pages are being merged, which should only be possible
    during transaction rollback or the purge of transaction history,
    when the R-tree index is at least 2 levels high and very many records
    are being deleted. The message says that a comparison result that two
    spatial index node pointer records are equal will cause an infinite loop
    in rtr_page_copy_rec_list_end_no_locks(). Hence, we must include the
    child page number in the comparison to be consistent with
    mysql/mysql-server@2e11fe0e152e34d73579e1a9ec19aedc3f6010f6.
    
    We fix this bug in a simpler way, involving fewer code changes.
    
    cmp_rec_rec(): Renamed from cmp_rec_rec_with_match().
    Assert that rec2 always resides in an index page.
    Treat non-leaf spatial index pages specially.
    457ce97e
btr0cur.cc 226 KB