Skip to content

Commit ea4562e

Browse files
committed
cleanup: index options don't need hton anymore
1 parent aed5928 commit ea4562e

File tree

4 files changed

+22
-29
lines changed

4 files changed

+22
-29
lines changed

sql/create_options.cc

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ static const size_t ha_option_type_sizeof[]=
226226
@retval FALSE OK
227227
*/
228228

229-
bool parse_option_list(THD* thd, handlerton *hton, void *option_struct_arg,
229+
bool parse_option_list(THD* thd, st_plugin_int *plugin, void *option_struct_arg,
230230
engine_option_value **option_list,
231231
ha_create_table_option *rules,
232232
bool suppress_warning, MEM_ROOT *root)
@@ -302,7 +302,7 @@ bool parse_option_list(THD* thd, handlerton *hton, void *option_struct_arg,
302302
(thd->lex->sql_command == SQLCOM_CREATE_TABLE || seen))
303303
{
304304
// take a value from the variable and add it to the list
305-
sys_var *sysvar= find_hton_sysvar(hton, opt->var);
305+
sys_var *sysvar= find_plugin_sysvar(plugin, opt->var);
306306
DBUG_ASSERT(sysvar);
307307

308308
if (!sysvar->session_is_default(thd))
@@ -344,7 +344,7 @@ bool parse_option_list(THD* thd, handlerton *hton, void *option_struct_arg,
344344
345345
This is done when an engine is loaded.
346346
*/
347-
static bool resolve_sysvars(handlerton *hton, ha_create_table_option *rules)
347+
bool resolve_sysvar_table_options(ha_create_table_option *rules)
348348
{
349349
for (ha_create_table_option *opt= rules; rules && opt->name; opt++)
350350
{
@@ -397,21 +397,14 @@ static bool resolve_sysvars(handlerton *hton, ha_create_table_option *rules)
397397
return 0;
398398
}
399399

400-
bool resolve_sysvar_table_options(handlerton *hton)
401-
{
402-
return resolve_sysvars(hton, hton->table_options) ||
403-
resolve_sysvars(hton, hton->field_options) ||
404-
resolve_sysvars(hton, hton->index_options);
405-
}
406-
407400
/*
408401
Restore HA_OPTION_TYPE_SYSVAR options back as they were
409402
before resolve_sysvars().
410403
411404
This is done when the engine is unloaded, so that we could
412405
call resolve_sysvars() if the engine is installed again.
413406
*/
414-
static void free_sysvars(handlerton *hton, ha_create_table_option *rules)
407+
void free_sysvar_table_options(ha_create_table_option *rules)
415408
{
416409
for (ha_create_table_option *opt= rules; rules && opt->name; opt++)
417410
{
@@ -428,14 +421,6 @@ static void free_sysvars(handlerton *hton, ha_create_table_option *rules)
428421
}
429422
}
430423

431-
void free_sysvar_table_options(handlerton *hton)
432-
{
433-
free_sysvars(hton, hton->table_options);
434-
free_sysvars(hton, hton->field_options);
435-
free_sysvars(hton, hton->index_options);
436-
}
437-
438-
439424
/**
440425
Parses all table/fields/keys options
441426

sql/create_options.h

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,16 +105,25 @@ class engine_option_value: public Sql_alloc
105105
typedef struct st_key KEY;
106106
class Create_field;
107107

108-
bool resolve_sysvar_table_options(handlerton *hton);
109-
void free_sysvar_table_options(handlerton *hton);
108+
bool resolve_sysvar_table_options(ha_create_table_option *rules);
109+
void free_sysvar_table_options(ha_create_table_option *rules);
110110
bool parse_engine_table_options(THD *thd, handlerton *ht, TABLE_SHARE *share);
111111
#ifdef WITH_PARTITION_STORAGE_ENGINE
112112
bool parse_engine_part_options(THD *thd, TABLE *table);
113113
#endif
114-
bool parse_option_list(THD* thd, handlerton *hton, void *option_struct,
114+
bool parse_option_list(THD* thd, st_plugin_int *plugin, void *option_struct,
115115
engine_option_value **option_list,
116116
ha_create_table_option *rules,
117117
bool suppress_warning, MEM_ROOT *root);
118+
119+
static inline bool parse_option_list(THD* thd, handlerton *hton,
120+
void *option_struct, engine_option_value **option_list,
121+
ha_create_table_option *rules, bool suppress_warning, MEM_ROOT *root)
122+
{
123+
return parse_option_list(thd, hton2plugin[hton->slot], option_struct,
124+
option_list, rules, suppress_warning, root);
125+
}
126+
118127
bool engine_table_options_frm_read(const uchar *buff, size_t length,
119128
TABLE_SHARE *share);
120129
bool merge_engine_options(engine_option_value *source,

sql/handler.cc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,9 @@ int ha_finalize_handlerton(st_plugin_int *plugin)
607607
if (plugin->plugin->deinit)
608608
deinit_status= plugin->plugin->deinit(NULL);
609609

610-
free_sysvar_table_options(hton);
610+
free_sysvar_table_options(hton->table_options);
611+
free_sysvar_table_options(hton->field_options);
612+
free_sysvar_table_options(hton->index_options);
611613
update_discovery_counters(hton, -1);
612614

613615
/*
@@ -811,7 +813,9 @@ int ha_initialize_handlerton(st_plugin_int *plugin)
811813
break;
812814
};
813815

814-
resolve_sysvar_table_options(hton);
816+
resolve_sysvar_table_options(hton->table_options);
817+
resolve_sysvar_table_options(hton->field_options);
818+
resolve_sysvar_table_options(hton->index_options);
815819
update_discovery_counters(hton, 1);
816820

817821
if (ddl_recovery_done && hton->signal_ddl_recovery_done)

sql/handler.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1761,11 +1761,6 @@ static inline handlerton *plugin_hton(plugin_ref plugin)
17611761
return plugin_data(plugin, handlerton *);
17621762
}
17631763

1764-
static inline sys_var *find_hton_sysvar(transaction_participant *hton, st_mysql_sys_var *var)
1765-
{
1766-
return find_plugin_sysvar(hton2plugin[hton->slot], var);
1767-
}
1768-
17691764
handlerton *ha_default_handlerton(THD *thd);
17701765
handlerton *ha_default_tmp_handlerton(THD *thd);
17711766

0 commit comments

Comments
 (0)