diff --git a/sql/create_options.cc b/sql/create_options.cc index b2d700c35b3..b4d6dfa8ba4 100644 --- a/sql/create_options.cc +++ b/sql/create_options.cc @@ -226,7 +226,7 @@ static const size_t ha_option_type_sizeof[]= @retval FALSE OK */ -bool parse_option_list(THD* thd, handlerton *hton, void *option_struct_arg, +bool parse_option_list(THD* thd, st_plugin_int *plugin, void *option_struct_arg, engine_option_value **option_list, ha_create_table_option *rules, bool suppress_warning, MEM_ROOT *root) @@ -302,7 +302,7 @@ bool parse_option_list(THD* thd, handlerton *hton, void *option_struct_arg, (thd->lex->sql_command == SQLCOM_CREATE_TABLE || seen)) { // take a value from the variable and add it to the list - sys_var *sysvar= find_hton_sysvar(hton, opt->var); + sys_var *sysvar= find_plugin_sysvar(plugin, opt->var); DBUG_ASSERT(sysvar); if (!sysvar->session_is_default(thd)) @@ -344,7 +344,7 @@ bool parse_option_list(THD* thd, handlerton *hton, void *option_struct_arg, This is done when an engine is loaded. */ -static bool resolve_sysvars(handlerton *hton, ha_create_table_option *rules) +bool resolve_sysvar_table_options(ha_create_table_option *rules) { for (ha_create_table_option *opt= rules; rules && opt->name; opt++) { @@ -397,13 +397,6 @@ static bool resolve_sysvars(handlerton *hton, ha_create_table_option *rules) return 0; } -bool resolve_sysvar_table_options(handlerton *hton) -{ - return resolve_sysvars(hton, hton->table_options) || - resolve_sysvars(hton, hton->field_options) || - resolve_sysvars(hton, hton->index_options); -} - /* Restore HA_OPTION_TYPE_SYSVAR options back as they were before resolve_sysvars(). @@ -411,7 +404,7 @@ bool resolve_sysvar_table_options(handlerton *hton) This is done when the engine is unloaded, so that we could call resolve_sysvars() if the engine is installed again. */ -static void free_sysvars(handlerton *hton, ha_create_table_option *rules) +void free_sysvar_table_options(ha_create_table_option *rules) { for (ha_create_table_option *opt= rules; rules && opt->name; opt++) { @@ -428,14 +421,6 @@ static void free_sysvars(handlerton *hton, ha_create_table_option *rules) } } -void free_sysvar_table_options(handlerton *hton) -{ - free_sysvars(hton, hton->table_options); - free_sysvars(hton, hton->field_options); - free_sysvars(hton, hton->index_options); -} - - /** Parses all table/fields/keys options diff --git a/sql/create_options.h b/sql/create_options.h index 0a949731df7..f7bb77c5772 100644 --- a/sql/create_options.h +++ b/sql/create_options.h @@ -105,16 +105,25 @@ public: typedef struct st_key KEY; class Create_field; -bool resolve_sysvar_table_options(handlerton *hton); -void free_sysvar_table_options(handlerton *hton); +bool resolve_sysvar_table_options(ha_create_table_option *rules); +void free_sysvar_table_options(ha_create_table_option *rules); bool parse_engine_table_options(THD *thd, handlerton *ht, TABLE_SHARE *share); #ifdef WITH_PARTITION_STORAGE_ENGINE bool parse_engine_part_options(THD *thd, TABLE *table); #endif -bool parse_option_list(THD* thd, handlerton *hton, void *option_struct, +bool parse_option_list(THD* thd, st_plugin_int *plugin, void *option_struct, engine_option_value **option_list, ha_create_table_option *rules, bool suppress_warning, MEM_ROOT *root); + +static inline bool parse_option_list(THD* thd, handlerton *hton, + void *option_struct, engine_option_value **option_list, + ha_create_table_option *rules, bool suppress_warning, MEM_ROOT *root) +{ + return parse_option_list(thd, hton2plugin[hton->slot], option_struct, + option_list, rules, suppress_warning, root); +} + bool engine_table_options_frm_read(const uchar *buff, size_t length, TABLE_SHARE *share); bool merge_engine_options(engine_option_value *source, diff --git a/sql/handler.cc b/sql/handler.cc index e2b0d2e05b6..07f0dc8088d 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -607,7 +607,9 @@ int ha_finalize_handlerton(st_plugin_int *plugin) if (plugin->plugin->deinit) deinit_status= plugin->plugin->deinit(NULL); - free_sysvar_table_options(hton); + free_sysvar_table_options(hton->table_options); + free_sysvar_table_options(hton->field_options); + free_sysvar_table_options(hton->index_options); update_discovery_counters(hton, -1); /* @@ -811,7 +813,9 @@ int ha_initialize_handlerton(st_plugin_int *plugin) break; }; - resolve_sysvar_table_options(hton); + resolve_sysvar_table_options(hton->table_options); + resolve_sysvar_table_options(hton->field_options); + resolve_sysvar_table_options(hton->index_options); update_discovery_counters(hton, 1); if (ddl_recovery_done && hton->signal_ddl_recovery_done) diff --git a/sql/handler.h b/sql/handler.h index 34869b5b6bc..6a63fae92f7 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -1761,11 +1761,6 @@ static inline handlerton *plugin_hton(plugin_ref plugin) return plugin_data(plugin, handlerton *); } -static inline sys_var *find_hton_sysvar(transaction_participant *hton, st_mysql_sys_var *var) -{ - return find_plugin_sysvar(hton2plugin[hton->slot], var); -} - handlerton *ha_default_handlerton(THD *thd); handlerton *ha_default_tmp_handlerton(THD *thd);