• unknown's avatar
    Fix for bug #16593 "Deadlock or crash in stress test for case where · e1c8d9c9
    unknown authored
    trigger starts trigger".
    
    In short, the deadlock/crash happened when execution of statement, which used
    stored functions or activated triggers, coincided with alteration of the
    tables used by these functions or triggers (in highly concurrent environment).
    
    Bug was caused by the incorrect handling of tables from prelocked set in
    open_tables() functions in situations when refresh happened. This fix replaces
    old smart but not very robust way of handling tables after refresh (which was
    closing only old tables), with new one which simply closes all tables opened so
    far and restarts open_tables().
    Also fixed handling of temporary tables in close_tables_for_reopen().
    
    No test case present since bug manifests itself only in concurrent environment.
    
    
    sql/mysql_priv.h:
      In order to handle correctly case when table list completely consists from tables
      from prelocked set close_tables_for_reopen() have to accept table list as in/out
      parameter.
    sql/sql_base.cc:
      open_tables():
        Removed part of comment  which was out of date.
        Changed handling of case when refresh happens during opening of tables, now
        instead of having code which decides for each table if it should be closed
        we simply close all tables. Old code also incorrectly handled tables from
        prelocked set in this situation which resulted in bug #16593 "Deadlock or
        crash in stress test for case where triggers starting trigger".
      close_tables_for_reopen():
        Now we correctly handle the case when table list completely consists from
        tables from prelocked set. Also now we simply close all tables instead
        leaving temporary tables non-closed (such approach allows easily handle
        correctly tables from prelocked set).
    sql/sql_prepare.cc:
      In order to handle correctly case when table list completely consists from tables
      from prelocked set close_tables_for_reopen() have to accept table list as in/out
      parameter.
    sql/sql_update.cc:
      In order to handle correctly case when table list completely consists from tables
      from prelocked set close_tables_for_reopen() have to accept table list as in/out
      parameter.
    e1c8d9c9
mysql_priv.h 60.4 KB