• kostja@bodhi.(none)'s avatar
    A fix and a test case for Bug#26141 mixing table types in trigger · 5ab4b6f1
    kostja@bodhi.(none) authored
    causes full table lock on innodb table.
    Also fixes Bug#28502 Triggers that update another innodb table 
    will block on X lock unnecessarily (duplciate).
    Code review fixes.
    
    Both bugs' synopses are misleading: InnoDB table is
    not X locked. The statements, however, cannot proceed concurrently, 
    but this happens due to lock conflicts for tables used in triggers,
    not for the InnoDB table. 
    
    If a user had an InnoDB table, and two triggers, AFTER UPDATE and 
    AFTER INSERT, competing for different resources (e.g. two distinct
    MyISAM tables), then these two triggers would not be able to execute
    concurrently. Moreover, INSERTS/UPDATES of the InnoDB table would
    not be able to run concurrently. 
    The problem had other side-effects (see respective bug reports).
    
    This behavior was a consequence of a shortcoming of the pre-locking
    algorithm, which would not distinguish between different DML operations
    (e.g. INSERT and DELETE) and pre-lock all the tables
    that are used by any trigger defined on the subject table.
    
    The idea of the fix is to extend the pre-locking algorithm to keep track,
    for each table, what DML operation it is used for and not
    load triggers that are known to never be fired.
    5ab4b6f1
trigger-trans.result 4.26 KB