• unknown's avatar
    Fix for bug bug#23651 "Server crashes when trigger which uses · fc83f787
    unknown authored
    stored function invoked from different connections".
    
    Invocation of trigger which was using stored function from different
    connections caused server crashes (for non-debug server this happened
    in highly concurrent environment, but debug server failed on assertion
    in relatively simple scenario).
    
    Item_func_sp was not safe to use in triggers (in other words for
    re-execution from different threads) as artificial TABLE object
    pointed by Item_func_sp::dummy_table referenced incorrect THD
    object. To fix the problem we force re-initialization of this
    object for each re-execution of statement.
    
    
    mysql-test/r/trigger.result:
      Added test for bug#23651 "Server crashes when trigger which uses
      stored function invoked from different connections".
    mysql-test/t/trigger.test:
      Added test for bug#23651 "Server crashes when trigger which uses
      stored function invoked from different connections".
    sql/item_func.cc:
      To make Item_func_sp safe for usage in triggers (in other words safe
      for re-execution in different threads) we need to ensure that artificial
      TABLE object pointed by Item_func_sp::dummy_table references correct
      THD object. To achieve this we simply force its re-initialization for
      each re-execution of statement.
    fc83f787
item_func.cc 124 KB