Below is the list of changes that have just been committed into a local
5.1 repository of serg. When serg does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2006-09-16 21:17:59+02:00, serg@stripped +17 -0
another way to allocate handlertons without disturbing plugin api
bug - cannot use myisam_hton before it's set
don't access thd->ha_data directly from a storage engine
include/mysql/plugin.h@stripped, 2006-09-16 21:17:53+02:00, serg@stripped +2 -2
restoring the abi
sql/ha_ndbcluster.cc@stripped, 2006-09-16 21:17:54+02:00, serg@stripped +5 -6
another way to allocate handlertons without disturbing plugin api
sql/ha_ndbcluster_binlog.h@stripped, 2006-09-16 21:17:54+02:00, serg@stripped +3 -2
don't access THD directly
sql/ha_partition.cc@stripped, 2006-09-16 21:17:54+02:00, serg@stripped +4 -5
another way to allocate handlertons without disturbing plugin api
sql/handler.cc@stripped, 2006-09-16 21:17:54+02:00, serg@stripped +5 -4
another way to allocate handlertons without disturbing plugin api
sql/log.cc@stripped, 2006-09-16 21:17:54+02:00, serg@stripped +6 -6
another way to allocate handlertons without disturbing plugin api
sql/mysqld.cc@stripped, 2006-09-16 21:17:54+02:00, serg@stripped +1 -1
bug - cannot use myisam_hton before it's set
sql/sql_plugin.cc@stripped, 2006-09-16 21:17:54+02:00, serg@stripped +31 -33
make the code uniform, remove if()-s
storage/archive/ha_archive.cc@stripped, 2006-09-16 21:17:54+02:00, serg@stripped +6 -7
another way to allocate handlertons without disturbing plugin api
storage/blackhole/ha_blackhole.cc@stripped, 2006-09-16 21:17:55+02:00, serg@stripped +5
-5
another way to allocate handlertons without disturbing plugin api
storage/csv/ha_tina.cc@stripped, 2006-09-16 21:17:55+02:00, serg@stripped +8 -8
another way to allocate handlertons without disturbing plugin api
storage/example/ha_example.cc@stripped, 2006-09-16 21:17:55+02:00, serg@stripped +6 -7
another way to allocate handlertons without disturbing plugin api
storage/federated/ha_federated.cc@stripped, 2006-09-16 21:17:55+02:00, serg@stripped +11
-11
another way to allocate handlertons without disturbing plugin api.
don't access thd->ha_data directly
storage/heap/ha_heap.cc@stripped, 2006-09-16 21:17:55+02:00, serg@stripped +5 -5
another way to allocate handlertons without disturbing plugin api
storage/innobase/handler/ha_innodb.cc@stripped, 2006-09-16 21:17:55+02:00, serg@stripped
+25 -25
another way to allocate handlertons without disturbing plugin api.
don't access thd->ha_data directly
storage/myisam/ha_myisam.cc@stripped, 2006-09-16 21:17:55+02:00, serg@stripped +4 -5
another way to allocate handlertons without disturbing plugin api
storage/myisammrg/ha_myisammrg.cc@stripped, 2006-09-16 21:17:55+02:00, serg@stripped +5
-5
another way to allocate handlertons without disturbing plugin api
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: serg
# Host: janus.mylan
# Root: /usr/home/serg/Abk/mysql-5.1-arch
--- 1.97/storage/heap/ha_heap.cc 2006-09-16 21:18:07 +02:00
+++ 1.98/storage/heap/ha_heap.cc 2006-09-16 21:18:07 +02:00
@@ -29,9 +29,12 @@
handlerton *heap_hton;
-int heap_init(void *p)
+static struct st_mysql_storage_engine heap_storage_engine=
+{ MYSQL_HANDLERTON_INTERFACE_VERSION, 0 };
+
+int heap_init(void)
{
- heap_hton= (handlerton *)p;
+ heap_hton= heap_storage_engine.handlerton;
heap_hton->state= SHOW_OPTION_YES;
heap_hton->db_type= DB_TYPE_HEAP;
heap_hton->create= heap_create_handler;
@@ -696,9 +699,6 @@
return COMPATIBLE_DATA_NO;
return COMPATIBLE_DATA_YES;
}
-
-struct st_mysql_storage_engine heap_storage_engine=
-{ MYSQL_HANDLERTON_INTERFACE_VERSION, heap_hton};
mysql_declare_plugin(heap)
{
--- 1.192/storage/myisam/ha_myisam.cc 2006-09-16 21:18:07 +02:00
+++ 1.193/storage/myisam/ha_myisam.cc 2006-09-16 21:18:07 +02:00
@@ -1776,10 +1776,12 @@
}
handlerton *myisam_hton;
+static struct st_mysql_storage_engine myisam_storage_engine=
+{ MYSQL_HANDLERTON_INTERFACE_VERSION, 0 };
-static int myisam_init(void *p)
+static int myisam_init(void)
{
- myisam_hton= (handlerton *)p;
+ myisam_hton= myisam_storage_engine.handlerton;
myisam_hton->state=SHOW_OPTION_YES;
myisam_hton->db_type=DB_TYPE_MYISAM;
myisam_hton->create=myisam_create_handler;
@@ -1787,9 +1789,6 @@
myisam_hton->flags=HTON_CAN_RECREATE;
return 0;
}
-
-struct st_mysql_storage_engine myisam_storage_engine=
-{ MYSQL_HANDLERTON_INTERFACE_VERSION, myisam_hton };
mysql_declare_plugin(myisam)
{
--- 1.98/storage/myisammrg/ha_myisammrg.cc 2006-09-16 21:18:07 +02:00
+++ 1.99/storage/myisammrg/ha_myisammrg.cc 2006-09-16 21:18:07 +02:00
@@ -550,9 +550,12 @@
return COMPATIBLE_DATA_NO;
}
-static int myisammrg_init(void *p)
+static struct st_mysql_storage_engine myisammrg_storage_engine=
+{ MYSQL_HANDLERTON_INTERFACE_VERSION, 0 };
+
+static int myisammrg_init(void)
{
- myisammrg_hton= (handlerton *)p;
+ myisammrg_hton= myisammrg_storage_engine.handlerton;
myisammrg_hton->state=have_merge_db;
myisammrg_hton->db_type=DB_TYPE_MRG_MYISAM;
@@ -562,9 +565,6 @@
return 0;
}
-
-struct st_mysql_storage_engine myisammrg_storage_engine=
-{ MYSQL_HANDLERTON_INTERFACE_VERSION, myisammrg_hton };
mysql_declare_plugin(myisammrg)
{
--- 1.266/sql/handler.cc 2006-09-16 21:18:07 +02:00
+++ 1.267/sql/handler.cc 2006-09-16 21:18:07 +02:00
@@ -386,7 +386,7 @@
engine plugins.
*/
DBUG_PRINT("info", ("Deinitializing plugin: '%s'", plugin->name.str));
- if (plugin->plugin->deinit(NULL))
+ if (plugin->plugin->deinit())
{
DBUG_PRINT("warning", ("Plugin '%s' deinit function returned error.",
plugin->name.str));
@@ -406,11 +406,12 @@
hton= (handlerton *)my_malloc(sizeof(handlerton),
MYF(MY_WME | MY_ZEROFILL));
- /* Historical Requirement */
- plugin->data= hton; // shortcut for the future
+ ((st_mysql_storage_engine *)plugin->plugin->info)->handlerton= hton;
+ plugin->data=hton;
+
if (plugin->plugin->init)
{
- if (plugin->plugin->init(hton))
+ if (plugin->plugin->init())
{
sql_print_error("Plugin '%s' init function returned error.",
plugin->name.str);
--- 1.230/sql/log.cc 2006-09-16 21:18:07 +02:00
+++ 1.231/sql/log.cc 2006-09-16 21:18:07 +02:00
@@ -46,7 +46,7 @@
static bool test_if_number(const char *str,
long *res, bool allow_wildcards);
-static int binlog_init();
+static int binlog_init(void);
static int binlog_close_connection(THD *thd);
static int binlog_savepoint_set(THD *thd, void *sv);
static int binlog_savepoint_rollback(THD *thd, void *sv);
@@ -92,6 +92,9 @@
handlerton *binlog_hton;
+struct st_mysql_storage_engine binlog_storage_engine=
+{ MYSQL_HANDLERTON_INTERFACE_VERSION, binlog_hton };
+
/*
Open log table of a given type (general or slow log)
@@ -1155,9 +1158,9 @@
should be moved here.
*/
-int binlog_init(void *p)
+int binlog_init(void)
{
- binlog_hton= (handlerton *)p;
+ binlog_hton= binlog_storage_engine.handlerton;
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);
@@ -4679,9 +4682,6 @@
"--tc-heuristic-recover={commit|rollback}");
return 1;
}
-
-struct st_mysql_storage_engine binlog_storage_engine=
-{ MYSQL_HANDLERTON_INTERFACE_VERSION, binlog_hton };
mysql_declare_plugin(binlog)
{
--- 1.576/sql/mysqld.cc 2006-09-16 21:18:07 +02:00
+++ 1.577/sql/mysqld.cc 2006-09-16 21:18:07 +02:00
@@ -6964,7 +6964,7 @@
/* 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= 0; // will be set later, after ha_init()
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;
--- 1.103/storage/archive/ha_archive.cc 2006-09-16 21:18:07 +02:00
+++ 1.104/storage/archive/ha_archive.cc 2006-09-16 21:18:07 +02:00
@@ -162,6 +162,8 @@
return (byte*) share->table_name;
}
+static struct st_mysql_storage_engine archive_storage_engine=
+{ MYSQL_HANDLERTON_INTERFACE_VERSION, 0 };
/*
Initialize the archive handler.
@@ -175,12 +177,12 @@
TRUE Error
*/
-int archive_db_init(void *p)
+int archive_db_init(void)
{
DBUG_ENTER("archive_db_init");
if (archive_inited)
DBUG_RETURN(FALSE);
- archive_hton= (handlerton *)p;
+ archive_hton= archive_storage_engine.handlerton;
archive_hton->state=SHOW_OPTION_YES;
archive_hton->db_type=DB_TYPE_ARCHIVE_DB;
archive_hton->create=archive_create_handler;
@@ -214,7 +216,7 @@
FALSE OK
*/
-int archive_db_done(void *p)
+int archive_db_done(void)
{
if (archive_inited)
{
@@ -228,7 +230,7 @@
int archive_db_end(ha_panic_function type)
{
- return archive_db_done(NULL);
+ return archive_db_done();
}
ha_archive::ha_archive(TABLE_SHARE *table_arg)
@@ -1569,9 +1571,6 @@
DBUG_RETURN(repair(thd, &check_opt));
}
-
-struct st_mysql_storage_engine archive_storage_engine=
-{ MYSQL_HANDLERTON_INTERFACE_VERSION, archive_hton };
mysql_declare_plugin(archive)
{
--- 1.61/storage/csv/ha_tina.cc 2006-09-16 21:18:07 +02:00
+++ 1.62/storage/csv/ha_tina.cc 2006-09-16 21:18:07 +02:00
@@ -148,11 +148,14 @@
return (byte*) share->table_name;
}
-static int tina_init_func(void *p)
+static struct st_mysql_storage_engine csv_storage_engine=
+{ MYSQL_HANDLERTON_INTERFACE_VERSION, 0};
+
+static int tina_init_func(void)
{
if (!tina_init)
{
- tina_hton= (handlerton *)p;
+ tina_hton= csv_storage_engine.handlerton;
tina_init++;
VOID(pthread_mutex_init(&tina_mutex,MY_MUTEX_INIT_FAST));
(void) hash_init(&tina_open_tables,system_charset_info,32,0,0,
@@ -166,7 +169,7 @@
return 0;
}
-static int tina_done_func(void *p)
+static int tina_done_func(void)
{
if (tina_init)
{
@@ -194,7 +197,7 @@
uint length;
if (!tina_init)
- tina_init_func(NULL);
+ tina_init_func();
pthread_mutex_lock(&tina_mutex);
length=(uint) strlen(table_name);
@@ -451,7 +454,7 @@
int tina_end(ha_panic_function type)
{
- return tina_done_func(NULL);
+ return tina_done_func();
}
@@ -1514,9 +1517,6 @@
{
return COMPATIBLE_DATA_YES;
}
-
-struct st_mysql_storage_engine csv_storage_engine=
-{ MYSQL_HANDLERTON_INTERFACE_VERSION, tina_hton };
mysql_declare_plugin(csv)
{
--- 1.43/storage/example/ha_example.cc 2006-09-16 21:18:07 +02:00
+++ 1.44/storage/example/ha_example.cc 2006-09-16 21:18:07 +02:00
@@ -96,12 +96,15 @@
return (byte*) share->table_name;
}
-static int example_init_func(void *p)
+static struct st_mysql_storage_engine example_storage_engine=
+{ MYSQL_HANDLERTON_INTERFACE_VERSION, 0 };
+
+static int example_init_func(void)
{
DBUG_ENTER("example_init_func");
if (!example_init)
{
- example_hton= (handlerton *)p;
+ example_hton= example_storage_engine.handlerton;
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,
@@ -115,7 +118,7 @@
DBUG_RETURN(0);
}
-static int example_done_func(void *p)
+static int example_done_func(void)
{
int error= 0;
DBUG_ENTER("example_done_func");
@@ -701,10 +704,6 @@
/* This is not implemented but we want someone to be able to see that it works. */
DBUG_RETURN(0);
}
-
-struct st_mysql_storage_engine example_storage_engine=
-{ MYSQL_HANDLERTON_INTERFACE_VERSION, example_hton };
-
mysql_declare_plugin(example)
{
--- 1.40/storage/blackhole/ha_blackhole.cc 2006-09-16 21:18:07 +02:00
+++ 1.41/storage/blackhole/ha_blackhole.cc 2006-09-16 21:18:07 +02:00
@@ -201,18 +201,18 @@
DBUG_RETURN(HA_ERR_END_OF_FILE);
}
-static int blackhole_init(void *p)
+static struct st_mysql_storage_engine blackhole_storage_engine=
+{ MYSQL_HANDLERTON_INTERFACE_VERSION, 0};
+
+static int blackhole_init(void)
{
- blackhole_hton= (handlerton *)p;
+ blackhole_hton= blackhole_storage_engine.handlerton;
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_declare_plugin(blackhole)
{
--- 1.360/sql/ha_ndbcluster.cc 2006-09-16 21:18:07 +02:00
+++ 1.361/sql/ha_ndbcluster.cc 2006-09-16 21:18:07 +02:00
@@ -74,7 +74,7 @@
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);
@@ -6378,14 +6378,16 @@
}
extern int ndb_dictionary_is_mysqld;
+static struct st_mysql_storage_engine ndbcluster_storage_engine=
+{ MYSQL_HANDLERTON_INTERFACE_VERSION, ndbcluster_hton };
-static int ndbcluster_init(void *p)
+static int ndbcluster_init(void)
{
int res;
DBUG_ENTER("ndbcluster_init");
ndb_dictionary_is_mysqld= 1;
- ndbcluster_hton= (handlerton *)p;
+ ndbcluster_hton= ndbcluster_storage_engine.handlerton;
{
handlerton *h= ndbcluster_hton;
@@ -10612,9 +10614,6 @@
{"Ndb", (char*) &ndb_status_variables, SHOW_ARRAY},
{NullS, NullS, SHOW_LONG}
};
-
-struct st_mysql_storage_engine ndbcluster_storage_engine=
-{ MYSQL_HANDLERTON_INTERFACE_VERSION, ndbcluster_hton };
mysql_declare_plugin(ndbcluster)
{
--- 1.297/storage/innobase/handler/ha_innodb.cc 2006-09-16 21:18:07 +02:00
+++ 1.298/storage/innobase/handler/ha_innodb.cc 2006-09-16 21:18:07 +02:00
@@ -210,6 +210,9 @@
handlerton *innobase_hton;
+static struct st_mysql_storage_engine innobase_storage_engine=
+{ MYSQL_HANDLERTON_INTERFACE_VERSION, 0 };
+
static handler *innobase_create_handler(TABLE_SHARE *table, MEM_ROOT *mem_root)
{
return new (mem_root) ha_innobase(table);
@@ -389,7 +392,7 @@
return 0;
}
- trx = (trx_t*) thd->ha_data[innobase_hton->slot];
+ trx = (trx_t*) *thd_ha_data(thd, innobase_hton);
if (trx) {
innobase_release_stat_resources(trx);
@@ -847,7 +850,7 @@
ut_ad(thd == current_thd);
- trx = (trx_t*) thd->ha_data[innobase_hton->slot];
+ trx = (trx_t*) *thd_ha_data(thd, innobase_hton);
if (trx == NULL) {
DBUG_ASSERT(thd != NULL);
@@ -861,7 +864,7 @@
CPU time */
trx->support_xa = (ibool)(thd->variables.innodb_support_xa);
- thd->ha_data[innobase_hton->slot] = trx;
+ *thd_ha_data(thd, innobase_hton) = trx;
} else {
if (trx->magic_n != TRX_MAGIC_N) {
mem_analyze_corruption(trx);
@@ -1329,7 +1332,7 @@
Opens an InnoDB database. */
int
-innobase_init(void *p)
+innobase_init(void)
/*===============*/
{
static char current_dir[3]; /* Set if using current lib */
@@ -1338,7 +1341,7 @@
char *default_path;
DBUG_ENTER("innobase_init");
- innobase_hton= (handlerton *)p;
+ innobase_hton= innobase_storage_engine.handlerton;
innobase_hton->state=have_innodb;
innobase_hton->db_type= DB_TYPE_INNODB;
@@ -1940,7 +1943,7 @@
{
trx_t* trx;
- trx = (trx_t*) thd->ha_data[innobase_hton->slot];
+ trx = (trx_t*) *thd_ha_data(thd, innobase_hton);
if (trx && trx->active_trans) {
@@ -2159,7 +2162,7 @@
{
trx_t* trx;
- trx = (trx_t*)thd->ha_data[innobase_hton->slot];
+ trx = (trx_t*)*thd_ha_data(thd, innobase_hton);
ut_a(trx);
@@ -3252,11 +3255,11 @@
DBUG_ENTER("ha_innobase::write_row");
if (prebuilt->trx !=
- (trx_t*) current_thd->ha_data[innobase_hton->slot]) {
+ (trx_t*) *thd_ha_data(current_thd, innobase_hton)) {
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*) *thd_ha_data(current_thd, innobase_hton));
fputs("InnoDB: Dump of 200 bytes around prebuilt: ", stderr);
ut_print_buf(stderr, ((const byte*)prebuilt) - 100, 200);
@@ -3264,7 +3267,7 @@
"InnoDB: Dump of 200 bytes around transaction.all: ",
stderr);
ut_print_buf(stderr,
- ((byte*)(&(current_thd->ha_data[innobase_hton->slot]))) - 100,
+ ((byte*)(&(*thd_ha_data(current_thd, innobase_hton)))) - 100,
200);
putc('\n', stderr);
ut_error;
@@ -3636,7 +3639,7 @@
DBUG_ENTER("ha_innobase::update_row");
ut_a(prebuilt->trx ==
- (trx_t*) current_thd->ha_data[innobase_hton->slot]);
+ (trx_t*) *thd_ha_data(current_thd, innobase_hton));
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
table->timestamp_field->set_time();
@@ -3697,7 +3700,7 @@
DBUG_ENTER("ha_innobase::delete_row");
ut_a(prebuilt->trx ==
- (trx_t*) current_thd->ha_data[innobase_hton->slot]);
+ (trx_t*) *thd_ha_data(current_thd, innobase_hton));
if (last_query_id != user_thd->query_id) {
prebuilt->sql_stat_start = TRUE;
@@ -3795,7 +3798,7 @@
row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
ut_a(prebuilt->trx ==
- (trx_t*) current_thd->ha_data[innobase_hton->slot]);
+ (trx_t*) *thd_ha_data(current_thd, innobase_hton));
/* Row read type is set to semi consistent read if this was
requested by the MySQL and either innodb_locks_unsafe_for_binlog
@@ -3962,7 +3965,7 @@
DBUG_ENTER("index_read");
ut_a(prebuilt->trx ==
- (trx_t*) current_thd->ha_data[innobase_hton->slot]);
+ (trx_t*) *thd_ha_data(current_thd, innobase_hton));
statistic_increment(current_thd->status_var.ha_read_key_count,
&LOCK_status);
@@ -4077,7 +4080,7 @@
ut_ad(user_thd == current_thd);
ut_a(prebuilt->trx ==
- (trx_t*) current_thd->ha_data[innobase_hton->slot]);
+ (trx_t*) *thd_ha_data(current_thd, innobase_hton));
active_index = keynr;
@@ -4167,7 +4170,7 @@
DBUG_ENTER("general_fetch");
ut_a(prebuilt->trx ==
- (trx_t*) current_thd->ha_data[innobase_hton->slot]);
+ (trx_t*) *thd_ha_data(current_thd, innobase_hton));
innodb_srv_conc_enter_innodb(prebuilt->trx);
@@ -4403,7 +4406,7 @@
&LOCK_status);
ut_a(prebuilt->trx ==
- (trx_t*) current_thd->ha_data[innobase_hton->slot]);
+ (trx_t*) *thd_ha_data(current_thd, innobase_hton));
if (prebuilt->clust_index_was_generated) {
/* No primary key was defined for the table and we
@@ -4453,7 +4456,7 @@
uint len;
ut_a(prebuilt->trx ==
- (trx_t*) current_thd->ha_data[innobase_hton->slot]);
+ (trx_t*) *thd_ha_data(current_thd, innobase_hton));
if (prebuilt->clust_index_was_generated) {
/* No primary key was defined for the table and we
@@ -4954,7 +4957,7 @@
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*) *thd_ha_data(current_thd, innobase_hton));
dict_table = prebuilt->table;
trx = prebuilt->trx;
@@ -5282,7 +5285,7 @@
DBUG_ENTER("records_in_range");
ut_a(prebuilt->trx ==
- (trx_t*) current_thd->ha_data[innobase_hton->slot]);
+ (trx_t*) *thd_ha_data(current_thd, innobase_hton));
prebuilt->trx->op_info = (char*)"estimating records in index range";
@@ -5724,7 +5727,7 @@
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*) *thd_ha_data(current_thd, innobase_hton));
if (prebuilt->mysql_template == NULL) {
/* Build the template; we will use a dummy template
@@ -6008,7 +6011,7 @@
DBUG_ENTER("ha_innobase::can_switch_engines");
ut_a(prebuilt->trx ==
- (trx_t*) current_thd->ha_data[innobase_hton->slot]);
+ (trx_t*) *thd_ha_data(current_thd, innobase_hton));
prebuilt->trx->op_info =
"determining if there are foreign key constraints";
@@ -7604,9 +7607,6 @@
{"Innodb", (char*) &show_innodb_vars, SHOW_FUNC},
{NullS, NullS, SHOW_LONG}
};
-
-struct st_mysql_storage_engine innobase_storage_engine=
-{ MYSQL_HANDLERTON_INTERFACE_VERSION, innobase_hton};
mysql_declare_plugin(innobase)
{
--- 1.19/include/mysql/plugin.h 2006-09-16 21:18:07 +02:00
+++ 1.20/include/mysql/plugin.h 2006-09-16 21:18:07 +02:00
@@ -88,8 +88,8 @@
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 */
--- 1.34/sql/sql_plugin.cc 2006-09-16 21:18:07 +02:00
+++ 1.35/sql/sql_plugin.cc 2006-09-16 21:18:07 +02:00
@@ -30,14 +30,36 @@
{ C_STRING_WITH_LEN("FTPARSER") }
};
+static int initialize_plugin(struct st_plugin_int *plugin)
+{
+ if (plugin->plugin->init && plugin->plugin->init())
+ {
+ sql_print_error("Plugin '%s' init function returned error.",
+ plugin->name.str);
+ return 1;
+ }
+ return 0;
+}
+
+static int deinitialize_plugin(struct st_plugin_int *plugin)
+{
+ if (plugin->plugin->deinit && plugin->plugin->deinit())
+ {
+ sql_print_error("Plugin '%s' deinit function returned error.",
+ plugin->name.str);
+ return 1;
+ }
+ return 0;
+}
+
plugin_type_init plugin_type_initialize[MYSQL_MAX_PLUGIN_TYPE_NUM]=
{
- 0,ha_initialize_handlerton,0
+ initialize_plugin, ha_initialize_handlerton, initialize_plugin
};
plugin_type_init plugin_type_deinitialize[MYSQL_MAX_PLUGIN_TYPE_NUM]=
{
- 0,ha_finalize_handlerton,0
+ deinitialize_plugin, ha_finalize_handlerton, deinitialize_plugin
};
static const char *plugin_interface_version_sym=
@@ -497,22 +519,10 @@
#endif /* FIX_LATER */
}
- if (plugin_type_deinitialize[plugin->plugin->type])
+ if ((*plugin_type_deinitialize[plugin->plugin->type])(plugin))
{
- 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(NULL))
- {
- DBUG_PRINT("warning", ("Plugin '%s' deinit function returned error.",
- plugin->name.str));
- }
+ sql_print_error("Plugin '%s' of type %s failed deinitialization",
+ plugin->name.str, plugin_type_names[plugin->plugin->type]);
}
plugin->state= PLUGIN_IS_UNINITIALIZED;
}
@@ -557,23 +567,11 @@
{
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_type_initialize[plugin->plugin->type])(plugin))
{
- if (plugin->plugin->init(NULL))
- {
- sql_print_error("Plugin '%s' init function returned error.",
- plugin->name.str);
- goto err;
- }
+ 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;
--- 1.73/sql/ha_partition.cc 2006-09-16 21:18:07 +02:00
+++ 1.74/sql/ha_partition.cc 2006-09-16 21:18:07 +02:00
@@ -75,11 +75,13 @@
static uint alter_table_flags(uint flags);
handlerton *partition_hton;
+static struct st_mysql_storage_engine partition_storage_engine=
+{ MYSQL_HANDLERTON_INTERFACE_VERSION, partition_hton };
-static int partition_initialize(void *p)
+static int partition_initialize()
{
- partition_hton= (handlerton *)p;
+ partition_hton= partition_storage_engine.handlerton;
partition_hton->state= SHOW_OPTION_YES;
partition_hton->db_type= DB_TYPE_PARTITION_DB;
@@ -5630,9 +5632,6 @@
return 0;
}
#endif /* NOT_USED */
-
-struct st_mysql_storage_engine partition_storage_engine=
-{ MYSQL_HANDLERTON_INTERFACE_VERSION, partition_hton };
mysql_declare_plugin(partition)
{
--- 1.79/storage/federated/ha_federated.cc 2006-09-16 21:18:07 +02:00
+++ 1.80/storage/federated/ha_federated.cc 2006-09-16 21:18:07 +02:00
@@ -384,6 +384,9 @@
return (byte*) share->scheme;
}
+static struct st_mysql_storage_engine federated_storage_engine=
+{ MYSQL_HANDLERTON_INTERFACE_VERSION, 0 };
+
/*
Initialize the federated handler.
@@ -396,10 +399,10 @@
TRUE Error
*/
-int federated_db_init(void *p)
+int federated_db_init(void)
{
DBUG_ENTER("federated_db_init");
- federated_hton= (handlerton *)p;
+ federated_hton= federated_storage_engine.handlerton;
federated_hton->state= SHOW_OPTION_YES;
federated_hton->db_type= DB_TYPE_FEDERATED_DB;
federated_hton->commit= federated_commit;
@@ -2736,7 +2739,7 @@
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(thd, federated_hton);
DBUG_ENTER("ha_federated::external_lock");
if (lock_type != F_UNLCK)
@@ -2770,7 +2773,7 @@
DBUG_PRINT("info", ("error setting autocommit FALSE: %d", error));
DBUG_RETURN(error);
}
- thd->ha_data[federated_hton->slot]= this;
+ *thd_ha_data(thd, federated_hton)= this;
trans_register_ha(thd, TRUE, federated_hton);
/*
Send a lock table to the remote end.
@@ -2799,7 +2802,7 @@
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(thd, federated_hton);
DBUG_ENTER("federated_commit");
if (all)
@@ -2814,7 +2817,7 @@
if (error && !return_val);
return_val= error;
}
- thd->ha_data[federated_hton->slot]= NULL;
+ *thd_ha_data(thd, federated_hton)= NULL;
}
DBUG_PRINT("info", ("error val: %d", return_val));
@@ -2825,7 +2828,7 @@
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(thd, federated_hton);
DBUG_ENTER("federated_rollback");
if (all)
@@ -2840,7 +2843,7 @@
if (error && !return_val)
return_val= error;
}
- thd->ha_data[federated_hton->slot]= NULL;
+ *thd_ha_data(thd, federated_hton)= NULL;
}
DBUG_PRINT("info", ("error val: %d", return_val));
@@ -2880,9 +2883,6 @@
}
DBUG_RETURN(0);
}
-
-struct st_mysql_storage_engine federated_storage_engine=
-{ MYSQL_HANDLERTON_INTERFACE_VERSION, federated_hton };
mysql_declare_plugin(federated)
{
--- 1.16/sql/ha_ndbcluster_binlog.h 2006-09-16 21:18:07 +02:00
+++ 1.17/sql/ha_ndbcluster_binlog.h 2006-09-16 21:18:07 +02:00
@@ -212,10 +212,11 @@
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(thd, ndbcluster_hton); }
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(thd, ndbcluster_hton)= thd_ndb; }
Ndb* check_ndb_in_thd(THD* thd);
+
| Thread |
|---|
| • bk commit into 5.1 tree (serg:1.2331) | Sergei Golubchik | 16 Sep |