This changes the order of the universe, black is now the new white.
In practice this means that handlerton is now created by the server and is passed to the engine. Plugin startups can now also control how plugins are inited (and can optionally pass values). Bit more flexibility to those who want to write plugin interfaces to the database. include/mysql/plugin.h: Optional to pass parameter now to init and deinit functions sql/ha_ndbcluster.cc: Cleanup, handlerton is now a pointer. sql/ha_ndbcluster_binlog.cc: Cleanup (handlerton is now a pointer) sql/ha_ndbcluster_binlog.h: Cleanup (handlerton is now a pointer) sql/ha_partition.cc: Cleaned up handlerton change sql/handler.cc: Cheanup of handlerton change sql/item_sum.cc: Cleanedup of handlerton change sql/log.cc: Cleanup of handlerton change sql/mysql_priv.h: Reverted patch for variables (what would have happen previously if a have_ would have been called that was dynamically loaded? boom!) sql/mysqld.cc: Cleanup of handlerton changes and reverted have variable patch sql/partition_info.cc: Cleanup of handlerton (we need to clean this up a bit more). sql/set_var.cc: Cleanup related to handlerton changes sql/sql_cache.cc: Handlerton changes cleanup sql/sql_insert.cc: Handlerton changes cleanup. sql/sql_partition.cc: Handlerton cleanup changes sql/sql_plugin.cc: Handlerton changes. init() can now be controlled by a plugin specific startup. There was also an issue with how we deinited the status variables. It should have been occuring before we shut down the engines. sql/sql_select.cc: Handlerton cleanup changes sql/sql_show.cc: Handlerton cleanup changes sql/sql_table.cc: Handlerton cleanup changes sql/table.cc: Cleanup storage/archive/ha_archive.cc: Cleanup storage/archive/ha_archive.h: Cleanup storage/blackhole/ha_blackhole.cc: Cleanup storage/csv/ha_tina.cc: Cleanup storage/example/ha_example.cc: Cleanup storage/federated/ha_federated.cc: Cleanup storage/heap/ha_heap.cc: Cleanup storage/innobase/handler/ha_innodb.cc: Cleanup storage/myisam/ha_myisam.cc: Cleanup storage/myisammrg/ha_myisammrg.cc: Cleanup
This commit is contained in:
parent
e7a27b6a58
commit
d79485a9be
@ -88,8 +88,8 @@ struct st_mysql_plugin
|
||||
const char *name; /* plugin name */
|
||||
const char *author; /* plugin author (for SHOW PLUGINS) */
|
||||
const char *descr; /* general descriptive text (for SHOW PLUGINS ) */
|
||||
int (*init)(void); /* the function to invoke when plugin is loaded */
|
||||
int (*deinit)(void); /* the function to invoke when plugin is unloaded */
|
||||
int (*init)(void *); /* the function to invoke when plugin is loaded */
|
||||
int (*deinit)(void *);/* the function to invoke when plugin is unloaded */
|
||||
unsigned int version; /* plugin version (for SHOW PLUGINS) */
|
||||
struct st_mysql_show_var *status_vars;
|
||||
void * __reserved1; /* placeholder for system variables */
|
||||
|
@ -74,13 +74,13 @@ static const int max_transactions= 3; // should really be 2 but there is a trans
|
||||
|
||||
static uint ndbcluster_partition_flags();
|
||||
static uint ndbcluster_alter_table_flags(uint flags);
|
||||
static int ndbcluster_init(void);
|
||||
static int ndbcluster_init(void *);
|
||||
static int ndbcluster_end(ha_panic_function flag);
|
||||
static bool ndbcluster_show_status(THD*,stat_print_fn *,enum ha_stat_type);
|
||||
static int ndbcluster_alter_tablespace(THD* thd, st_alter_tablespace *info);
|
||||
static int ndbcluster_fill_files_table(THD *thd, TABLE_LIST *tables, COND *cond);
|
||||
|
||||
handlerton ndbcluster_hton;
|
||||
handlerton *ndbcluster_hton;
|
||||
|
||||
static handler *ndbcluster_create_handler(TABLE_SHARE *table,
|
||||
MEM_ROOT *mem_root)
|
||||
@ -4005,7 +4005,7 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
|
||||
thd_ndb->init_open_tables();
|
||||
thd_ndb->stmt= trans;
|
||||
thd_ndb->query_state&= NDB_QUERY_NORMAL;
|
||||
trans_register_ha(thd, FALSE, &ndbcluster_hton);
|
||||
trans_register_ha(thd, FALSE, ndbcluster_hton);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -4021,7 +4021,7 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
|
||||
thd_ndb->init_open_tables();
|
||||
thd_ndb->all= trans;
|
||||
thd_ndb->query_state&= NDB_QUERY_NORMAL;
|
||||
trans_register_ha(thd, TRUE, &ndbcluster_hton);
|
||||
trans_register_ha(thd, TRUE, ndbcluster_hton);
|
||||
|
||||
/*
|
||||
If this is the start of a LOCK TABLE, a table look
|
||||
@ -4175,7 +4175,7 @@ int ha_ndbcluster::start_stmt(THD *thd, thr_lock_type lock_type)
|
||||
ERR_RETURN(ndb->getNdbError());
|
||||
no_uncommitted_rows_reset(thd);
|
||||
thd_ndb->stmt= trans;
|
||||
trans_register_ha(thd, FALSE, &ndbcluster_hton);
|
||||
trans_register_ha(thd, FALSE, ndbcluster_hton);
|
||||
}
|
||||
thd_ndb->query_state&= NDB_QUERY_NORMAL;
|
||||
m_active_trans= trans;
|
||||
@ -5544,7 +5544,7 @@ void ha_ndbcluster::get_auto_increment(ulonglong offset, ulonglong increment,
|
||||
HA_HAS_RECORDS
|
||||
|
||||
ha_ndbcluster::ha_ndbcluster(TABLE_SHARE *table_arg):
|
||||
handler(&ndbcluster_hton, table_arg),
|
||||
handler(ndbcluster_hton, table_arg),
|
||||
m_active_trans(NULL),
|
||||
m_active_cursor(NULL),
|
||||
m_table(NULL),
|
||||
@ -6372,35 +6372,36 @@ static int connect_callback()
|
||||
|
||||
extern int ndb_dictionary_is_mysqld;
|
||||
|
||||
static int ndbcluster_init()
|
||||
static int ndbcluster_init(void *p)
|
||||
{
|
||||
int res;
|
||||
DBUG_ENTER("ndbcluster_init");
|
||||
|
||||
ndb_dictionary_is_mysqld= 1;
|
||||
ndbcluster_hton= (handlerton *)p;
|
||||
|
||||
{
|
||||
handlerton &h= ndbcluster_hton;
|
||||
h.state= have_ndbcluster;
|
||||
h.db_type= DB_TYPE_NDBCLUSTER;
|
||||
h.close_connection= ndbcluster_close_connection;
|
||||
h.commit= ndbcluster_commit;
|
||||
h.rollback= ndbcluster_rollback;
|
||||
h.create= ndbcluster_create_handler; /* Create a new handler */
|
||||
h.drop_database= ndbcluster_drop_database; /* Drop a database */
|
||||
h.panic= ndbcluster_end; /* Panic call */
|
||||
h.show_status= ndbcluster_show_status; /* Show status */
|
||||
h.alter_tablespace= ndbcluster_alter_tablespace; /* Show status */
|
||||
h.partition_flags= ndbcluster_partition_flags; /* Partition flags */
|
||||
h.alter_table_flags=ndbcluster_alter_table_flags; /* Alter table flags */
|
||||
h.fill_files_table= ndbcluster_fill_files_table;
|
||||
handlerton *h= ndbcluster_hton;
|
||||
h->state= have_ndbcluster;
|
||||
h->db_type= DB_TYPE_NDBCLUSTER;
|
||||
h->close_connection= ndbcluster_close_connection;
|
||||
h->commit= ndbcluster_commit;
|
||||
h->rollback= ndbcluster_rollback;
|
||||
h->create= ndbcluster_create_handler; /* Create a new handler */
|
||||
h->drop_database= ndbcluster_drop_database; /* Drop a database */
|
||||
h->panic= ndbcluster_end; /* Panic call */
|
||||
h->show_status= ndbcluster_show_status; /* Show status */
|
||||
h->alter_tablespace= ndbcluster_alter_tablespace; /* Show status */
|
||||
h->partition_flags= ndbcluster_partition_flags; /* Partition flags */
|
||||
h->alter_table_flags=ndbcluster_alter_table_flags; /* Alter table flags */
|
||||
h->fill_files_table= ndbcluster_fill_files_table;
|
||||
#ifdef HAVE_NDB_BINLOG
|
||||
ndbcluster_binlog_init_handlerton();
|
||||
#endif
|
||||
h.flags= HTON_CAN_RECREATE | HTON_TEMPORARY_NOT_SUPPORTED;
|
||||
h.discover= ndbcluster_discover;
|
||||
h.find_files= ndbcluster_find_files;
|
||||
h.table_exists_in_engine= ndbcluster_table_exists_in_engine;
|
||||
h->flags= HTON_CAN_RECREATE | HTON_TEMPORARY_NOT_SUPPORTED;
|
||||
h->discover= ndbcluster_discover;
|
||||
h->find_files= ndbcluster_find_files;
|
||||
h->table_exists_in_engine= ndbcluster_table_exists_in_engine;
|
||||
}
|
||||
|
||||
if (have_ndbcluster != SHOW_OPTION_YES)
|
||||
@ -6509,6 +6510,8 @@ ndbcluster_init_error:
|
||||
delete g_ndb_cluster_connection;
|
||||
g_ndb_cluster_connection= NULL;
|
||||
have_ndbcluster= SHOW_OPTION_DISABLED; // If we couldn't use handler
|
||||
ndbcluster_hton->state= SHOW_OPTION_DISABLED; // If we couldn't use handler
|
||||
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
@ -8113,7 +8116,7 @@ pthread_handler_t ndb_util_thread_func(void *arg __attribute__((unused)))
|
||||
Wait for cluster to start
|
||||
*/
|
||||
pthread_mutex_lock(&LOCK_ndb_util_thread);
|
||||
while (!ndb_cluster_node_id && (ndbcluster_hton.slot != ~(uint)0))
|
||||
while (!ndb_cluster_node_id && (ndbcluster_hton->slot != ~(uint)0))
|
||||
{
|
||||
/* ndb not connected yet */
|
||||
set_timespec(abstime, 1);
|
||||
@ -10604,7 +10607,7 @@ SHOW_VAR ndb_status_variables_export[]= {
|
||||
};
|
||||
|
||||
struct st_mysql_storage_engine ndbcluster_storage_engine=
|
||||
{ MYSQL_HANDLERTON_INTERFACE_VERSION, &ndbcluster_hton };
|
||||
{ MYSQL_HANDLERTON_INTERFACE_VERSION, ndbcluster_hton };
|
||||
|
||||
mysql_declare_plugin(ndbcluster)
|
||||
{
|
||||
|
@ -662,9 +662,9 @@ static int ndbcluster_binlog_func(THD *thd, enum_binlog_func fn, void *arg)
|
||||
|
||||
void ndbcluster_binlog_init_handlerton()
|
||||
{
|
||||
handlerton &h= ndbcluster_hton;
|
||||
h.binlog_func= ndbcluster_binlog_func;
|
||||
h.binlog_log_query= ndbcluster_binlog_log_query;
|
||||
handlerton *h= ndbcluster_hton;
|
||||
h->binlog_func= ndbcluster_binlog_func;
|
||||
h->binlog_log_query= ndbcluster_binlog_log_query;
|
||||
}
|
||||
|
||||
|
||||
@ -3431,7 +3431,7 @@ restart:
|
||||
|
||||
if (thd_ndb == NULL)
|
||||
{
|
||||
DBUG_ASSERT(ndbcluster_hton.slot != ~(uint)0);
|
||||
DBUG_ASSERT(ndbcluster_hton->slot != ~(uint)0);
|
||||
if (!(thd_ndb= ha_ndbcluster::seize_thd_ndb()))
|
||||
{
|
||||
sql_print_error("Could not allocate Thd_ndb object");
|
||||
|
@ -103,7 +103,7 @@ extern pthread_mutex_t injector_mutex;
|
||||
extern pthread_cond_t injector_cond;
|
||||
|
||||
extern unsigned char g_node_id_map[max_ndb_nodes];
|
||||
extern handlerton ndbcluster_hton;
|
||||
extern handlerton *ndbcluster_hton;
|
||||
extern pthread_t ndb_util_thread;
|
||||
extern pthread_mutex_t LOCK_ndb_util_thread;
|
||||
extern pthread_cond_t COND_ndb_util_thread;
|
||||
@ -212,10 +212,10 @@ inline void real_free_share(NDB_SHARE **share)
|
||||
|
||||
inline
|
||||
Thd_ndb *
|
||||
get_thd_ndb(THD *thd) { return (Thd_ndb *) thd->ha_data[ndbcluster_hton.slot]; }
|
||||
get_thd_ndb(THD *thd) { return (Thd_ndb *) thd->ha_data[ndbcluster_hton->slot]; }
|
||||
|
||||
inline
|
||||
void
|
||||
set_thd_ndb(THD *thd, Thd_ndb *thd_ndb) { thd->ha_data[ndbcluster_hton.slot]= thd_ndb; }
|
||||
set_thd_ndb(THD *thd, Thd_ndb *thd_ndb) { thd->ha_data[ndbcluster_hton->slot]= thd_ndb; }
|
||||
|
||||
Ndb* check_ndb_in_thd(THD* thd);
|
||||
|
@ -74,16 +74,20 @@ static handler *partition_create_handler(TABLE_SHARE *share,
|
||||
static uint partition_flags();
|
||||
static uint alter_table_flags(uint flags);
|
||||
|
||||
handlerton partition_hton;
|
||||
handlerton *partition_hton;
|
||||
|
||||
static int partition_initialize()
|
||||
static int partition_initialize(void *p)
|
||||
{
|
||||
partition_hton.state= SHOW_OPTION_YES;
|
||||
partition_hton.db_type= DB_TYPE_PARTITION_DB;
|
||||
partition_hton.create= partition_create_handler;
|
||||
partition_hton.partition_flags= partition_flags;
|
||||
partition_hton.alter_table_flags= alter_table_flags;
|
||||
partition_hton.flags= HTON_NOT_USER_SELECTABLE | HTON_HIDDEN;
|
||||
|
||||
partition_hton= (handlerton *)p;
|
||||
|
||||
partition_hton->state= SHOW_OPTION_YES;
|
||||
partition_hton->db_type= DB_TYPE_PARTITION_DB;
|
||||
partition_hton->create= partition_create_handler;
|
||||
partition_hton->partition_flags= partition_flags;
|
||||
partition_hton->alter_table_flags= alter_table_flags;
|
||||
partition_hton->flags= HTON_NOT_USER_SELECTABLE | HTON_HIDDEN;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -152,7 +156,7 @@ static uint alter_table_flags(uint flags __attribute__((unused)))
|
||||
*/
|
||||
|
||||
ha_partition::ha_partition(TABLE_SHARE *share)
|
||||
:handler(&partition_hton, share), m_part_info(NULL), m_create_handler(FALSE),
|
||||
:handler(partition_hton, share), m_part_info(NULL), m_create_handler(FALSE),
|
||||
m_is_sub_partitioned(0)
|
||||
{
|
||||
DBUG_ENTER("ha_partition::ha_partition(table)");
|
||||
@ -173,7 +177,7 @@ ha_partition::ha_partition(TABLE_SHARE *share)
|
||||
*/
|
||||
|
||||
ha_partition::ha_partition(partition_info *part_info)
|
||||
:handler(&partition_hton, NULL), m_part_info(part_info),
|
||||
:handler(partition_hton, NULL), m_part_info(part_info),
|
||||
m_create_handler(TRUE),
|
||||
m_is_sub_partitioned(m_part_info->is_sub_partitioned())
|
||||
|
||||
@ -2016,7 +2020,7 @@ bool ha_partition::create_handlers(MEM_ROOT *mem_root)
|
||||
DBUG_PRINT("info", ("engine_type: %u", m_engine_array[i]));
|
||||
}
|
||||
/* For the moment we only support partition over the same table engine */
|
||||
if (m_engine_array[0] == &myisam_hton)
|
||||
if (m_engine_array[0] == myisam_hton)
|
||||
{
|
||||
DBUG_PRINT("info", ("MyISAM"));
|
||||
m_myisam= TRUE;
|
||||
@ -2089,7 +2093,7 @@ bool ha_partition::new_handlers_from_part_info(MEM_ROOT *mem_root)
|
||||
(uint) ha_legacy_type(part_elem->engine_type)));
|
||||
}
|
||||
} while (++i < m_part_info->no_parts);
|
||||
if (part_elem->engine_type == &myisam_hton)
|
||||
if (part_elem->engine_type == myisam_hton)
|
||||
{
|
||||
DBUG_PRINT("info", ("MyISAM"));
|
||||
m_myisam= TRUE;
|
||||
@ -5628,7 +5632,7 @@ static int free_share(PARTITION_SHARE *share)
|
||||
#endif /* NOT_USED */
|
||||
|
||||
struct st_mysql_storage_engine partition_storage_engine=
|
||||
{ MYSQL_HANDLERTON_INTERFACE_VERSION, &partition_hton };
|
||||
{ MYSQL_HANDLERTON_INTERFACE_VERSION, partition_hton };
|
||||
|
||||
mysql_declare_plugin(partition)
|
||||
{
|
||||
|
@ -97,7 +97,7 @@ handlerton *ha_default_handlerton(THD *thd)
|
||||
return (thd->variables.table_type != NULL) ?
|
||||
thd->variables.table_type :
|
||||
(global_system_variables.table_type != NULL ?
|
||||
global_system_variables.table_type : &myisam_hton);
|
||||
global_system_variables.table_type : myisam_hton);
|
||||
}
|
||||
|
||||
|
||||
@ -378,16 +378,45 @@ int ha_finalize_handlerton(st_plugin_int *plugin)
|
||||
DBUG_RETURN(1);
|
||||
break;
|
||||
};
|
||||
|
||||
if (plugin->plugin->deinit)
|
||||
{
|
||||
/*
|
||||
Today we have no defined/special behavior for uninstalling
|
||||
engine plugins.
|
||||
*/
|
||||
DBUG_PRINT("info", ("Deinitializing plugin: '%s'", plugin->name.str));
|
||||
if (plugin->plugin->deinit(NULL))
|
||||
{
|
||||
DBUG_PRINT("warning", ("Plugin '%s' deinit function returned error.",
|
||||
plugin->name.str));
|
||||
}
|
||||
}
|
||||
|
||||
my_free((gptr)hton, MYF(0));
|
||||
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
||||
int ha_initialize_handlerton(st_plugin_int *plugin)
|
||||
{
|
||||
handlerton *hton= ((st_mysql_storage_engine *)plugin->plugin->info)->handlerton;
|
||||
handlerton *hton;
|
||||
DBUG_ENTER("ha_initialize_handlerton");
|
||||
|
||||
hton= (handlerton *)my_malloc(sizeof(handlerton),
|
||||
MYF(MY_WME | MY_ZEROFILL));
|
||||
/* Historical Requirement */
|
||||
plugin->data= hton; // shortcut for the future
|
||||
if (plugin->plugin->init)
|
||||
{
|
||||
if (plugin->plugin->init(hton))
|
||||
{
|
||||
sql_print_error("Plugin '%s' init function returned error.",
|
||||
plugin->name.str);
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
the switch below and hton->state should be removed when
|
||||
@ -435,6 +464,8 @@ int ha_initialize_handlerton(st_plugin_int *plugin)
|
||||
break;
|
||||
}
|
||||
DBUG_RETURN(0);
|
||||
err:
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
||||
int ha_init()
|
||||
|
@ -2547,7 +2547,7 @@ bool Item_sum_count_distinct::setup(THD *thd)
|
||||
table->file->extra(HA_EXTRA_NO_ROWS); // Don't update rows
|
||||
table->no_rows=1;
|
||||
|
||||
if (table->s->db_type == &heap_hton)
|
||||
if (table->s->db_type == heap_hton)
|
||||
{
|
||||
/*
|
||||
No blobs, otherwise it would have been MyISAM: set up a compare
|
||||
|
62
sql/log.cc
62
sql/log.cc
@ -90,7 +90,7 @@ struct binlog_trx_data {
|
||||
#endif
|
||||
};
|
||||
|
||||
handlerton binlog_hton;
|
||||
handlerton *binlog_hton;
|
||||
|
||||
/*
|
||||
Open log table of a given type (general or slow log)
|
||||
@ -1155,30 +1155,30 @@ void Log_to_csv_event_handler::
|
||||
should be moved here.
|
||||
*/
|
||||
|
||||
int binlog_init()
|
||||
int binlog_init(void *p)
|
||||
{
|
||||
|
||||
binlog_hton.state=opt_bin_log ? SHOW_OPTION_YES : SHOW_OPTION_NO;
|
||||
binlog_hton.db_type=DB_TYPE_BINLOG;
|
||||
binlog_hton.savepoint_offset= sizeof(my_off_t);
|
||||
binlog_hton.close_connection= binlog_close_connection;
|
||||
binlog_hton.savepoint_set= binlog_savepoint_set;
|
||||
binlog_hton.savepoint_rollback= binlog_savepoint_rollback;
|
||||
binlog_hton.commit= binlog_commit;
|
||||
binlog_hton.rollback= binlog_rollback;
|
||||
binlog_hton.prepare= binlog_prepare;
|
||||
binlog_hton.flags= HTON_NOT_USER_SELECTABLE | HTON_HIDDEN;
|
||||
binlog_hton= (handlerton *)p;
|
||||
binlog_hton->state=opt_bin_log ? SHOW_OPTION_YES : SHOW_OPTION_NO;
|
||||
binlog_hton->db_type=DB_TYPE_BINLOG;
|
||||
binlog_hton->savepoint_offset= sizeof(my_off_t);
|
||||
binlog_hton->close_connection= binlog_close_connection;
|
||||
binlog_hton->savepoint_set= binlog_savepoint_set;
|
||||
binlog_hton->savepoint_rollback= binlog_savepoint_rollback;
|
||||
binlog_hton->commit= binlog_commit;
|
||||
binlog_hton->rollback= binlog_rollback;
|
||||
binlog_hton->prepare= binlog_prepare;
|
||||
binlog_hton->flags= HTON_NOT_USER_SELECTABLE | HTON_HIDDEN;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int binlog_close_connection(THD *thd)
|
||||
{
|
||||
binlog_trx_data *const trx_data=
|
||||
(binlog_trx_data*) thd->ha_data[binlog_hton.slot];
|
||||
(binlog_trx_data*) thd->ha_data[binlog_hton->slot];
|
||||
IO_CACHE *trans_log= &trx_data->trans_log;
|
||||
DBUG_ASSERT(mysql_bin_log.is_open() && trx_data->empty());
|
||||
close_cached_file(trans_log);
|
||||
thd->ha_data[binlog_hton.slot]= 0;
|
||||
thd->ha_data[binlog_hton->slot]= 0;
|
||||
my_free((gptr)trx_data, MYF(0));
|
||||
return 0;
|
||||
}
|
||||
@ -1253,7 +1253,7 @@ static int binlog_commit(THD *thd, bool all)
|
||||
{
|
||||
DBUG_ENTER("binlog_commit");
|
||||
binlog_trx_data *const trx_data=
|
||||
(binlog_trx_data*) thd->ha_data[binlog_hton.slot];
|
||||
(binlog_trx_data*) thd->ha_data[binlog_hton->slot];
|
||||
IO_CACHE *trans_log= &trx_data->trans_log;
|
||||
DBUG_ASSERT(mysql_bin_log.is_open() &&
|
||||
(all || !(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))));
|
||||
@ -1278,7 +1278,7 @@ static int binlog_rollback(THD *thd, bool all)
|
||||
DBUG_ENTER("binlog_rollback");
|
||||
int error=0;
|
||||
binlog_trx_data *const trx_data=
|
||||
(binlog_trx_data*) thd->ha_data[binlog_hton.slot];
|
||||
(binlog_trx_data*) thd->ha_data[binlog_hton->slot];
|
||||
IO_CACHE *trans_log= &trx_data->trans_log;
|
||||
/*
|
||||
First assert is guaranteed - see trans_register_ha() call below.
|
||||
@ -1330,7 +1330,7 @@ static int binlog_savepoint_set(THD *thd, void *sv)
|
||||
{
|
||||
DBUG_ENTER("binlog_savepoint_set");
|
||||
binlog_trx_data *const trx_data=
|
||||
(binlog_trx_data*) thd->ha_data[binlog_hton.slot];
|
||||
(binlog_trx_data*) thd->ha_data[binlog_hton->slot];
|
||||
DBUG_ASSERT(mysql_bin_log.is_open() && my_b_tell(&trx_data->trans_log));
|
||||
|
||||
*(my_off_t *)sv= my_b_tell(&trx_data->trans_log);
|
||||
@ -1346,7 +1346,7 @@ static int binlog_savepoint_rollback(THD *thd, void *sv)
|
||||
{
|
||||
DBUG_ENTER("binlog_savepoint_rollback");
|
||||
binlog_trx_data *const trx_data=
|
||||
(binlog_trx_data*) thd->ha_data[binlog_hton.slot];
|
||||
(binlog_trx_data*) thd->ha_data[binlog_hton->slot];
|
||||
IO_CACHE *trans_log= &trx_data->trans_log;
|
||||
DBUG_ASSERT(mysql_bin_log.is_open() && my_b_tell(trans_log));
|
||||
|
||||
@ -3076,19 +3076,19 @@ int THD::binlog_setup_trx_data()
|
||||
{
|
||||
DBUG_ENTER("THD::binlog_setup_trx_data");
|
||||
binlog_trx_data *trx_data=
|
||||
(binlog_trx_data*) ha_data[binlog_hton.slot];
|
||||
(binlog_trx_data*) ha_data[binlog_hton->slot];
|
||||
|
||||
if (trx_data)
|
||||
DBUG_RETURN(0); // Already set up
|
||||
|
||||
ha_data[binlog_hton.slot]= trx_data=
|
||||
ha_data[binlog_hton->slot]= trx_data=
|
||||
(binlog_trx_data*) my_malloc(sizeof(binlog_trx_data), MYF(MY_ZEROFILL));
|
||||
if (!trx_data ||
|
||||
open_cached_file(&trx_data->trans_log, mysql_tmpdir,
|
||||
LOG_PREFIX, binlog_cache_size, MYF(MY_WME)))
|
||||
{
|
||||
my_free((gptr)trx_data, MYF(MY_ALLOW_ZERO_PTR));
|
||||
ha_data[binlog_hton.slot]= 0;
|
||||
ha_data[binlog_hton->slot]= 0;
|
||||
DBUG_RETURN(1); // Didn't manage to set it up
|
||||
}
|
||||
trx_data->trans_log.end_of_file= max_binlog_cache_size;
|
||||
@ -3124,7 +3124,7 @@ int THD::binlog_write_table_map(TABLE *table, bool is_trans)
|
||||
if (is_trans)
|
||||
trans_register_ha(this,
|
||||
(options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) != 0,
|
||||
&binlog_hton);
|
||||
binlog_hton);
|
||||
|
||||
if ((error= mysql_bin_log.write(&the_event)))
|
||||
DBUG_RETURN(error);
|
||||
@ -3138,7 +3138,7 @@ Rows_log_event*
|
||||
THD::binlog_get_pending_rows_event() const
|
||||
{
|
||||
binlog_trx_data *const trx_data=
|
||||
(binlog_trx_data*) ha_data[binlog_hton.slot];
|
||||
(binlog_trx_data*) ha_data[binlog_hton->slot];
|
||||
/*
|
||||
This is less than ideal, but here's the story: If there is no
|
||||
trx_data, prepare_pending_rows_event() has never been called
|
||||
@ -3151,11 +3151,11 @@ THD::binlog_get_pending_rows_event() const
|
||||
void
|
||||
THD::binlog_set_pending_rows_event(Rows_log_event* ev)
|
||||
{
|
||||
if (ha_data[binlog_hton.slot] == NULL)
|
||||
if (ha_data[binlog_hton->slot] == NULL)
|
||||
binlog_setup_trx_data();
|
||||
|
||||
binlog_trx_data *const trx_data=
|
||||
(binlog_trx_data*) ha_data[binlog_hton.slot];
|
||||
(binlog_trx_data*) ha_data[binlog_hton->slot];
|
||||
|
||||
DBUG_ASSERT(trx_data);
|
||||
trx_data->pending= ev;
|
||||
@ -3177,7 +3177,7 @@ int MYSQL_BIN_LOG::
|
||||
int error= 0;
|
||||
|
||||
binlog_trx_data *const trx_data=
|
||||
(binlog_trx_data*) thd->ha_data[binlog_hton.slot];
|
||||
(binlog_trx_data*) thd->ha_data[binlog_hton->slot];
|
||||
|
||||
DBUG_ASSERT(trx_data);
|
||||
|
||||
@ -3331,14 +3331,14 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info)
|
||||
goto err;
|
||||
|
||||
binlog_trx_data *const trx_data=
|
||||
(binlog_trx_data*) thd->ha_data[binlog_hton.slot];
|
||||
(binlog_trx_data*) thd->ha_data[binlog_hton->slot];
|
||||
IO_CACHE *trans_log= &trx_data->trans_log;
|
||||
bool trans_log_in_use= my_b_tell(trans_log) != 0;
|
||||
if (event_info->get_cache_stmt() && !trans_log_in_use)
|
||||
trans_register_ha(thd,
|
||||
(thd->options &
|
||||
(OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) != 0,
|
||||
&binlog_hton);
|
||||
binlog_hton);
|
||||
if (event_info->get_cache_stmt() || trans_log_in_use)
|
||||
{
|
||||
DBUG_PRINT("info", ("Using trans_log"));
|
||||
@ -4620,7 +4620,7 @@ int TC_LOG_BINLOG::log(THD *thd, my_xid xid)
|
||||
DBUG_ENTER("TC_LOG_BINLOG::log");
|
||||
Xid_log_event xle(thd, xid);
|
||||
binlog_trx_data *trx_data=
|
||||
(binlog_trx_data*) thd->ha_data[binlog_hton.slot];
|
||||
(binlog_trx_data*) thd->ha_data[binlog_hton->slot];
|
||||
DBUG_RETURN(!binlog_end_trans(thd, trx_data, &xle)); // invert return value
|
||||
}
|
||||
|
||||
@ -4681,7 +4681,7 @@ err1:
|
||||
}
|
||||
|
||||
struct st_mysql_storage_engine binlog_storage_engine=
|
||||
{ MYSQL_HANDLERTON_INTERFACE_VERSION, &binlog_hton };
|
||||
{ MYSQL_HANDLERTON_INTERFACE_VERSION, binlog_hton };
|
||||
|
||||
mysql_declare_plugin(binlog)
|
||||
{
|
||||
|
@ -1624,61 +1624,63 @@ extern TYPELIB log_output_typelib;
|
||||
/* optional things, have_* variables */
|
||||
|
||||
#ifdef WITH_INNOBASE_STORAGE_ENGINE
|
||||
extern handlerton innobase_hton;
|
||||
#define have_innodb innobase_hton.state
|
||||
extern handlerton *innobase_hton;
|
||||
extern SHOW_COMP_OPTION have_innodb;
|
||||
#else
|
||||
extern SHOW_COMP_OPTION have_innodb;
|
||||
#endif
|
||||
#ifdef WITH_EXAMPLE_STORAGE_ENGINE
|
||||
extern handlerton example_hton;
|
||||
#define have_example_db example_hton.state
|
||||
extern handlerton *example_hton;
|
||||
extern SHOW_COMP_OPTION have_example_db;
|
||||
#else
|
||||
extern SHOW_COMP_OPTION have_example_db;
|
||||
#endif
|
||||
#ifdef WITH_ARCHIVE_STORAGE_ENGINE
|
||||
extern handlerton archive_hton;
|
||||
#define have_archive_db archive_hton.state
|
||||
extern handlerton *archive_hton;
|
||||
extern SHOW_COMP_OPTION have_archive_db;
|
||||
#else
|
||||
extern SHOW_COMP_OPTION have_archive_db;
|
||||
#endif
|
||||
#ifdef WITH_CSV_STORAGE_ENGINE
|
||||
extern handlerton tina_hton;
|
||||
#define have_csv_db tina_hton.state
|
||||
extern handlerton *tina_hton;
|
||||
extern SHOW_COMP_OPTION have_csv_db;
|
||||
#else
|
||||
extern SHOW_COMP_OPTION have_csv_db;
|
||||
#endif
|
||||
#ifdef WITH_FEDERATED_STORAGE_ENGINE
|
||||
extern handlerton federated_hton;
|
||||
#define have_federated_db federated_hton.state
|
||||
extern handlerton *federated_hton;
|
||||
extern SHOW_COMP_OPTION have_federated_db;
|
||||
#else
|
||||
extern SHOW_COMP_OPTION have_federated_db;
|
||||
#endif
|
||||
#ifdef WITH_BLACKHOLE_STORAGE_ENGINE
|
||||
extern handlerton blackhole_hton;
|
||||
#define have_blackhole_db blackhole_hton.state
|
||||
extern handlerton *blackhole_hton;
|
||||
extern SHOW_COMP_OPTION have_blackhole_db;
|
||||
#else
|
||||
extern SHOW_COMP_OPTION have_blackhole_db;
|
||||
#endif
|
||||
#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
|
||||
extern handlerton ndbcluster_hton;
|
||||
#define have_ndbcluster ndbcluster_hton.state
|
||||
extern handlerton *ndbcluster_hton;
|
||||
extern SHOW_COMP_OPTION have_ndbcluster;
|
||||
#else
|
||||
extern SHOW_COMP_OPTION have_ndbcluster;
|
||||
#endif
|
||||
#ifdef WITH_PARTITION_STORAGE_ENGINE
|
||||
extern handlerton partition_hton;
|
||||
#define have_partition_db partition_hton.state
|
||||
extern handlerton *partition_hton;
|
||||
extern SHOW_COMP_OPTION have_partition_db;
|
||||
#else
|
||||
extern SHOW_COMP_OPTION have_partition_db;
|
||||
#endif
|
||||
|
||||
extern handlerton myisammrg_hton;
|
||||
/* MRG_MYISAM handler is always built, but may be skipped */
|
||||
#define have_merge_db myisammrg_hton.state
|
||||
#ifdef WITH_MYISAMMRG_STORAGE_ENGINE
|
||||
extern handlerton *myisammrg_hton;
|
||||
extern SHOW_COMP_OPTION have_merge_db;
|
||||
#else
|
||||
extern SHOW_COMP_OPTION have_merge_db;
|
||||
#endif
|
||||
|
||||
extern handlerton myisam_hton;
|
||||
extern handlerton myisammrg_hton;
|
||||
extern handlerton heap_hton;
|
||||
extern handlerton *myisam_hton;
|
||||
extern handlerton *heap_hton;
|
||||
|
||||
extern SHOW_COMP_OPTION have_row_based_replication;
|
||||
extern SHOW_COMP_OPTION have_raid, have_openssl, have_symlink, have_dlopen;
|
||||
|
@ -3247,7 +3247,7 @@ server.");
|
||||
default_storage_engine_str);
|
||||
unireg_abort(1);
|
||||
}
|
||||
hton= &myisam_hton;
|
||||
hton= myisam_hton;
|
||||
}
|
||||
global_system_variables.table_type= hton;
|
||||
}
|
||||
@ -6963,7 +6963,7 @@ static void mysql_init_variables(void)
|
||||
|
||||
/* Set default values for some option variables */
|
||||
default_storage_engine_str= (char*) "MyISAM";
|
||||
global_system_variables.table_type= &myisam_hton;
|
||||
global_system_variables.table_type= myisam_hton;
|
||||
global_system_variables.tx_isolation= ISO_REPEATABLE_READ;
|
||||
global_system_variables.select_limit= (ulonglong) HA_POS_ERROR;
|
||||
max_system_variables.select_limit= (ulonglong) HA_POS_ERROR;
|
||||
@ -6984,6 +6984,51 @@ static void mysql_init_variables(void)
|
||||
"d:t:i:o,/tmp/mysqld.trace");
|
||||
#endif
|
||||
opt_error_log= IF_WIN(1,0);
|
||||
#ifdef WITH_MYISAMMRG_STORAGE_ENGINE
|
||||
have_merge_db= SHOW_OPTION_YES;
|
||||
#else
|
||||
have_merge_db= SHOW_OPTION_NO;
|
||||
#endif
|
||||
#ifdef WITH_INNOBASE_STORAGE_ENGINE
|
||||
have_innodb= SHOW_OPTION_YES;
|
||||
#else
|
||||
have_innodb= SHOW_OPTION_NO;
|
||||
#endif
|
||||
#ifdef WITH_EXAMPLE_STORAGE_ENGINE
|
||||
have_example_db= SHOW_OPTION_YES;
|
||||
#else
|
||||
have_example_db= SHOW_OPTION_NO;
|
||||
#endif
|
||||
#ifdef WITH_ARCHIVE_STORAGE_ENGINE
|
||||
have_archive_db= SHOW_OPTION_YES;
|
||||
#else
|
||||
have_archive_db= SHOW_OPTION_NO;
|
||||
#endif
|
||||
#ifdef WITH_BLACKHOLE_STORAGE_ENGINE
|
||||
have_blackhole_db= SHOW_OPTION_YES;
|
||||
#else
|
||||
have_blackhole_db= SHOW_OPTION_NO;
|
||||
#endif
|
||||
#ifdef WITH_FEDERATED_STORAGE_ENGINE
|
||||
have_federated_db= SHOW_OPTION_YES;
|
||||
#else
|
||||
have_federated_db= SHOW_OPTION_NO;
|
||||
#endif
|
||||
#ifdef WITH_CSV_STORAGE_ENGINE
|
||||
have_csv_db= SHOW_OPTION_YES;
|
||||
#else
|
||||
have_csv_db= SHOW_OPTION_NO;
|
||||
#endif
|
||||
#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
|
||||
have_ndbcluster= SHOW_OPTION_DISABLED;
|
||||
#else
|
||||
have_ndbcluster= SHOW_OPTION_NO;
|
||||
#endif
|
||||
#ifdef WITH_PARTITION_STORAGE_ENGINE
|
||||
have_partition_db= SHOW_OPTION_YES;
|
||||
#else
|
||||
have_partition_db= SHOW_OPTION_NO;
|
||||
#endif
|
||||
#ifdef HAVE_ROW_BASED_REPLICATION
|
||||
have_row_based_replication= SHOW_OPTION_YES;
|
||||
#else
|
||||
@ -8050,6 +8095,7 @@ void refresh_status(THD *thd)
|
||||
#undef have_federated_db
|
||||
#undef have_partition_db
|
||||
#undef have_blackhole_db
|
||||
#undef have_merge_db
|
||||
|
||||
SHOW_COMP_OPTION have_innodb= SHOW_OPTION_NO;
|
||||
SHOW_COMP_OPTION have_ndbcluster= SHOW_OPTION_NO;
|
||||
@ -8059,6 +8105,7 @@ SHOW_COMP_OPTION have_csv_db= SHOW_OPTION_NO;
|
||||
SHOW_COMP_OPTION have_federated_db= SHOW_OPTION_NO;
|
||||
SHOW_COMP_OPTION have_partition_db= SHOW_OPTION_NO;
|
||||
SHOW_COMP_OPTION have_blackhole_db= SHOW_OPTION_NO;
|
||||
SHOW_COMP_OPTION have_merge_db= SHOW_OPTION_NO;
|
||||
|
||||
#ifndef WITH_INNOBASE_STORAGE_ENGINE
|
||||
uint innobase_flush_log_at_trx_commit;
|
||||
|
@ -443,11 +443,11 @@ bool partition_info::check_engine_mix(handlerton **engine_array, uint no_parts)
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
} while (++i < no_parts);
|
||||
if (engine_array[0] == &myisammrg_hton ||
|
||||
engine_array[0] == &tina_hton)
|
||||
if (engine_array[0] == myisammrg_hton ||
|
||||
engine_array[0] == tina_hton)
|
||||
{
|
||||
my_error(ER_PARTITION_MERGE_ERROR, MYF(0),
|
||||
engine_array[0] == &myisammrg_hton ? "MyISAM Merge" : "CSV");
|
||||
engine_array[0] == myisammrg_hton ? "MyISAM Merge" : "CSV");
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
DBUG_RETURN(FALSE);
|
||||
|
@ -3591,7 +3591,7 @@ byte *sys_var_thd_storage_engine::value_ptr(THD *thd, enum_var_type type,
|
||||
void sys_var_thd_storage_engine::set_default(THD *thd, enum_var_type type)
|
||||
{
|
||||
if (type == OPT_GLOBAL)
|
||||
global_system_variables.*offset= &myisam_hton;
|
||||
global_system_variables.*offset= myisam_hton;
|
||||
else
|
||||
thd->variables.*offset= global_system_variables.*offset;
|
||||
}
|
||||
|
@ -2389,7 +2389,7 @@ Query_cache::register_tables_from_list(TABLE_LIST *tables_used,
|
||||
tables_used->engine_data))
|
||||
DBUG_RETURN(0);
|
||||
|
||||
if (tables_used->table->s->db_type == &myisammrg_hton)
|
||||
if (tables_used->table->s->db_type == myisammrg_hton)
|
||||
{
|
||||
ha_myisammrg *handler = (ha_myisammrg *) tables_used->table->file;
|
||||
MYRG_INFO *file = handler->myrg_info();
|
||||
@ -3013,7 +3013,7 @@ static TABLE_COUNTER_TYPE process_and_count_tables(TABLE_LIST *tables_used,
|
||||
"other non-cacheable table(s)"));
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
if (tables_used->table->s->db_type == &myisammrg_hton)
|
||||
if (tables_used->table->s->db_type == myisammrg_hton)
|
||||
{
|
||||
ha_myisammrg *handler = (ha_myisammrg *)tables_used->table->file;
|
||||
MYRG_INFO *file = handler->myrg_info();
|
||||
|
@ -2767,8 +2767,8 @@ static TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
|
||||
tmp_table.s->db_create_options=0;
|
||||
tmp_table.s->blob_ptr_size= portable_sizeof_char_ptr;
|
||||
tmp_table.s->db_low_byte_first=
|
||||
test(create_info->db_type == &myisam_hton ||
|
||||
create_info->db_type == &heap_hton);
|
||||
test(create_info->db_type == myisam_hton ||
|
||||
create_info->db_type == heap_hton);
|
||||
tmp_table.null_row=tmp_table.maybe_null=0;
|
||||
|
||||
while ((item=it++))
|
||||
|
@ -4677,7 +4677,7 @@ the generated partition syntax in a correct manner.
|
||||
DBUG_PRINT("info", ("partition changed"));
|
||||
*partition_changed= TRUE;
|
||||
}
|
||||
if (create_info->db_type == &partition_hton)
|
||||
if (create_info->db_type == partition_hton)
|
||||
part_info->default_engine_type= table->part_info->default_engine_type;
|
||||
else
|
||||
part_info->default_engine_type= create_info->db_type;
|
||||
@ -4689,7 +4689,7 @@ the generated partition syntax in a correct manner.
|
||||
if (!is_native_partitioned)
|
||||
{
|
||||
DBUG_ASSERT(create_info->db_type);
|
||||
create_info->db_type= &partition_hton;
|
||||
create_info->db_type= partition_hton;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -477,13 +477,6 @@ err:
|
||||
void plugin_deinitialize(struct st_plugin_int *plugin)
|
||||
{
|
||||
|
||||
if (plugin_type_deinitialize[plugin->plugin->type] &&
|
||||
(*plugin_type_deinitialize[plugin->plugin->type])(plugin))
|
||||
{
|
||||
sql_print_error("Plugin '%s' of type %s failed deinitialization",
|
||||
plugin->name.str, plugin_type_names[plugin->plugin->type]);
|
||||
}
|
||||
|
||||
if (plugin->plugin->status_vars)
|
||||
{
|
||||
#ifdef FIX_LATER
|
||||
@ -504,10 +497,18 @@ void plugin_deinitialize(struct st_plugin_int *plugin)
|
||||
#endif /* FIX_LATER */
|
||||
}
|
||||
|
||||
if (plugin->plugin->deinit)
|
||||
if (plugin_type_deinitialize[plugin->plugin->type])
|
||||
{
|
||||
if ((*plugin_type_deinitialize[plugin->plugin->type])(plugin))
|
||||
{
|
||||
sql_print_error("Plugin '%s' of type %s failed deinitialization",
|
||||
plugin->name.str, plugin_type_names[plugin->plugin->type]);
|
||||
}
|
||||
}
|
||||
else if (plugin->plugin->deinit)
|
||||
{
|
||||
DBUG_PRINT("info", ("Deinitializing plugin: '%s'", plugin->name.str));
|
||||
if (plugin->plugin->deinit())
|
||||
if (plugin->plugin->deinit(NULL))
|
||||
{
|
||||
DBUG_PRINT("warning", ("Plugin '%s' deinit function returned error.",
|
||||
plugin->name.str));
|
||||
@ -556,6 +557,27 @@ static int plugin_initialize(struct st_plugin_int *plugin)
|
||||
{
|
||||
DBUG_ENTER("plugin_initialize");
|
||||
|
||||
if (plugin_type_initialize[plugin->plugin->type])
|
||||
{
|
||||
if ((*plugin_type_initialize[plugin->plugin->type])(plugin))
|
||||
{
|
||||
sql_print_error("Plugin '%s' registration as a %s failed.",
|
||||
plugin->name.str, plugin_type_names[plugin->plugin->type]);
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
else if (plugin->plugin->init)
|
||||
{
|
||||
if (plugin->plugin->init(NULL))
|
||||
{
|
||||
sql_print_error("Plugin '%s' init function returned error.",
|
||||
plugin->name.str);
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
||||
plugin->state= PLUGIN_IS_READY;
|
||||
|
||||
if (plugin->plugin->status_vars)
|
||||
{
|
||||
#ifdef FIX_LATER
|
||||
@ -576,24 +598,6 @@ static int plugin_initialize(struct st_plugin_int *plugin)
|
||||
add_status_vars(plugin->plugin->status_vars); // add_status_vars makes a copy
|
||||
#endif /* FIX_LATER */
|
||||
}
|
||||
if (plugin->plugin->init)
|
||||
{
|
||||
if (plugin->plugin->init())
|
||||
{
|
||||
sql_print_error("Plugin '%s' init function returned error.",
|
||||
plugin->name.str);
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
if (plugin_type_initialize[plugin->plugin->type] &&
|
||||
(*plugin_type_initialize[plugin->plugin->type])(plugin))
|
||||
{
|
||||
sql_print_error("Plugin '%s' registration as a %s failed.",
|
||||
plugin->name.str, plugin_type_names[plugin->plugin->type]);
|
||||
goto err;
|
||||
}
|
||||
|
||||
plugin->state= PLUGIN_IS_READY;
|
||||
|
||||
DBUG_RETURN(0);
|
||||
err:
|
||||
|
@ -8857,7 +8857,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
|
||||
OPTION_BIG_TABLES || (select_options & TMP_TABLE_FORCE_MYISAM))
|
||||
{
|
||||
table->file= get_new_handler(share, &table->mem_root,
|
||||
share->db_type= &myisam_hton);
|
||||
share->db_type= myisam_hton);
|
||||
if (group &&
|
||||
(param->group_parts > table->file->max_key_parts() ||
|
||||
param->group_length > table->file->max_key_length()))
|
||||
@ -8866,7 +8866,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
|
||||
else
|
||||
{
|
||||
table->file= get_new_handler(share, &table->mem_root,
|
||||
share->db_type= &heap_hton);
|
||||
share->db_type= heap_hton);
|
||||
}
|
||||
if (!table->file)
|
||||
goto err;
|
||||
@ -9027,7 +9027,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
|
||||
if (thd->variables.tmp_table_size == ~(ulong) 0) // No limit
|
||||
share->max_rows= ~(ha_rows) 0;
|
||||
else
|
||||
share->max_rows= (((share->db_type == &heap_hton) ?
|
||||
share->max_rows= (((share->db_type == heap_hton) ?
|
||||
min(thd->variables.tmp_table_size,
|
||||
thd->variables.max_heap_table_size) :
|
||||
thd->variables.tmp_table_size)/ share->reclength);
|
||||
@ -9172,7 +9172,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
|
||||
if (thd->is_fatal_error) // If end of memory
|
||||
goto err; /* purecov: inspected */
|
||||
share->db_record_offset= 1;
|
||||
if (share->db_type == &myisam_hton)
|
||||
if (share->db_type == myisam_hton)
|
||||
{
|
||||
if (create_myisam_tmp_table(table,param,select_options))
|
||||
goto err;
|
||||
@ -9498,7 +9498,7 @@ bool create_myisam_from_heap(THD *thd, TABLE *table, TMP_TABLE_PARAM *param,
|
||||
int write_err;
|
||||
DBUG_ENTER("create_myisam_from_heap");
|
||||
|
||||
if (table->s->db_type != &heap_hton ||
|
||||
if (table->s->db_type != heap_hton ||
|
||||
error != HA_ERR_RECORD_FILE_FULL)
|
||||
{
|
||||
table->file->print_error(error,MYF(0));
|
||||
@ -9507,9 +9507,9 @@ bool create_myisam_from_heap(THD *thd, TABLE *table, TMP_TABLE_PARAM *param,
|
||||
new_table= *table;
|
||||
share= *table->s;
|
||||
new_table.s= &share;
|
||||
new_table.s->db_type= &myisam_hton;
|
||||
new_table.s->db_type= myisam_hton;
|
||||
if (!(new_table.file= get_new_handler(&share, &new_table.mem_root,
|
||||
&myisam_hton)))
|
||||
myisam_hton)))
|
||||
DBUG_RETURN(1); // End of memory
|
||||
|
||||
save_proc_info=thd->proc_info;
|
||||
@ -12120,7 +12120,7 @@ remove_duplicates(JOIN *join, TABLE *entry,List<Item> &fields, Item *having)
|
||||
|
||||
free_io_cache(entry); // Safety
|
||||
entry->file->info(HA_STATUS_VARIABLE);
|
||||
if (entry->s->db_type == &heap_hton ||
|
||||
if (entry->s->db_type == heap_hton ||
|
||||
(!entry->s->blob_fields &&
|
||||
((ALIGN_SIZE(reclength) + HASH_OVERHEAD) * entry->file->stats.records <
|
||||
thd->variables.sortbuff_size)))
|
||||
|
@ -2925,7 +2925,7 @@ static int get_schema_tables_record(THD *thd, struct st_table_list *tables,
|
||||
ha_row_type[(uint) share->row_type],
|
||||
NullS);
|
||||
#ifdef WITH_PARTITION_STORAGE_ENGINE
|
||||
if (show_table->s->db_type == &partition_hton &&
|
||||
if (show_table->s->db_type == partition_hton &&
|
||||
show_table->part_info != NULL &&
|
||||
show_table->part_info->no_parts > 0)
|
||||
ptr= strmov(ptr, " partitioned");
|
||||
|
@ -3276,7 +3276,7 @@ bool mysql_create_table_internal(THD *thd,
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
if ((part_engine_type == &partition_hton) &&
|
||||
if ((part_engine_type == partition_hton) &&
|
||||
part_info->default_engine_type)
|
||||
{
|
||||
/*
|
||||
@ -3319,7 +3319,7 @@ bool mysql_create_table_internal(THD *thd,
|
||||
part_info->part_info_len= syntax_len;
|
||||
if ((!(engine_type->partition_flags &&
|
||||
engine_type->partition_flags() & HA_CAN_PARTITION)) ||
|
||||
create_info->db_type == &partition_hton)
|
||||
create_info->db_type == partition_hton)
|
||||
{
|
||||
/*
|
||||
The handler assigned to the table cannot handle partitioning.
|
||||
@ -3328,7 +3328,7 @@ bool mysql_create_table_internal(THD *thd,
|
||||
DBUG_PRINT("info", ("db_type: %d",
|
||||
ha_legacy_type(create_info->db_type)));
|
||||
delete file;
|
||||
create_info->db_type= &partition_hton;
|
||||
create_info->db_type= partition_hton;
|
||||
if (!(file= get_ha_partition(part_info)))
|
||||
{
|
||||
DBUG_RETURN(TRUE);
|
||||
@ -6779,7 +6779,7 @@ static bool check_engine(THD *thd, const char *table_name,
|
||||
*new_engine= 0;
|
||||
return TRUE;
|
||||
}
|
||||
*new_engine= &myisam_hton;
|
||||
*new_engine= myisam_hton;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -632,7 +632,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
|
||||
if (!strncmp(next_chunk + 2, "partition", str_db_type_length))
|
||||
{
|
||||
/* Use partition handler */
|
||||
share->db_type= &partition_hton;
|
||||
share->db_type= partition_hton;
|
||||
DBUG_PRINT("info", ("setting dbtype to '%.*s' (%d)",
|
||||
str_db_type_length, next_chunk + 2,
|
||||
ha_legacy_type(share->db_type)));
|
||||
|
@ -145,7 +145,7 @@ static handler *archive_create_handler(TABLE_SHARE *table, MEM_ROOT *mem_root);
|
||||
*/
|
||||
#define ARCHIVE_MIN_ROWS_TO_USE_BULK_INSERT 2
|
||||
|
||||
handlerton archive_hton;
|
||||
handlerton *archive_hton;
|
||||
|
||||
static handler *archive_create_handler(TABLE_SHARE *table, MEM_ROOT *mem_root)
|
||||
{
|
||||
@ -168,24 +168,24 @@ static byte* archive_get_key(ARCHIVE_SHARE *share,uint *length,
|
||||
|
||||
SYNOPSIS
|
||||
archive_db_init()
|
||||
void
|
||||
void *
|
||||
|
||||
RETURN
|
||||
FALSE OK
|
||||
TRUE Error
|
||||
*/
|
||||
|
||||
int archive_db_init()
|
||||
int archive_db_init(void *p)
|
||||
{
|
||||
DBUG_ENTER("archive_db_init");
|
||||
if (archive_inited)
|
||||
DBUG_RETURN(FALSE);
|
||||
|
||||
archive_hton.state=SHOW_OPTION_YES;
|
||||
archive_hton.db_type=DB_TYPE_ARCHIVE_DB;
|
||||
archive_hton.create=archive_create_handler;
|
||||
archive_hton.panic=archive_db_end;
|
||||
archive_hton.flags=HTON_NO_FLAGS;
|
||||
archive_hton= (handlerton *)p;
|
||||
archive_hton->state=SHOW_OPTION_YES;
|
||||
archive_hton->db_type=DB_TYPE_ARCHIVE_DB;
|
||||
archive_hton->create=archive_create_handler;
|
||||
archive_hton->panic=archive_db_end;
|
||||
archive_hton->flags=HTON_NO_FLAGS;
|
||||
|
||||
if (pthread_mutex_init(&archive_mutex, MY_MUTEX_INIT_FAST))
|
||||
goto error;
|
||||
@ -214,7 +214,7 @@ error:
|
||||
FALSE OK
|
||||
*/
|
||||
|
||||
int archive_db_done()
|
||||
int archive_db_done(void *p)
|
||||
{
|
||||
if (archive_inited)
|
||||
{
|
||||
@ -228,11 +228,11 @@ int archive_db_done()
|
||||
|
||||
int archive_db_end(ha_panic_function type)
|
||||
{
|
||||
return archive_db_done();
|
||||
return archive_db_done(NULL);
|
||||
}
|
||||
|
||||
ha_archive::ha_archive(TABLE_SHARE *table_arg)
|
||||
:handler(&archive_hton, table_arg), delayed_insert(0), bulk_insert(0)
|
||||
:handler(archive_hton, table_arg), delayed_insert(0), bulk_insert(0)
|
||||
{
|
||||
/* Set our original buffer from pre-allocated memory */
|
||||
buffer.set((char *)byte_buffer, IO_SIZE, system_charset_info);
|
||||
@ -1571,7 +1571,7 @@ bool ha_archive::check_and_repair(THD *thd)
|
||||
}
|
||||
|
||||
struct st_mysql_storage_engine archive_storage_engine=
|
||||
{ MYSQL_HANDLERTON_INTERFACE_VERSION, &archive_hton };
|
||||
{ MYSQL_HANDLERTON_INTERFACE_VERSION, archive_hton };
|
||||
|
||||
mysql_declare_plugin(archive)
|
||||
{
|
||||
|
@ -139,6 +139,5 @@ public:
|
||||
bool check_and_repair(THD *thd);
|
||||
};
|
||||
|
||||
int archive_db_init(void);
|
||||
int archive_db_end(ha_panic_function type);
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
/* Static declarations for handlerton */
|
||||
|
||||
handlerton blackhole_hton;
|
||||
handlerton *blackhole_hton;
|
||||
static handler *blackhole_create_handler(TABLE_SHARE *table,
|
||||
MEM_ROOT *mem_root)
|
||||
{
|
||||
@ -37,7 +37,7 @@ static handler *blackhole_create_handler(TABLE_SHARE *table,
|
||||
*****************************************************************************/
|
||||
|
||||
ha_blackhole::ha_blackhole(TABLE_SHARE *table_arg)
|
||||
:handler(&blackhole_hton, table_arg)
|
||||
:handler(blackhole_hton, table_arg)
|
||||
{}
|
||||
|
||||
|
||||
@ -201,17 +201,18 @@ int ha_blackhole::index_last(byte * buf)
|
||||
DBUG_RETURN(HA_ERR_END_OF_FILE);
|
||||
}
|
||||
|
||||
static int blackhole_init()
|
||||
static int blackhole_init(void *p)
|
||||
{
|
||||
blackhole_hton.state= SHOW_OPTION_YES;
|
||||
blackhole_hton.db_type= DB_TYPE_BLACKHOLE_DB;
|
||||
blackhole_hton.create= blackhole_create_handler;
|
||||
blackhole_hton.flags= HTON_CAN_RECREATE;
|
||||
blackhole_hton= (handlerton *)p;
|
||||
blackhole_hton->state= SHOW_OPTION_YES;
|
||||
blackhole_hton->db_type= DB_TYPE_BLACKHOLE_DB;
|
||||
blackhole_hton->create= blackhole_create_handler;
|
||||
blackhole_hton->flags= HTON_CAN_RECREATE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct st_mysql_storage_engine blackhole_storage_engine=
|
||||
{ MYSQL_HANDLERTON_INTERFACE_VERSION, &blackhole_hton };
|
||||
{ MYSQL_HANDLERTON_INTERFACE_VERSION, blackhole_hton };
|
||||
|
||||
mysql_declare_plugin(blackhole)
|
||||
{
|
||||
|
@ -75,7 +75,6 @@ pthread_mutex_t tina_mutex;
|
||||
static HASH tina_open_tables;
|
||||
static int tina_init= 0;
|
||||
static handler *tina_create_handler(TABLE_SHARE *table, MEM_ROOT *mem_root);
|
||||
static int tina_init_func();
|
||||
|
||||
off_t Transparent_file::read_next()
|
||||
{
|
||||
@ -124,7 +123,7 @@ char Transparent_file::get_value(off_t offset)
|
||||
return buff[0];
|
||||
}
|
||||
}
|
||||
handlerton tina_hton;
|
||||
handlerton *tina_hton;
|
||||
|
||||
/*****************************************************************************
|
||||
** TINA tables
|
||||
@ -149,25 +148,25 @@ static byte* tina_get_key(TINA_SHARE *share,uint *length,
|
||||
return (byte*) share->table_name;
|
||||
}
|
||||
|
||||
static int tina_init_func()
|
||||
static int tina_init_func(void *p)
|
||||
{
|
||||
if (!tina_init)
|
||||
{
|
||||
tina_hton= (handlerton *)p;
|
||||
tina_init++;
|
||||
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;
|
||||
tina_hton.panic= tina_end;
|
||||
tina_hton.flags= HTON_CAN_RECREATE;
|
||||
tina_hton->state= SHOW_OPTION_YES;
|
||||
tina_hton->db_type= DB_TYPE_CSV_DB;
|
||||
tina_hton->create= tina_create_handler;
|
||||
tina_hton->panic= tina_end;
|
||||
tina_hton->flags= HTON_CAN_RECREATE;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tina_done_func()
|
||||
static int tina_done_func(void *p)
|
||||
{
|
||||
if (tina_init)
|
||||
{
|
||||
@ -195,7 +194,7 @@ static TINA_SHARE *get_share(const char *table_name, TABLE *table)
|
||||
uint length;
|
||||
|
||||
if (!tina_init)
|
||||
tina_init_func();
|
||||
tina_init_func(NULL);
|
||||
|
||||
pthread_mutex_lock(&tina_mutex);
|
||||
length=(uint) strlen(table_name);
|
||||
@ -452,7 +451,7 @@ static int free_share(TINA_SHARE *share)
|
||||
|
||||
int tina_end(ha_panic_function type)
|
||||
{
|
||||
return tina_done_func();
|
||||
return tina_done_func(NULL);
|
||||
}
|
||||
|
||||
|
||||
@ -501,7 +500,7 @@ static handler *tina_create_handler(TABLE_SHARE *table, MEM_ROOT *mem_root)
|
||||
|
||||
|
||||
ha_tina::ha_tina(TABLE_SHARE *table_arg)
|
||||
:handler(&tina_hton, table_arg),
|
||||
:handler(tina_hton, table_arg),
|
||||
/*
|
||||
These definitions are found in handler.h
|
||||
They are not probably completely right.
|
||||
@ -1517,7 +1516,7 @@ bool ha_tina::check_if_incompatible_data(HA_CREATE_INFO *info,
|
||||
}
|
||||
|
||||
struct st_mysql_storage_engine csv_storage_engine=
|
||||
{ MYSQL_HANDLERTON_INTERFACE_VERSION, &tina_hton };
|
||||
{ MYSQL_HANDLERTON_INTERFACE_VERSION, tina_hton };
|
||||
|
||||
mysql_declare_plugin(csv)
|
||||
{
|
||||
|
@ -78,7 +78,7 @@ static int example_init_func();
|
||||
static bool example_init_func_for_handlerton();
|
||||
static int example_panic(enum ha_panic_function flag);
|
||||
|
||||
handlerton example_hton;
|
||||
handlerton *example_hton;
|
||||
|
||||
/* Variables for example share methods */
|
||||
static HASH example_open_tables; // Hash used to track open tables
|
||||
@ -96,25 +96,26 @@ static byte* example_get_key(EXAMPLE_SHARE *share,uint *length,
|
||||
return (byte*) share->table_name;
|
||||
}
|
||||
|
||||
static int example_init_func()
|
||||
static int example_init_func(void *p)
|
||||
{
|
||||
DBUG_ENTER("example_init_func");
|
||||
if (!example_init)
|
||||
{
|
||||
example_hton= (handlerton *)p;
|
||||
example_init= 1;
|
||||
VOID(pthread_mutex_init(&example_mutex,MY_MUTEX_INIT_FAST));
|
||||
(void) hash_init(&example_open_tables,system_charset_info,32,0,0,
|
||||
(hash_get_key) example_get_key,0,0);
|
||||
|
||||
example_hton.state= SHOW_OPTION_YES;
|
||||
example_hton.db_type= DB_TYPE_EXAMPLE_DB;
|
||||
example_hton.create= example_create_handler;
|
||||
example_hton.flags= HTON_CAN_RECREATE;
|
||||
example_hton->state= SHOW_OPTION_YES;
|
||||
example_hton->db_type= DB_TYPE_EXAMPLE_DB;
|
||||
example_hton->create= example_create_handler;
|
||||
example_hton->flags= HTON_CAN_RECREATE;
|
||||
}
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
static int example_done_func()
|
||||
static int example_done_func(void *p)
|
||||
{
|
||||
int error= 0;
|
||||
DBUG_ENTER("example_done_func");
|
||||
@ -207,7 +208,7 @@ static handler* example_create_handler(TABLE_SHARE *table, MEM_ROOT *mem_root)
|
||||
|
||||
|
||||
ha_example::ha_example(TABLE_SHARE *table_arg)
|
||||
:handler(&example_hton, table_arg)
|
||||
:handler(example_hton, table_arg)
|
||||
{}
|
||||
|
||||
/*
|
||||
@ -702,7 +703,7 @@ int ha_example::create(const char *name, TABLE *table_arg,
|
||||
}
|
||||
|
||||
struct st_mysql_storage_engine example_storage_engine=
|
||||
{ MYSQL_HANDLERTON_INTERFACE_VERSION, &example_hton };
|
||||
{ MYSQL_HANDLERTON_INTERFACE_VERSION, example_hton };
|
||||
|
||||
|
||||
mysql_declare_plugin(example)
|
||||
|
@ -366,7 +366,7 @@ static int federated_rollback(THD *thd, bool all);
|
||||
|
||||
/* Federated storage engine handlerton */
|
||||
|
||||
handlerton federated_hton;
|
||||
handlerton *federated_hton;
|
||||
|
||||
static handler *federated_create_handler(TABLE_SHARE *table,
|
||||
MEM_ROOT *mem_root)
|
||||
@ -396,17 +396,17 @@ static byte *federated_get_key(FEDERATED_SHARE *share, uint *length,
|
||||
TRUE Error
|
||||
*/
|
||||
|
||||
int federated_db_init()
|
||||
int federated_db_init(void *p)
|
||||
{
|
||||
DBUG_ENTER("federated_db_init");
|
||||
|
||||
federated_hton.state= SHOW_OPTION_YES;
|
||||
federated_hton.db_type= DB_TYPE_FEDERATED_DB;
|
||||
federated_hton.commit= federated_commit;
|
||||
federated_hton.rollback= federated_rollback;
|
||||
federated_hton.create= federated_create_handler;
|
||||
federated_hton.panic= federated_db_end;
|
||||
federated_hton.flags= HTON_ALTER_NOT_SUPPORTED;
|
||||
federated_hton= (handlerton *)p;
|
||||
federated_hton->state= SHOW_OPTION_YES;
|
||||
federated_hton->db_type= DB_TYPE_FEDERATED_DB;
|
||||
federated_hton->commit= federated_commit;
|
||||
federated_hton->rollback= federated_rollback;
|
||||
federated_hton->create= federated_create_handler;
|
||||
federated_hton->panic= federated_db_end;
|
||||
federated_hton->flags= HTON_ALTER_NOT_SUPPORTED;
|
||||
|
||||
if (pthread_mutex_init(&federated_mutex, MY_MUTEX_INIT_FAST))
|
||||
goto error;
|
||||
@ -724,7 +724,7 @@ error:
|
||||
*****************************************************************************/
|
||||
|
||||
ha_federated::ha_federated(TABLE_SHARE *table_arg)
|
||||
:handler(&federated_hton, table_arg),
|
||||
:handler(federated_hton, table_arg),
|
||||
mysql(0), stored_result(0)
|
||||
{
|
||||
trx_next= 0;
|
||||
@ -2736,7 +2736,7 @@ bool ha_federated::get_error_message(int error, String* buf)
|
||||
int ha_federated::external_lock(THD *thd, int lock_type)
|
||||
{
|
||||
int error= 0;
|
||||
ha_federated *trx= (ha_federated *)thd->ha_data[federated_hton.slot];
|
||||
ha_federated *trx= (ha_federated *)thd->ha_data[federated_hton->slot];
|
||||
DBUG_ENTER("ha_federated::external_lock");
|
||||
|
||||
if (lock_type != F_UNLCK)
|
||||
@ -2754,7 +2754,7 @@ int ha_federated::external_lock(THD *thd, int lock_type)
|
||||
DBUG_PRINT("info", ("error setting autocommit TRUE: %d", error));
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
trans_register_ha(thd, FALSE, &federated_hton);
|
||||
trans_register_ha(thd, FALSE, federated_hton);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2770,8 +2770,8 @@ int ha_federated::external_lock(THD *thd, int lock_type)
|
||||
DBUG_PRINT("info", ("error setting autocommit FALSE: %d", error));
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
thd->ha_data[federated_hton.slot]= this;
|
||||
trans_register_ha(thd, TRUE, &federated_hton);
|
||||
thd->ha_data[federated_hton->slot]= this;
|
||||
trans_register_ha(thd, TRUE, federated_hton);
|
||||
/*
|
||||
Send a lock table to the remote end.
|
||||
We do not support this at the moment
|
||||
@ -2799,7 +2799,7 @@ int ha_federated::external_lock(THD *thd, int lock_type)
|
||||
static int federated_commit(THD *thd, bool all)
|
||||
{
|
||||
int return_val= 0;
|
||||
ha_federated *trx= (ha_federated *)thd->ha_data[federated_hton.slot];
|
||||
ha_federated *trx= (ha_federated *)thd->ha_data[federated_hton->slot];
|
||||
DBUG_ENTER("federated_commit");
|
||||
|
||||
if (all)
|
||||
@ -2814,7 +2814,7 @@ static int federated_commit(THD *thd, bool all)
|
||||
if (error && !return_val);
|
||||
return_val= error;
|
||||
}
|
||||
thd->ha_data[federated_hton.slot]= NULL;
|
||||
thd->ha_data[federated_hton->slot]= NULL;
|
||||
}
|
||||
|
||||
DBUG_PRINT("info", ("error val: %d", return_val));
|
||||
@ -2825,7 +2825,7 @@ static int federated_commit(THD *thd, bool all)
|
||||
static int federated_rollback(THD *thd, bool all)
|
||||
{
|
||||
int return_val= 0;
|
||||
ha_federated *trx= (ha_federated *)thd->ha_data[federated_hton.slot];
|
||||
ha_federated *trx= (ha_federated *)thd->ha_data[federated_hton->slot];
|
||||
DBUG_ENTER("federated_rollback");
|
||||
|
||||
if (all)
|
||||
@ -2840,7 +2840,7 @@ static int federated_rollback(THD *thd, bool all)
|
||||
if (error && !return_val)
|
||||
return_val= error;
|
||||
}
|
||||
thd->ha_data[federated_hton.slot]= NULL;
|
||||
thd->ha_data[federated_hton->slot]= NULL;
|
||||
}
|
||||
|
||||
DBUG_PRINT("info", ("error val: %d", return_val));
|
||||
@ -2882,7 +2882,7 @@ int ha_federated::execute_simple_query(const char *query, int len)
|
||||
}
|
||||
|
||||
struct st_mysql_storage_engine federated_storage_engine=
|
||||
{ MYSQL_HANDLERTON_INTERFACE_VERSION, &federated_hton };
|
||||
{ MYSQL_HANDLERTON_INTERFACE_VERSION, federated_hton };
|
||||
|
||||
mysql_declare_plugin(federated)
|
||||
{
|
||||
|
@ -27,15 +27,17 @@
|
||||
|
||||
static handler *heap_create_handler(TABLE_SHARE *table, MEM_ROOT *mem_root);
|
||||
|
||||
handlerton heap_hton;
|
||||
handlerton *heap_hton;
|
||||
|
||||
int heap_init()
|
||||
int heap_init(void *p)
|
||||
{
|
||||
heap_hton.state= SHOW_OPTION_YES;
|
||||
heap_hton.db_type= DB_TYPE_HEAP;
|
||||
heap_hton.create= heap_create_handler;
|
||||
heap_hton.panic= heap_panic;
|
||||
heap_hton.flags= HTON_CAN_RECREATE;
|
||||
heap_hton= (handlerton *)p;
|
||||
heap_hton->state= SHOW_OPTION_YES;
|
||||
heap_hton->db_type= DB_TYPE_HEAP;
|
||||
heap_hton->create= heap_create_handler;
|
||||
heap_hton->panic= heap_panic;
|
||||
heap_hton->flags= HTON_CAN_RECREATE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -50,7 +52,7 @@ static handler *heap_create_handler(TABLE_SHARE *table, MEM_ROOT *mem_root)
|
||||
*****************************************************************************/
|
||||
|
||||
ha_heap::ha_heap(TABLE_SHARE *table_arg)
|
||||
:handler(&heap_hton, table_arg), file(0), records_changed(0),
|
||||
:handler(heap_hton, table_arg), file(0), records_changed(0),
|
||||
key_stat_version(0)
|
||||
{}
|
||||
|
||||
@ -696,7 +698,7 @@ bool ha_heap::check_if_incompatible_data(HA_CREATE_INFO *info,
|
||||
}
|
||||
|
||||
struct st_mysql_storage_engine heap_storage_engine=
|
||||
{ MYSQL_HANDLERTON_INTERFACE_VERSION, &heap_hton};
|
||||
{ MYSQL_HANDLERTON_INTERFACE_VERSION, heap_hton};
|
||||
|
||||
mysql_declare_plugin(heap)
|
||||
{
|
||||
|
@ -208,7 +208,7 @@ static handler *innobase_create_handler(TABLE_SHARE *table,
|
||||
|
||||
static const char innobase_hton_name[]= "InnoDB";
|
||||
|
||||
handlerton innobase_hton;
|
||||
handlerton *innobase_hton;
|
||||
|
||||
static handler *innobase_create_handler(TABLE_SHARE *table, MEM_ROOT *mem_root)
|
||||
{
|
||||
@ -389,7 +389,7 @@ innobase_release_temporary_latches(
|
||||
return 0;
|
||||
}
|
||||
|
||||
trx = (trx_t*) thd->ha_data[innobase_hton.slot];
|
||||
trx = (trx_t*) thd->ha_data[innobase_hton->slot];
|
||||
|
||||
if (trx) {
|
||||
innobase_release_stat_resources(trx);
|
||||
@ -847,7 +847,7 @@ check_trx_exists(
|
||||
|
||||
ut_ad(thd == current_thd);
|
||||
|
||||
trx = (trx_t*) thd->ha_data[innobase_hton.slot];
|
||||
trx = (trx_t*) thd->ha_data[innobase_hton->slot];
|
||||
|
||||
if (trx == NULL) {
|
||||
DBUG_ASSERT(thd != NULL);
|
||||
@ -861,7 +861,7 @@ check_trx_exists(
|
||||
CPU time */
|
||||
trx->support_xa = (ibool)(thd->variables.innodb_support_xa);
|
||||
|
||||
thd->ha_data[innobase_hton.slot] = trx;
|
||||
thd->ha_data[innobase_hton->slot] = trx;
|
||||
} else {
|
||||
if (trx->magic_n != TRX_MAGIC_N) {
|
||||
mem_analyze_corruption(trx);
|
||||
@ -890,7 +890,7 @@ check_trx_exists(
|
||||
Construct ha_innobase handler. */
|
||||
|
||||
ha_innobase::ha_innobase(TABLE_SHARE *table_arg)
|
||||
:handler(&innobase_hton, table_arg),
|
||||
:handler(innobase_hton, table_arg),
|
||||
int_table_flags(HA_REC_NOT_IN_SEQ |
|
||||
HA_NULL_IN_KEY |
|
||||
HA_CAN_INDEX_BLOBS |
|
||||
@ -941,7 +941,7 @@ innobase_register_stmt(
|
||||
THD* thd) /* in: MySQL thd (connection) object */
|
||||
{
|
||||
/* Register the statement */
|
||||
trans_register_ha(thd, FALSE, &innobase_hton);
|
||||
trans_register_ha(thd, FALSE, innobase_hton);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
@ -965,7 +965,7 @@ innobase_register_trx_and_stmt(
|
||||
if (thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) {
|
||||
|
||||
/* No autocommit mode, register for a transaction */
|
||||
trans_register_ha(thd, TRUE, &innobase_hton);
|
||||
trans_register_ha(thd, TRUE, innobase_hton);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1329,7 +1329,7 @@ ha_innobase::init_table_handle_for_HANDLER(void)
|
||||
Opens an InnoDB database. */
|
||||
|
||||
int
|
||||
innobase_init(void)
|
||||
innobase_init(void *p)
|
||||
/*===============*/
|
||||
{
|
||||
static char current_dir[3]; /* Set if using current lib */
|
||||
@ -1338,31 +1338,32 @@ innobase_init(void)
|
||||
char *default_path;
|
||||
|
||||
DBUG_ENTER("innobase_init");
|
||||
innobase_hton= (handlerton *)p;
|
||||
|
||||
innobase_hton.state=have_innodb;
|
||||
innobase_hton.db_type= DB_TYPE_INNODB;
|
||||
innobase_hton.savepoint_offset=sizeof(trx_named_savept_t);
|
||||
innobase_hton.close_connection=innobase_close_connection;
|
||||
innobase_hton.savepoint_set=innobase_savepoint;
|
||||
innobase_hton.savepoint_rollback=innobase_rollback_to_savepoint;
|
||||
innobase_hton.savepoint_release=innobase_release_savepoint;
|
||||
innobase_hton.commit=innobase_commit;
|
||||
innobase_hton.rollback=innobase_rollback;
|
||||
innobase_hton.prepare=innobase_xa_prepare;
|
||||
innobase_hton.recover=innobase_xa_recover;
|
||||
innobase_hton.commit_by_xid=innobase_commit_by_xid;
|
||||
innobase_hton.rollback_by_xid=innobase_rollback_by_xid;
|
||||
innobase_hton.create_cursor_read_view=innobase_create_cursor_view;
|
||||
innobase_hton.set_cursor_read_view=innobase_set_cursor_view;
|
||||
innobase_hton.close_cursor_read_view=innobase_close_cursor_view;
|
||||
innobase_hton.create=innobase_create_handler;
|
||||
innobase_hton.drop_database=innobase_drop_database;
|
||||
innobase_hton.panic=innobase_end;
|
||||
innobase_hton.start_consistent_snapshot=innobase_start_trx_and_assign_read_view;
|
||||
innobase_hton.flush_logs=innobase_flush_logs;
|
||||
innobase_hton.show_status=innobase_show_status;
|
||||
innobase_hton.flags=HTON_NO_FLAGS;
|
||||
innobase_hton.release_temporary_latches=innobase_release_temporary_latches;
|
||||
innobase_hton->state=have_innodb;
|
||||
innobase_hton->db_type= DB_TYPE_INNODB;
|
||||
innobase_hton->savepoint_offset=sizeof(trx_named_savept_t);
|
||||
innobase_hton->close_connection=innobase_close_connection;
|
||||
innobase_hton->savepoint_set=innobase_savepoint;
|
||||
innobase_hton->savepoint_rollback=innobase_rollback_to_savepoint;
|
||||
innobase_hton->savepoint_release=innobase_release_savepoint;
|
||||
innobase_hton->commit=innobase_commit;
|
||||
innobase_hton->rollback=innobase_rollback;
|
||||
innobase_hton->prepare=innobase_xa_prepare;
|
||||
innobase_hton->recover=innobase_xa_recover;
|
||||
innobase_hton->commit_by_xid=innobase_commit_by_xid;
|
||||
innobase_hton->rollback_by_xid=innobase_rollback_by_xid;
|
||||
innobase_hton->create_cursor_read_view=innobase_create_cursor_view;
|
||||
innobase_hton->set_cursor_read_view=innobase_set_cursor_view;
|
||||
innobase_hton->close_cursor_read_view=innobase_close_cursor_view;
|
||||
innobase_hton->create=innobase_create_handler;
|
||||
innobase_hton->drop_database=innobase_drop_database;
|
||||
innobase_hton->panic=innobase_end;
|
||||
innobase_hton->start_consistent_snapshot=innobase_start_trx_and_assign_read_view;
|
||||
innobase_hton->flush_logs=innobase_flush_logs;
|
||||
innobase_hton->show_status=innobase_show_status;
|
||||
innobase_hton->flags=HTON_NO_FLAGS;
|
||||
innobase_hton->release_temporary_latches=innobase_release_temporary_latches;
|
||||
|
||||
if (have_innodb != SHOW_OPTION_YES)
|
||||
DBUG_RETURN(0); // nothing else to do
|
||||
@ -1939,7 +1940,7 @@ innobase_commit_complete(
|
||||
{
|
||||
trx_t* trx;
|
||||
|
||||
trx = (trx_t*) thd->ha_data[innobase_hton.slot];
|
||||
trx = (trx_t*) thd->ha_data[innobase_hton->slot];
|
||||
|
||||
if (trx && trx->active_trans) {
|
||||
|
||||
@ -2158,7 +2159,7 @@ innobase_close_connection(
|
||||
{
|
||||
trx_t* trx;
|
||||
|
||||
trx = (trx_t*)thd->ha_data[innobase_hton.slot];
|
||||
trx = (trx_t*)thd->ha_data[innobase_hton->slot];
|
||||
|
||||
ut_a(trx);
|
||||
|
||||
@ -3251,11 +3252,11 @@ ha_innobase::write_row(
|
||||
DBUG_ENTER("ha_innobase::write_row");
|
||||
|
||||
if (prebuilt->trx !=
|
||||
(trx_t*) current_thd->ha_data[innobase_hton.slot]) {
|
||||
(trx_t*) current_thd->ha_data[innobase_hton->slot]) {
|
||||
sql_print_error("The transaction object for the table handle is at "
|
||||
"%p, but for the current thread it is at %p",
|
||||
prebuilt->trx,
|
||||
(trx_t*) current_thd->ha_data[innobase_hton.slot]);
|
||||
(trx_t*) current_thd->ha_data[innobase_hton->slot]);
|
||||
|
||||
fputs("InnoDB: Dump of 200 bytes around prebuilt: ", stderr);
|
||||
ut_print_buf(stderr, ((const byte*)prebuilt) - 100, 200);
|
||||
@ -3263,7 +3264,7 @@ ha_innobase::write_row(
|
||||
"InnoDB: Dump of 200 bytes around transaction.all: ",
|
||||
stderr);
|
||||
ut_print_buf(stderr,
|
||||
((byte*)(&(current_thd->ha_data[innobase_hton.slot]))) - 100,
|
||||
((byte*)(&(current_thd->ha_data[innobase_hton->slot]))) - 100,
|
||||
200);
|
||||
putc('\n', stderr);
|
||||
ut_error;
|
||||
@ -3635,7 +3636,7 @@ ha_innobase::update_row(
|
||||
DBUG_ENTER("ha_innobase::update_row");
|
||||
|
||||
ut_a(prebuilt->trx ==
|
||||
(trx_t*) current_thd->ha_data[innobase_hton.slot]);
|
||||
(trx_t*) current_thd->ha_data[innobase_hton->slot]);
|
||||
|
||||
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
|
||||
table->timestamp_field->set_time();
|
||||
@ -3696,7 +3697,7 @@ ha_innobase::delete_row(
|
||||
DBUG_ENTER("ha_innobase::delete_row");
|
||||
|
||||
ut_a(prebuilt->trx ==
|
||||
(trx_t*) current_thd->ha_data[innobase_hton.slot]);
|
||||
(trx_t*) current_thd->ha_data[innobase_hton->slot]);
|
||||
|
||||
if (last_query_id != user_thd->query_id) {
|
||||
prebuilt->sql_stat_start = TRUE;
|
||||
@ -3794,7 +3795,7 @@ ha_innobase::try_semi_consistent_read(bool yes)
|
||||
row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
|
||||
|
||||
ut_a(prebuilt->trx ==
|
||||
(trx_t*) current_thd->ha_data[innobase_hton.slot]);
|
||||
(trx_t*) current_thd->ha_data[innobase_hton->slot]);
|
||||
|
||||
/* Row read type is set to semi consistent read if this was
|
||||
requested by the MySQL and either innodb_locks_unsafe_for_binlog
|
||||
@ -3961,7 +3962,7 @@ ha_innobase::index_read(
|
||||
DBUG_ENTER("index_read");
|
||||
|
||||
ut_a(prebuilt->trx ==
|
||||
(trx_t*) current_thd->ha_data[innobase_hton.slot]);
|
||||
(trx_t*) current_thd->ha_data[innobase_hton->slot]);
|
||||
|
||||
statistic_increment(current_thd->status_var.ha_read_key_count,
|
||||
&LOCK_status);
|
||||
@ -4076,7 +4077,7 @@ ha_innobase::change_active_index(
|
||||
|
||||
ut_ad(user_thd == current_thd);
|
||||
ut_a(prebuilt->trx ==
|
||||
(trx_t*) current_thd->ha_data[innobase_hton.slot]);
|
||||
(trx_t*) current_thd->ha_data[innobase_hton->slot]);
|
||||
|
||||
active_index = keynr;
|
||||
|
||||
@ -4166,7 +4167,7 @@ ha_innobase::general_fetch(
|
||||
DBUG_ENTER("general_fetch");
|
||||
|
||||
ut_a(prebuilt->trx ==
|
||||
(trx_t*) current_thd->ha_data[innobase_hton.slot]);
|
||||
(trx_t*) current_thd->ha_data[innobase_hton->slot]);
|
||||
|
||||
innodb_srv_conc_enter_innodb(prebuilt->trx);
|
||||
|
||||
@ -4402,7 +4403,7 @@ ha_innobase::rnd_pos(
|
||||
&LOCK_status);
|
||||
|
||||
ut_a(prebuilt->trx ==
|
||||
(trx_t*) current_thd->ha_data[innobase_hton.slot]);
|
||||
(trx_t*) current_thd->ha_data[innobase_hton->slot]);
|
||||
|
||||
if (prebuilt->clust_index_was_generated) {
|
||||
/* No primary key was defined for the table and we
|
||||
@ -4452,7 +4453,7 @@ ha_innobase::position(
|
||||
uint len;
|
||||
|
||||
ut_a(prebuilt->trx ==
|
||||
(trx_t*) current_thd->ha_data[innobase_hton.slot]);
|
||||
(trx_t*) current_thd->ha_data[innobase_hton->slot]);
|
||||
|
||||
if (prebuilt->clust_index_was_generated) {
|
||||
/* No primary key was defined for the table and we
|
||||
@ -4953,7 +4954,7 @@ ha_innobase::discard_or_import_tablespace(
|
||||
|
||||
ut_a(prebuilt->trx && prebuilt->trx->magic_n == TRX_MAGIC_N);
|
||||
ut_a(prebuilt->trx ==
|
||||
(trx_t*) current_thd->ha_data[innobase_hton.slot]);
|
||||
(trx_t*) current_thd->ha_data[innobase_hton->slot]);
|
||||
|
||||
dict_table = prebuilt->table;
|
||||
trx = prebuilt->trx;
|
||||
@ -5281,7 +5282,7 @@ ha_innobase::records_in_range(
|
||||
DBUG_ENTER("records_in_range");
|
||||
|
||||
ut_a(prebuilt->trx ==
|
||||
(trx_t*) current_thd->ha_data[innobase_hton.slot]);
|
||||
(trx_t*) current_thd->ha_data[innobase_hton->slot]);
|
||||
|
||||
prebuilt->trx->op_info = (char*)"estimating records in index range";
|
||||
|
||||
@ -5723,7 +5724,7 @@ ha_innobase::check(
|
||||
|
||||
ut_a(prebuilt->trx && prebuilt->trx->magic_n == TRX_MAGIC_N);
|
||||
ut_a(prebuilt->trx ==
|
||||
(trx_t*) current_thd->ha_data[innobase_hton.slot]);
|
||||
(trx_t*) current_thd->ha_data[innobase_hton->slot]);
|
||||
|
||||
if (prebuilt->mysql_template == NULL) {
|
||||
/* Build the template; we will use a dummy template
|
||||
@ -6007,7 +6008,7 @@ ha_innobase::can_switch_engines(void)
|
||||
DBUG_ENTER("ha_innobase::can_switch_engines");
|
||||
|
||||
ut_a(prebuilt->trx ==
|
||||
(trx_t*) current_thd->ha_data[innobase_hton.slot]);
|
||||
(trx_t*) current_thd->ha_data[innobase_hton->slot]);
|
||||
|
||||
prebuilt->trx->op_info =
|
||||
"determining if there are foreign key constraints";
|
||||
@ -7605,7 +7606,7 @@ SHOW_VAR innodb_status_variables_export[]= {
|
||||
};
|
||||
|
||||
struct st_mysql_storage_engine innobase_storage_engine=
|
||||
{ MYSQL_HANDLERTON_INTERFACE_VERSION, &innobase_hton};
|
||||
{ MYSQL_HANDLERTON_INTERFACE_VERSION, innobase_hton};
|
||||
|
||||
mysql_declare_plugin(innobase)
|
||||
{
|
||||
|
@ -134,7 +134,7 @@ void mi_check_print_warning(MI_CHECK *param, const char *fmt,...)
|
||||
|
||||
|
||||
ha_myisam::ha_myisam(TABLE_SHARE *table_arg)
|
||||
:handler(&myisam_hton, table_arg), file(0),
|
||||
:handler(myisam_hton, table_arg), file(0),
|
||||
int_table_flags(HA_NULL_IN_KEY | HA_CAN_FULLTEXT | HA_CAN_SQL_HANDLER |
|
||||
HA_DUPLICATE_POS | HA_CAN_INDEX_BLOBS | HA_AUTO_PART_KEY |
|
||||
HA_FILE_BASED | HA_CAN_GEOMETRY | HA_NO_TRANSACTIONS |
|
||||
@ -1775,20 +1775,21 @@ bool ha_myisam::check_if_incompatible_data(HA_CREATE_INFO *info,
|
||||
return COMPATIBLE_DATA_YES;
|
||||
}
|
||||
|
||||
handlerton myisam_hton;
|
||||
handlerton *myisam_hton;
|
||||
|
||||
static int myisam_init()
|
||||
static int myisam_init(void *p)
|
||||
{
|
||||
myisam_hton.state=SHOW_OPTION_YES;
|
||||
myisam_hton.db_type=DB_TYPE_MYISAM;
|
||||
myisam_hton.create=myisam_create_handler;
|
||||
myisam_hton.panic=mi_panic;
|
||||
myisam_hton.flags=HTON_CAN_RECREATE;
|
||||
myisam_hton= (handlerton *)p;
|
||||
myisam_hton->state=SHOW_OPTION_YES;
|
||||
myisam_hton->db_type=DB_TYPE_MYISAM;
|
||||
myisam_hton->create=myisam_create_handler;
|
||||
myisam_hton->panic=mi_panic;
|
||||
myisam_hton->flags=HTON_CAN_RECREATE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct st_mysql_storage_engine myisam_storage_engine=
|
||||
{ MYSQL_HANDLERTON_INTERFACE_VERSION, &myisam_hton };
|
||||
{ MYSQL_HANDLERTON_INTERFACE_VERSION, myisam_hton };
|
||||
|
||||
mysql_declare_plugin(myisam)
|
||||
{
|
||||
|
@ -36,7 +36,7 @@ static handler *myisammrg_create_handler(TABLE_SHARE *table,
|
||||
|
||||
/* MyISAM MERGE handlerton */
|
||||
|
||||
handlerton myisammrg_hton;
|
||||
handlerton *myisammrg_hton;
|
||||
|
||||
static handler *myisammrg_create_handler(TABLE_SHARE *table,
|
||||
MEM_ROOT *mem_root)
|
||||
@ -46,7 +46,7 @@ static handler *myisammrg_create_handler(TABLE_SHARE *table,
|
||||
|
||||
|
||||
ha_myisammrg::ha_myisammrg(TABLE_SHARE *table_arg)
|
||||
:handler(&myisammrg_hton, table_arg), file(0)
|
||||
:handler(myisammrg_hton, table_arg), file(0)
|
||||
{}
|
||||
|
||||
static const char *ha_myisammrg_exts[] = {
|
||||
@ -550,18 +550,21 @@ bool ha_myisammrg::check_if_incompatible_data(HA_CREATE_INFO *info,
|
||||
return COMPATIBLE_DATA_NO;
|
||||
}
|
||||
|
||||
static int myisammrg_init()
|
||||
static int myisammrg_init(void *p)
|
||||
{
|
||||
myisammrg_hton.state=have_merge_db;
|
||||
myisammrg_hton.db_type=DB_TYPE_MRG_MYISAM;
|
||||
myisammrg_hton.create=myisammrg_create_handler;
|
||||
myisammrg_hton.panic=myrg_panic;
|
||||
myisammrg_hton.flags= HTON_CAN_RECREATE;
|
||||
myisammrg_hton= (handlerton *)p;
|
||||
|
||||
myisammrg_hton->state=have_merge_db;
|
||||
myisammrg_hton->db_type=DB_TYPE_MRG_MYISAM;
|
||||
myisammrg_hton->create=myisammrg_create_handler;
|
||||
myisammrg_hton->panic=myrg_panic;
|
||||
myisammrg_hton->flags= HTON_CAN_RECREATE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct st_mysql_storage_engine myisammrg_storage_engine=
|
||||
{ MYSQL_HANDLERTON_INTERFACE_VERSION, &myisammrg_hton };
|
||||
{ MYSQL_HANDLERTON_INTERFACE_VERSION, myisammrg_hton };
|
||||
|
||||
mysql_declare_plugin(myisammrg)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user