• Konstantin Osipov's avatar
    Backport of: · 289d2bf7
    Konstantin Osipov authored
    ------------------------------------------------------------
    revno: 2617.69.37
    committer: Dmitry Lenev <dlenev@mysql.com>
    branch nick: mysql-next-bg46748
    timestamp: Fri 2009-08-21 18:17:02 +0400
    message:
      Fix for bug #46748 "Assertion in MDL_context::wait_for_locks()
      on INSERT + CREATE TRIGGER".
    
      Concurrent execution of statements involving stored functions or triggers
      which were using several tables and DDL statements which affected those
      tables on debug build of server might have led to assertion failures in
      MDL_context::wait_for_locks(). Non-debug build was not affected.
    
      The problem was that during back-off which happens when open_tables()
      encounters conflicting metadata lock for one of the tables being open
      we didn't reset MDL_request::ticket value for requests which correspond
      to tables from extended prelocking set. Since these requests are part
      of of list of requests to be waited for in Open_table_context this broke
      assumption that ticket value for them is 0 in MDL_context::wait_for_locks()
      and caused assertion failure.
    
      This fix ensures that close_tables_for_reopen(), which performs this back-off
      resets MDL_request::ticket value not only for tables directly used by the
      statement but also for tables from extended prelocking set, thus satisfying
      assumption described above.
    289d2bf7
mdl_sync.test 3.86 KB