Below is the list of changes that have just been committed into a local
5.1 repository of antony. When antony 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.2210 06/03/07 09:20:39 acurtis@stripped +33 -0
plugins and storage engines
storage/innobase/Makefile.am
1.10 06/03/07 09:20:32 acurtis@stripped +29 -0
simplify - consolidate all libraries into one
storage/example/ha_example.cc
1.34 06/03/07 09:20:32 acurtis@stripped +2 -2
change to plugin decl
storage/example/Makefile.am
1.5 06/03/07 09:20:32 acurtis@stripped +13 -4
archive as a plugin
storage/csv/ha_tina.cc
1.36 06/03/07 09:20:32 acurtis@stripped +2 -2
change to plugin decl
storage/csv/Makefile.am
1.7 06/03/07 09:20:32 acurtis@stripped +9 -4
archive as a plugin
storage/archive/ha_archive.h
1.44 06/03/07 09:20:32 acurtis@stripped +1 -1
change include
storage/archive/ha_archive.cc
1.86 06/03/07 09:20:32 acurtis@stripped +36 -14
archive as a plugin
storage/archive/Makefile.am
1.3 06/03/07 09:20:32 acurtis@stripped +39 -10
archive as a plugin
sql/sql_show.cc
1.316 06/03/07 09:20:32 acurtis@stripped +28 -17
dont show builtin plugins by default
sql/sql_plugin.cc
1.16 06/03/07 09:20:32 acurtis@stripped +64 -11
install builtin plugins
sql/mysqld.cc
1.542 06/03/07 09:20:32 acurtis@stripped +13 -17
ha_register_builtin_plugins removed
relocate storage engine init
sql/log.cc
1.194 06/03/07 09:20:32 acurtis@stripped +15 -0
declare plugin
sql/handler.h
1.199 06/03/07 09:20:32 acurtis@stripped +3 -2
storage engine init/fini
sql/handler.cc
1.219 06/03/07 09:20:32 acurtis@stripped +70 -82
clean up
sql/ha_partition.cc
1.34 06/03/07 09:20:32 acurtis@stripped +16 -0
declare plugin
sql/ha_ndbcluster.cc
1.280 06/03/07 09:20:32 acurtis@stripped +16 -0
declare plugin
sql/ha_myisammrg.cc
1.83 06/03/07 09:20:32 acurtis@stripped +15 -0
declare plugin
sql/ha_myisam.cc
1.175 06/03/07 09:20:32 acurtis@stripped +16 -0
declare plugin
sql/ha_innodb.cc
1.259 06/03/07 09:20:31 acurtis@stripped +15 -0
declare plugin
sql/ha_heap.cc
1.84 06/03/07 09:20:31 acurtis@stripped +13 -0
declare plugin
sql/ha_federated.cc
1.54 06/03/07 09:20:31 acurtis@stripped +16 -0
declare plugin
sql/ha_blackhole.cc
1.29 06/03/07 09:20:31 acurtis@stripped +14 -0
declare plugin
sql/ha_berkeley.cc
1.173 06/03/07 09:20:31 acurtis@stripped +14 -0
declare plugin
sql/Makefile.am
1.133 06/03/07 09:20:31 acurtis@stripped +4 -4
ha_archive moved
handlerton.cc -> sql_builtin.cc
plugin/fulltext/plugin_example.c
1.8 06/03/07 09:20:31 acurtis@stripped +1 -1
change to macro arg
libmysqld/Makefile.am
1.81 06/03/07 09:20:31 acurtis@stripped +2 -3
handlerton.cc replaced by more general sql_builtin.cc
include/mysql/plugin.h
1.12 06/03/07 09:20:31 acurtis@stripped +23 -4
make plugins use weak symbols so that plugins can be linked into make executable
without any changes to code. Also if plugin is built as a shared library, it can be
linked in at compile time or loaded runtime with no modifications to binary.
configure.in
1.346 06/03/07 09:20:31 acurtis@stripped +49 -72
tidy up macros for storage engines
config/ac-macros/storage.m4
1.5 06/03/07 09:20:31 acurtis@stripped +137 -35
tidy up macros for storage engines
config/ac-macros/ha_ndbcluster.m4
1.14 06/03/07 09:20:31 acurtis@stripped +2 -0
split macro, always want to build makefile
config/ac-macros/ha_berkeley.m4
1.5 06/03/07 09:20:31 acurtis@stripped +0 -1
split macro, always want to build makefile
Makefile.am
1.83 06/03/07 09:20:31 acurtis@stripped +0 -1
mysql_se_plugins no longer used
BitKeeper/deleted/.del-handlerton.cc.in~377156e7b06067cc
1.2 06/03/02 14:53:09 acurtis@stripped +0 -0
Delete: sql/handlerton.cc.in
storage/archive/ha_archive.h
1.43 06/03/02 13:18:53 acurtis@stripped +0 -0
Rename: sql/ha_archive.h -> storage/archive/ha_archive.h
storage/archive/ha_archive.cc
1.85 06/03/02 13:18:49 acurtis@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: acurtis
# Host: localhost.(none)
# Root: /home/antony/work2/mysql-5.1-plugable.5
--- 1.82/Makefile.am 2005-12-28 04:05:19 -08:00
+++ 1.83/Makefile.am 2006-03-07 09:20:31 -08:00
@@ -26,7 +26,6 @@ SUBDIRS = . include @docs_dirs@ @zlib_d
@thread_dirs@ pstack \
@sql_union_dirs@ @mysql_se_dirs@ \
@sql_server@ scripts @man_dirs@ tests \
- @mysql_se_plugins@ \
netware @libmysqld_dirs@ \
@bench_dirs@ support-files @tools_dirs@ \
plugin
--- 1.345/configure.in 2006-02-28 13:46:18 -08:00
+++ 1.346/configure.in 2006-03-07 09:20:31 -08:00
@@ -672,6 +672,48 @@ MYSQL_SYS_LARGEFILE
AC_TYPE_SIZE_T
#--------------------------------------------------------------------
+# Check for requested features
+#--------------------------------------------------------------------
+
+MYSQL_CHECK_BIG_TABLES
+MYSQL_CHECK_MAX_INDEXES
+MYSQL_CHECK_REPLICATION
+
+
+MYSQL_PLUGIN_STORAGE_ENGINE(example)
+MYSQL_PLUGIN_STORAGE_ENGINE(archive)
+MYSQL_PLUGIN_STORAGE_ENGINE(csv)
+
+MYSQL_STATIC_STORAGE_ENGINE(blackhole,,,,no,[
+ mysql_se_objs="$mysql_se_objs ha_blackhole.o"
+])
+MYSQL_STATIC_STORAGE_ENGINE(federated,,,,no,[
+ mysql_se_objs="$mysql_se_objs ha_federated.o"
+])
+MYSQL_STATIC_STORAGE_ENGINE(ndbcluster,,ndbcluster,,storage/ndb,[
+ mysql_se_objs="$mysql_se_objs ha_ndbcluster.o"
+ ha_ndbcluster_libs="no"
+ MYSQL_SETUP_NDBCLUSTER
+])
+MYSQL_STATIC_STORAGE_ENGINE(partition,,partition,,no,[
+ mysql_se_objs="$mysql_se_objs ha_partition.o"
+])
+MYSQL_STATIC_STORAGE_ENGINE(berkeley,,berkeley-db,,storage/bdb,[
+ mysql_se_objs="$mysql_se_objs ha_berkeley.o"
+ ha_berkeley_libs="no"
+ MYSQL_SETUP_BERKELEY_DB
+])
+MYSQL_STATIC_STORAGE_ENGINE(innobase,,innodb,,,[
+ 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_se_objs="$mysql_se_objs ha_innodb.o"
+])
+
+
+#--------------------------------------------------------------------
# Check for system header files
#--------------------------------------------------------------------
@@ -2398,73 +2440,6 @@ AC_SUBST(readline_basedir)
AC_SUBST(readline_link)
AC_SUBST(readline_h_ln_cmd)
-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,no,
- \$(top_builddir)/storage/csv/libcsv.a,[
- 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=
sql_server=
@@ -2539,9 +2514,8 @@ AC_SUBST(server_scripts)
AC_SUBST(mysql_se_dirs)
AC_SUBST(mysql_se_libs)
AC_SUBST(mysql_se_objs)
-AC_SUBST(mysql_se_htons)
-AC_SUBST(mysql_se_decls)
-AC_SUBST(mysql_se_plugins)
+
+AC_SUBST(mysql_builtin_plugins)
# Now that sql_client_dirs and sql_server_dirs are stable, determine the union.
@@ -2581,15 +2555,18 @@ done
AC_SUBST(MAKE_BINARY_DISTRIBUTION_OPTIONS)
+NDBCLUSTER_CONFIG_FILES
+
# Output results
AC_CONFIG_FILES(Makefile extra/Makefile mysys/Makefile dnl
strings/Makefile regex/Makefile storage/Makefile storage/heap/Makefile dnl
- storage/myisam/Makefile storage/myisammrg/Makefile dnl
+ storage/myisam/Makefile storage/myisammrg/Makefile storage/bdb/Makefile dnl
+ storage/example/Makefile storage/archive/Makefile storage/csv/Makefile dnl
os2/Makefile os2/include/Makefile os2/include/sys/Makefile dnl
man/Makefile BUILD/Makefile vio/Makefile dnl
libmysql/Makefile client/Makefile dnl
pstack/Makefile pstack/aout/Makefile sql/Makefile sql/share/Makefile dnl
- sql/handlerton.cc sql-common/Makefile SSL/Makefile dnl
+ sql/sql_builtin.cc sql-common/Makefile SSL/Makefile dnl
dbug/Makefile scripts/Makefile dnl
include/Makefile sql-bench/Makefile dnl
server-tools/Makefile server-tools/instance-manager/Makefile dnl
--- 1.132/sql/Makefile.am 2006-02-21 15:39:56 -08:00
+++ 1.133/sql/Makefile.am 2006-03-07 09:20:31 -08:00
@@ -102,9 +102,9 @@ mysqld_SOURCES = sql_lex.cc sql_handler.
sp_cache.cc parse_file.cc sql_trigger.cc \
event_executor.cc event.cc event_timed.cc \
sql_plugin.cc sql_binlog.cc \
- handlerton.cc sql_tablespace.cc partition_info.cc
-EXTRA_mysqld_SOURCES = ha_innodb.cc ha_berkeley.cc ha_archive.cc \
- ha_innodb.h ha_berkeley.h ha_archive.h \
+ sql_builtin.cc sql_tablespace.cc partition_info.cc
+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 \
@@ -124,7 +124,7 @@ DEFS = -DMYSQL_SERVER \
@DEFS@
BUILT_SOURCES = sql_yacc.cc sql_yacc.h lex_hash.h
-EXTRA_DIST = udf_example.cc handlerton-win.cc $(BUILT_SOURCES)
+EXTRA_DIST = udf_example.cc sql_builtin-win.cc $(BUILT_SOURCES)
CLEANFILES = lex_hash.h sql_yacc.cc sql_yacc.h
AM_YFLAGS = -d
--- 1.172/sql/ha_berkeley.cc 2006-02-25 13:20:52 -08:00
+++ 1.173/sql/ha_berkeley.cc 2006-03-07 09:20:31 -08:00
@@ -60,6 +60,8 @@
#include "sql_manager.h"
#include <stdarg.h>
+#include <mysql/plugin.h>
+
#define HA_BERKELEY_ROWS_IN_TABLE 10000 /* to get optimization right */
#define HA_BERKELEY_RANGE_COUNT 100
#define HA_BERKELEY_MAX_ROWS 10000000 /* Max rows in table */
@@ -2724,3 +2726,15 @@ bool ha_berkeley::check_if_incompatible_
}
+mysql_declare_plugin(berkeley)
+{
+ MYSQL_STORAGE_ENGINE_PLUGIN,
+ &berkeley_hton,
+ berkeley_hton.name,
+ "MySQL AB",
+ "BerkeleyDB Storage Engine",
+ NULL, /* Plugin Init */
+ NULL, /* Plugin Deinit */
+ 0x0100 /* 1.0 */,
+}
+mysql_declare_plugin_end;
--- 1.83/sql/ha_heap.cc 2006-02-25 13:20:52 -08:00
+++ 1.84/sql/ha_heap.cc 2006-03-07 09:20:31 -08:00
@@ -706,3 +706,16 @@ bool ha_heap::check_if_incompatible_data
return COMPATIBLE_DATA_NO;
return COMPATIBLE_DATA_YES;
}
+
+mysql_declare_plugin(heap)
+{
+ MYSQL_STORAGE_ENGINE_PLUGIN,
+ &heap_hton,
+ heap_hton.name,
+ NULL,
+ heap_hton.comment,
+ NULL,
+ NULL,
+ 0
+}
+mysql_declare_plugin_end;
--- 1.174/sql/ha_myisam.cc 2006-02-25 13:20:52 -08:00
+++ 1.175/sql/ha_myisam.cc 2006-03-07 09:20:32 -08:00
@@ -31,6 +31,8 @@
#include "../storage/myisam/rt_index.h"
#endif
+#include <mysql/plugin.h>
+
ulong myisam_recover_options= HA_RECOVER_NONE;
/* bits in myisam_recover_options */
@@ -1786,3 +1788,17 @@ bool ha_myisam::check_if_incompatible_da
return COMPATIBLE_DATA_NO;
return COMPATIBLE_DATA_YES;
}
+
+
+mysql_declare_plugin(myisam)
+{
+ MYSQL_STORAGE_ENGINE_PLUGIN,
+ &myisam_hton,
+ myisam_hton.name,
+ "MySQL AB",
+ "MyISAM Storage Engine",
+ NULL, /* Plugin Init */
+ NULL, /* Plugin Deinit */
+ 0x0100 /* 1.0 */,
+}
+mysql_declare_plugin_end;
--- 1.82/sql/ha_myisammrg.cc 2006-02-27 07:58:32 -08:00
+++ 1.83/sql/ha_myisammrg.cc 2006-03-07 09:20:32 -08:00
@@ -28,6 +28,8 @@
#include "../storage/myisammrg/myrg_def.h"
#endif
+#include <mysql/plugin.h>
+
/*****************************************************************************
** MyISAM MERGE tables
*****************************************************************************/
@@ -572,3 +574,16 @@ bool ha_myisammrg::check_if_incompatible
*/
return COMPATIBLE_DATA_NO;
}
+
+mysql_declare_plugin(myisammrg)
+{
+ MYSQL_STORAGE_ENGINE_PLUGIN,
+ &myisammrg_hton,
+ myisammrg_hton.name,
+ "MySQL AB",
+ "MyISAMMRG Storage Engine",
+ NULL, /* Plugin Init */
+ NULL, /* Plugin Deinit */
+ 0x0100 /* 1.0 */,
+}
+mysql_declare_plugin_end;
--- 1.218/sql/handler.cc 2006-02-25 13:20:52 -08:00
+++ 1.219/sql/handler.cc 2006-03-07 09:20:32 -08:00
@@ -43,7 +43,7 @@
#include "ha_innodb.h"
#endif
-extern handlerton *sys_table_types[];
+static handlerton *installed_htons[128];
#define BITMAP_STACKBUF_SIZE (128/8)
@@ -137,30 +137,8 @@ handlerton *ha_resolve_by_name(THD *thd,
}
-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:
@@ -168,13 +146,10 @@ const char *ha_get_storage_engine(enum l
case DB_TYPE_UNKNOWN:
return "UNKNOWN";
default:
- info.db_type= db_type;
-
- if (!plugin_foreach(NULL, plugin_find_dbtype,
- MYSQL_STORAGE_ENGINE_PLUGIN, &info))
+ if (db_type > DB_TYPE_UNKNOWN && db_type < DB_TYPE_DEFAULT &&
+ installed_htons[db_type])
+ return installed_htons[db_type]->name;
return "*NONE*";
-
- return info.hton->name;
}
}
@@ -189,8 +164,6 @@ static handler *create_default(TABLE_SHA
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:
@@ -201,12 +174,9 @@ handlerton *ha_resolve_by_legacy_type(TH
case DB_TYPE_UNKNOWN:
return NULL;
default:
- info.db_type= db_type;
- if (!plugin_foreach(NULL, plugin_find_dbtype,
- MYSQL_STORAGE_ENGINE_PLUGIN, &info))
+ if (db_type > DB_TYPE_UNKNOWN && db_type < DB_TYPE_DEFAULT)
+ return installed_htons[db_type];
return NULL;
-
- return info.hton;
}
}
@@ -393,32 +363,77 @@ static int ha_finish_errors(void)
}
-static void ha_was_inited_ok(handlerton *ht)
+int ha_finalize_handlerton(st_plugin_int *plugin)
{
- 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++;
+ handlerton *hton;
+ DBUG_ENTER("ha_finalize_handlerton");
+
+ if (!(hton= (handlerton *) plugin->plugin->info))
+ 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(st_plugin_int *plugin)
{
+ handlerton *hton;
DBUG_ENTER("ha_initialize_handlerton");
- if (hton == NULL)
+ if (!(hton= (handlerton *) plugin->plugin->info))
DBUG_RETURN(1);
- switch (hton->state)
- {
+ /* for the sake of sanity, we set the handlerton name to be the
+ same as the plugin name */
+ hton->name= plugin->name.str;
+
+
+ switch (hton->state) {
case SHOW_OPTION_NO:
break;
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])
+ {
+ int idx= (int) DB_TYPE_FIRST_DYNAMIC;
+
+ while (idx < (int) DB_TYPE_DEFAULT && installed_htons[idx])
+ idx++;
+
+ if (idx == (int) DB_TYPE_DEFAULT)
+ {
+ sql_print_warning("Too many storage engines!");
+ DBUG_RETURN(1);
+ }
+ 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 */
@@ -435,7 +450,7 @@ static my_bool init_handlerton(THD *unus
{
if (plugin->state == PLUGIN_IS_UNINITIALIZED)
{
- ha_initialize_handlerton((handlerton *) plugin->plugin->info);
+ ha_initialize_handlerton(plugin);
plugin->state= PLUGIN_IS_READY;
}
return FALSE;
@@ -448,12 +463,15 @@ int ha_init()
handlerton **types;
show_table_alias_st *table_alias;
total_ha= savepoint_alloc_size= 0;
+ DBUG_ENTER("ha_init");
+
+ bzero(installed_htons, sizeof(installed_htons));
if (ha_init_errors())
- return 1;
+ DBUG_RETURN(1);
if (plugin_foreach(NULL, init_handlerton, MYSQL_STORAGE_ENGINE_PLUGIN, 0))
- return 1;
+ DBUG_RETURN(1);
DBUG_ASSERT(total_ha < MAX_HA);
/*
@@ -463,37 +481,7 @@ int ha_init()
*/
opt_using_transactions= total_ha>(ulong)opt_bin_log;
savepoint_alloc_size+= sizeof(SAVEPOINT);
- return error;
-}
-
-
-int ha_register_builtin_plugins()
-{
- handlerton **hton;
- uint size= 0;
- struct st_mysql_plugin *plugin;
- DBUG_ENTER("ha_register_builtin_plugins");
-
- for (hton= sys_table_types; *hton; hton++)
- size+= sizeof(struct st_mysql_plugin);
-
- if (!(plugin= (struct st_mysql_plugin *)
- my_once_alloc(size, MYF(MY_WME | MY_ZEROFILL))))
- DBUG_RETURN(1);
-
- for (hton= sys_table_types; *hton; hton++, plugin++)
- {
- plugin->type= MYSQL_STORAGE_ENGINE_PLUGIN;
- plugin->info= *hton;
- plugin->version= 0;
- plugin->name= (*hton)->name;
- plugin->author= NULL;
- plugin->descr= (*hton)->comment;
-
- if (plugin_register_builtin(plugin))
- DBUG_RETURN(1);
- }
- DBUG_RETURN(0);
+ DBUG_RETURN(error);
}
--- 1.198/sql/handler.h 2006-02-28 05:45:25 -08:00
+++ 1.199/sql/handler.h 2006-03-07 09:20:32 -08:00
@@ -233,6 +233,7 @@ enum legacy_db_type
DB_TYPE_BLACKHOLE_DB,
DB_TYPE_PARTITION_DB,
DB_TYPE_BINLOG,
+ DB_TYPE_FIRST_DYNAMIC=32,
DB_TYPE_DEFAULT=127 // Must be last
};
@@ -1501,8 +1502,8 @@ static inline bool ha_storage_engine_is_
/* basic stuff */
int ha_init(void);
-int ha_register_builtin_plugins();
-int ha_initialize_handlerton(handlerton *hton);
+int ha_initialize_handlerton(st_plugin_int *plugin);
+int ha_finalize_handlerton(st_plugin_int *plugin);
TYPELIB *ha_known_exts(void);
int ha_panic(enum ha_panic_function flag);
--- 1.193/sql/log.cc 2006-02-25 13:20:52 -08:00
+++ 1.194/sql/log.cc 2006-03-07 09:20:32 -08:00
@@ -34,6 +34,8 @@
#include "message.h"
#endif
+#include <mysql/plugin.h>
+
/* max size of the log message */
#define MAX_LOG_BUFFER_SIZE 1024
#define MAX_USER_HOST_SIZE 512
@@ -4320,3 +4322,16 @@ err1:
return 1;
}
+
+mysql_declare_plugin(binlog)
+{
+ MYSQL_STORAGE_ENGINE_PLUGIN,
+ &binlog_hton,
+ binlog_hton.name,
+ "MySQL AB",
+ "Binlog Engine",
+ NULL, /* Plugin Init */
+ NULL, /* Plugin Deinit */
+ 0x0100 /* 1.0 */,
+}
+mysql_declare_plugin_end;
--- 1.541/sql/mysqld.cc 2006-02-26 05:12:51 -08:00
+++ 1.542/sql/mysqld.cc 2006-03-07 09:20:32 -08:00
@@ -2703,12 +2703,6 @@ static int init_common_variables(const c
return 1;
}
- if (ha_register_builtin_plugins())
- {
- sql_print_error("Failed to register built-in storage engines.");
- return 1;
- }
-
load_defaults(conf_file_name, groups, &argc, &argv);
defaults_argv=argv;
get_options(argc,argv);
@@ -3077,6 +3071,19 @@ static int init_server_components()
}
}
+ if (xid_cache_init())
+ {
+ sql_print_error("Out of memory");
+ unireg_abort(1);
+ }
+
+ /* We have to initialize the storage engines before CSV logging */
+ if (ha_init())
+ {
+ sql_print_error("Can't init databases");
+ unireg_abort(1);
+ }
+
#ifdef WITH_CSV_STORAGE_ENGINE
if (opt_bootstrap)
log_output_options= LOG_FILE;
@@ -3238,17 +3245,6 @@ server.");
INSERT ... SELECT. This will change when we have row level logging.
*/
using_update_log=1;
- }
-
- if (xid_cache_init())
- {
- sql_print_error("Out of memory");
- unireg_abort(1);
- }
- if (ha_init())
- {
- sql_print_error("Can't init databases");
- unireg_abort(1);
}
/*
--- 1.315/sql/sql_show.cc 2006-02-28 09:33:25 -08:00
+++ 1.316/sql/sql_show.cc 2006-03-07 09:20:32 -08:00
@@ -111,6 +111,10 @@ static my_bool show_plugins(THD *thd, st
CHARSET_INFO *cs= system_charset_info;
char version_buf[20];
+ /* we normally hide all the built-in plugins */
+ if (!plugin->plugin_dl && !thd->lex->verbose)
+ return 0;
+
restore_record(table, s->default_values);
table->field[0]->store(plugin->name.str, plugin->name.length, cs);
@@ -2971,43 +2975,50 @@ int fill_schema_charsets(THD *thd, TABLE
}
-int fill_schema_engines(THD *thd, TABLE_LIST *tables, COND *cond)
+static my_bool iter_schema_engines(THD *thd, st_plugin_int *plugin,
+ void *ptable)
{
+ TABLE *table= (TABLE *) ptable;
+ handlerton *hton= (handlerton *) plugin->plugin->info;
const char *wild= thd->lex->wild ? thd->lex->wild->ptr() : NullS;
- TABLE *table= tables->table;
CHARSET_INFO *scs= system_charset_info;
- handlerton **types;
-
- DBUG_ENTER("fill_schema_engines");
+ DBUG_ENTER("iter_schema_engines");
- for (types= sys_table_types; *types; types++)
+ if (!(hton->flags & HTON_HIDDEN))
{
- if ((*types)->flags & HTON_HIDDEN)
- continue;
-
if (!(wild && wild[0] &&
- wild_case_compare(scs, (*types)->name,wild)))
+ wild_case_compare(scs, hton->name,wild)))
{
const char *tmp;
restore_record(table, s->default_values);
- table->field[0]->store((*types)->name, strlen((*types)->name), scs);
- tmp= (*types)->state ? "DISABLED" : "ENABLED";
+ table->field[0]->store(hton->name, strlen(hton->name), scs);
+ tmp= hton->state ? "DISABLED" : "ENABLED";
table->field[1]->store( tmp, strlen(tmp), scs);
- table->field[2]->store((*types)->comment, strlen((*types)->comment), scs);
- tmp= (*types)->commit ? "YES" : "NO";
+ table->field[2]->store(hton->comment, strlen(hton->comment), scs);
+ tmp= hton->commit ? "YES" : "NO";
table->field[3]->store( tmp, strlen(tmp), scs);
- tmp= (*types)->prepare ? "YES" : "NO";
+ tmp= hton->prepare ? "YES" : "NO";
table->field[4]->store( tmp, strlen(tmp), scs);
- tmp= (*types)->savepoint_set ? "YES" : "NO";
+ tmp= hton->savepoint_set ? "YES" : "NO";
table->field[5]->store( tmp, strlen(tmp), scs);
if (schema_table_store_record(thd, table))
DBUG_RETURN(1);
}
}
-
DBUG_RETURN(0);
+}
+
+
+int fill_schema_engines(THD *thd, TABLE_LIST *tables, COND *cond)
+{
+ const char *wild= thd->lex->wild ? thd->lex->wild->ptr() : NullS;
+ TABLE *table= tables->table;
+ CHARSET_INFO *scs= system_charset_info;
+
+ return plugin_foreach(thd, iter_schema_engines,
+ MYSQL_STORAGE_ENGINE_PLUGIN, tables);
}
--- 1.4/config/ac-macros/storage.m4 2006-01-19 13:40:51 -08:00
+++ 1.5/config/ac-macros/storage.m4 2006-03-07 09:20:31 -08:00
@@ -1,55 +1,157 @@
dnl ---------------------------------------------------------------------------
-dnl Macro: MYSQL_STORAGE_ENGINE
+dnl Macro: MYSQL_STATIC_STORAGE_ENGINE
dnl
dnl What it does:
dnl creates --with-xxx configure option
dnl adds HAVE_XXX to config.h
-dnl appends &xxx_hton, to the list of hanldertons
+dnl appends &builtin_xxx, to the list of static plugins
dnl appends a dir to the list of source directories
-dnl appends ha_xxx.cc to the list of handler files
dnl
dnl all names above are configurable with reasonable defaults.
dnl
dnl ---------------------------------------------------------------------------
+dnl Macro: MYSQL_PLUGIN_STORAGE_ENGINE
+dnl
+dnl What it does:
+dnl creates --with-xxx configure option
+dnl creates --with-xxx-plugin configure option
+dnl creates --with-xxx-shared configure option
+dnl adds HAVE_XXX to config.h
+dnl appends &builtin_xxx, to the list of static plugins
+dnl appends a dir to the list of source directories
+dnl
+dnl all names above are configurable with reasonable defaults.
+dnl
+dnl ---------------------------------------------------------------------------
+
+AC_DEFUN([MYSQL_PLUGIN_STORAGE_ENGINE],
+[_MYSQL_PLUGIN_STORAGE_ENGINE(
+[$1],
+m4_default([$2], [$1 storage engine]), dnl verbose name
+m4_default([$3], [$1-storage-engine]), dnl with-name
+m4_default([$4], [no]), dnl default
+m4_default([$5], [storage/$1]), dnl default path
+[$6]
+)])
+
+AC_DEFUN([MYSQL_STATIC_STORAGE_ENGINE],
+[_MYSQL_STATIC_STORAGE_ENGINE(
+[$1],
+m4_default([$2], [$1 storage engine]), dnl verbose name
+m4_default([$3], [$1-storage-engine]), dnl with-name
+m4_default([$4], [no]), dnl default
+m4_default([$5], [storage/$1]), dnl default path
+[$6]
+)])
+
+
+dnl ---------------------------------------------------------------------------
+
+
+AC_DEFUN([_MYSQL_PLUGIN_STORAGE_ENGINE],
+[__MYSQL_PLUGIN_STORAGE_ENGINE(
+[$1], [$2], [$3], [$4], [$5],
+[WITH_]AS_TR_CPP([$1])[_STORAGE_ENGINE],
+m4_bpatsubst([$3], -, _), [$6]
+)])
+
+
+AC_DEFUN([__MYSQL_PLUGIN_STORAGE_ENGINE],
+[_CHECK_STORAGE_ENGINE(
+[$1], [$2], [$3], [$4], [$5], [$6], [$7], [$8],
+[AC_ARG_WITH([$3-shared], AS_HELP_STRING([--with-$3-shared],
+ [build $2 as a shared library (default is no)]),
+ [], [ [with_$7_shared]=['no']])
+ AC_ARG_WITH([$3-plugin], AS_HELP_STRING([--with-$3-plugin],
+ [build $2 as a plugin module, setting this option to yes implies --with-$3-shared (default is no)]),
+ [], [ [with_$7_plugin]=['no']])],
+[AC_CACHE_CHECK([whether to build $2 as a plugin module],
+ [mysql_cv_use_$7_plugin],
+ [mysql_cv_use_$7_plugin]=[$with_$7_plugin])
+ if test "[$mysql_cv_use_$7_plugin]" == "yes"; then
+ [mysql_cv_use_$7_shared]="yes"
+ fi
+ AC_CACHE_CHECK([whether to build $2 as a shared library],
+ [mysql_cv_use_$7_shared],
+ [mysql_cv_use_$7_shared]=[$with_$7_shared])]
+)])
+
-AC_DEFUN([MYSQL_STORAGE_ENGINE],
-[_MYSQL_STORAGE_ENGINE(
-[$1], dnl name
-m4_default([$2], [$1 storage engine]), dnl verbose name
-m4_default([$3], [$1-storage-engine]), dnl with-name
-m4_default([$4], no), dnl default
-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
+AC_DEFUN([_MYSQL_STATIC_STORAGE_ENGINE],
+[_CHECK_STORAGE_ENGINE(
+[$1], [$2], [$3], [$4], [$5],
+[WITH_]AS_TR_CPP([$1])[_STORAGE_ENGINE],
+m4_bpatsubst([$3], -, _), [$6], [],
+[[mysql_cv_use_]m4_bpatsubst([$3], -, _)[_plugin]="no"
+ [mysql_cv_use_]m4_bpatsubst([$3], -, _)[_shared]="no"]
)])
-AC_DEFUN([_MYSQL_STORAGE_ENGINE],
+
+dnl ---------------------------------------------------------------------------
+
+
+AC_DEFUN([STORAGE_ENGINE_BADOPT],
+[AC_MSG_ERROR([Invalid option for --with-$1. See the Installation chapter in the Reference Manual.])])
+
+
+AC_DEFUN([_CHECK_STORAGE_ENGINE],
[
AC_ARG_WITH([$3], AS_HELP_STRING([--with-$3], [enable $2 (default is $4)]),
-[], [ [with_]m4_bpatsubst([$3], -, _)=['$4']])
-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
- AC_DEFINE([$5])
- mysql_se_decls="${mysql_se_decls},$6"
- mysql_se_htons="${mysql_se_htons},&$6"
- if test "$8" != "no"
- then
- mysql_se_objs="$mysql_se_objs $8"
+ [], [ [with_$7]=['$4']])
+$9
+
+AC_CACHE_CHECK([whether to use $2], [mysql_cv_use_$7],
+ [mysql_cv_use_$7]=[$with_$7])
+
+AH_TEMPLATE([$6], [Build $2])
+
+[ha_$1_static_target]=""
+[ha_$1_shared_target]=""
+
+if test "[$mysql_cv_use_$7]" == "yes"; then
+ [ha_$1_libs]="no"
+
+ $10
+
+ if test "[$mysql_cv_use_$7_shared]" == "no"; then
+ [ha_$1_target]="lib$1.a"
+ [ha_$1_static_target]="[$ha_$1_target]"
+ elif test "[$mysql_cv_use_$7_shared]" == "yes"; then
+ [ha_$1_target]="ha_$1.la"
+ [ha_$1_shared_target]="[$ha_$1_target]"
+ else
+ STORAGE_ENGINE_BADOPT([$3-shared])
fi
- mysql_se_dirs="$mysql_se_dirs $7"
- mysql_se_libs="$mysql_se_libs $9"
-else
- mysql_se_plugins="$mysql_se_plugins $7"
-fi
-$10
+
+ if test "[$5]" != "no"; then
+ mysql_se_dirs="$mysql_se_dirs $5"
+ fi
+
+ if test "[$mysql_cv_use_$7_plugin]" == "no"; then
+ AC_DEFINE([$6])
+ if test "[$ha_$1_target]" != "no" -a "[$5]" != "no"; then
+ [ha_$1_libs]="\$(top_builddir)/$5/[$ha_$1_target]"
+ fi
+ mysql_builtin_plugins="[builtin_$1_plugin], $mysql_builtin_plugins"
+ elif test "[$mysql_cv_use_$7_plugin]" != "yes" -o \
+ "[$mysql_cv_use_$7_shared]" == "no"; then
+ STORAGE_ENGINE_BADOPT([$3-plugin])
+ fi
+
+ $8
+
+ if test "[$ha_$1_libs]" != "no"; then
+ mysql_se_libs="$mysql_se_libs [$ha_$1_libs]"
+ fi
+
+elif test "[$mysql_cv_use_$7]" != "no"; then
+ STORAGE_ENGINE_BADOPT([$3])
fi
+
+AC_SUBST([ha_$1_static_target])
+AC_SUBST([ha_$1_shared_target])
+
])
+
dnl ---------------------------------------------------------------------------
--- 1.6/storage/csv/Makefile.am 2006-02-22 11:22:50 -08:00
+++ 1.7/storage/csv/Makefile.am 2006-03-07 09:20:32 -08:00
@@ -25,15 +25,20 @@ INCLUDES = -I$(top_builddir
-I$(top_srcdir)/regex \
-I$(top_srcdir)/sql \
-I$(srcdir)
-
-pkglib_LIBRARIES = libcsv.a
-
LDADD =
DEFS = @DEFS@
+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
+EXTRA_LIBRARIES = libcsv.a
+noinst_LIBRARIES = @ha_csv_static_target@
libcsv_a_CXXFLAGS = $(AM_CFLAGS)
-noinst_HEADERS = ha_tina.h
libcsv_a_SOURCES = ha_tina.cc
# Don't update the files from bitkeeper
--- 1.4/storage/example/Makefile.am 2006-01-05 05:16:22 -08:00
+++ 1.5/storage/example/Makefile.am 2006-03-07 09:20:32 -08:00
@@ -26,15 +26,24 @@ INCLUDES = -I$(top_srcdir)/
-I$(srcdir)
WRAPLIBS=
-pkglib_LTLIBRARIES = ha_example.la
+LDADD =
+
+DEFS = @DEFS@
-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.4/config/ac-macros/ha_berkeley.m4 2005-11-07 07:24:33 -08:00
+++ 1.5/config/ac-macros/ha_berkeley.m4 2006-03-07 09:20:31 -08:00
@@ -125,7 +125,6 @@ AC_DEFUN([MYSQL_SETUP_BERKELEY_DB], [
AC_SUBST(bdb_includes)
AC_SUBST(bdb_libs)
AC_SUBST(bdb_libs_with_path)
- AC_CONFIG_FILES(storage/bdb/Makefile)
])
AC_DEFUN([MYSQL_CHECK_INSTALLED_BDB], [
--- 1.13/config/ac-macros/ha_ndbcluster.m4 2006-02-15 12:04:36 -08:00
+++ 1.14/config/ac-macros/ha_ndbcluster.m4 2006-03-07 09:20:31 -08:00
@@ -310,7 +310,9 @@ AC_DEFUN([MYSQL_SETUP_NDBCLUSTER], [
AC_SUBST(NDB_DEFS)
AC_SUBST(ndb_cxxflags_fix)
+])
+AC_DEFUN([NDBCLUSTER_CONFIG_FILES], [
AC_CONFIG_FILES(storage/ndb/Makefile storage/ndb/include/Makefile dnl
storage/ndb/src/Makefile storage/ndb/src/common/Makefile dnl
storage/ndb/docs/Makefile dnl
--- 1.84/sql/ha_archive.cc 2006-02-25 13:20:51 -08:00
+++ 1.86/storage/archive/ha_archive.cc 2006-03-07 09:20:32 -08:00
@@ -19,10 +19,13 @@
#endif
#include "mysql_priv.h"
+#include <myisam.h>
#include "ha_archive.h"
#include <my_dir.h>
+#include <mysql/plugin.h>
+
/*
First, if you want to understand storage engines you should look at
ha_example.cc and ha_example.h.
@@ -214,6 +217,8 @@ static byte* archive_get_key(ARCHIVE_SHA
bool 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,
@@ -227,7 +232,6 @@ bool archive_db_init()
DBUG_RETURN(FALSE);
}
error:
- have_archive_db= SHOW_OPTION_DISABLED; // If we couldn't use handler
DBUG_RETURN(TRUE);
}
@@ -235,14 +239,14 @@ error:
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)
{
@@ -253,6 +257,12 @@ int archive_db_end(ha_panic_function typ
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)
{
@@ -779,7 +789,7 @@ int ha_archive::write_row(byte *buf)
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);
@@ -1096,8 +1106,7 @@ int ha_archive::rnd_next(byte *buf)
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);
@@ -1133,8 +1142,7 @@ void ha_archive::position(const byte *re
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);
@@ -1317,8 +1325,8 @@ THR_LOCK_DATA **ha_archive::store_lock(T
*/
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;
/*
@@ -1329,7 +1337,7 @@ THR_LOCK_DATA **ha_archive::store_lock(T
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;
@@ -1440,11 +1448,11 @@ int ha_archive::check(THD* thd, HA_CHECK
{
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);
share->forced_flushes++;
@@ -1469,7 +1477,7 @@ int ha_archive::check(THD* thd, HA_CHECK
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)
{
@@ -1494,3 +1502,17 @@ bool ha_archive::check_and_repair(THD *t
DBUG_RETURN(repair(thd, &check_opt));
}
+
+
+mysql_declare_plugin(archive)
+{
+ MYSQL_STORAGE_ENGINE_PLUGIN,
+ &archive_hton,
+ archive_hton.name,
+ "Brian Aker, MySQL AB",
+ "Archive Storage Engine",
+ NULL, /* Plugin Init */
+ archive_db_done, /* Plugin Deinit */
+ 0x0100 /* 1.0 */,
+}
+mysql_declare_plugin_end;
--- 1.42/sql/ha_archive.h 2006-02-15 00:59:20 -08:00
+++ 1.44/storage/archive/ha_archive.h 2006-03-07 09:20:32 -08: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
--- 1.35/storage/csv/ha_tina.cc 2006-02-14 01:51:20 -08:00
+++ 1.36/storage/csv/ha_tina.cc 2006-03-07 09:20:32 -08:00
@@ -1026,7 +1026,8 @@ bool ha_tina::check_if_incompatible_data
return COMPATIBLE_DATA_YES;
}
-mysql_declare_plugin
+
+mysql_declare_plugin(csv)
{
MYSQL_STORAGE_ENGINE_PLUGIN,
&tina_hton,
@@ -1038,4 +1039,3 @@ mysql_declare_plugin
0x0100 /* 1.0 */,
}
mysql_declare_plugin_end;
-
--- 1.33/storage/example/ha_example.cc 2006-02-14 01:51:20 -08:00
+++ 1.34/storage/example/ha_example.cc 2006-03-07 09:20:32 -08:00
@@ -726,7 +726,8 @@ int ha_example::create(const char *name,
DBUG_RETURN(0);
}
-mysql_declare_plugin
+
+mysql_declare_plugin(example)
{
MYSQL_STORAGE_ENGINE_PLUGIN,
&example_hton,
@@ -738,4 +739,3 @@ mysql_declare_plugin
0x0001 /* 0.1 */,
}
mysql_declare_plugin_end;
-
--- 1.28/sql/ha_blackhole.cc 2006-02-25 13:20:52 -08:00
+++ 1.29/sql/ha_blackhole.cc 2006-03-07 09:20:31 -08:00
@@ -22,6 +22,8 @@
#include "mysql_priv.h"
#include "ha_blackhole.h"
+#include <mysql/plugin.h>
+
/* Static declarations for handlerton */
static handler *blackhole_create_handler(TABLE_SHARE *table);
@@ -249,3 +251,15 @@ int ha_blackhole::index_last(byte * buf)
DBUG_RETURN(HA_ERR_END_OF_FILE);
}
+mysql_declare_plugin(blackhole)
+{
+ MYSQL_STORAGE_ENGINE_PLUGIN,
+ &blackhole_hton,
+ blackhole_hton.name,
+ "MySQL AB",
+ "Blackhole Storage Engine",
+ NULL, /* Plugin Init */
+ NULL, /* Plugin Deinit */
+ 0x0100 /* 1.0 */,
+}
+mysql_declare_plugin_end;
--- 1.2/storage/archive/Makefile.am 2006-02-22 11:21:00 -08:00
+++ 1.3/storage/archive/Makefile.am 2006-03-07 09:20:32 -08:00
@@ -14,19 +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_builddir)/mysys/libmysys.a \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/strings/libmystrings.a \
- @ZLIB_LIBS@
-pkglib_LIBRARIES = libarchive.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@
archive_test_LDFLAGS = @NOINST_LDFLAGS@
-noinst_HEADERS = azlib.h
-libarchive_a_SOURCES = azio.c
+
# Don't update the files from bitkeeper
%::SCCS/s.%
--- 1.279/sql/ha_ndbcluster.cc 2006-03-01 09:23:59 -08:00
+++ 1.280/sql/ha_ndbcluster.cc 2006-03-07 09:20:32 -08:00
@@ -36,6 +36,8 @@
#include "ha_ndbcluster_binlog.h"
#include "ha_ndbcluster_tables.h"
+#include <mysql/plugin.h>
+
#ifdef ndb_dynamite
#undef assert
#define assert(x) do { if(x) break; ::printf("%s %d: assert failed: %s\n", __FILE__, __LINE__, #x); ::fflush(stdout); ::signal(SIGABRT,SIG_DFL); ::abort(); ::kill(::getpid(),6); ::kill(::getpid(),9); } while (0)
@@ -9887,3 +9889,17 @@ static int ndbcluster_fill_files_table(T
}
DBUG_RETURN(0);
}
+
+
+mysql_declare_plugin(ndbcluster)
+{
+ MYSQL_STORAGE_ENGINE_PLUGIN,
+ &ndbcluster_hton,
+ ndbcluster_hton.name,
+ "MySQL AB",
+ "NDB Storage Engine",
+ NULL, /* Plugin Init */
+ NULL, /* Plugin Deinit */
+ 0x0100 /* 1.0 */,
+}
+mysql_declare_plugin_end;
--- 1.9/storage/innobase/Makefile.am 2005-12-16 03:45:37 -08:00
+++ 1.10/storage/innobase/Makefile.am 2006-03-07 09:20:32 -08:00
@@ -78,5 +78,34 @@ EXTRA_DIST = include/btr0btr.h include/
include/ut0mem.h include/ut0mem.ic include/ut0rnd.h include/ut0rnd.ic \
include/ut0sort.h include/ut0ut.h include/ut0ut.ic
+noinst_LIBRARIES = libinnobase.a
+libinnobase_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
+libinnobase_a_SOURCES =
+
+
+libinnobase.a: $(libinnobase_a_LIBADD)
+ -rm -f $@
+ if test "$(host_os)" = "netware" ; \
+ then \
+ $(libmysqld_a_AR) $@ $(libinnobase_a_LIBADD) ; \
+ else \
+ (for arc in $(libinnobase_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.258/sql/ha_innodb.cc 2006-02-25 13:20:52 -08:00
+++ 1.259/sql/ha_innodb.cc 2006-03-07 09:20:31 -08:00
@@ -44,6 +44,8 @@ have disables the InnoDB inlining in thi
#include "ha_innodb.h"
+#include <mysql/plugin.h>
+
pthread_mutex_t innobase_share_mutex, /* to protect innobase_open_files */
prepare_commit_mutex; /* to force correct commit order in
binlog */
@@ -7571,3 +7573,16 @@ bool ha_innobase::check_if_incompatible_
return COMPATIBLE_DATA_YES;
}
+
+mysql_declare_plugin(innobase)
+{
+ MYSQL_STORAGE_ENGINE_PLUGIN,
+ &innobase_hton,
+ innobase_hton.name,
+ "Innobase Oy, MySQL AB",
+ "InnoDB Storage Engine",
+ NULL, /* Plugin Init */
+ NULL, /* Plugin Deinit */
+ 0x0100 /* 1.0 */,
+}
+mysql_declare_plugin_end;
--- 1.11/include/mysql/plugin.h 2006-02-14 13:56:53 -08:00
+++ 1.12/include/mysql/plugin.h 2006-03-07 09:20:31 -08:00
@@ -37,10 +37,29 @@
be a st_mysql_plugin struct for each plugin to be declared.
*/
-#define mysql_declare_plugin \
-int _mysql_plugin_interface_version_= MYSQL_PLUGIN_INTERFACE_VERSION; \
-int _mysql_sizeof_struct_st_plugin_= sizeof(struct st_mysql_plugin); \
-struct st_mysql_plugin _mysql_plugin_declarations_[]= {
+#ifdef __GNUC__
+#define weak_plugin_ref(x,y) asm(".weak\t" #x "\n\t.set\t" #x "," #y);
+#else
+#error "Need to define weak_plugin_ref() for this compiler/platform"
+#endif
+
+
+#define __DECLARE_PLUGIN(NAME, VERSION, PSIZE, DECLS) \
+extern int _mysql_plugin_interface_version_, _mysql_sizeof_struct_st_plugin_; \
+extern struct st_mysql_plugin _mysql_plugin_declarations_[]; \
+weak_plugin_ref(_mysql_plugin_interface_version_, VERSION) \
+weak_plugin_ref(_mysql_sizeof_struct_st_plugin_, PSIZE) \
+weak_plugin_ref(_mysql_plugin_declarations_, DECLS) \
+int VERSION= MYSQL_PLUGIN_INTERFACE_VERSION; \
+int PSIZE= sizeof(struct st_mysql_plugin); \
+struct st_mysql_plugin DECLS[]= {
+
+#define _DECLARE_PLUGIN(NAME) \
+__DECLARE_PLUGIN(NAME, builtin_ ## NAME ## _plugin_interface_version, \
+ builtin_ ## NAME ## _sizeof_struct_st_plugin, \
+ builtin_ ## NAME ## _plugin)
+
+#define mysql_declare_plugin(NAME) _DECLARE_PLUGIN(NAME)
#define mysql_declare_plugin_end ,{0,0,0,0,0,0,0,0,0}}
/*
--- 1.15/sql/sql_plugin.cc 2006-02-28 00:40:19 -08:00
+++ 1.16/sql/sql_plugin.cc 2006-03-07 09:20:32 -08:00
@@ -19,6 +19,8 @@
#define REPORT_TO_LOG 1
#define REPORT_TO_USER 2
+extern struct st_mysql_plugin *mysqld_builtins[];
+
char *opt_plugin_dir_ptr;
char opt_plugin_dir[FN_REFLEN];
LEX_STRING plugin_type_names[]=
@@ -537,6 +539,53 @@ err:
DBUG_RETURN(1);
}
+static int plugin_finalize(THD *thd, struct st_plugin_int *plugin)
+{
+ int rc;
+ DBUG_ENTER("plugin_finalize");
+
+ if (plugin->ref_count)
+ {
+ push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
+ "Plugin is busy and will be uninstalled on shutdown");
+ goto err;
+ }
+
+ switch (plugin->plugin->type)
+ {
+ case MYSQL_STORAGE_ENGINE_PLUGIN:
+ if (ha_finalize_handlerton(plugin))
+ {
+ push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
+ "Storage engine shutdown failed. "
+ "It will be uninstalled on shutdown");
+ sql_print_warning("Storage engine '%s' shutdown failed. "
+ "It will be uninstalled on shutdown", plugin->name.str);
+ goto err;
+ }
+ break;
+ default:
+ break;
+ }
+
+ if (plugin->plugin->deinit)
+ {
+ if ((rc= plugin->plugin->deinit()))
+ {
+ push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
+ "Plugin deinit failed. "
+ "It will be uninstalled on shutdown");
+ sql_print_warning("Plugin '%s' deinit failed. "
+ "It will be uninstalled on shutdown", plugin->name.str);
+ goto err;
+ }
+ }
+
+ DBUG_RETURN(0);
+err:
+ DBUG_RETURN(1);
+}
+
static void plugin_call_initializer(void)
{
uint i;
@@ -595,6 +644,8 @@ static byte *get_hash_key(const byte *bu
int plugin_init(void)
{
int i;
+ struct st_mysql_plugin **builtins;
+ struct st_mysql_plugin *plugin;
DBUG_ENTER("plugin_init");
if (initialized)
@@ -614,6 +665,16 @@ int plugin_init(void)
get_hash_key, NULL, 0))
goto err;
}
+
+ /* Register all the built-in plugins */
+ for (builtins= mysqld_builtins; *builtins; builtins++)
+ {
+ for (plugin= *builtins; plugin->info; plugin++)
+ {
+ if (plugin_register_builtin(plugin))
+ goto err;
+ }
+ }
initialized= 1;
@@ -820,18 +881,10 @@ my_bool mysql_uninstall_plugin(THD *thd,
goto err;
}
- if (plugin->ref_count)
- {
- plugin->state= PLUGIN_IS_DELETED;
- push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
- "Plugin is not deleted, waiting on tables.");
- }
- else
- {
- if (plugin->plugin->deinit)
- plugin->plugin->deinit();
+ if (!plugin_finalize(thd, plugin))
plugin_del(name);
- }
+ else
+ plugin->state= PLUGIN_IS_DELETED;
table->field[0]->store(name->str, name->length, system_charset_info);
table->file->extra(HA_EXTRA_RETRIEVE_ALL_COLS);
--- 1.80/libmysqld/Makefile.am 2006-02-21 15:39:56 -08:00
+++ 1.81/libmysqld/Makefile.am 2006-03-07 09:20:31 -08:00
@@ -65,12 +65,12 @@ sqlsources = derror.cc field.cc field_co
sp_head.cc sp_pcontext.cc sp.cc sp_cache.cc sp_rcontext.cc \
parse_file.cc sql_view.cc sql_trigger.cc my_decimal.cc \
event_executor.cc event.cc event_timed.cc \
- rpl_filter.cc sql_partition.cc handlerton.cc sql_plugin.cc \
+ rpl_filter.cc sql_partition.cc sql_builtin.cc sql_plugin.cc \
sql_tablespace.cc \
rpl_injector.cc my_user.c partition_info.cc
libmysqld_int_a_SOURCES= $(libmysqld_sources) $(libmysqlsources) $(sqlsources)
-EXTRA_libmysqld_a_SOURCES = ha_innodb.cc ha_berkeley.cc ha_archive.cc \
+EXTRA_libmysqld_a_SOURCES = ha_innodb.cc ha_berkeley.cc \
ha_blackhole.cc ha_federated.cc ha_ndbcluster.cc \
ha_ndbcluster_binlog.cc \
ha_partition.cc
@@ -86,7 +86,6 @@ sql_yacc.cc sql_yacc.h: $(top_srcdir)/sq
INC_LIB= $(top_builddir)/regex/libregex.a \
$(top_builddir)/storage/myisam/libmyisam.a \
$(top_builddir)/storage/myisammrg/libmyisammrg.a \
- $(top_builddir)/storage/archive/libarchive.a \
$(top_builddir)/storage/heap/libheap.a \
$(top_builddir)/mysys/libmysys.a \
$(top_builddir)/strings/libmystrings.a \
--- 1.33/sql/ha_partition.cc 2006-02-25 13:20:52 -08:00
+++ 1.34/sql/ha_partition.cc 2006-03-07 09:20:32 -08:00
@@ -56,6 +56,8 @@
#include "ha_partition.h"
+#include <mysql/plugin.h>
+
static const char *ha_par_ext= ".par";
#ifdef NOT_USED
static int free_share(PARTITION_SHARE * share);
@@ -5410,3 +5412,17 @@ static int free_share(PARTITION_SHARE *s
return 0;
}
#endif /* NOT_USED */
+
+
+mysql_declare_plugin(partition)
+{
+ MYSQL_STORAGE_ENGINE_PLUGIN,
+ &partition_hton,
+ partition_hton.name,
+ "Mikael Ronstrom, MySQL AB",
+ "Partitioning Engine",
+ NULL, /* Plugin Init */
+ NULL, /* Plugin Deinit */
+ 0x0100 /* 1.0 */,
+}
+mysql_declare_plugin_end;
--- 1.53/sql/ha_federated.cc 2006-02-25 13:20:52 -08:00
+++ 1.54/sql/ha_federated.cc 2006-03-07 09:20:31 -08:00
@@ -354,6 +354,9 @@
#include "ha_federated.h"
#include "m_string.h"
+
+#include <mysql/plugin.h>
+
/* Variables for federated share methods */
static HASH federated_open_tables; // To track open tables
pthread_mutex_t federated_mutex; // To init the hash
@@ -2814,3 +2817,16 @@ int ha_federated::execute_simple_query(c
DBUG_RETURN(0);
}
+
+mysql_declare_plugin(federated)
+{
+ MYSQL_STORAGE_ENGINE_PLUGIN,
+ &federated_hton,
+ federated_hton.name,
+ "Patrick Galbraith and Brian Aker, MySQL AB",
+ "Federated Storage Engine",
+ NULL, /* Plugin Init */
+ NULL, /* Plugin Deinit */
+ 0x0100 /* 1.0 */,
+}
+mysql_declare_plugin_end;
--- 1.7/plugin/fulltext/plugin_example.c 2006-02-14 01:51:20 -08:00
+++ 1.8/plugin/fulltext/plugin_example.c 2006-03-07 09:20:31 -08:00
@@ -216,7 +216,7 @@ struct st_mysql_show_var simple_status[]
Plugin library descriptor
*/
-mysql_declare_plugin
+mysql_declare_plugin(simple_parser)
{
MYSQL_FTPARSER_PLUGIN, /* type */
&simple_parser_descriptor, /* descriptor */
| Thread |
|---|
| • bk commit into 5.1 tree (acurtis:1.2210) | antony | 7 Mar |