• unknown's avatar
    Backport of revno: 2617.68.36 · 832ad466
    unknown authored
    ---------------------------------------------
    
    This is a patch for bug#47098 assert in MDL_context::destroy on
    HANDLER <damaged merge table> OPEN.
          
    The assert occurs in MDL_context::destroy when the connection is terminated,
    because all mdl_tickets have not been released.
    MERGE tables do not support being opened using the HANDLER ... OPEN command,
    and trying to do so will result in an error. In the event of an error, all
    tables that are opened, should be closed again. The fix for bug#45781 made
    sure that this also works for MERGE tables, which causes multiple tables to
    be opened.
    This fix extends the fix for bug#45781, by ensuring that also all locks are
    released, when MERGE tables are involved.
    
    mysql-test/r/merge.result:
      The result of the test.
    mysql-test/t/merge.test:
      Added a test based on the bug report, as well as a test of the more general
      scenario.
    sql/sql_handler.cc:
      Added code to release all the locks.
    832ad466
merge.test 61 KB