diff options
author | unknown <brian@zim.(none)> | 2006-08-25 13:31:15 -0700 |
---|---|---|
committer | unknown <brian@zim.(none)> | 2006-08-25 13:31:15 -0700 |
commit | ac11ba6c68f6cde4f77a5b853dbd457f1098d33e (patch) | |
tree | 825c18473a6c308d0d012e1296f6a6d742e60552 | |
parent | 4ec86b1c0453c18092a9f66292b19afbceadd9dc (diff) | |
download | mariadb-git-ac11ba6c68f6cde4f77a5b853dbd457f1098d33e.tar.gz |
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.
sql/ha_innodb.h:
Unused variable
sql/ha_ndbcluster.cc:
Added "discover" to handlerton.
sql/handler.cc:
Added plugin loop and correctly now use handler API.
sql/handler.h:
Removed unused variable. Added discover to handler API
sql/mysqld.cc:
Removed unused variables.
sql/sql_plugin.cc:
Fixed DBUG Enter comment (obvious cut paste mistake)
storage/csv/ha_tina.cc:
Found that if we don't bzero handlerton, that things can go boom!
This probably needs to be fixed for all handlers
-rw-r--r-- | sql/ha_innodb.h | 6 | ||||
-rw-r--r-- | sql/ha_ndbcluster.cc | 1 | ||||
-rw-r--r-- | sql/handler.cc | 31 | ||||
-rw-r--r-- | sql/handler.h | 3 | ||||
-rw-r--r-- | sql/mysqld.cc | 9 | ||||
-rw-r--r-- | sql/sql_plugin.cc | 2 | ||||
-rw-r--r-- | storage/csv/ha_tina.cc | 1 |
7 files changed, 33 insertions, 20 deletions
diff --git a/sql/ha_innodb.h b/sql/ha_innodb.h index ba8560f717f..4d5dc6b52d6 100644 --- a/sql/ha_innodb.h +++ b/sql/ha_innodb.h @@ -227,12 +227,6 @@ extern my_bool innobase_log_archive, innobase_use_native_aio, innobase_file_per_table, innobase_locks_unsafe_for_binlog, 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 ulong srv_max_buf_pool_modified_pct; extern ulong srv_max_purge_lag; diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 0090f30de19..c7b0ce95214 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -6387,6 +6387,7 @@ static int ndbcluster_init() ndbcluster_binlog_init_handlerton(); #endif h.flags= HTON_CAN_RECREATE | HTON_TEMPORARY_NOT_SUPPORTED; + h.discover= ndbcluster_discover; } if (have_ndbcluster != SHOW_OPTION_YES) diff --git a/sql/handler.cc b/sql/handler.cc index 6fb70d95521..c5087f0e639 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -2705,18 +2705,41 @@ int ha_change_key_cache(KEY_CACHE *old_key_cache, >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, const void **frmblob, uint *frmlen) { int error= -1; // Table does not exist in any handler DBUG_ENTER("ha_discover"); 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 */ DBUG_RETURN(error); -#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE - if (have_ndbcluster == SHOW_OPTION_YES) - error= ndbcluster_discover(thd, db, name, frmblob, frmlen); -#endif + + if (plugin_foreach(thd, discover_handlerton, + MYSQL_STORAGE_ENGINE_PLUGIN, &args)) + error= 0; + if (!error) statistic_increment(thd->status_var.ha_discover_count,&LOCK_status); DBUG_RETURN(error); diff --git a/sql/handler.h b/sql/handler.h index 201a2f1980a..bfc502b0658 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -667,6 +667,8 @@ struct handlerton enum handler_create_iterator_result (*create_iterator)(enum handler_iterator_type type, 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: /* Some extern variables used with handlers */ -extern handlerton *sys_table_types[]; extern const char *ha_row_type[]; extern TYPELIB tx_isolation_typelib; extern TYPELIB myisam_stats_method_typelib; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 7917950529e..46f5e0ae4e9 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -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_innodb; #ifdef WITH_INNOBASE_STORAGE_ENGINE -extern uint innobase_init_flags, innobase_lock_type; -extern uint innobase_flush_log_at_trx_commit; -extern ulong innobase_cache_size, innobase_fast_shutdown; +extern ulong innobase_fast_shutdown; extern ulong innobase_large_page_size; extern char *innobase_home, *innobase_tmpdir, *innobase_logdir; extern long innobase_lock_scan_time; @@ -383,11 +381,6 @@ extern my_bool innobase_log_archive, innobase_use_native_aio, innobase_file_per_table, innobase_locks_unsafe_for_binlog, 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 ulong srv_max_buf_pool_modified_pct; extern ulong srv_max_purge_lag; diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index f7205470abd..51a6a76fdda 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -927,7 +927,7 @@ my_bool plugin_foreach(THD *thd, plugin_foreach_func *func, { uint idx; struct st_plugin_int *plugin; - DBUG_ENTER("mysql_uninstall_plugin"); + DBUG_ENTER("plugin_foreach"); rw_rdlock(&THR_LOCK_plugin); if (type == MYSQL_ANY_PLUGIN) diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc index bec236becd0..354239005fd 100644 --- a/storage/csv/ha_tina.cc +++ b/storage/csv/ha_tina.cc @@ -157,6 +157,7 @@ static int tina_init_func() VOID(pthread_mutex_init(&tina_mutex,MY_MUTEX_INIT_FAST)); (void) hash_init(&tina_open_tables,system_charset_info,32,0,0, (hash_get_key) tina_get_key,0,0); + bzero(&tina_hton, sizeof(handlerton)); tina_hton.state= SHOW_OPTION_YES; tina_hton.db_type= DB_TYPE_CSV_DB; tina_hton.create= tina_create_handler; |