diff options
Diffstat (limited to 'sql/handler.cc')
-rw-r--r-- | sql/handler.cc | 46 |
1 files changed, 19 insertions, 27 deletions
diff --git a/sql/handler.cc b/sql/handler.cc index 13fe1ce6f1d..451f974a066 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -376,11 +376,12 @@ int ha_finalize_handlerton(st_plugin_int *plugin) case SHOW_OPTION_YES: if (installed_htons[hton->db_type] == hton) installed_htons[hton->db_type]= NULL; - if (hton->panic && hton->panic(hton, HA_PANIC_CLOSE)) - DBUG_RETURN(1); break; }; + if (hton->panic) + hton->panic(hton, HA_PANIC_CLOSE); + if (plugin->plugin->deinit) { /* @@ -509,31 +510,22 @@ int ha_init() DBUG_RETURN(error); } -/* - close, flush or restart databases - Ignore this for other databases than ours -*/ - -static my_bool panic_handlerton(THD *unused1, st_plugin_int *plugin, void *arg) +int ha_end() { - handlerton *hton= (handlerton *)plugin->data; - if (hton->state == SHOW_OPTION_YES && hton->panic) - ((int*)arg)[0]|= hton->panic(hton, (enum ha_panic_function)((int*)arg)[1]); - return FALSE; -} - + int error= 0; + DBUG_ENTER("ha_end"); -int ha_panic(enum ha_panic_function flag) -{ - int error[2]; - error[0]= 0; error[1]= (int)flag; - plugin_foreach(NULL, panic_handlerton, MYSQL_STORAGE_ENGINE_PLUGIN, error); + /* + This should be eventualy based on the graceful shutdown flag. + So if flag is equal to HA_PANIC_CLOSE, the deallocate + the errors. + */ + if (ha_finish_errors()) + error= 1; - if (flag == HA_PANIC_CLOSE && ha_finish_errors()) - error[0]= 1; - return error[0]; -} /* ha_panic */ + DBUG_RETURN(error); +} static my_bool dropdb_handlerton(THD *unused1, st_plugin_int *plugin, void *path) @@ -2959,15 +2951,15 @@ static my_bool binlog_func_list(THD *thd, st_plugin_int *plugin, void *arg) static my_bool binlog_func_foreach(THD *thd, binlog_func_st *bfn) { - handlerton *hton; hton_list_st hton_list; + uint i, sz; + hton_list.sz= 0; plugin_foreach(thd, binlog_func_list, MYSQL_STORAGE_ENGINE_PLUGIN, &hton_list); - uint i= 0, sz= hton_list.sz; - while(i < sz) - hton_list.hton[i++]->binlog_func(hton, thd, bfn->fn, bfn->arg); + for (i= 0, sz= hton_list.sz; i < sz ; i++) + hton_list.hton[i]->binlog_func(hton_list.hton[i], thd, bfn->fn, bfn->arg); return FALSE; } |