• Marko Mäkelä's avatar
    MDEV-18272 InnoDB fails to rollback after exceeding FOREIGN KEY recursion depth · 8024f8c6
    Marko Mäkelä authored
    row_mysql_handle_errors(): Correct the wrong error handling for
    the code DB_FOREIGN_EXCEED_MAX_CASCADE that was introduced in
    
    https://github.com/mysql/mysql-server/commit/c0923d396aef46799883390e9dcf7bbf173e4a03
    
        commit 35f5429e
        Author: Jimmy Yang <jimmy.yang@oracle.com>
        Date:   Wed Oct 6 06:55:34 2010 -0700
    
            Manual port Bug #Bug #54582 "stack overflow when opening many tables
            linked with foreign keys at once" from mysql-5.1-security to
            mysql-5.5-security again.
    
            rb://391 approved by Heikki
    
    No known test case exists for repeating the bug before MariaDB 10.2.
    The scenario should be that DB_FOREIGN_EXCEED_MAX_CASCADE is returned,
    then InnoDB wrongly skips the rollback to the start of the current
    row operation, and finally the SQL layer commits the transaction.
    Normally the SQL layer would roll back either the entire transaction or
    to the start of the statement. In the faulty scenario, InnoDB would
    leave the transaction in an inconsistent state, and the SQL layer could
    commit the transaction.
    8024f8c6
row0mysql.c 124 KB