diff options
author | Sergey Vojtovich <svoj@mariadb.org> | 2019-11-14 17:45:19 +0400 |
---|---|---|
committer | Sergey Vojtovich <svoj@mariadb.org> | 2019-11-15 15:23:42 +0400 |
commit | 7740cb245720f2ecb92e0ca5d6ce8e39a6124679 (patch) | |
tree | df21c1a27830819438fa01a060314cac2d81a76d /sql/handler.cc | |
parent | da6d7f72b0a933ccf10dd78f41b0c32a88c4eb56 (diff) | |
download | mariadb-git-bb-10.5-robert.tar.gz |
Don't use plugin->data for storage engine pluginsbb-10.5-robert
Use plugin->plugin->info->hton instead.
plugin_data() replaced with plugin_hton().
plugin_hton() must never return NULL anymore and is only good to be called
against plugins in PLUGIN_IS_READY state.
Part of
MDEV-20044 - Replace dynamic storage engine initialisation with declarative
approach
Diffstat (limited to 'sql/handler.cc')
-rw-r--r-- | sql/handler.cc | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/sql/handler.cc b/sql/handler.cc index 9dda482dfc6..636c94bd92c 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -193,7 +193,7 @@ redo: if ((plugin= my_plugin_lock_by_name(thd, name, MYSQL_STORAGE_ENGINE_PLUGIN))) { handlerton *hton= plugin_hton(plugin); - if (hton && !(hton->flags & HTON_NOT_USER_SELECTABLE)) + if (!(hton->flags & HTON_NOT_USER_SELECTABLE)) return plugin; /* @@ -477,11 +477,11 @@ static void update_discovery_counters(handlerton *hton, int val) int ha_finalize_handlerton(st_plugin_int *plugin) { - handlerton *hton= (handlerton *)plugin->data; + handlerton *hton= plugin_hton(plugin_int_to_ref(plugin)); DBUG_ENTER("ha_finalize_handlerton"); - /* hton can be NULL here, if ha_initialize_handlerton() failed. */ - if (!hton) + /* data can be NULL here, if ha_initialize_handlerton() failed. */ + if (!plugin->data) goto end; if (installed_htons[hton->db_type] == hton) @@ -538,11 +538,8 @@ int ha_initialize_handlerton(st_plugin_int *plugin) DBUG_ENTER("ha_initialize_handlerton"); DBUG_PRINT("plugin", ("initialize plugin: '%s'", plugin->name.str)); - handlerton *hton= - static_cast<st_mysql_storage_engine*>(plugin->plugin->info)->hton; + handlerton *hton= plugin_hton(plugin_int_to_ref(plugin)); - /* Historical Requirement */ - plugin->data= hton; // shortcut for the future if (plugin->plugin->init && plugin->plugin->init(0)) { sql_print_error("Plugin '%s' init function returned error.", @@ -662,6 +659,8 @@ int ha_initialize_handlerton(st_plugin_int *plugin) resolve_sysvar_table_options(hton); update_discovery_counters(hton, 1); + /* Signal ha_finalize_handlerton() that init succeeded. */ + plugin->data= (void*) 1; DBUG_RETURN(0); err_deinit: @@ -677,6 +676,7 @@ err: if (hton->prepare) failed_ha_2pc++; #endif + /* Signal ha_finalize_handlerton() that init failed. */ plugin->data= NULL; DBUG_RETURN(1); } |