• Jon Olav Hauglid's avatar
    Bug #56085 Embedded server tests fails with assert in · 41caa7f4
    Jon Olav Hauglid authored
               check_if_table_exists()
    
    This assert was triggered when the server tried to load plugins
    while running in embedded server mode. In embedded server mode,
    check_if_table_exists() was used to check if mysql.plugin existed
    so that ER_NO_SUCH_TABLE could be silently ignored.
    The problem was that this check was done without acquiring a metadata
    lock on mysql.plugin first. This triggered the assert.
    
    This patch fixes the problem by removing the call to
    check_if_table_exists() from plugin_load(). Instead an error handler
    which traps ER_NO_SUCH_TABLE is installed before trying to open
    mysql.plugin when running in embedded server mode.
    
    No test coverage added since this assert was triggered by 
    existing tests running in embedded server mode.
    
    
    sql/sql_base.cc:
      Renamed Prelock_error_handler to No_such_table_error_handler
      and moved the declaration to sql_base.h to make it usable
      in plugin_load().
    sql/sql_base.h:
      Renamed Prelock_error_handler to No_such_table_error_handler
      and moved the declaration to sql_base.h to make it usable
      in plugin_load().
    sql/sql_plugin.cc:
      Removed call to check_if_table_exists() used to check for mysql.plugin 
      in plugin_load() for embedded server. Instead install error handler
      which traps ER_NO_SUCH_TABLE during open_and_lock_tables().
    41caa7f4
sql_plugin.cc 101 KB