Commit baa914e6 authored by brian@zim.(none)'s avatar brian@zim.(none)

Cleanup of unused variables.

Fixed "discover" in the handler API.

Fixed problem where handlerton was not zero'ed. I need to look around, I suspect this problem is more widespread. 
parent d4118813
...@@ -227,12 +227,6 @@ extern my_bool innobase_log_archive, ...@@ -227,12 +227,6 @@ extern my_bool innobase_log_archive,
innobase_use_native_aio, innobase_use_native_aio,
innobase_file_per_table, innobase_locks_unsafe_for_binlog, innobase_file_per_table, innobase_locks_unsafe_for_binlog,
innobase_create_status_file; innobase_create_status_file;
extern my_bool innobase_very_fast_shutdown; /* set this to 1 just before
calling innobase_end() if
you want InnoDB to shut down
without flushing the buffer
pool: this is equivalent to
a 'crash' */
extern "C" { extern "C" {
extern ulong srv_max_buf_pool_modified_pct; extern ulong srv_max_buf_pool_modified_pct;
extern ulong srv_max_purge_lag; extern ulong srv_max_purge_lag;
......
...@@ -6387,6 +6387,7 @@ static int ndbcluster_init() ...@@ -6387,6 +6387,7 @@ static int ndbcluster_init()
ndbcluster_binlog_init_handlerton(); ndbcluster_binlog_init_handlerton();
#endif #endif
h.flags= HTON_CAN_RECREATE | HTON_TEMPORARY_NOT_SUPPORTED; h.flags= HTON_CAN_RECREATE | HTON_TEMPORARY_NOT_SUPPORTED;
h.discover= ndbcluster_discover;
} }
if (have_ndbcluster != SHOW_OPTION_YES) if (have_ndbcluster != SHOW_OPTION_YES)
......
...@@ -2705,18 +2705,41 @@ int ha_change_key_cache(KEY_CACHE *old_key_cache, ...@@ -2705,18 +2705,41 @@ int ha_change_key_cache(KEY_CACHE *old_key_cache,
>0 : error. frmblob and frmlen may not be set >0 : error. frmblob and frmlen may not be set
*/ */
typedef struct st_discover_args
{
const char *db;
const char *name;
const void** frmblob;
uint* frmlen;
};
static my_bool discover_handlerton(THD *thd, st_plugin_int *plugin,
void *arg)
{
st_discover_args *vargs= (st_discover_args *)arg;
handlerton *hton= (handlerton *)plugin->data;
if (hton->state == SHOW_OPTION_YES && hton->discover &&
(!(hton->discover(thd, vargs->db, vargs->name, vargs->frmblob, vargs->frmlen))))
return TRUE;
return FALSE;
}
int ha_discover(THD *thd, const char *db, const char *name, int ha_discover(THD *thd, const char *db, const char *name,
const void **frmblob, uint *frmlen) const void **frmblob, uint *frmlen)
{ {
int error= -1; // Table does not exist in any handler int error= -1; // Table does not exist in any handler
DBUG_ENTER("ha_discover"); DBUG_ENTER("ha_discover");
DBUG_PRINT("enter", ("db: %s, name: %s", db, name)); DBUG_PRINT("enter", ("db: %s, name: %s", db, name));
st_discover_args args= {db, name, frmblob, frmlen};
if (is_prefix(name,tmp_file_prefix)) /* skip temporary tables */ if (is_prefix(name,tmp_file_prefix)) /* skip temporary tables */
DBUG_RETURN(error); DBUG_RETURN(error);
#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
if (have_ndbcluster == SHOW_OPTION_YES) if (plugin_foreach(thd, discover_handlerton,
error= ndbcluster_discover(thd, db, name, frmblob, frmlen); MYSQL_STORAGE_ENGINE_PLUGIN, &args))
#endif error= 0;
if (!error) if (!error)
statistic_increment(thd->status_var.ha_discover_count,&LOCK_status); statistic_increment(thd->status_var.ha_discover_count,&LOCK_status);
DBUG_RETURN(error); DBUG_RETURN(error);
......
...@@ -667,6 +667,8 @@ struct handlerton ...@@ -667,6 +667,8 @@ struct handlerton
enum handler_create_iterator_result enum handler_create_iterator_result
(*create_iterator)(enum handler_iterator_type type, (*create_iterator)(enum handler_iterator_type type,
struct handler_iterator *fill_this_in); struct handler_iterator *fill_this_in);
int (*discover)(THD* thd, const char *db, const char *name,
const void** frmblob, uint* frmlen);
}; };
...@@ -1589,7 +1591,6 @@ private: ...@@ -1589,7 +1591,6 @@ private:
/* Some extern variables used with handlers */ /* Some extern variables used with handlers */
extern handlerton *sys_table_types[];
extern const char *ha_row_type[]; extern const char *ha_row_type[];
extern TYPELIB tx_isolation_typelib; extern TYPELIB tx_isolation_typelib;
extern TYPELIB myisam_stats_method_typelib; extern TYPELIB myisam_stats_method_typelib;
......
...@@ -357,9 +357,7 @@ my_bool opt_show_slave_auth_info, opt_sql_bin_update = 0; ...@@ -357,9 +357,7 @@ my_bool opt_show_slave_auth_info, opt_sql_bin_update = 0;
my_bool opt_log_slave_updates= 0; my_bool opt_log_slave_updates= 0;
my_bool opt_innodb; my_bool opt_innodb;
#ifdef WITH_INNOBASE_STORAGE_ENGINE #ifdef WITH_INNOBASE_STORAGE_ENGINE
extern uint innobase_init_flags, innobase_lock_type; extern ulong innobase_fast_shutdown;
extern uint innobase_flush_log_at_trx_commit;
extern ulong innobase_cache_size, innobase_fast_shutdown;
extern ulong innobase_large_page_size; extern ulong innobase_large_page_size;
extern char *innobase_home, *innobase_tmpdir, *innobase_logdir; extern char *innobase_home, *innobase_tmpdir, *innobase_logdir;
extern long innobase_lock_scan_time; extern long innobase_lock_scan_time;
...@@ -383,11 +381,6 @@ extern my_bool innobase_log_archive, ...@@ -383,11 +381,6 @@ extern my_bool innobase_log_archive,
innobase_use_native_aio, innobase_use_native_aio,
innobase_file_per_table, innobase_locks_unsafe_for_binlog, innobase_file_per_table, innobase_locks_unsafe_for_binlog,
innobase_create_status_file; innobase_create_status_file;
extern my_bool innobase_very_fast_shutdown; /* set this to 1 just before
calling innobase_end() if you want
InnoDB to shut down without
flushing the buffer pool: this
is equivalent to a 'crash' */
extern "C" { extern "C" {
extern ulong srv_max_buf_pool_modified_pct; extern ulong srv_max_buf_pool_modified_pct;
extern ulong srv_max_purge_lag; extern ulong srv_max_purge_lag;
......
...@@ -927,7 +927,7 @@ my_bool plugin_foreach(THD *thd, plugin_foreach_func *func, ...@@ -927,7 +927,7 @@ my_bool plugin_foreach(THD *thd, plugin_foreach_func *func,
{ {
uint idx; uint idx;
struct st_plugin_int *plugin; struct st_plugin_int *plugin;
DBUG_ENTER("mysql_uninstall_plugin"); DBUG_ENTER("plugin_foreach");
rw_rdlock(&THR_LOCK_plugin); rw_rdlock(&THR_LOCK_plugin);
if (type == MYSQL_ANY_PLUGIN) if (type == MYSQL_ANY_PLUGIN)
......
...@@ -157,6 +157,7 @@ static int tina_init_func() ...@@ -157,6 +157,7 @@ static int tina_init_func()
VOID(pthread_mutex_init(&tina_mutex,MY_MUTEX_INIT_FAST)); VOID(pthread_mutex_init(&tina_mutex,MY_MUTEX_INIT_FAST));
(void) hash_init(&tina_open_tables,system_charset_info,32,0,0, (void) hash_init(&tina_open_tables,system_charset_info,32,0,0,
(hash_get_key) tina_get_key,0,0); (hash_get_key) tina_get_key,0,0);
bzero(&tina_hton, sizeof(handlerton));
tina_hton.state= SHOW_OPTION_YES; tina_hton.state= SHOW_OPTION_YES;
tina_hton.db_type= DB_TYPE_CSV_DB; tina_hton.db_type= DB_TYPE_CSV_DB;
tina_hton.create= tina_create_handler; tina_hton.create= tina_create_handler;
......
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