Commit 9747c64a authored by V Narayanan's avatar V Narayanan

WL#4448 Generalize the handlerton::fill_files_table call with handlerton::fill_is_table

The attached patch adds a method
handlerton::fill_is_table that can be used
instead of having to create specific
handlerton::fill_*_table methods.
parent 187958a9
...@@ -94,6 +94,11 @@ static bool ndbcluster_show_status(handlerton *hton, THD*, ...@@ -94,6 +94,11 @@ static bool ndbcluster_show_status(handlerton *hton, THD*,
static int ndbcluster_alter_tablespace(handlerton *hton, static int ndbcluster_alter_tablespace(handlerton *hton,
THD* thd, THD* thd,
st_alter_tablespace *info); st_alter_tablespace *info);
static int ndbcluster_fill_is_table(handlerton *hton,
THD *thd,
TABLE_LIST *tables,
COND *cond,
enum enum_schema_tables);
static int ndbcluster_fill_files_table(handlerton *hton, static int ndbcluster_fill_files_table(handlerton *hton,
THD *thd, THD *thd,
TABLE_LIST *tables, TABLE_LIST *tables,
...@@ -7403,7 +7408,7 @@ static int ndbcluster_init(void *p) ...@@ -7403,7 +7408,7 @@ static int ndbcluster_init(void *p)
h->alter_tablespace= ndbcluster_alter_tablespace; /* Show status */ h->alter_tablespace= ndbcluster_alter_tablespace; /* Show status */
h->partition_flags= ndbcluster_partition_flags; /* Partition flags */ h->partition_flags= ndbcluster_partition_flags; /* Partition flags */
h->alter_table_flags=ndbcluster_alter_table_flags; /* Alter table flags */ h->alter_table_flags=ndbcluster_alter_table_flags; /* Alter table flags */
h->fill_files_table= ndbcluster_fill_files_table; h->fill_is_table= ndbcluster_fill_is_table;
#ifdef HAVE_NDB_BINLOG #ifdef HAVE_NDB_BINLOG
ndbcluster_binlog_init_handlerton(); ndbcluster_binlog_init_handlerton();
#endif #endif
...@@ -7539,6 +7544,34 @@ static int ndbcluster_init(void *p) ...@@ -7539,6 +7544,34 @@ static int ndbcluster_init(void *p)
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
/**
Used to fill in INFORMATION_SCHEMA* tables.
@param hton handle to the handlerton structure
@param thd the thread/connection descriptor
@param[in,out] tables the information schema table that is filled up
@param cond used for conditional pushdown to storage engine
@param schema_table_idx the table id that distinguishes the type of table
@return Operation status
*/
static int ndbcluster_fill_is_table(handlerton *hton,
THD *thd,
TABLE_LIST *tables,
COND *cond,
enum enum_schema_tables schema_table_idx)
{
int ret= 0;
if (schema_table_idx == SCH_FILES)
{
ret= ndbcluster_fill_files_table(hton, thd, tables, cond);
}
return ret;
}
static int ndbcluster_end(handlerton *hton, ha_panic_function type) static int ndbcluster_end(handlerton *hton, ha_panic_function type)
{ {
DBUG_ENTER("ndbcluster_end"); DBUG_ENTER("ndbcluster_end");
......
...@@ -515,6 +515,46 @@ class st_alter_tablespace : public Sql_alloc ...@@ -515,6 +515,46 @@ class st_alter_tablespace : public Sql_alloc
/* The handler for a table type. Will be included in the TABLE structure */ /* The handler for a table type. Will be included in the TABLE structure */
struct TABLE; struct TABLE;
/*
Make sure that the order of schema_tables and enum_schema_tables are the same.
*/
enum enum_schema_tables
{
SCH_CHARSETS= 0,
SCH_COLLATIONS,
SCH_COLLATION_CHARACTER_SET_APPLICABILITY,
SCH_COLUMNS,
SCH_COLUMN_PRIVILEGES,
SCH_ENGINES,
SCH_EVENTS,
SCH_FILES,
SCH_GLOBAL_STATUS,
SCH_GLOBAL_VARIABLES,
SCH_KEY_COLUMN_USAGE,
SCH_OPEN_TABLES,
SCH_PARTITIONS,
SCH_PLUGINS,
SCH_PROCESSLIST,
SCH_PROFILES,
SCH_REFERENTIAL_CONSTRAINTS,
SCH_PROCEDURES,
SCH_SCHEMATA,
SCH_SCHEMA_PRIVILEGES,
SCH_SESSION_STATUS,
SCH_SESSION_VARIABLES,
SCH_STATISTICS,
SCH_STATUS,
SCH_TABLES,
SCH_TABLE_CONSTRAINTS,
SCH_TABLE_NAMES,
SCH_TABLE_PRIVILEGES,
SCH_TRIGGERS,
SCH_USER_PRIVILEGES,
SCH_VARIABLES,
SCH_VIEWS
};
struct TABLE_SHARE; struct TABLE_SHARE;
struct st_foreign_key_info; struct st_foreign_key_info;
typedef struct st_foreign_key_info FOREIGN_KEY_INFO; typedef struct st_foreign_key_info FOREIGN_KEY_INFO;
...@@ -679,9 +719,9 @@ struct handlerton ...@@ -679,9 +719,9 @@ struct handlerton
uint (*partition_flags)(); uint (*partition_flags)();
uint (*alter_table_flags)(uint flags); uint (*alter_table_flags)(uint flags);
int (*alter_tablespace)(handlerton *hton, THD *thd, st_alter_tablespace *ts_info); int (*alter_tablespace)(handlerton *hton, THD *thd, st_alter_tablespace *ts_info);
int (*fill_files_table)(handlerton *hton, THD *thd, int (*fill_is_table)(handlerton *hton, THD *thd, TABLE_LIST *tables,
TABLE_LIST *tables, class Item *cond,
class Item *cond); enum enum_schema_tables);
uint32 flags; /* global handler flags */ uint32 flags; /* global handler flags */
/* /*
Those handlerton functions below are properly initialized at handler Those handlerton functions below are properly initialized at handler
......
...@@ -6264,8 +6264,9 @@ static my_bool run_hton_fill_schema_files(THD *thd, plugin_ref plugin, ...@@ -6264,8 +6264,9 @@ static my_bool run_hton_fill_schema_files(THD *thd, plugin_ref plugin,
struct run_hton_fill_schema_files_args *args= struct run_hton_fill_schema_files_args *args=
(run_hton_fill_schema_files_args *) arg; (run_hton_fill_schema_files_args *) arg;
handlerton *hton= plugin_data(plugin, handlerton *); handlerton *hton= plugin_data(plugin, handlerton *);
if(hton->fill_files_table && hton->state == SHOW_OPTION_YES) if (hton->fill_is_table && hton->state == SHOW_OPTION_YES)
hton->fill_files_table(hton, thd, args->tables, args->cond); hton->fill_is_table(hton, thd, args->tables, args->cond,
get_schema_table_idx(args->tables->schema_table));
return false; return false;
} }
......
...@@ -878,47 +878,6 @@ typedef struct st_foreign_key_info ...@@ -878,47 +878,6 @@ typedef struct st_foreign_key_info
List<LEX_STRING> referenced_fields; List<LEX_STRING> referenced_fields;
} FOREIGN_KEY_INFO; } FOREIGN_KEY_INFO;
/*
Make sure that the order of schema_tables and enum_schema_tables are the same.
*/
enum enum_schema_tables
{
SCH_CHARSETS= 0,
SCH_COLLATIONS,
SCH_COLLATION_CHARACTER_SET_APPLICABILITY,
SCH_COLUMNS,
SCH_COLUMN_PRIVILEGES,
SCH_ENGINES,
SCH_EVENTS,
SCH_FILES,
SCH_GLOBAL_STATUS,
SCH_GLOBAL_VARIABLES,
SCH_KEY_COLUMN_USAGE,
SCH_OPEN_TABLES,
SCH_PARTITIONS,
SCH_PLUGINS,
SCH_PROCESSLIST,
SCH_PROFILES,
SCH_REFERENTIAL_CONSTRAINTS,
SCH_PROCEDURES,
SCH_SCHEMATA,
SCH_SCHEMA_PRIVILEGES,
SCH_SESSION_STATUS,
SCH_SESSION_VARIABLES,
SCH_STATISTICS,
SCH_STATUS,
SCH_TABLES,
SCH_TABLE_CONSTRAINTS,
SCH_TABLE_NAMES,
SCH_TABLE_PRIVILEGES,
SCH_TRIGGERS,
SCH_USER_PRIVILEGES,
SCH_VARIABLES,
SCH_VIEWS
};
#define MY_I_S_MAYBE_NULL 1 #define MY_I_S_MAYBE_NULL 1
#define MY_I_S_UNSIGNED 2 #define MY_I_S_UNSIGNED 2
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment