Below is the list of changes that have just been committed into a local
5.1 repository of cps. When cps 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
1.2079 06/01/19 17:53:33 cps@stripped +23 -0
apply and merge with current tree antony's patch:
"Allow for Archive, CSV and Example storage engines
to be built as plugins or linked in"
storage/innobase/Makefile.am
1.10 06/01/19 17:52:21 cps@stripped +29 -0
Generate one library for all of Innodb instead on many
storage/example/ha_example.cc
1.31 06/01/19 17:52:21 cps@stripped +5 -1
allow to be built both as plugin or as static
storage/archive/ha_archive.h
1.42 06/01/19 17:52:21 cps@stripped +2 -2
allow to be built both as plugin or as static
storage/archive/ha_archive.cc
1.77 06/01/19 17:52:21 cps@stripped +42 -16
allow to be built both as plugin or as static
storage/example/Makefile.am
1.5 06/01/19 17:52:20 cps@stripped +14 -5
Single makefile for both plugin and static builds
storage/csv/ha_tina.h
1.12 06/01/19 17:52:20 cps@stripped +5 -1
fix prototype
storage/csv/ha_tina.cc
1.31 06/01/19 17:52:20 cps@stripped +17 -17
allow to be built both as plugin or as static
storage/csv/Makefile.am
1.5 06/01/19 17:52:20 cps@stripped +12 -4
Single makefile for both plugin and static builds
storage/archive/Makefile.am
1.2 06/01/19 17:52:20 cps@stripped +38 -8
Single makefile for both plugin and static builds
sql/sql_plugin.cc
1.11 06/01/19 17:52:20 cps@stripped +41 -4
Add code for uninstalling storage engines (currently not really possible
due to ref-counting issues
sql/sql_lex.h
1.212 06/01/19 17:52:20 cps@stripped +6 -0
Don't include all the types when not building mysqld
sql/sql_class.h
1.284 06/01/19 17:52:20 cps@stripped +5 -1
Don't include all the types when not building mysqld
sql/sql_class.cc
1.238 06/01/19 17:52:20 cps@stripped +20 -0
new funcs for plugins
sql/mysql_priv.h
1.371 06/01/19 17:52:20 cps@stripped +13 -0
Don't include all the types when not building mysqld
sql/lock.cc
1.86 06/01/19 17:52:20 cps@stripped +5 -2
don's assume that handler knows about THD
sql/item.h
1.188 06/01/19 17:52:20 cps@stripped +2 -1
Don't include all the types when not building mysqld
sql/handler.h
1.183 06/01/19 17:52:20 cps@stripped +13 -3
Ensure that there are no db_type collisions
new method handler::ha_statistic_increment() so that storage engines
do not need to know THD type
sql/handler.cc
1.213 06/01/19 17:52:20 cps@stripped +81 -47
Ensure that there are no db_type collisions
new method handler::ha_statistic_increment() so that storage engines
do not need to know THD typ
sql/ha_myisam.h
1.72 06/01/19 17:52:20 cps@stripped +4 -1
fix prototype to get rid of THD
sql/ha_myisam.cc
1.170 06/01/19 17:52:20 cps@stripped +4 -1
fix prototype
sql/Makefile.am
1.129 06/01/19 17:52:20 cps@stripped +2 -2
remove archive.cc/h
configure.in
1.333 06/01/19 17:52:20 cps@stripped +37 -64
Do checks for user-requested storage engines earlier.
Also check for replication as ndb_binlog relies on it.
config/ac-macros/storage.m4
1.4 06/01/19 17:52:20 cps@stripped +28 -10
Allow user to choose a storage engine to be built as a plugin
at configure time
storage/archive/ha_archive.h
1.41 06/01/19 16:55:17 cps@stripped +0 -0
Rename: sql/ha_archive.h -> storage/archive/ha_archive.h
storage/archive/ha_archive.cc
1.76 06/01/19 16:55:12 cps@stripped +0 -0
Rename: sql/ha_archive.cc -> storage/archive/ha_archive.cc
# 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: cps
# Host: outpost.site
# Root: /home/cps/mysql/devel/test-1
--- 1.332/configure.in 2006-01-19 05:55:59 +03:00
+++ 1.333/configure.in 2006-01-19 17:52:20 +03:00
@@ -660,6 +660,43 @@
AC_TYPE_SIZE_T
#--------------------------------------------------------------------
+# Check for requested features
+#--------------------------------------------------------------------
+
+MYSQL_CHECK_REPLICATION
+
+MYSQL_STORAGE_ENGINE(example,,,,,,storage/example,,
+ \$(top_builddir)/storage/archive/libexample.a,yes,[
+ AC_CONFIG_FILES(storage/example/Makefile)
+])
+MYSQL_STORAGE_ENGINE(archive,,,,,,storage/archive,,
+ \$(top_builddir)/storage/archive/libarchive.a,yes,[
+ AC_CONFIG_FILES(storage/archive/Makefile)
+])
+MYSQL_STORAGE_ENGINE(csv,,,yes,,tina_hton,storage/csv,,
+ \$(top_builddir)/storage/csv/libcsv.a,yes,[
+ AC_CONFIG_FILES(storage/csv/Makefile)
+])
+MYSQL_STORAGE_ENGINE(blackhole)
+MYSQL_STORAGE_ENGINE(federated)
+MYSQL_STORAGE_ENGINE(ndbcluster,,ndbcluster,,,,storage/ndb,,,,[
+ MYSQL_SETUP_NDBCLUSTER
+])
+MYSQL_STORAGE_ENGINE(partition,,partition)
+MYSQL_STORAGE_ENGINE(berkeley,,berkeley-db,,,,storage/bdb,,,,[
+ MYSQL_SETUP_BERKELEY_DB
+])
+MYSQL_STORAGE_ENGINE(innobase,,innodb,,,,storage/innobase,ha_innodb.o,
+ \$(top_builddir)/storage/innobase/libinnodb.a,,[
+ AC_CHECK_LIB(rt, aio_read, [innodb_system_libs="-lrt"])
+ AC_SUBST(innodb_includes)
+ AC_SUBST(innodb_libs)
+ AC_SUBST(innodb_system_libs)
+ other_configures="$other_configures storage/innobase/configure"
+])
+
+
+#--------------------------------------------------------------------
# Check for system header files
#--------------------------------------------------------------------
@@ -2383,70 +2420,6 @@
MYSQL_CHECK_BIG_TABLES
MYSQL_CHECK_MAX_INDEXES
-MYSQL_CHECK_REPLICATION
-
-MYSQL_STORAGE_ENGINE(innobase,,innodb,,,,storage/innobase,ha_innodb.o,[ dnl
- \$(top_builddir)/storage/innobase/usr/libusr.a dnl
- \$(top_builddir)/storage/innobase/srv/libsrv.a dnl
- \$(top_builddir)/storage/innobase/dict/libdict.a dnl
- \$(top_builddir)/storage/innobase/que/libque.a dnl
- \$(top_builddir)/storage/innobase/srv/libsrv.a dnl
- \$(top_builddir)/storage/innobase/ibuf/libibuf.a dnl
- \$(top_builddir)/storage/innobase/row/librow.a dnl
- \$(top_builddir)/storage/innobase/pars/libpars.a dnl
- \$(top_builddir)/storage/innobase/btr/libbtr.a dnl
- \$(top_builddir)/storage/innobase/trx/libtrx.a dnl
- \$(top_builddir)/storage/innobase/read/libread.a dnl
- \$(top_builddir)/storage/innobase/usr/libusr.a dnl
- \$(top_builddir)/storage/innobase/buf/libbuf.a dnl
- \$(top_builddir)/storage/innobase/ibuf/libibuf.a dnl
- \$(top_builddir)/storage/innobase/eval/libeval.a dnl
- \$(top_builddir)/storage/innobase/log/liblog.a dnl
- \$(top_builddir)/storage/innobase/fsp/libfsp.a dnl
- \$(top_builddir)/storage/innobase/fut/libfut.a dnl
- \$(top_builddir)/storage/innobase/fil/libfil.a dnl
- \$(top_builddir)/storage/innobase/lock/liblock.a dnl
- \$(top_builddir)/storage/innobase/mtr/libmtr.a dnl
- \$(top_builddir)/storage/innobase/page/libpage.a dnl
- \$(top_builddir)/storage/innobase/rem/librem.a dnl
- \$(top_builddir)/storage/innobase/thr/libthr.a dnl
- \$(top_builddir)/storage/innobase/sync/libsync.a dnl
- \$(top_builddir)/storage/innobase/data/libdata.a dnl
- \$(top_builddir)/storage/innobase/mach/libmach.a dnl
- \$(top_builddir)/storage/innobase/ha/libha.a dnl
- \$(top_builddir)/storage/innobase/dyn/libdyn.a dnl
- \$(top_builddir)/storage/innobase/mem/libmem.a dnl
- \$(top_builddir)/storage/innobase/sync/libsync.a dnl
- \$(top_builddir)/storage/innobase/ut/libut.a dnl
- \$(top_builddir)/storage/innobase/os/libos.a dnl
- \$(top_builddir)/storage/innobase/ut/libut.a],[
- AC_CHECK_LIB(rt, aio_read, [innodb_system_libs="-lrt"])
- AC_SUBST(innodb_includes)
- AC_SUBST(innodb_libs)
- AC_SUBST(innodb_system_libs)
- other_configures="$other_configures storage/innobase/configure"
-])
-
-MYSQL_STORAGE_ENGINE(berkeley,,berkeley-db,,,,storage/bdb,,,[
- MYSQL_SETUP_BERKELEY_DB
-])
-MYSQL_STORAGE_ENGINE(example,,,,,no,storage/example,,,[
- AC_CONFIG_FILES(storage/example/Makefile)
-])
-MYSQL_STORAGE_ENGINE(archive,,,,,,storage/archive,,
- \$(top_builddir)/storage/archive/libarchive.a, [
- AC_CONFIG_FILES(storage/archive/Makefile)
-])
-MYSQL_STORAGE_ENGINE(csv,,,"yes",,tina_hton,storage/csv,
- ../storage/csv/ha_tina.o,,[
- AC_CONFIG_FILES(storage/csv/Makefile)
-])
-MYSQL_STORAGE_ENGINE(blackhole)
-MYSQL_STORAGE_ENGINE(federated)
-MYSQL_STORAGE_ENGINE(ndbcluster,,ndbcluster,,,,storage/ndb,,,[
- MYSQL_SETUP_NDBCLUSTER
-])
-MYSQL_STORAGE_ENGINE(partition,,partition)
# If we have threads generate some library functions and test programs
sql_server_dirs=
--- 1.128/sql/Makefile.am 2006-01-13 19:04:32 +03:00
+++ 1.129/sql/Makefile.am 2006-01-19 17:52:20 +03:00
@@ -102,8 +102,8 @@
event_executor.cc event.cc event_timed.cc \
sql_plugin.cc sql_binlog.cc \
handlerton.cc sql_tablespace.cc
-EXTRA_mysqld_SOURCES = ha_innodb.cc ha_berkeley.cc ha_archive.cc \
- ha_innodb.h ha_berkeley.h ha_archive.h \
+EXTRA_mysqld_SOURCES = ha_innodb.cc ha_berkeley.cc \
+ ha_innodb.h ha_berkeley.h \
ha_blackhole.cc ha_federated.cc ha_ndbcluster.cc \
ha_blackhole.h ha_federated.h ha_ndbcluster.h \
ha_ndbcluster_binlog.cc ha_ndbcluster_binlog.h \
--- 1.169/sql/ha_myisam.cc 2006-01-19 05:56:00 +03:00
+++ 1.170/sql/ha_myisam.cc 2006-01-19 17:52:20 +03:00
@@ -296,7 +296,10 @@
#endif /* HAVE_REPLICATION */
-bool ha_myisam::check_if_locking_is_allowed(THD *thd, TABLE *table, uint count)
+bool ha_myisam::check_if_locking_is_allowed(uint sql_command,
+ ulong type, TABLE *table,
+ uint count,
+ bool called_by_logger_thread)
{
/*
To be able to open and lock for reading system tables like 'mysql.proc',
--- 1.71/sql/ha_myisam.h 2006-01-19 05:56:00 +03:00
+++ 1.72/sql/ha_myisam.h 2006-01-19 17:52:20 +03:00
@@ -60,7 +60,10 @@
uint max_supported_key_part_length() const { return MI_MAX_KEY_LENGTH; }
uint checksum() const;
- virtual bool check_if_locking_is_allowed(THD *thd, TABLE *table, uint count);
+ virtual bool check_if_locking_is_allowed(uint sql_command,
+ ulong type, TABLE *table,
+ uint count,
+ bool called_by_logger_thread);
int open(const char *name, int mode, uint test_if_locked);
int close(void);
int write_row(byte * buf);
--- 1.212/sql/handler.cc 2006-01-17 10:37:24 +03:00
+++ 1.213/sql/handler.cc 2006-01-19 17:52:20 +03:00
@@ -44,6 +44,7 @@
#endif
extern handlerton *sys_table_types[];
+static handlerton *installed_htons[128];
#define BITMAP_STACKBUF_SIZE (128/8)
@@ -133,30 +134,8 @@
}
-struct plugin_find_dbtype_st
-{
- enum legacy_db_type db_type;
- handlerton *hton;
-};
-
-
-static my_bool plugin_find_dbtype(THD *unused, st_plugin_int *plugin,
- void *arg)
-{
- handlerton *types= (handlerton *) plugin->plugin->info;
- if (types->db_type == ((struct plugin_find_dbtype_st *)arg)->db_type)
- {
- ((struct plugin_find_dbtype_st *)arg)->hton= types;
- return TRUE;
- }
- return FALSE;
-}
-
-
const char *ha_get_storage_engine(enum legacy_db_type db_type)
{
- struct plugin_find_dbtype_st info;
-
switch (db_type)
{
case DB_TYPE_DEFAULT:
@@ -164,13 +143,10 @@
case DB_TYPE_UNKNOWN:
return "UNKNOWN";
default:
- info.db_type= db_type;
-
- if (!plugin_foreach(NULL, plugin_find_dbtype,
- MYSQL_STORAGE_ENGINE_PLUGIN, &info))
- return "*NONE*";
-
- return info.hton->name;
+ if (db_type > DB_TYPE_UNKNOWN && db_type < DB_TYPE_DEFAULT &&
+ installed_htons[db_type])
+ return installed_htons[db_type]->name;
+ return "*NONE*";
}
}
@@ -185,8 +161,6 @@
handlerton *ha_resolve_by_legacy_type(THD *thd, enum legacy_db_type db_type)
{
- struct plugin_find_dbtype_st info;
-
switch (db_type)
{
case DB_TYPE_DEFAULT:
@@ -197,12 +171,9 @@
case DB_TYPE_UNKNOWN:
return NULL;
default:
- info.db_type= db_type;
- if (!plugin_foreach(NULL, plugin_find_dbtype,
- MYSQL_STORAGE_ENGINE_PLUGIN, &info))
- return NULL;
-
- return info.hton;
+ if (db_type > DB_TYPE_UNKNOWN && db_type < DB_TYPE_DEFAULT)
+ return installed_htons[db_type];
+ return NULL;
}
}
@@ -387,24 +358,38 @@
}
-static void ha_was_inited_ok(handlerton *ht)
+int ha_finalize_handlerton(handlerton *hton)
{
- uint tmp= ht->savepoint_offset;
- ht->savepoint_offset= savepoint_alloc_size;
- savepoint_alloc_size+= tmp;
- ht->slot= total_ha++;
- if (ht->prepare)
- total_ha_2pc++;
+ DBUG_ENTER("ha_finalize_handlerton");
+
+ if (hton == NULL)
+ DBUG_RETURN(1);
+
+ switch (hton->state)
+ {
+ case SHOW_OPTION_NO:
+ case SHOW_OPTION_DISABLED:
+ break;
+ case SHOW_OPTION_YES:
+ if (hton->panic && hton->panic(HA_PANIC_CLOSE))
+ DBUG_RETURN(1);
+ if (installed_htons[hton->db_type] == hton)
+ installed_htons[hton->db_type]= NULL;
+ break;
+ };
+ DBUG_RETURN(0);
}
-int ha_initialize_handlerton(handlerton *hton)
+int ha_initialize_handlerton(char *name, handlerton *hton)
{
DBUG_ENTER("ha_initialize_handlerton");
if (hton == NULL)
DBUG_RETURN(1);
+ hton->name= name; /* sanity */
+
switch (hton->state)
{
case SHOW_OPTION_NO:
@@ -412,7 +397,47 @@
case SHOW_OPTION_YES:
if (!hton->init || !hton->init())
{
- ha_was_inited_ok(hton);
+ uint tmp= hton->savepoint_offset;
+ hton->savepoint_offset= savepoint_alloc_size;
+ savepoint_alloc_size+= tmp;
+ hton->slot= total_ha++;
+ if (hton->prepare)
+ total_ha_2pc++;
+
+ /* now check the db_type for conflict */
+ if (hton->db_type <= DB_TYPE_UNKNOWN ||
+ hton->db_type >= DB_TYPE_DEFAULT ||
+ installed_htons[hton->db_type])
+ {
+ uint32 tbl[256], crc, idx;
+
+ for (unsigned i = 0; i < 256; ++i)
+ {
+ ulong reg = i << 24;
+ reg= (reg << 1) ^ ((reg & 0x80000000) ? 0x04c11db7 : 0);
+ reg= (reg << 1) ^ ((reg & 0x80000000) ? 0x04c11db7 : 0);
+ reg= (reg << 1) ^ ((reg & 0x80000000) ? 0x04c11db7 : 0);
+ reg= (reg << 1) ^ ((reg & 0x80000000) ? 0x04c11db7 : 0);
+ reg= (reg << 1) ^ ((reg & 0x80000000) ? 0x04c11db7 : 0);
+ reg= (reg << 1) ^ ((reg & 0x80000000) ? 0x04c11db7 : 0);
+ reg= (reg << 1) ^ ((reg & 0x80000000) ? 0x04c11db7 : 0);
+ reg= (reg << 1) ^ ((reg & 0x80000000) ? 0x04c11db7 : 0);
+ tbl[i]= reg;
+ }
+
+ for (crc= 0; *name; name++)
+ crc= (crc << 8) ^ tbl[(crc >> 24) ^ *(uchar*)name];
+
+ idx= (crc % (127 - 32)) + 32;
+ while (installed_htons[idx])
+ idx= ((crc= (crc << 8) ^ tbl[crc >> 24]) % (127 - 32)) + 32;
+
+ if (hton->db_type >= DB_TYPE_UNKNOWN)
+ sql_print_warning("Storage engine '%s' has conflicting typecode. "
+ "Assigning value %d.", hton->name, idx);
+ hton->db_type= (enum legacy_db_type) idx;
+ }
+ installed_htons[hton->db_type]= hton;
break;
}
/* fall through */
@@ -429,7 +454,8 @@
{
if (plugin->state == PLUGIN_IS_UNINITIALIZED)
{
- ha_initialize_handlerton((handlerton *) plugin->plugin->info);
+ ha_initialize_handlerton(plugin->name.str,
+ (handlerton *) plugin->plugin->info);
plugin->state= PLUGIN_IS_READY;
}
return FALSE;
@@ -443,6 +469,8 @@
show_table_alias_st *table_alias;
total_ha= savepoint_alloc_size= 0;
+ bzero(installed_htons, sizeof(installed_htons));
+
if (ha_init_errors())
return 1;
@@ -1424,6 +1452,12 @@
/****************************************************************************
** General handler functions
****************************************************************************/
+
+
+void handler::ha_statistic_increment(ulong SSV::*offset) const
+{
+ statistic_increment(table->in_use->status_var.*offset, &LOCK_status);
+}
/*
Open database-handler.
--- 1.182/sql/handler.h 2006-01-19 05:56:00 +03:00
+++ 1.183/sql/handler.h 2006-01-19 17:52:20 +03:00
@@ -237,6 +237,7 @@
DB_TYPE_BLACKHOLE_DB,
DB_TYPE_PARTITION_DB,
DB_TYPE_BINLOG,
+ DB_TYPE_FIRST_DYNAMIC=32,
DB_TYPE_DEFAULT=127 // Must be last
};
@@ -1006,6 +1007,9 @@
byte *end_of_used_area; /* End of area that was used by handler */
} HANDLER_BUFFER;
+typedef struct system_status_var SSV;
+
+
class handler :public Sql_alloc
{
#ifdef WITH_PARTITION_STORAGE_ENGINE
@@ -1027,6 +1031,8 @@
virtual int rnd_init(bool scan) =0;
virtual int rnd_end() { return 0; }
+ void ha_statistic_increment(ulong SSV::*offset) const;
+
private:
virtual int reset() { return extra(HA_EXTRA_RESET); }
public:
@@ -1109,7 +1115,10 @@
TRUE Locking is allowed
FALSE Locking is not allowed. The error was thrown.
*/
- virtual bool check_if_locking_is_allowed(THD *thd, TABLE *table, uint count)
+ virtual bool check_if_locking_is_allowed(uint sql_command,
+ ulong type, TABLE *table,
+ uint count,
+ bool called_by_logger_thread)
{
return TRUE;
}
@@ -1704,7 +1713,7 @@
virtual bool check_if_incompatible_data(HA_CREATE_INFO *create_info,
uint table_changes)
{ return COMPATIBLE_DATA_NO; }
-
+
private:
/*
@@ -1779,7 +1788,8 @@
/* basic stuff */
int ha_init(void);
int ha_register_builtin_plugins();
-int ha_initialize_handlerton(handlerton *hton);
+int ha_initialize_handlerton(char *name, handlerton *hton);
+int ha_finalize_handlerton(handlerton *hton);
TYPELIB *ha_known_exts(void);
int ha_panic(enum ha_panic_function flag);
--- 1.187/sql/item.h 2006-01-06 21:34:56 +03:00
+++ 1.188/sql/item.h 2006-01-19 17:52:20 +03:00
@@ -1932,7 +1932,7 @@
virtual Item *real_item() { return ref; }
};
-
+#ifdef MYSQL_SERVER
#include "gstream.h"
#include "spatial.h"
#include "item_sum.h"
@@ -1945,6 +1945,7 @@
#include "item_uniq.h"
#include "item_subselect.h"
#include "item_xmlfunc.h"
+#endif
class Item_copy_string :public Item
{
--- 1.85/sql/lock.cc 2006-01-19 05:56:00 +03:00
+++ 1.86/sql/lock.cc 2006-01-19 17:52:20 +03:00
@@ -617,8 +617,11 @@
Check if we can lock the table. For some tables we cannot do that
beacause of handler-specific locking issues.
*/
- if (!table_ptr[i]->file->check_if_locking_is_allowed(thd, table_ptr[i],
- count))
+ if (!table_ptr[i]-> file->
+ check_if_locking_is_allowed(thd->lex->sql_command, thd->lex->type,
+ table_ptr[i], count,
+ (thd == logger.get_general_log_thd()) ||
+ (thd == logger.get_slow_log_thd())))
return 0;
}
--- 1.370/sql/mysql_priv.h 2006-01-19 05:56:00 +03:00
+++ 1.371/sql/mysql_priv.h 2006-01-19 17:52:20 +03:00
@@ -477,6 +477,10 @@
}
#define current_thd _current_thd()
+my_bool thd_in_lock_tables(const THD *thd);
+my_bool thd_tablespace_op(const THD *thd);
+const char *thd_proc_info(THD *thd, const char *info);
+
/*
External variables
*/
@@ -507,7 +511,9 @@
class sys_var;
#include "item.h"
extern my_decimal decimal_zero;
+#ifdef MYSQL_SERVER
typedef Comp_creator* (*chooser_compare_func_creator)(bool invert);
+#endif
/* sql_parse.cc */
void free_items(Item *item);
void cleanup_items(Item *item);
@@ -545,6 +551,7 @@
#include "sql_class.h"
#include "sql_acl.h"
#include "tztime.h"
+#ifdef MYSQL_SERVER
#include "opt_range.h"
#ifdef HAVE_QUERY_CACHE
@@ -841,6 +848,8 @@
Field *
find_field_in_table_sef(TABLE *table, const char *name);
+#endif /* MYSQL_SERVER */
+
#ifdef HAVE_OPENSSL
#include <openssl/des.h>
struct st_des_keyblock
@@ -858,6 +867,7 @@
bool load_des_key_file(const char *file_name);
#endif /* HAVE_OPENSSL */
+#ifdef MYSQL_SERVER
/* sql_do.cc */
bool mysql_do(THD *thd, List<Item> &values);
@@ -1169,6 +1179,7 @@
int key_rec_cmp(void *key_info, byte *a, byte *b);
bool init_errmessage(void);
+#endif /* MYSQL_SERVER */
void sql_perror(const char *message);
int vprint_msg_to_log(enum loglevel level, const char *format, va_list args);
@@ -1191,6 +1202,7 @@
bool fn_format_relative_to_data_home(my_string to, const char *name,
const char *dir, const char *extension);
+#ifdef MYSQL_SERVER
File open_binlog(IO_CACHE *log, const char *log_file_name,
const char **errmsg);
@@ -1739,4 +1751,5 @@
#define check_stack_overrun(A, B, C) 0
#endif
+#endif /* MYSQL_SERVER */
#endif /* MYSQL_CLIENT */
--- 1.237/sql/sql_class.cc 2006-01-18 11:46:25 +03:00
+++ 1.238/sql/sql_class.cc 2006-01-19 17:52:20 +03:00
@@ -168,6 +168,26 @@
}
+my_bool thd_in_lock_tables(const THD *thd)
+{
+ return thd->in_lock_tables;
+}
+
+
+my_bool thd_tablespace_op(const THD *thd)
+{
+ return thd->tablespace_op;
+}
+
+
+const char *thd_proc_info(THD *thd, const char *info)
+{
+ const char *old_info= thd->proc_info;
+ thd->proc_info= info;
+ return old_info;
+}
+
+
/*
Pass nominal parameters to Statement constructor only to ensure that
the destructor works OK in case of error. The main_mem_root will be
--- 1.283/sql/sql_class.h 2006-01-18 11:47:54 +03:00
+++ 1.284/sql/sql_class.h 2006-01-19 17:52:20 +03:00
@@ -171,6 +171,7 @@
class delayed_insert;
class select_result;
+class Time_zone;
#define THD_SENTRY_MAGIC 0xfeedd1ff
#define THD_SENTRY_GONE 0xdeadbeef
@@ -344,6 +345,8 @@
#define last_system_status_var com_stmt_close
+#ifdef MYSQL_SERVER
+
void free_tmp_table(THD *thd, TABLE *entry);
@@ -354,7 +357,6 @@
#define INIT_ARENA_DBUG_INFO
#endif
-
class Query_arena
{
public:
@@ -1905,3 +1907,5 @@
/* Functions in sql_class.cc */
void add_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var);
+
+#endif /* MYSQL_SERVER */
--- 1.211/sql/sql_lex.h 2006-01-17 10:37:27 +03:00
+++ 1.212/sql/sql_lex.h 2006-01-19 17:52:20 +03:00
@@ -29,6 +29,7 @@
class partition_info;
class event_timed;
+#ifdef MYSQL_SERVER
/*
The following hack is needed because mysql_yacc.cc does not define
YYSTYPE before including this file
@@ -43,6 +44,7 @@
#include "sql_yacc.h"
#define LEX_YYSTYPE YYSTYPE *
#endif
+#endif
/*
When a command is added here, be sure it's also added in mysqld.cc
@@ -115,6 +117,8 @@
*/
#define DESCRIBE_PARTITIONS 4
+#ifdef MYSQL_SERVER
+
enum enum_sp_suid_behaviour
{
SP_IS_DEFAULT_SUID= 0,
@@ -1109,3 +1113,5 @@
extern pthread_key(LEX*,THR_LEX);
#define current_lex (current_thd->lex)
+
+#endif
--- 1.3/config/ac-macros/storage.m4 2005-12-22 01:57:53 +03:00
+++ 1.4/config/ac-macros/storage.m4 2006-01-19 17:52:20 +03:00
@@ -21,9 +21,14 @@
m4_default([$5], [WITH_]AS_TR_CPP([$1])[_STORAGE_ENGINE]),
m4_default([$6], $1[_hton]), dnl hton
m4_default([$7], []), dnl path to the code
-m4_default([$8], [ha_$1.o]), dnl path to the handler in
-m4_default([$9], []), dnl path to extra libraries
-[$10], dnl code-if-set
+m4_default([$8], [ha_$1.o]), dnl path to the handler in
+m4_default([$9], []), dnl path to extra libraries
+m4_default([$10], no), dnl plugin support
+[$11], dnl code-if-set
+[lib$1.a], dnl path to the handler in
+[ha_$1][_static_target],
+[ha_$1.la], dnl path to the handler in
+[ha_$1][_shared_target],
)])
AC_DEFUN([_MYSQL_STORAGE_ENGINE],
@@ -33,19 +38,32 @@
AC_CACHE_CHECK([whether to use $2], [mysql_cv_use_]m4_bpatsubst([$3], -, _),
[mysql_cv_use_]m4_bpatsubst([$3], -, _)=[$with_]m4_bpatsubst([$3], -, _))
AH_TEMPLATE([$5], [Build $2])
-if test "[$mysql_cv_use_]m4_bpatsubst([$3], -, _)" != no; then
-if test "$6" != "no"
-then
+if test "[$mysql_cv_use_]m4_bpatsubst([$3], -, _)" != "no"; then
+[$13]=""
+[$15]=""
+if test "[$mysql_cv_use_]m4_bpatsubst([$3], -, _)" == "plugin"; then
+ if test "$10" == "yes"; then
+ mysql_se_plugins="$mysql_se_plugins $7"
+ [$15]="$14"
+ else
+ AC_MSG_ERROR([$2 is not available as a plugin.])
+ fi
+elif test "[$mysql_cv_use_]m4_bpatsubst([$3], -, _)" == "yes"; then
AC_DEFINE([$5])
mysql_se_decls="${mysql_se_decls},$6"
mysql_se_htons="${mysql_se_htons},&$6"
- mysql_se_objs="$mysql_se_objs $8"
+ if test "$10" != "yes"; then
+ mysql_se_objs="$mysql_se_objs $8"
+ fi
mysql_se_dirs="$mysql_se_dirs $7"
mysql_se_libs="$mysql_se_libs $9"
-else
- mysql_se_plugins="$mysql_se_plugins $7"
+ [$13]="$12"
+elif test "[$mysql_cv_use_]m4_bpatsubst([$3], -, _)" != "no"; then
+ AC_MSG_ERROR([Invalid option for --with-$3. See the Installation chapter in the Reference Manual.])
fi
-$10
+AC_SUBST([$13])
+AC_SUBST([$15])
+$11
fi
])
--- 1.4/storage/csv/Makefile.am 2006-01-05 16:16:22 +03:00
+++ 1.5/storage/csv/Makefile.am 2006-01-19 17:52:20 +03:00
@@ -26,15 +26,23 @@
-I$(srcdir)
WRAPLIBS=
-pkglib_LTLIBRARIES = ha_csv.la
+LDADD =
+
+DEFS = @DEFS@
-ha_csv_la_LDFLAGS = -module
noinst_HEADERS = ha_tina.h
+
+EXTRA_LTLIBRARIES = ha_csv.la
+pkglib_LTLIBRARIES = @ha_csv_shared_target@
+ha_csv_la_LDFLAGS = -module -rpath $(MYSQLLIBdir)
+ha_csv_la_CXXFLAGS = $(AM_CFLAGS) -DMYSQL_PLUGIN
ha_csv_la_SOURCES = ha_tina.cc
-LDADD =
-DEFS = -DMYSQL_SERVER @DEFS@
+EXTRA_LIBRARIES = libcsv.a
+noinst_LIBRARIES = @ha_csv_static_target@
+libcsv_a_CXXFLAGS = $(AM_CFLAGS)
+libcsv_a_SOURCES = ha_tina.cc
# Don't update the files from bitkeeper
%::SCCS/s.%
--- 1.4/storage/example/Makefile.am 2006-01-05 16:16:22 +03:00
+++ 1.5/storage/example/Makefile.am 2006-01-19 17:52:20 +03:00
@@ -26,15 +26,24 @@
-I$(srcdir)
WRAPLIBS=
-pkglib_LTLIBRARIES = ha_example.la
+LDADD =
+
+DEFS = @DEFS@
+
+noinst_HEADERS = ha_example.h
-ha_example_la_LDFLAGS = -module
-noinst_HEADERS = ha_example.h
+EXTRA_LTLIBRARIES = ha_example.la
+pkglib_LTLIBRARIES = @ha_example_shared_target@
+ha_example_la_LDFLAGS = -module -rpath $(MYSQLLIBdir)
+ha_example_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_PLUGIN
ha_example_la_SOURCES = ha_example.cc
-LDADD =
-DEFS = -DMYSQL_SERVER @DEFS@
+EXTRA_LIBRARIES = libexample.a
+noinst_LIBRARIES = @ha_example_static_target@
+libexample_a_CXXFLAGS = $(AM_CFLAGS)
+libexample_a_SOURCES = ha_example.cc
+
# Don't update the files from bitkeeper
%::SCCS/s.%
--- 1.75/sql/ha_archive.cc 2006-01-17 10:37:21 +03:00
+++ 1.77/storage/archive/ha_archive.cc 2006-01-19 17:52:21 +03:00
@@ -19,10 +19,15 @@
#endif
#include "mysql_priv.h"
+#include <myisam.h>
#include "ha_archive.h"
#include <my_dir.h>
+#ifdef MYSQL_PLUGIN
+#include <plugin.h>
+#endif
+
/*
First, if you want to understand storage engines you should look at
ha_example.cc and ha_example.h.
@@ -148,7 +153,7 @@
SHOW_OPTION_YES,
"Archive storage engine",
DB_TYPE_ARCHIVE_DB,
- archive_db_init,
+ (bool (*)())archive_db_init,
0, /* slot */
0, /* savepoint size. */
NULL, /* close_connection */
@@ -204,9 +209,11 @@
TRUE Error
*/
-bool archive_db_init()
+int archive_db_init()
{
DBUG_ENTER("archive_db_init");
+ if (archive_inited)
+ DBUG_RETURN(FALSE);
if (pthread_mutex_init(&archive_mutex, MY_MUTEX_INIT_FAST))
goto error;
if (hash_init(&archive_open_tables, system_charset_info, 32, 0, 0,
@@ -220,7 +227,6 @@
DBUG_RETURN(FALSE);
}
error:
- have_archive_db= SHOW_OPTION_DISABLED; // If we couldn't use handler
DBUG_RETURN(TRUE);
}
@@ -228,14 +234,14 @@
Release the archive handler.
SYNOPSIS
- archive_db_end()
+ archive_db_done()
void
RETURN
FALSE OK
*/
-int archive_db_end(ha_panic_function type)
+int archive_db_done()
{
if (archive_inited)
{
@@ -246,6 +252,12 @@
return 0;
}
+
+int archive_db_end(ha_panic_function type)
+{
+ return archive_db_done();
+}
+
ha_archive::ha_archive(TABLE_SHARE *table_arg)
:handler(&archive_hton, table_arg), delayed_insert(0), bulk_insert(0)
{
@@ -716,7 +728,7 @@
if (share->crashed)
DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE);
- statistic_increment(table->in_use->status_var.ha_write_count, &LOCK_status);
+ ha_statistic_increment(&SSV::ha_write_count);
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT)
table->timestamp_field->set_time();
pthread_mutex_lock(&share->mutex);
@@ -1028,8 +1040,7 @@
DBUG_RETURN(HA_ERR_END_OF_FILE);
scan_rows--;
- statistic_increment(table->in_use->status_var.ha_read_rnd_next_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_rnd_next_count);
current_position= aztell(&archive);
rc= get_row(&archive, buf);
@@ -1065,8 +1076,7 @@
int ha_archive::rnd_pos(byte * buf, byte *pos)
{
DBUG_ENTER("ha_archive::rnd_pos");
- statistic_increment(table->in_use->status_var.ha_read_rnd_next_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_rnd_next_count);
current_position= (my_off_t)my_get_ptr(pos, ref_length);
(void)azseek(&archive, current_position, SEEK_SET);
@@ -1225,8 +1235,8 @@
*/
if ((lock_type >= TL_WRITE_CONCURRENT_INSERT &&
- lock_type <= TL_WRITE) && !thd->in_lock_tables
- && !thd->tablespace_op)
+ lock_type <= TL_WRITE) && !thd_in_lock_tables(thd)
+ && !thd_tablespace_op(thd))
lock_type = TL_WRITE_ALLOW_WRITE;
/*
@@ -1237,7 +1247,7 @@
concurrent inserts to t2.
*/
- if (lock_type == TL_READ_NO_INSERT && !thd->in_lock_tables)
+ if (lock_type == TL_READ_NO_INSERT && !thd_in_lock_tables(thd))
lock_type = TL_READ;
lock.type=lock_type;
@@ -1346,11 +1356,11 @@
{
int rc= 0;
byte *buf;
- const char *old_proc_info=thd->proc_info;
+ const char *old_proc_info;
ha_rows count= share->rows_recorded;
DBUG_ENTER("ha_archive::check");
- thd->proc_info= "Checking table";
+ old_proc_info= thd_proc_info(thd, "Checking table");
/* Flush any waiting data */
azflush(&(share->archive_write), Z_SYNC_FLUSH);
@@ -1374,7 +1384,7 @@
my_free((char*)buf, MYF(0));
- thd->proc_info= old_proc_info;
+ thd_proc_info(thd, old_proc_info);
if ((rc && rc != HA_ERR_END_OF_FILE) || count)
{
@@ -1406,3 +1416,19 @@
DBUG_RETURN(HA_ADMIN_OK);
}
}
+
+
+#ifdef MYSQL_PLUGIN
+mysql_declare_plugin
+{
+ MYSQL_STORAGE_ENGINE_PLUGIN,
+ &archive_hton,
+ archive_hton.name,
+ "Brian Aker, MySQL AB",
+ "Archive Storage Engine",
+ archive_db_init, /* Plugin Init */
+ archive_db_done, /* Plugin Deinit */
+ 0x0100 /* 1.0 */,
+}
+mysql_declare_plugin_end;
+#endif
--- 1.40/sql/ha_archive.h 2006-01-12 09:58:57 +03:00
+++ 1.42/storage/archive/ha_archive.h 2006-01-19 17:52:21 +03:00
@@ -19,7 +19,7 @@
#endif
#include <zlib.h>
-#include "../storage/archive/azlib.h"
+#include "azlib.h"
/*
Please read ha_archive.cc first. If you are looking for more general
@@ -125,6 +125,6 @@
bool check_and_repair(THD *thd);
};
-bool archive_db_init(void);
+int archive_db_init(void);
int archive_db_end(ha_panic_function type);
--- 1.30/storage/csv/ha_tina.cc 2006-01-19 05:56:01 +03:00
+++ 1.31/storage/csv/ha_tina.cc 2006-01-19 17:52:20 +03:00
@@ -51,7 +51,9 @@
#include "ha_tina.h"
#include <sys/mman.h>
+#ifdef MYSQL_PLUGIN
#include <plugin.h>
+#endif
/* Stuff for shares */
pthread_mutex_t tina_mutex;
@@ -590,7 +592,10 @@
}
-bool ha_tina::check_if_locking_is_allowed(THD *thd, TABLE *table, uint count)
+bool ha_tina::check_if_locking_is_allowed(uint sql_command,
+ ulong type, TABLE *table,
+ uint count,
+ bool called_by_logger_thread)
{
/*
Deny locking of the log tables, which is incompatible with
@@ -598,11 +603,10 @@
general_log_thd or slow_log_thd.
*/
if (table->s->log_table &&
- thd->lex->sql_command != SQLCOM_TRUNCATE &&
- !(thd->lex->sql_command == SQLCOM_FLUSH &&
- thd->lex->type & REFRESH_LOG) &&
- (thd != logger.get_general_log_thd()) &&
- (thd != logger.get_slow_log_thd()) &&
+ sql_command != SQLCOM_TRUNCATE &&
+ !(sql_command == SQLCOM_FLUSH &&
+ type & REFRESH_LOG) &&
+ !called_by_logger_thread &&
(table->reginfo.lock_type >= TL_READ_NO_INSERT))
{
/*
@@ -665,7 +669,7 @@
int size;
DBUG_ENTER("ha_tina::write_row");
- statistic_increment(table->in_use->status_var.ha_write_count, &LOCK_status);
+ ha_statistic_increment(&SSV::ha_write_count);
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT)
table->timestamp_field->set_time();
@@ -714,9 +718,7 @@
int size;
DBUG_ENTER("ha_tina::update_row");
-
- statistic_increment(table->in_use->status_var.ha_read_rnd_next_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_rnd_next_count);
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
table->timestamp_field->set_time();
@@ -751,8 +753,7 @@
int ha_tina::delete_row(const byte * buf)
{
DBUG_ENTER("ha_tina::delete_row");
- statistic_increment(table->in_use->status_var.ha_delete_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_delete_count);
if (chain_append())
DBUG_RETURN(-1);
@@ -903,8 +904,7 @@
{
DBUG_ENTER("ha_tina::rnd_next");
- statistic_increment(table->in_use->status_var.ha_read_rnd_next_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_rnd_next_count);
current_position= next_position;
if (!share->mapped_file)
@@ -941,8 +941,7 @@
int ha_tina::rnd_pos(byte * buf, byte *pos)
{
DBUG_ENTER("ha_tina::rnd_pos");
- statistic_increment(table->in_use->status_var.ha_read_rnd_next_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_rnd_next_count);
current_position= my_get_ptr(pos,ref_length);
DBUG_RETURN(find_current_row(buf));
}
@@ -1111,6 +1110,7 @@
DBUG_RETURN(0);
}
+#ifdef MYSQL_PLUGIN
mysql_declare_plugin
{
MYSQL_STORAGE_ENGINE_PLUGIN,
@@ -1123,4 +1123,4 @@
0x0100 /* 1.0 */,
}
mysql_declare_plugin_end;
-
+#endif
--- 1.11/storage/csv/ha_tina.h 2006-01-19 05:56:01 +03:00
+++ 1.12/storage/csv/ha_tina.h 2006-01-19 17:52:20 +03:00
@@ -104,7 +104,11 @@
*/
ha_rows estimate_rows_upper_bound() { return HA_POS_ERROR; }
- virtual bool check_if_locking_is_allowed(THD *thd, TABLE *table, uint count);
+ virtual bool ha_tina::
+ check_if_locking_is_allowed(uint sql_command,
+ ulong type, TABLE *table,
+ uint count,
+ bool called_by_logger_thread);
int open(const char *name, int mode, uint test_if_locked);
int close(void);
int write_row(byte * buf);
--- 1.30/storage/example/ha_example.cc 2006-01-17 10:37:30 +03:00
+++ 1.31/storage/example/ha_example.cc 2006-01-19 17:52:21 +03:00
@@ -70,7 +70,9 @@
#include "mysql_priv.h"
#include "ha_example.h"
+#ifdef MYSQL_PLUGIN
#include <plugin.h>
+#endif
static handler* example_create_handler(TABLE_SHARE *table);
static int example_init_func();
@@ -725,6 +727,8 @@
DBUG_RETURN(0);
}
+
+#ifdef MYSQL_PLUGIN
mysql_declare_plugin
{
MYSQL_STORAGE_ENGINE_PLUGIN,
@@ -737,4 +741,4 @@
0x0001 /* 0.1 */,
}
mysql_declare_plugin_end;
-
+#endif
--- 1.1/storage/archive/Makefile.am 2005-12-23 06:49:59 +03:00
+++ 1.2/storage/archive/Makefile.am 2006-01-19 17:52:20 +03:00
@@ -14,18 +14,48 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \
- @ZLIB_INCLUDES@
+#called from the top level Makefile
-LDADD = libarchive.a $(top_srcdir)/mysys/libmysys.a \
+MYSQLDATAdir = $(localstatedir)
+MYSQLSHAREdir = $(pkgdatadir)
+MYSQLBASEdir= $(prefix)
+MYSQLLIBdir= $(pkglibdir)
+INCLUDES = -I$(top_srcdir)/include \
+ -I$(top_srcdir)/regex \
+ -I$(top_srcdir)/sql \
+ -I$(srcdir) @ZLIB_INCLUDES@
+WRAPLIBS=
+
+LDADD =
+
+DEFS = @DEFS@
+
+noinst_HEADERS = ha_archive.h azlib.h
+noinst_PROGRAMS = archive_test
+
+EXTRA_LTLIBRARIES = ha_archive.la
+pkglib_LTLIBRARIES = @ha_archive_shared_target@
+ha_archive_la_LDFLAGS = -module -rpath $(MYSQLLIBdir)
+ha_archive_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_PLUGIN
+ha_archive_la_CFLAGS = $(AM_CFLAGS)
+ha_archive_la_SOURCES = ha_archive.cc azio.c
+
+
+EXTRA_LIBRARIES = libarchive.a
+noinst_LIBRARIES = @ha_archive_static_target@
+libarchive_a_CXXFLAGS = $(AM_CFLAGS)
+libarchive_a_CFLAGS = $(AM_CFLAGS)
+libarchive_a_SOURCES = ha_archive.cc azio.c
+
+
+archive_test_SOURCES = archive_test.c azio.c
+archive_test_CFLAGS = $(AM_CFLAGS)
+archive_test_LDADD = $(top_srcdir)/mysys/libmysys.a \
$(top_srcdir)/dbug/libdbug.a \
$(top_srcdir)/strings/libmystrings.a \
@ZLIB_LIBS@
-pkglib_LIBRARIES = libarchive.a
-noinst_PROGRAMS = archive_test
-archive_test_LDFLAGS = @NOINST_LDFLAGS@
-noinst_HEADERS = azlib.h
-libarchive_a_SOURCES = azio.c
+archive_test_LDFLAGS = @NOINST_LDFLAGS@
+
# Don't update the files from bitkeeper
%::SCCS/s.%
--- 1.9/storage/innobase/Makefile.am 2005-12-16 14:45:37 +03:00
+++ 1.10/storage/innobase/Makefile.am 2006-01-19 17:52:21 +03:00
@@ -78,5 +78,34 @@
include/ut0mem.h include/ut0mem.ic include/ut0rnd.h include/ut0rnd.ic \
include/ut0sort.h include/ut0ut.h include/ut0ut.ic
+noinst_LIBRARIES = libinnodb.a
+libinnodb_a_LIBADD = usr/libusr.a srv/libsrv.a dict/libdict.a \
+ que/libque.a srv/libsrv.a ibuf/libibuf.a \
+ row/librow.a pars/libpars.a btr/libbtr.a \
+ trx/libtrx.a read/libread.a usr/libusr.a \
+ buf/libbuf.a ibuf/libibuf.a eval/libeval.a \
+ log/liblog.a fsp/libfsp.a fut/libfut.a \
+ fil/libfil.a lock/liblock.a mtr/libmtr.a \
+ page/libpage.a rem/librem.a thr/libthr.a \
+ sync/libsync.a data/libdata.a mach/libmach.a \
+ ha/libha.a dyn/libdyn.a mem/libmem.a \
+ ut/libut.a os/libos.a ut/libut.a
+libinnodb_a_SOURCES =
+
+
+libinnodb.a: $(libinnodb_a_LIBADD)
+ -rm -f $@
+ if test "$(host_os)" = "netware" ; \
+ then \
+ $(libmysqld_a_AR) $@ $(libinnodb_a_LIBADD) ; \
+ else \
+ (for arc in $(libinnodb_a_LIBADD); do \
+ arpath=`echo $$arc|sed 's|[^/]*$$||'`; \
+ $(AR) t $$arc|xargs -n 1 find $$arpath -name; \
+ $(AR) t $$arc|xargs -n 1 find `dirname $$arpath` -path \*/`basename $$arpath`/\* -name; \
+ done ) | sort -u | xargs $(AR) cq $@ ; \
+ $(RANLIB) $@ ; \
+ fi
+
# Don't update the files from bitkeeper
%::SCCS/s.%
--- 1.10/sql/sql_plugin.cc 2006-01-07 16:49:42 +03:00
+++ 1.11/sql/sql_plugin.cc 2006-01-19 17:52:20 +03:00
@@ -517,7 +517,8 @@
switch (plugin->plugin->type)
{
case MYSQL_STORAGE_ENGINE_PLUGIN:
- if (ha_initialize_handlerton((handlerton*) plugin->plugin->info))
+ if (ha_initialize_handlerton(plugin->name.str,
+ (handlerton*) plugin->plugin->info))
{
sql_print_error("Plugin '%s' handlerton init returned error.",
plugin->name.str);
@@ -535,6 +536,44 @@
DBUG_RETURN(1);
}
+static int plugin_finalize(struct st_plugin_int *plugin)
+{
+ int rc;
+ DBUG_ENTER("plugin_finalize");
+
+ if (plugin->plugin->deinit)
+ {
+ if ((rc= plugin->plugin->deinit()))
+ {
+ sql_print_error("Plugin '%s' deinit function returned error rc=%d",
+ plugin->name.str, rc);
+ DBUG_PRINT("warning", ("Plugin '%s' deinit function returned error rc=%d",
+ plugin->name.str, rc))
+ goto err;
+ }
+ }
+
+ switch (plugin->plugin->type)
+ {
+ case MYSQL_STORAGE_ENGINE_PLUGIN:
+ if (ha_finalize_handlerton((handlerton*) plugin->plugin->info))
+ {
+ sql_print_error("Plugin '%s' handlerton deinit returned error.",
+ plugin->name.str);
+ DBUG_PRINT("warning", ("Plugin '%s' handlerton deinit returned error.",
+ plugin->name.str))
+ goto err;
+ }
+ break;
+ default:
+ break;
+ }
+
+ DBUG_RETURN(0);
+err:
+ DBUG_RETURN(1);
+}
+
static void plugin_call_initializer(void)
{
uint i;
@@ -818,7 +857,7 @@
goto err;
}
- if (plugin->ref_count)
+ if (plugin->ref_count || plugin_finalize(plugin))
{
plugin->state= PLUGIN_IS_DELETED;
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
@@ -826,8 +865,6 @@
}
else
{
- if (plugin->plugin->deinit)
- plugin->plugin->deinit();
plugin_del(name);
}
| Thread |
|---|
| • bk commit into 5.1 tree (cps:1.2079) | Petr Chardin | 19 Jan |