From 4e11a4d94199c710b0c7d0bf547157c14c480f19 Mon Sep 17 00:00:00 2001 From: "acurtis@xiphis.org" <> Date: Thu, 13 Apr 2006 13:49:29 -0700 Subject: WL#3201 " Configure support for server plugins " --- BUILD/SETUP.sh | 15 +- Makefile.am | 3 +- config/ac-macros/ha_archive.m4 | 29 - config/ac-macros/ha_berkeley.m4 | 3 - config/ac-macros/ha_blackhole.m4 | 29 - config/ac-macros/ha_example.m4 | 30 - config/ac-macros/ha_federated.m4 | 29 - config/ac-macros/ha_innodb.m4 | 77 -- config/ac-macros/ha_ndbcluster.m4 | 7 +- config/ac-macros/ha_partition.m4 | 33 - config/ac-macros/ha_tina.m4 | 29 - config/ac-macros/plugins.m4 | 603 +++++++++++++++ config/ac-macros/storage.m4 | 55 -- configure.in | 185 +++-- include/mysql/plugin.h | 21 +- libmysqld/Makefile.am | 24 +- plugin/Makefile.am | 28 +- plugin/fulltext/Makefile.am | 47 +- plugin/fulltext/plugin_example.c | 2 +- sql/Makefile.am | 32 +- sql/ha_archive.cc | 1499 ------------------------------------ sql/ha_archive.h | 136 ---- sql/ha_berkeley.cc | 18 + sql/ha_blackhole.cc | 252 ------ sql/ha_blackhole.h | 88 --- sql/ha_federated.cc | 19 + sql/ha_heap.cc | 13 + sql/ha_innodb.cc | 17 + sql/ha_myisam.cc | 16 + sql/ha_myisammrg.cc | 15 + sql/ha_ndbcluster.cc | 19 + sql/ha_ndbcluster_binlog.cc | 2 + sql/ha_partition.cc | 19 + sql/handler.cc | 153 ++-- sql/handler.h | 5 +- sql/handlerton-win.cc | 72 -- sql/handlerton.cc.in | 14 - sql/log.cc | 15 + sql/mysqld.cc | 30 +- sql/partition_info.cc | 3 +- sql/sql_builtin.cc.in | 13 + sql/sql_delete.cc | 2 + sql/sql_plugin.cc | 75 +- sql/sql_show.cc | 45 +- sql/sql_yacc.yy | 2 +- storage/archive/Makefile.am | 50 +- storage/archive/ha_archive.cc | 1521 +++++++++++++++++++++++++++++++++++++ storage/archive/ha_archive.h | 136 ++++ storage/blackhole/Makefile.am | 51 ++ storage/blackhole/ha_blackhole.cc | 266 +++++++ storage/blackhole/ha_blackhole.h | 88 +++ storage/csv/Makefile.am | 13 +- storage/csv/ha_tina.cc | 6 +- storage/example/Makefile.am | 30 +- storage/example/ha_example.cc | 6 +- storage/innobase/Makefile.am | 29 + 56 files changed, 3344 insertions(+), 2675 deletions(-) delete mode 100644 config/ac-macros/ha_archive.m4 delete mode 100644 config/ac-macros/ha_blackhole.m4 delete mode 100644 config/ac-macros/ha_example.m4 delete mode 100644 config/ac-macros/ha_federated.m4 delete mode 100644 config/ac-macros/ha_innodb.m4 delete mode 100644 config/ac-macros/ha_partition.m4 delete mode 100644 config/ac-macros/ha_tina.m4 create mode 100644 config/ac-macros/plugins.m4 delete mode 100644 config/ac-macros/storage.m4 delete mode 100644 sql/ha_archive.cc delete mode 100644 sql/ha_archive.h delete mode 100644 sql/ha_blackhole.cc delete mode 100644 sql/ha_blackhole.h delete mode 100644 sql/handlerton-win.cc delete mode 100644 sql/handlerton.cc.in create mode 100644 sql/sql_builtin.cc.in create mode 100644 storage/archive/ha_archive.cc create mode 100644 storage/archive/ha_archive.h create mode 100644 storage/blackhole/Makefile.am create mode 100644 storage/blackhole/ha_blackhole.cc create mode 100644 storage/blackhole/ha_blackhole.h diff --git a/BUILD/SETUP.sh b/BUILD/SETUP.sh index 3c3facae34f..7b6dc29ad66 100755 --- a/BUILD/SETUP.sh +++ b/BUILD/SETUP.sh @@ -146,18 +146,9 @@ static_link="$static_link --with-client-ldflags=-all-static" local_infile_configs="--enable-local-infile" -max_configs="--with-innodb --with-berkeley-db" -max_configs="$max_configs --with-archive-storage-engine" -max_configs="$max_configs --with-big-tables" -max_configs="$max_configs --with-blackhole-storage-engine" -max_configs="$max_configs --with-federated-storage-engine" -max_configs="$max_configs --with-csv-storage-engine" -max_configs="$max_configs --with-example-storage-engine" -max_configs="$max_configs --with-partition $SSL_LIBRARY" - -max_no_embedded_configs="$max_configs --with-ndbcluster" -max_no_ndb_configs="$max_configs --without-ndbcluster --with-embedded-server" -max_configs="$max_configs --with-ndbcluster --with-embedded-server" +max_no_embedded_configs="$SSL_LIBRARY --with-modules=max" +max_no_ndb_configs="$SSL_LIBRARY --with-modules=max-no-ndb --with-embedded-server" +max_configs="$SSL_LIBRARY --with-modules=max --with-embedded-server" # # CPU and platform specific compilation flags. diff --git a/Makefile.am b/Makefile.am index 4e648dabe27..86bf6d6c03d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -24,9 +24,8 @@ EXTRA_DIST = INSTALL-SOURCE INSTALL-WIN-SOURCE \ SUBDIRS = . include @docs_dirs@ @zlib_dir@ @yassl_dir@ \ @readline_topdir@ sql-common \ @thread_dirs@ pstack \ - @sql_union_dirs@ @mysql_se_dirs@ \ + @sql_union_dirs@ @mysql_plugin_dirs@ \ @sql_server@ scripts @man_dirs@ tests \ - @mysql_se_plugins@ \ netware @libmysqld_dirs@ \ @bench_dirs@ support-files @tools_dirs@ \ plugin win diff --git a/config/ac-macros/ha_archive.m4 b/config/ac-macros/ha_archive.m4 deleted file mode 100644 index 2d2558ea600..00000000000 --- a/config/ac-macros/ha_archive.m4 +++ /dev/null @@ -1,29 +0,0 @@ -dnl --------------------------------------------------------------------------- -dnl Macro: MYSQL_CHECK_ARCHIVEDB -dnl Sets HAVE_ARCHIVE_DB if --with-archive-storage-engine is used -dnl --------------------------------------------------------------------------- -AC_DEFUN([MYSQL_CHECK_ARCHIVEDB], [ - AC_ARG_WITH([archive-storage-engine], - [ - --with-archive-storage-engine - Enable the Archive Storage Engine], - [archivedb="$withval"], - [archivedb=no]) - AC_MSG_CHECKING([for archive storage engine]) - - case "$archivedb" in - yes ) - AC_DEFINE([HAVE_ARCHIVE_DB], [1], [Builds Archive Storage Engine]) - AC_MSG_RESULT([yes]) - [archivedb=yes] - ;; - * ) - AC_MSG_RESULT([no]) - [archivedb=no] - ;; - esac - -]) -dnl --------------------------------------------------------------------------- -dnl END OF MYSQL_CHECK_ARCHIVE SECTION -dnl --------------------------------------------------------------------------- diff --git a/config/ac-macros/ha_berkeley.m4 b/config/ac-macros/ha_berkeley.m4 index 183a622dfc9..c389077ea8b 100644 --- a/config/ac-macros/ha_berkeley.m4 +++ b/config/ac-macros/ha_berkeley.m4 @@ -120,12 +120,9 @@ AC_DEFUN([MYSQL_SETUP_BERKELEY_DB], [ sh $rel_srcdir/$bdb/dist/configure $bdb_conf_flags) || \ AC_MSG_ERROR([could not configure Berkeley DB]) - mysql_se_libs="$mysql_se_libs $bdb_libs_with_path" - 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], [ diff --git a/config/ac-macros/ha_blackhole.m4 b/config/ac-macros/ha_blackhole.m4 deleted file mode 100644 index cc4d360f5a8..00000000000 --- a/config/ac-macros/ha_blackhole.m4 +++ /dev/null @@ -1,29 +0,0 @@ -dnl --------------------------------------------------------------------------- -dnl Macro: MYSQL_CHECK_BLACKHOLEDB -dnl Sets HAVE_BLACKHOLE_DB if --with-blackhole-storage-engine is used -dnl --------------------------------------------------------------------------- -AC_DEFUN([MYSQL_CHECK_BLACKHOLEDB], [ - AC_ARG_WITH([blackhole-storage-engine], - [ - --with-blackhole-storage-engine - Enable the Blackhole Storage Engine], - [blackholedb="$withval"], - [blackholedb=no]) - AC_MSG_CHECKING([for blackhole storage engine]) - - case "$blackholedb" in - yes ) - AC_DEFINE([HAVE_BLACKHOLE_DB], [1], [Builds Blackhole Storage Engine]) - AC_MSG_RESULT([yes]) - [blackholedb=yes] - ;; - * ) - AC_MSG_RESULT([no]) - [blackholedb=no] - ;; - esac - -]) -dnl --------------------------------------------------------------------------- -dnl END OF MYSQL_CHECK_BLACKHOLE SECTION -dnl --------------------------------------------------------------------------- diff --git a/config/ac-macros/ha_example.m4 b/config/ac-macros/ha_example.m4 deleted file mode 100644 index f8067931ce6..00000000000 --- a/config/ac-macros/ha_example.m4 +++ /dev/null @@ -1,30 +0,0 @@ -dnl --------------------------------------------------------------------------- -dnl Macro: MYSQL_CHECK_EXAMPLEDB -dnl Sets HAVE_EXAMPLE_DB if --with-example-storage-engine is used -dnl --------------------------------------------------------------------------- -AC_DEFUN([MYSQL_CHECK_EXAMPLEDB], [ - AC_ARG_WITH([example-storage-engine], - [ - --with-example-storage-engine - Enable the Example Storage Engine], - [exampledb="$withval"], - [exampledb=no]) - AC_MSG_CHECKING([for example storage engine]) - - case "$exampledb" in - yes ) - AC_DEFINE([HAVE_EXAMPLE_DB], [1], [Builds Example DB]) - AC_MSG_RESULT([yes]) - [exampledb=yes] - ;; - * ) - AC_MSG_RESULT([no]) - [exampledb=no] - ;; - esac - -]) -dnl --------------------------------------------------------------------------- -dnl END OF MYSQL_CHECK_EXAMPLE SECTION -dnl --------------------------------------------------------------------------- - diff --git a/config/ac-macros/ha_federated.m4 b/config/ac-macros/ha_federated.m4 deleted file mode 100644 index 5c991f31666..00000000000 --- a/config/ac-macros/ha_federated.m4 +++ /dev/null @@ -1,29 +0,0 @@ -dnl --------------------------------------------------------------------------- -dnl Macro: MYSQL_CHECK_FEDERATED -dnl Sets HAVE_FEDERATED if --with-federated-storage-engine is used -dnl --------------------------------------------------------------------------- -AC_DEFUN([MYSQL_CHECK_FEDERATED], [ - AC_ARG_WITH([federated-storage-engine], - [ - --with-federated-storage-engine - Enable the MySQL Federated Storage Engine], - [federateddb="$withval"], - [federateddb=no]) - AC_MSG_CHECKING([for MySQL federated storage engine]) - - case "$federateddb" in - yes ) - AC_DEFINE([HAVE_FEDERATED_DB], [1], [Define to enable Federated Handler]) - AC_MSG_RESULT([yes]) - [federateddb=yes] - ;; - * ) - AC_MSG_RESULT([no]) - [federateddb=no] - ;; - esac - -]) -dnl --------------------------------------------------------------------------- -dnl END OF MYSQL_CHECK_FEDERATED SECTION -dnl --------------------------------------------------------------------------- diff --git a/config/ac-macros/ha_innodb.m4 b/config/ac-macros/ha_innodb.m4 deleted file mode 100644 index 287b77c8851..00000000000 --- a/config/ac-macros/ha_innodb.m4 +++ /dev/null @@ -1,77 +0,0 @@ -dnl --------------------------------------------------------------------------- -dnl Macro: MYSQL_CHECK_INNODB -dnl Sets HAVE_INNOBASE_DB if --with-innodb is used -dnl --------------------------------------------------------------------------- - -AC_DEFUN([MYSQL_CHECK_INNODB], [ - AC_ARG_WITH([innodb], - [ - --without-innodb Do not include the InnoDB table handler], - [innodb="$withval"], - [innodb=yes]) - - AC_MSG_CHECKING([for Innodb]) - - have_innodb=no - innodb_includes= - innodb_libs= - case "$innodb" in - yes ) - AC_MSG_RESULT([Using Innodb]) - AC_DEFINE([HAVE_INNOBASE_DB], [1], [Using Innobase DB]) - have_innodb="yes" - innodb_includes="-I\$(top_builddir)/innobase/include" - innodb_system_libs="" -dnl Some libs are listed several times, in order for gcc to sort out -dnl circular references. - innodb_libs="\ - \$(top_builddir)/storage/innobase/usr/libusr.a\ - \$(top_builddir)/storage/innobase/srv/libsrv.a\ - \$(top_builddir)/storage/innobase/dict/libdict.a\ - \$(top_builddir)/storage/innobase/que/libque.a\ - \$(top_builddir)/storage/innobase/srv/libsrv.a\ - \$(top_builddir)/storage/innobase/ibuf/libibuf.a\ - \$(top_builddir)/storage/innobase/row/librow.a\ - \$(top_builddir)/storage/innobase/pars/libpars.a\ - \$(top_builddir)/storage/innobase/btr/libbtr.a\ - \$(top_builddir)/storage/innobase/trx/libtrx.a\ - \$(top_builddir)/storage/innobase/read/libread.a\ - \$(top_builddir)/storage/innobase/usr/libusr.a\ - \$(top_builddir)/storage/innobase/buf/libbuf.a\ - \$(top_builddir)/storage/innobase/ibuf/libibuf.a\ - \$(top_builddir)/storage/innobase/eval/libeval.a\ - \$(top_builddir)/storage/innobase/log/liblog.a\ - \$(top_builddir)/storage/innobase/fsp/libfsp.a\ - \$(top_builddir)/storage/innobase/fut/libfut.a\ - \$(top_builddir)/storage/innobase/fil/libfil.a\ - \$(top_builddir)/storage/innobase/lock/liblock.a\ - \$(top_builddir)/storage/innobase/mtr/libmtr.a\ - \$(top_builddir)/storage/innobase/page/libpage.a\ - \$(top_builddir)/storage/innobase/rem/librem.a\ - \$(top_builddir)/storage/innobase/thr/libthr.a\ - \$(top_builddir)/storage/innobase/sync/libsync.a\ - \$(top_builddir)/storage/innobase/data/libdata.a\ - \$(top_builddir)/storage/innobase/mach/libmach.a\ - \$(top_builddir)/storage/innobase/ha/libha.a\ - \$(top_builddir)/storage/innobase/dyn/libdyn.a\ - \$(top_builddir)/storage/innobase/mem/libmem.a\ - \$(top_builddir)/storage/innobase/sync/libsync.a\ - \$(top_builddir)/storage/innobase/ut/libut.a\ - \$(top_builddir)/storage/innobase/os/libos.a\ - \$(top_builddir)/storage/innobase/ut/libut.a" - - AC_CHECK_LIB(rt, aio_read, [innodb_system_libs="-lrt"]) - ;; - * ) - AC_MSG_RESULT([Not using Innodb]) - ;; - esac - - AC_SUBST(innodb_includes) - AC_SUBST(innodb_libs) - AC_SUBST(innodb_system_libs) -]) - -dnl --------------------------------------------------------------------------- -dnl END OF MYSQL_CHECK_INNODB SECTION -dnl --------------------------------------------------------------------------- diff --git a/config/ac-macros/ha_ndbcluster.m4 b/config/ac-macros/ha_ndbcluster.m4 index 8e839d8fee9..1358807e000 100644 --- a/config/ac-macros/ha_ndbcluster.m4 +++ b/config/ac-macros/ha_ndbcluster.m4 @@ -191,7 +191,6 @@ AC_DEFUN([MYSQL_SETUP_NDBCLUSTER], [ ndbcluster_libs="\$(top_builddir)/storage/ndb/src/.libs/libndbclient.a" ndbcluster_system_libs="" ndb_mgmclient_libs="\$(top_builddir)/storage/ndb/src/mgmclient/libndbmgmclient.la" - mysql_se_objs="$mysql_se_objs ha_ndbcluster_binlog.o" MYSQL_CHECK_NDB_OPTIONS NDBCLUSTER_WORKAROUNDS @@ -282,9 +281,6 @@ AC_DEFUN([MYSQL_SETUP_NDBCLUSTER], [ ndb_bin_am_ldflags="" fi - mysql_se_libs="$mysql_se_libs $ndbcluster_libs $ndbcluster_system_libs" - mysql_se_libs="$mysql_se_libs $NDB_SCI_LIBS" - AC_SUBST(NDB_VERSION_MAJOR) AC_SUBST(NDB_VERSION_MINOR) AC_SUBST(NDB_VERSION_BUILD) @@ -302,6 +298,7 @@ AC_DEFUN([MYSQL_SETUP_NDBCLUSTER], [ AC_SUBST(ndbcluster_libs) AC_SUBST(ndbcluster_system_libs) AC_SUBST(ndb_mgmclient_libs) + AC_SUBST(NDB_SCI_LIBS) AC_SUBST(ndb_transporter_opt_objs) AC_SUBST(ndb_port) @@ -310,7 +307,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 diff --git a/config/ac-macros/ha_partition.m4 b/config/ac-macros/ha_partition.m4 deleted file mode 100644 index 1ce7dedc5f3..00000000000 --- a/config/ac-macros/ha_partition.m4 +++ /dev/null @@ -1,33 +0,0 @@ -dnl --------------------------------------------------------------------------- -dnl Macro: MYSQL_CHECK_PARTITIONDB -dnl Sets HAVE_PARTITION_DB if --with-partition is used -dnl --------------------------------------------------------------------------- -AC_DEFUN([MYSQL_CHECK_PARTITIONDB], [ - AC_ARG_WITH([partition], - [ - --with-partition - Enable the Partition Storage Engine], - [partitiondb="$withval"], - [partitiondb=no]) - AC_MSG_CHECKING([for partition]) - -dnl case "$partitiondb" in -dnl yes ) -dnl AC_DEFINE([HAVE_PARTITION_DB], [1], [Builds Partition DB]) -dnl AC_MSG_RESULT([yes]) -dnl [partitiondb=yes] -dnl ;; -dnl * ) -dnl AC_MSG_RESULT([no]) -dnl [partitiondb=no] -dnl ;; -dnl esac - AC_DEFINE([HAVE_PARTITION_DB], [1], [Builds Partition DB]) - AC_MSG_RESULT([yes]) - [partitiondb=yes] - -]) -dnl --------------------------------------------------------------------------- -dnl END OF MYSQL_CHECK_PARTITION SECTION -dnl --------------------------------------------------------------------------- - diff --git a/config/ac-macros/ha_tina.m4 b/config/ac-macros/ha_tina.m4 deleted file mode 100644 index fe6e382ce20..00000000000 --- a/config/ac-macros/ha_tina.m4 +++ /dev/null @@ -1,29 +0,0 @@ -dnl --------------------------------------------------------------------------- -dnl Macro: MYSQL_CHECK_CSVDB -dnl Sets HAVE_CSV_DB if --with-csv-storage-engine is used -dnl --------------------------------------------------------------------------- -AC_DEFUN([MYSQL_CHECK_CSVDB], [ - AC_ARG_WITH([csv-storage-engine], - [ - --with-csv-storage-engine - Enable the CSV Storage Engine], - [csvdb="$withval"], - [csvdb=no]) - AC_MSG_CHECKING([for csv storage engine]) - - case "$csvdb" in - yes ) - AC_DEFINE([HAVE_CSV_DB], [1], [Builds the CSV Storage Engine]) - AC_MSG_RESULT([yes]) - [csvdb=yes] - ;; - * ) - AC_MSG_RESULT([no]) - [csvdb=no] - ;; - esac - -]) -dnl --------------------------------------------------------------------------- -dnl END OF MYSQL_CHECK_CSV SECTION -dnl --------------------------------------------------------------------------- diff --git a/config/ac-macros/plugins.m4 b/config/ac-macros/plugins.m4 new file mode 100644 index 00000000000..5969a85dc14 --- /dev/null +++ b/config/ac-macros/plugins.m4 @@ -0,0 +1,603 @@ +dnl =========================================================================== +dnl Support for plugable mysql server modules +dnl =========================================================================== +dnl +dnl WorkLog#3201 +dnl +dnl Framework for pluggable static and dynamic modules for mysql +dnl +dnl --------------------------------------------------------------------------- +dnl Macro: MYSQL_MODULE +dnl +dnl Syntax: +dnl MYSQL_MODULE([name],[Plugin module name], +dnl [Plugin module description], +dnl [group,group...]) +dnl +dnl What it does: +dnl First declaration for a plugin module (mandatory). +dnl Adds module as member to configuration groups (if specified) +dnl +dnl --------------------------------------------------------------------------- + +AC_DEFUN([MYSQL_MODULE],[ dnl + _MYSQL_MODULE( + [$1], + [__MYSQL_MODULE_]AS_TR_CPP([$1])[__], + m4_default([$2], [$1 plugin]), + m4_default([$3], [plugin for $1]), + m4_default([$4], []), + ) dnl +]) + +AC_DEFUN([_MYSQL_MODULE],[ dnl + m4_ifdef([$2], [ dnl + AC_FATAL([[Duplicate MYSQL_MODULE declaration for ]][$3]) dnl + ],[ dnl + m4_define([$2], [$1]) dnl + _MYSQL_PLUGAPPEND([__mysql_plugin_list__],[$1]) dnl + AC_DEFUN([MYSQL_MODULE_NAME_]AS_TR_CPP([$1]), [$3]) dnl + AC_DEFUN([MYSQL_MODULE_DESC_]AS_TR_CPP([$1]), [$4]) dnl + ifelse([$5], [], [], [ dnl + _MYSQL_PLUGAPPEND_OPTS([$1], $5) dnl + ]) dnl + ]) dnl +]) + + +dnl --------------------------------------------------------------------------- +dnl Macro: MYSQL_STORAGE_ENGINE +dnl +dnl What it does: +dnl Short cut for storage engine declarations +dnl +dnl --------------------------------------------------------------------------- + +AC_DEFUN([MYSQL_STORAGE_ENGINE],[ dnl + MYSQL_MODULE([$1], [$3], [$4], [[$5]]) dnl + MYSQL_MODULE_DEFINE([$1], [WITH_]AS_TR_CPP([$1])[_STORAGE_ENGINE]) dnl + ifelse([$2],[no],[],[ dnl + _MYSQL_LEGACY_STORAGE_ENGINE([$1],m4_default([$2], [$1-storage-engine])) dnl + ]) dnl +]) + +AC_DEFUN([_MYSQL_LEGACY_STORAGE_ENGINE],[ +if test "[${with_]m4_bpatsubst($2, -, _)[+set}]" = set; then + [with_module_]m4_bpatsubst($1, -, _)="[$with_]m4_bpatsubst($2, -, _)" +fi dnl +]) + + +dnl --------------------------------------------------------------------------- +dnl Macro: MYSQL_MODULE_DEFINE +dnl +dnl What it does: +dnl When a plugin module is to be statically linked, define the C macro +dnl +dnl --------------------------------------------------------------------------- + +AC_DEFUN([MYSQL_MODULE_DEFINE],[ dnl + REQUIRE_PLUGIN([$1]) dnl + AC_DEFUN([MYSQL_MODULE_DEFINE_]AS_TR_CPP([$1]), [$2]) dnl +]) + + +dnl --------------------------------------------------------------------------- +dnl Macro: MYSQL_MODULE_DIRECTORY +dnl +dnl What it does: +dnl Adds a directory to the build process +dnl +dnl --------------------------------------------------------------------------- + +AC_DEFUN([MYSQL_MODULE_DIRECTORY],[ dnl + REQUIRE_PLUGIN([$1]) dnl + AC_DEFUN([MYSQL_MODULE_DIRECTORY_]AS_TR_CPP([$1]), [$2]) dnl +]) + + +dnl --------------------------------------------------------------------------- +dnl Macro: MYSQL_MODULE_STATIC +dnl +dnl What it does: +dnl Declare the name for the static library +dnl +dnl --------------------------------------------------------------------------- + +AC_DEFUN([MYSQL_MODULE_STATIC],[ dnl + REQUIRE_PLUGIN([$1]) dnl + AC_DEFUN([MYSQL_MODULE_STATIC_]AS_TR_CPP([$1]), [$2]) dnl +]) + + +dnl --------------------------------------------------------------------------- +dnl Macro: MYSQL_MODULE_DYNAMIC +dnl +dnl What it does: +dnl Declare the name for the shared library +dnl +dnl --------------------------------------------------------------------------- + +AC_DEFUN([MYSQL_MODULE_DYNAMIC],[ dnl + REQUIRE_PLUGIN([$1]) dnl + AC_DEFUN([MYSQL_MODULE_DYNAMIC_]AS_TR_CPP([$1]), [$2]) dnl +]) + + +dnl --------------------------------------------------------------------------- +dnl Macro: MYSQL_MODULE_MANDATORY +dnl +dnl What it does: +dnl Marks the specified plugin as a mandatory module +dnl +dnl --------------------------------------------------------------------------- + +AC_DEFUN([MYSQL_MODULE_MANDATORY],[ dnl + REQUIRE_PLUGIN([$1]) dnl + _MYSQL_MODULE_MANDATORY([$1], + [MYSQL_MODULE_MANDATORY_]AS_TR_CPP([$1]), + [MYSQL_MODULE_DISABLED_]AS_TR_CPP([$1]) + ) dnl +]) + +AC_DEFUN([_MYSQL_MODULE_MANDATORY],[ dnl + m4_define([$2], [yes]) dnl + m4_ifdef([$3], [ dnl + AC_WARNING([syntax],[Mandatory plugin $1 has been disabled]) dnl + m4_undefine([$2]) dnl + ]) dnl +]) + + +dnl --------------------------------------------------------------------------- +dnl Macro: MYSQL_MODULE_DISABLED +dnl +dnl What it does: +dnl Marks the specified plugin as a disabled module +dnl +dnl --------------------------------------------------------------------------- + +AC_DEFUN([MYSQL_MODULE_DISABLED],[ dnl + REQUIRE_PLUGIN([$1]) dnl + _MYSQL_MODULE_DISABLED([$1], + [MYSQL_MODULE_DISABLED_]AS_TR_CPP([$1]), + [MYSQL_MODULE_MANDATORY_]AS_TR_CPP([$1]) + ) dnl +]) + +AC_DEFUN([_MYSQL_MODULE_DISABLED],[ dnl + m4_define([$2], [yes]) dnl + m4_ifdef([$3], [ dnl + AC_FATAL([attempt to disable mandatory plugin $1]) dnl + m4_undefine([$2]) dnl + ]) dnl +]) + + +dnl --------------------------------------------------------------------------- +dnl Macro: MYSQL_MODULE_DEPENDS +dnl +dnl What it does: +dnl Enables other modules neccessary for this module +dnl Dependency checking is not recursive so if any +dnl required module requires further modules, list them +dnl here too! +dnl +dnl --------------------------------------------------------------------------- + +AC_DEFUN([MYSQL_MODULE_DEPENDS],[ dnl + REQUIRE_PLUGIN([$1]) dnl + ifelse($#, 0, [], $#, 1, [ dnl + AC_FATAL([[bad number of arguments]]) dnl + ], $#, 2, [ dnl + _MYSQL_MODULE_DEPEND([$1],[$2]) dnl + ],[ dnl + _MYSQL_MODULE_DEPEND([$1],[$2]) dnl + MYSQL_MODULE_DEPENDS([$1], m4_shift(m4_shift($@))) dnl + ]) +]) + +AC_DEFUN([_MYSQL_MODULE_DEPEND],[ dnl + REQUIRE_PLUGIN([$2]) dnl + _MYSQL_PLUGAPPEND([__mysql_plugdepends_$1__],[$2]) dnl +]) + + +dnl --------------------------------------------------------------------------- +dnl Macro: MYSQL_MODULE_ACTIONS +dnl +dnl What it does: +dnl Declares additional actions required to configure the module +dnl +dnl --------------------------------------------------------------------------- + +AC_DEFUN([MYSQL_MODULE_ACTIONS],[ dnl + REQUIRE_PLUGIN([$1]) dnl + m4_ifdef([$2],[ dnl + m4_define([MYSQL_MODULE_ACTIONS_]AS_TR_CPP([$1]),m4_defn([$2])) dnl + ],[ dnl + AC_DEFUN([MYSQL_MODULE_ACTIONS_]AS_TR_CPP([$1]), [$2]) dnl + ]) +]) + + +dnl --------------------------------------------------------------------------- +dnl Macro: MYSQL_CONFIGURE_PLUGINS +dnl +dnl What it does: +dnl Called last, emits all required shell code to configure the modules +dnl +dnl --------------------------------------------------------------------------- + +AC_DEFUN([MYSQL_CONFIGURE_PLUGINS],[ dnl + m4_ifdef([__mysql_plugin_configured__],[ dnl + AC_FATAL([cannot call [MYSQL_CONFIGURE_PLUGINS] multiple times]) dnl + ],[ dnl + m4_define([__mysql_plugin_configured__],[done]) dnl + m4_ifdef([__mysql_plugin_list__],[ dnl + _MYSQL_CHECK_PLUGIN_ARGS([none]) + _MYSQL_CONFIGURE_PLUGINS(m4_bpatsubst(__mysql_plugin_list__, :, [,])) + ]) dnl + ]) dnl +]) + +AC_DEFUN([_MYSQL_CONFIGURE_PLUGINS],[ dnl + ifelse($#, 0, [], $#, 1, [ dnl + _MYSQL_CHECK_PLUGIN([$1]) dnl + ],[ dnl + _MYSQL_CHECK_PLUGIN([$1]) dnl + _MYSQL_CONFIGURE_PLUGINS(m4_shift($@)) dnl + ]) +]) + +AC_DEFUN([_MYSQL_CHECK_PLUGIN],[ dnl + _DO_MYSQL_CHECK_PLUGIN( + [$1], + [$1-plugin], + [MYSQL_MODULE_NAME_]AS_TR_CPP([$1]), + [MYSQL_MODULE_DESC_]AS_TR_CPP([$1]), + [MYSQL_MODULE_DEFINE_]AS_TR_CPP([$1]), + [MYSQL_MODULE_DIRECTORY_]AS_TR_CPP([$1]), + [MYSQL_MODULE_STATIC_]AS_TR_CPP([$1]), + [MYSQL_MODULE_DYNAMIC_]AS_TR_CPP([$1]), + [MYSQL_MODULE_MANDATORY_]AS_TR_CPP([$1]), + [MYSQL_MODULE_DISABLED_]AS_TR_CPP([$1]), + [MYSQL_MODULE_ACTIONS_]AS_TR_CPP([$1]) + ) dnl +]) + +AC_DEFUN([_DO_MYSQL_CHECK_PLUGIN],[ dnl + m4_ifdef([$5],[ dnl + AH_TEMPLATE($5, [Include ]$4[ into mysqld]) + ]) + AC_MSG_CHECKING([whether to use ]$3) dnl + m4_ifdef([$10],[ + if test "[$mysql_module_]m4_bpatsubst([$1], -, _)" == "yes" -a \ + "[$with_module_]m4_bpatsubst([$1], -, _)" != "no" -o \ + "[$with_module_]m4_bpatsubst([$1], -, _)" == "yes"; then + AC_MSG_ERROR([disabled]) + fi + AC_MSG_RESULT([no]) dnl + ],[ dnl + m4_ifdef([$9],[ + if test "[$with_module_]m4_bpatsubst([$1], -, _)" == "no"; then + AC_MSG_ERROR([cannot disable mandatory module]) + fi + [mysql_module_]m4_bpatsubst([$1], -, _)="yes" dnl + ]) + if test "[$with_module_]m4_bpatsubst([$1], -, _)" != "no"; then + if test "[$mysql_module_]m4_bpatsubst([$1], -, _)" != "yes" -a \ + "[$with_module_]m4_bpatsubst([$1], -, _)" != "yes"; then dnl + m4_ifdef([$8],[ dnl + m4_ifdef([$6],[ + mysql_plugin_dirs="$mysql_plugin_dirs $6" dnl + ]) + AC_SUBST([plugin_]m4_bpatsubst([$1], -, _)[_shared_target], "$8") + AC_SUBST([plugin_]m4_bpatsubst([$1], -, _)[_static_target], [""]) + [with_module_]m4_bpatsubst([$1], -, _)="yes" dnl + ],[ + AC_MSG_RESULT([cannot build dynamically]) + [with_module_]m4_bpatsubst([$1], -, _)="no" dnl + ]) + else dnl + m4_ifdef([$7],[ + ifelse(m4_bregexp($7, [^lib[^.]+\.a$]), -2, [ dnl + m4_ifdef([$6],[ + mysql_plugin_dirs="$mysql_plugin_dirs $6" + mysql_plugin_libs="$mysql_plugin_libs -L[\$(top_builddir)]/$6" dnl + ]) + mysql_plugin_libs="$mysql_plugin_libs dnl +[-l]m4_bregexp($7, [^lib\([^.]+\)], [\1])" dnl + ], m4_bregexp($7, [^\\\$]), 0, [ dnl + m4_ifdef([$6],[ + mysql_plugin_dirs="$mysql_plugin_dirs $6" dnl + ]) + mysql_plugin_libs="$mysql_plugin_libs $7" dnl + ], [ dnl + m4_ifdef([$6],[ + mysql_plugin_dirs="$mysql_plugin_dirs $6" + mysql_plugin_libs="$mysql_plugin_libs \$(top_builddir)/$6/$7" dnl + ],[ + mysql_plugin_libs="$mysql_plugin_libs $7" dnl + ]) dnl + ]) dnl + m4_ifdef([$5],[ + AC_DEFINE($5) dnl + ]) + AC_SUBST([plugin_]m4_bpatsubst([$1], -, _)[_static_target], "$7") + AC_SUBST([plugin_]m4_bpatsubst([$1], -, _)[_shared_target], [""]) dnl + ],[ dnl + m4_ifdef([$6],[ + AC_FATAL([plugin directory specified without library for ]$3) dnl + ],[ dnl + m4_ifdef([$5],[ + AC_DEFINE($5) + AC_SUBST([plugin_]m4_bpatsubst([$1], -, _)[_static_target], ["yes"]) + AC_SUBST([plugin_]m4_bpatsubst([$1], -, _)[_shared_target], [""]) dnl + ]) dnl + ]) dnl + ]) + mysql_plugin_defs="$mysql_plugin_defs, [builtin_]m4_bpatsubst([$2], -, _)" + [with_module_]m4_bpatsubst([$1], -, _)="yes" + fi + else + AC_MSG_RESULT([no]) + fi + + if test "[$with_module_]m4_bpatsubst([$1], -, _)" == "yes"; then + if test "[$plugin_]m4_bpatsubst([$1], -, _)[_static_target]" != ""; then + AC_MSG_RESULT([static]) + elif test "[$plugin_]m4_bpatsubst([$1], -, _)[_shared_target]" != ""; then + AC_MSG_RESULT([plugin]) + else + AC_MSG_ERROR([thats strange]) + fi + $11 + fi dnl + ]) dnl +]) + + + +dnl =========================================================================== +dnl Private helper macros +dnl =========================================================================== + + +AC_DEFUN([REQUIRE_PLUGIN],[ dnl + _REQUIRE_PLUGIN([$1], [__MYSQL_MODULE_]AS_TR_CPP([$1])[__]) dnl +]) + +define([_REQUIRE_PLUGIN],[ dnl + ifdef([$2],[ dnl + ifelse($2, [$1], [], [ dnl + AC_FATAL([[Misspelt MYSQL_MODULE declaration for ]][$1]) dnl + ]) dnl + ],[ dnl + AC_FATAL([[Missing MYSQL_MODULE declaration for ]][$1]) dnl + ]) +]) + + +dnl --------------------------------------------------------------------------- + + +AC_DEFUN([_MYSQL_MODULE_META_CHECK], [ifelse($#, 0, [], $#, 1, dnl +[_MYSQL_CHECK_PLUGIN_META([$1], [__mysql_]m4_bpatsubst($1, -, _)[_plugins__]) dnl +], dnl +[_MYSQL_CHECK_PLUGIN_META([$1], [__mysql_]m4_bpatsubst($1, -, _)[_plugins__]) dnl +_MYSQL_MODULE_META_CHECK(m4_shift($@))]) dnl +]) + +AC_DEFUN([_MYSQL_CHECK_PLUGIN_META], [ + elif test "$mysql_modules" == "[$1]"; then dnl +m4_ifdef([$2], [ + mysql_modules="m4_bpatsubst($2, :, [,])" dnl +],[ + mysql_modules="" dnl +]) dnl +]) + + +dnl --------------------------------------------------------------------------- + + +AC_DEFUN([_MYSQL_PLUGAPPEND],[ dnl + m4_ifdef([$1],[ dnl + m4_define([__plugin_append_tmp__], m4_defn([$1])) dnl + m4_undefine([$1]) dnl + m4_define([$1], __plugin_append_tmp__[:$2]) dnl + m4_undefine([__plugin_append_tmp__]) dnl + ],[ dnl + m4_define([$1], [$2]) dnl + $3 + ]) dnl +]) + +AC_DEFUN([_MYSQL_PLUGAPPEND_OPTS],[ dnl + ifelse($#, 0, [], $#, 1, [ dnl + AC_FATAL([[bad number of args]]) + ], $#, 2, [ dnl + _MYSQL_PLUGAPPEND_OPTONE([$1],[$2]) dnl + ],[ dnl + _MYSQL_PLUGAPPEND_OPTONE([$1],[$2]) dnl + _MYSQL_PLUGAPPEND_OPTS([$1], m4_shift(m4_shift($@))) + ]) +]) + +AC_DEFUN([_MYSQL_PLUGAPPEND_OPTONE],[ dnl + ifelse([$2], [all], [ dnl + AC_FATAL([[protected plugin group: all]]) dnl + ],[ dnl + ifelse([$2], [none], [ dnl + AC_FATAL([[protected plugin group: none]]) dnl + ],[ dnl + _MYSQL_PLUGAPPEND([__mysql_$1_configs__],[$2]) dnl + _MYSQL_PLUGAPPEND([__mysql_]m4_bpatsubst($2, -, _)[_plugins__],[$1], [ dnl + _MYSQL_PLUGAPPEND([__mysql_metaplugin_list__],[$2]) dnl + ]) dnl + ]) dnl + ]) dnl +]) + + +dnl --------------------------------------------------------------------------- + + +AC_DEFUN([MYSQL_LIST_PLUGINS],[ dnl + m4_ifdef([__mysql_plugin_list__],[ dnl + _MYSQL_LIST_PLUGINS(m4_bpatsubst(__mysql_plugin_list__, :, [,])) dnl + ]) dnl +]) + +AC_DEFUN([_MYSQL_LIST_PLUGINS],[ dnl + ifelse($#, 0, [], $#, 1, [ dnl + MYSQL_SHOW_PLUGIN([$1]) dnl + ],[ dnl + MYSQL_SHOW_PLUGIN([$1]) dnl + _MYSQL_LIST_PLUGINS(m4_shift($@)) dnl + ]) dnl +]) + +AC_DEFUN([MYSQL_SHOW_PLUGIN],[ dnl + _MYSQL_SHOW_PLUGIN( + [$1], + [$1-plugin], + [MYSQL_MODULE_NAME_]AS_TR_CPP([$1]), + [MYSQL_MODULE_DESC_]AS_TR_CPP([$1]), + [MYSQL_MODULE_DEFINE_]AS_TR_CPP([$1]), + [MYSQL_MODULE_DIRECTORY_]AS_TR_CPP([$1]), + [MYSQL_MODULE_STATIC_]AS_TR_CPP([$1]), + [MYSQL_MODULE_DYNAMIC_]AS_TR_CPP([$1]), + [MYSQL_MODULE_MANDATORY_]AS_TR_CPP([$1]), + [MYSQL_MODULE_DISABLED_]AS_TR_CPP([$1]), + [MYSQL_MODULE_ACTIONS_]AS_TR_CPP([$1]), + __mysql_[$1]_configs__, + ) +]) + +AC_DEFUN([_MYSQL_SHOW_PLUGIN],[ + === Plug-in: $3 === + Module Name: [$1] + Description: $4 + Supports build: _PLUGIN_BUILD_TYPE([$7],[$8]) dnl +m4_ifdef([$12],[ + Configurations: m4_bpatsubst($12, :, [, ])]) dnl +m4_ifdef([$10],[ + Status: disabled], [ dnl +m4_ifdef([$9],[ + Status: mandatory])])]) + +AC_DEFUN([_PLUGIN_BUILD_TYPE], dnl +[m4_ifdef([$1],[ifelse($1,[no],[],[static ]m4_ifdef([$2],[and dnl +]))])[]m4_ifdef([$2],[dynamic],[m4_ifdef([$1],[],[static])])]) + + +dnl --------------------------------------------------------------------------- + + +AC_DEFUN([_MYSQL_MODULE_ARGS_CHECK],[ dnl + ifelse($#, 0, [], $#, 1, [ dnl + _MYSQL_CHECK_PLUGIN_ARG([$1], + [MYSQL_MODULE_DISABLED_]AS_TR_CPP([$1]), + [MYSQL_MODULE_ACTIONS_]AS_TR_CPP([$1])) dnl + ],[ dnl + _MYSQL_CHECK_PLUGIN_ARG([$1], + [MYSQL_MODULE_DISABLED_]AS_TR_CPP([$1]), + [MYSQL_MODULE_ACTIONS_]AS_TR_CPP([$1])) dnl + _MYSQL_MODULE_ARGS_CHECK(m4_shift($@)) dnl + ]) dnl +]) + +AC_DEFUN([_MYSQL_CHECK_PLUGIN_ARG],[ dnl +m4_ifdef([$3], [], [AC_DEFUN([$3],[ ])]) + elif test "$plugin" == "[$1]"; then dnl +m4_ifdef([$2],[ + AC_MSG_ERROR([plugin $1 is disabled]) dnl +],[ + [mysql_module_]m4_bpatsubst([$1], -, _)="yes" dnl +]) dnl +]) + +AC_DEFUN([_MYSQL_CHECK_DEPENDENCIES], [ dnl + ifelse($#, 0, [], $#, 1, [ dnl + _MYSQL_CHECK_DEPENDS([$1],[__mysql_plugdepends_$1__]) dnl + ],[ dnl + _MYSQL_CHECK_DEPENDS([$1],[__mysql_plugdepends_$1__]) dnl + _MYSQL_CHECK_DEPENDENCIES(m4_shift($@)) dnl + ]) dnl +]) + +AC_DEFUN([_MYSQL_CHECK_DEPENDS], [ dnl + m4_ifdef([$2], [ + if test "[$mysql_module_]m4_bpatsubst([$1], -, _)" == "yes" -a \ + "[$with_module_]m4_bpatsubst([$1], -, _)" != "no" -o \ + "[$with_module_]m4_bpatsubst([$1], -, _)" == "yes"; then dnl + _MYSQL_GEN_DEPENDS(m4_bpatsubst($2, :, [,])) + fi + ]) dnl +]) + +AC_DEFUN([_MYSQL_GEN_DEPENDS], [ dnl + ifelse($#, 0, [], $#, 1, [ + [mysql_module_]m4_bpatsubst([$1], -, _)="yes" + if test "[$with_module_]m4_bpatsubst([$1], -, _)" == "no"; then + AC_MSG_ERROR([depends upon disabled module $1]) + fi dnl + ],[ + [mysql_module_]m4_bpatsubst([$1], -, _)="yes" + if test "[$with_module_]m4_bpatsubst([$1], -, _)" == "no"; then + AC_MSG_ERROR([depends upon disabled module $1]) + fi dnl + _MYSQL_GEN_DEPENDS(m4_shift($@)) dnl + ]) dnl +]) + + +AC_DEFUN([_MYSQL_CHECK_PLUGIN_ARGS],[ + + AC_ARG_WITH([modules], [ + --with-modules=PLUGIN[[,PLUGIN..]] +m4_text_wrap([Plugin modules to include in mysqld. (default is: $1) +Must be configuration name or a comma seperated list of modules.], +[ ]) +m4_text_wrap([Available configurations are: ] +m4_bpatsubst(m4_ifdef([__mysql_metaplugin_list__], dnl +none:all:__mysql_metaplugin_list__,none:all), :, [ ])[.], +[ ]) +m4_text_wrap([Available plugin modules are: ] dnl +m4_bpatsubst(__mysql_plugin_list__, :, [ ])[.], [ ]) + --without-module-PLUGIN +m4_text_wrap([Disable the named module from being built. Otherwise, +for modules which are not selected for inclusion in mysqld will be +built dynamically (if supported)],[ ])], +[mysql_modules="$withval"], [mysql_modules=['$1']]) + +m4_divert_once([HELP_VAR_END],[ +Description of plugin modules: +m4_indir([MYSQL_LIST_PLUGINS]) +]) + + if test "$mysql_modules" == "all"; then + mysql_modules="m4_bpatsubst(__mysql_plugin_list__, :, [,])" + elif test "$mysql_modules" == "none"; then + mysql_modules="" dnl +m4_ifdef([__mysql_metaplugin_list__],[ dnl +_MYSQL_MODULE_META_CHECK(m4_bpatsubst(__mysql_metaplugin_list__, :, [,])) dnl +]) + fi + + for plugin in `echo $mysql_modules | tr ",.:;" " "`; do + if test "$plugin" == "all" -o "$plugin" == "none"; then + AC_MSG_ERROR([bad module name: $plugin]) dnl +_MYSQL_MODULE_ARGS_CHECK(m4_bpatsubst(__mysql_plugin_list__, :, [,])) + else + AC_MSG_ERROR([unknown plugin module: $plugin]) + fi + done + + _MYSQL_CHECK_DEPENDENCIES(m4_bpatsubst(__mysql_plugin_list__, :, [,])) +]) + + +dnl =========================================================================== diff --git a/config/ac-macros/storage.m4 b/config/ac-macros/storage.m4 deleted file mode 100644 index 4148aed818d..00000000000 --- a/config/ac-macros/storage.m4 +++ /dev/null @@ -1,55 +0,0 @@ -dnl --------------------------------------------------------------------------- -dnl Macro: MYSQL_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 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 --------------------------------------------------------------------------- - -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_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" - 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 -fi -]) - -dnl --------------------------------------------------------------------------- diff --git a/configure.in b/configure.in index e2c94060ae7..70d36ee84f5 100644 --- a/configure.in +++ b/configure.in @@ -31,7 +31,7 @@ sinclude(config/ac-macros/alloca.m4) sinclude(config/ac-macros/check_cpu.m4) sinclude(config/ac-macros/character_sets.m4) sinclude(config/ac-macros/compiler_flag.m4) -sinclude(config/ac-macros/storage.m4) +sinclude(config/ac-macros/plugins.m4) sinclude(config/ac-macros/ha_berkeley.m4) sinclude(config/ac-macros/ha_ndbcluster.m4) sinclude(config/ac-macros/large_file.m4) @@ -48,6 +48,92 @@ czech danish dutch english estonian french german greek hungarian \ italian japanese korean norwegian norwegian-ny polish portuguese \ romanian russian serbian slovak spanish swedish ukrainian" +#-------------------------------------------------------------------- +# Declare our plugin modules +#-------------------------------------------------------------------- + +MYSQL_STORAGE_ENGINE(archive,, [Archive Storage Engine], + [Archive Storage Engine], [max,max-no-ndb]) +MYSQL_MODULE_DIRECTORY(archive, [storage/archive]) +MYSQL_MODULE_STATIC(archive, [libarchive.a]) +MYSQL_MODULE_DYNAMIC(archive, [ha_archive.la]) + +MYSQL_STORAGE_ENGINE(berkeley, berkeley-db, [BerkeleyDB Storage Engine], + [Transactional Tables using BerkeleyDB], [max,max-no-ndb]) +MYSQL_MODULE_DIRECTORY(berkeley,[storage/bdb]) +MYSQL_MODULE_STATIC(berkeley, [[\$(bdb_libs_with_path)]]) +MYSQL_MODULE_ACTIONS(berkeley, [MYSQL_SETUP_BERKELEY_DB]) + +MYSQL_STORAGE_ENGINE(blackhole,,[Blackhole Storage Engine], + [Basic Write-only Read-never tables], [max,max-no-ndb]) +MYSQL_MODULE_DIRECTORY(blackhole, [storage/blackhole]) +MYSQL_MODULE_STATIC(blackhole, [libblackhole.a]) +MYSQL_MODULE_DYNAMIC(blackhole, [ha_blackhole.la]) + +MYSQL_STORAGE_ENGINE(csv,, [CSV Storage Engine], + [Stores tables in text CSV format]) +MYSQL_MODULE_DIRECTORY(csv, [storage/csv]) +MYSQL_MODULE_STATIC(csv, [libcsv.a]) + +MYSQL_STORAGE_ENGINE(example,, [Example Storage Engine], + [Skeleton for Storage Engines for developers], [max,max-no-ndb]) +MYSQL_MODULE_DIRECTORY(example, [storage/example]) +MYSQL_MODULE_STATIC(example, [libexample.a]) +MYSQL_MODULE_DYNAMIC(example, [ha_example.la]) + +MYSQL_STORAGE_ENGINE(federated,,[Federated Storage Engine], + [Connects to tables on remote MySQL servers], [max,max-no-ndb]) + +MYSQL_MODULE(ftexample, [Simple Parser], + [Simple full-text parser plugin]) +MYSQL_MODULE_DIRECTORY(ftexample, [plugin/fulltext]) +MYSQL_MODULE_STATIC(ftexample, [libftexample.a]) +MYSQL_MODULE_DYNAMIC(ftexample, [ft_example.la]) + +MYSQL_STORAGE_ENGINE(heap,no, [Memory Storage Engine], + [In memory hashed tables]) +MYSQL_MODULE_DIRECTORY(heap, [storage/heap]) +MYSQL_MODULE_STATIC(heap, [libheap.a]) + +MYSQL_STORAGE_ENGINE(innobase, innodb, [InnoDB Storage Engine], + [Transactional Tables using InnoDB], [max,max-no-ndb]) +MYSQL_MODULE_DIRECTORY(innobase, [storage/innobase]) +MYSQL_MODULE_STATIC(innobase, [libinnobase.a]) +MYSQL_MODULE_ACTIONS(innobase, [ + 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(myisam,no, [MyISAM Storage Engine], + [Traditional non-transactional MySQL tables]) +MYSQL_MODULE_DIRECTORY(myisam, [storage/myisam]) +MYSQL_MODULE_STATIC(myisam, [libmyisam.a]) + +MYSQL_STORAGE_ENGINE(myisammrg,no,[MyISAM MERGE Engine], + [Merge multiple MySQL tables into one]) +MYSQL_MODULE_DIRECTORY(myisammrg,[storage/myisammrg]) +MYSQL_MODULE_STATIC(myisammrg, [libmyisammrg.a]) + +MYSQL_STORAGE_ENGINE(ndbcluster, ndbcluster, [Cluster Storage Engine], + [High Availability Clustered tables], [max]) +MYSQL_MODULE_DIRECTORY(ndbcluster,[storage/ndb]) +MYSQL_MODULE_STATIC(ndbcluster, [[\$(ndbcluster_libs) \$(ndbcluster_system_libs) \$(NDB_SCI_LIBS)]]) +MYSQL_MODULE_ACTIONS(ndbcluster,[MYSQL_SETUP_NDBCLUSTER]) + +MYSQL_STORAGE_ENGINE(partition, partition, [Partition Engine], + [MySQL Table Partitioning Engine], [max,max-no-ndb]) + +MYSQL_MODULE_MANDATORY(csv) dnl Used for logging +MYSQL_MODULE_MANDATORY(heap) dnl Memory tables +MYSQL_MODULE_MANDATORY(myisam) dnl Default +MYSQL_MODULE_MANDATORY(myisammrg) + +dnl -- ndbcluster requires partition to be enabled +MYSQL_MODULE_DEPENDS(ndbcluster, partition) + ##### ##### @@ -671,6 +757,16 @@ MYSQL_SYS_LARGEFILE # Types that must be checked AFTER large file support is checked AC_TYPE_SIZE_T +#-------------------------------------------------------------------- +# Check for requested features +#-------------------------------------------------------------------- + +MYSQL_CHECK_BIG_TABLES +MYSQL_CHECK_MAX_INDEXES +MYSQL_CHECK_REPLICATION + +MYSQL_CONFIGURE_PLUGINS([none]) + #-------------------------------------------------------------------- # Check for system header files #-------------------------------------------------------------------- @@ -2416,74 +2512,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,,,,,,storage/example,no, - \$(top_builddir)/storage/example/libexample.a,[ - 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,7 +2567,6 @@ then AC_SUBST(THREAD_LOBJECTS) server_scripts="mysqld_safe mysql_install_db" sql_server_dirs="strings mysys dbug extra regex" - mysql_se_dirs="storage/myisam storage/myisammrg storage/heap $mysql_se_dirs" sql_server="$sql_server vio sql" fi @@ -2555,12 +2582,9 @@ AC_SUBST(sql_server) AC_SUBST(thread_dirs) 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_plugin_dirs) +AC_SUBST(mysql_plugin_libs) +AC_SUBST(mysql_plugin_defs) # Now that sql_client_dirs and sql_server_dirs are stable, determine the union. @@ -2600,14 +2624,19 @@ 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 + strings/Makefile regex/Makefile dnl + storage/Makefile dnl + storage/archive/Makefile storage/bdb/Makefile storage/blackhole/Makefile dnl + storage/csv/Makefile storage/example/Makefile storage/heap/Makefile dnl storage/myisam/Makefile storage/myisammrg/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 diff --git a/include/mysql/plugin.h b/include/mysql/plugin.h index a7b3606061f..2093043744a 100644 --- a/include/mysql/plugin.h +++ b/include/mysql/plugin.h @@ -37,10 +37,25 @@ 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); \ + +#ifndef MYSQL_DYNAMIC_PLUGIN +#define __DECLARE_PLUGIN(NAME, VERSION, PSIZE, DECLS) \ +int VERSION= MYSQL_PLUGIN_INTERFACE_VERSION; \ +int PSIZE= sizeof(struct st_mysql_plugin); \ +struct st_mysql_plugin DECLS[]= { +#else +#define __DECLARE_PLUGIN(NAME, VERSION, PSIZE, DECLS) \ +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_[]= { +#endif + +#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}} /* diff --git a/libmysqld/Makefile.am b/libmysqld/Makefile.am index 6e38fb267d9..32cccf2c942 100644 --- a/libmysqld/Makefile.am +++ b/libmysqld/Makefile.am @@ -44,7 +44,10 @@ libmysqlsources = errmsg.c get_password.c libmysql.c client.c pack.c \ noinst_HEADERS = embedded_priv.h emb_qcache.h sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \ - ha_heap.cc ha_myisam.cc ha_myisammrg.cc handler.cc sql_handler.cc \ + ha_heap.cc ha_myisam.cc ha_myisammrg.cc \ + ha_innodb.cc ha_berkeley.cc ha_federated.cc ha_ndbcluster.cc \ + ha_ndbcluster_binlog.cc ha_partition.cc \ + handler.cc sql_handler.cc \ hostname.cc init.cc password.c \ item.cc item_buff.cc item_cmpfunc.cc item_create.cc \ item_func.cc item_strfunc.cc item_sum.cc item_timefunc.cc \ @@ -65,17 +68,12 @@ sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \ spatial.cc gstream.cc sql_help.cc tztime.cc sql_cursor.cc \ 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 \ - sql_tablespace.cc \ - rpl_injector.cc my_user.c partition_info.cc + event_executor.cc event.cc event_timed.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 \ - ha_blackhole.cc ha_federated.cc ha_ndbcluster.cc \ - ha_ndbcluster_binlog.cc \ - ha_partition.cc -libmysqld_a_DEPENDENCIES= @mysql_se_objs@ libmysqld_a_SOURCES= sqlstoragesources = $(EXTRA_libmysqld_a_SOURCES) @@ -85,15 +83,11 @@ sql_yacc.cc sql_yacc.h: $(top_srcdir)/sql/sql_yacc.yy # The following libraries should be included in libmysqld.a 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 \ $(top_builddir)/dbug/libdbug.a \ $(top_builddir)/vio/libvio.a \ - @mysql_se_libs@ \ + @mysql_plugin_libs@ \ $(yassl_las) if HAVE_YASSL diff --git a/plugin/Makefile.am b/plugin/Makefile.am index da4ff0a8d5c..2e98d6a3328 100644 --- a/plugin/Makefile.am +++ b/plugin/Makefile.am @@ -1 +1,27 @@ -SUBDIRS= fulltext +# Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Process this file with automake to create Makefile.in + +AUTOMAKE_OPTIONS = foreign + +# These are built from source in the Docs directory +EXTRA_DIST = +SUBDIRS = +DIST_SUBDIRS = . fulltext + +# Don't update the files from bitkeeper +%::SCCS/s.% diff --git a/plugin/fulltext/Makefile.am b/plugin/fulltext/Makefile.am index 4df5a1dc78a..331db7c98f8 100644 --- a/plugin/fulltext/Makefile.am +++ b/plugin/fulltext/Makefile.am @@ -1,9 +1,44 @@ #Makefile.am example for a plugin -pkglibdir=$(libdir)/mysql -INCLUDES= -I$(top_builddir)/include -I$(top_srcdir)/include -noinst_LTLIBRARIES= mypluglib.la -#pkglib_LTLIBRARIES= mypluglib.la -mypluglib_la_SOURCES= plugin_example.c -mypluglib_la_LDFLAGS= -module -rpath $(pkglibdir) +#MYSQL_MODULE(ftexample, [Simple Parser], +# [Simple full-text parser plugin]) +#MYSQL_MODULE_DIRECTORY(ftexample, [plugin/fulltext]) +#MYSQL_MODULE_STATIC(ftexample, [libftexample.a]) +#MYSQL_MODULE_DYNAMIC(ftexample, [ft_example.la]) + +#called from the top level Makefile + +MYSQLDATAdir = $(localstatedir) +MYSQLSHAREdir = $(pkgdatadir) +MYSQLBASEdir= $(prefix) +MYSQLLIBdir= $(pkglibdir) +INCLUDES = -I$(top_srcdir)/include \ + -I$(top_srcdir)/regex \ + -I$(top_srcdir)/sql \ + -I$(srcdir) +WRAPLIBS= + +LDADD = + +DEFS = @DEFS@ + +noinst_HEADERS = + +EXTRA_LTLIBRARIES = ft_example.la +pkglib_LTLIBRARIES = @plugin_ftexample_shared_target@ +ft_example_la_LDFLAGS = -module -rpath $(MYSQLLIBdir) +ft_example_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN +ft_example_la_CFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN +ft_example_la_SOURCES = plugin_example.c + + +EXTRA_LIBRARIES = libftexample.a +noinst_LIBRARIES = @plugin_ftexample_static_target@ +libftexample_a_CXXFLAGS=$(AM_CFLAGS) +libftexample_a_CFLAGS = $(AM_CFLAGS) +libftexample_a_SOURCES= plugin_example.c + + +# Don't update the files from bitkeeper +%::SCCS/s.% diff --git a/plugin/fulltext/plugin_example.c b/plugin/fulltext/plugin_example.c index cdf1527b310..9b937453ce4 100644 --- a/plugin/fulltext/plugin_example.c +++ b/plugin/fulltext/plugin_example.c @@ -216,7 +216,7 @@ static struct st_mysql_show_var simple_status[]= Plugin library descriptor */ -mysql_declare_plugin +mysql_declare_plugin(ftexample) { MYSQL_FTPARSER_PLUGIN, /* type */ &simple_parser_descriptor, /* descriptor */ diff --git a/sql/Makefile.am b/sql/Makefile.am index 60e7891931f..2665e3fcfd5 100644 --- a/sql/Makefile.am +++ b/sql/Makefile.am @@ -30,10 +30,7 @@ libexec_PROGRAMS = mysqld noinst_PROGRAMS = gen_lex_hash bin_PROGRAMS = mysql_tzinfo_to_sql gen_lex_hash_LDFLAGS = @NOINST_LDFLAGS@ -LDADD = $(top_builddir)/storage/myisam/libmyisam.a \ - $(top_builddir)/storage/myisammrg/libmyisammrg.a \ - $(top_builddir)/storage/heap/libheap.a \ - $(top_builddir)/vio/libvio.a \ +LDADD = $(top_builddir)/vio/libvio.a \ $(top_builddir)/mysys/libmysys.a \ $(top_builddir)/dbug/libdbug.a \ $(top_builddir)/regex/libregex.a \ @@ -41,7 +38,7 @@ LDADD = $(top_builddir)/storage/myisam/libmyisam.a \ mysqld_LDADD = @MYSQLD_EXTRA_LDFLAGS@ \ @pstack_libs@ \ - @mysql_se_objs@ @mysql_se_libs@ \ + @mysql_plugin_libs@ \ $(LDADD) $(CXXLDFLAGS) $(WRAPLIBS) @LIBDL@ \ @yassl_libs@ @openssl_libs@ noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \ @@ -53,6 +50,9 @@ noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \ sql_manager.h sql_map.h sql_string.h unireg.h \ sql_error.h field.h handler.h mysqld_suffix.h \ ha_heap.h ha_myisam.h ha_myisammrg.h ha_partition.h \ + ha_innodb.h ha_berkeley.h ha_federated.h \ + ha_ndbcluster.h ha_ndbcluster_binlog.h \ + ha_ndbcluster_tables.h opt_range.h protocol.h rpl_tblmap.h \ log.h sql_show.h rpl_rli.h \ sql_select.h structs.h table.h sql_udf.h hash_filo.h\ @@ -61,12 +61,12 @@ noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \ rpl_injector.h \ stacktrace.h sql_sort.h sql_cache.h set_var.h \ spatial.h gstream.h client_settings.h tzfile.h \ - tztime.h my_decimal.h\ + tztime.h my_decimal.h\ sp_head.h sp_pcontext.h sp_rcontext.h sp.h sp_cache.h \ parse_file.h sql_view.h sql_trigger.h \ sql_array.h sql_cursor.h event.h event_priv.h \ sql_plugin.h authors.h sql_partition.h \ - partition_info.h partition_element.h + partition_info.h partition_element.h mysqld_SOURCES = sql_lex.cc sql_handler.cc sql_partition.cc \ item.cc item_sum.cc item_buff.cc item_func.cc \ item_cmpfunc.cc item_strfunc.cc item_timefunc.cc \ @@ -79,7 +79,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc sql_partition.cc \ mysqld.cc password.c hash_filo.cc hostname.cc \ set_var.cc sql_parse.cc sql_yacc.yy \ sql_base.cc table.cc sql_select.cc sql_insert.cc \ - sql_prepare.cc sql_error.cc \ + sql_prepare.cc sql_error.cc \ sql_update.cc sql_delete.cc uniques.cc sql_do.cc \ procedure.cc item_uniq.cc sql_test.cc \ log.cc log_event.cc init.cc derror.cc sql_acl.cc \ @@ -87,6 +87,9 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc sql_partition.cc \ discover.cc time.cc opt_range.cc opt_sum.cc \ records.cc filesort.cc handler.cc \ ha_heap.cc ha_myisam.cc ha_myisammrg.cc \ + ha_partition.cc ha_innodb.cc ha_berkeley.cc \ + ha_federated.cc \ + ha_ndbcluster.cc ha_ndbcluster_binlog.cc \ sql_db.cc sql_table.cc sql_rename.cc sql_crypt.cc \ sql_load.cc mf_iocache.cc field_conv.cc sql_show.cc \ sql_udf.cc sql_analyse.cc sql_analyse.h sql_cache.cc \ @@ -102,15 +105,9 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc sql_partition.cc \ 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 \ - 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 \ - ha_ndbcluster_tables.h \ - ha_partition.cc ha_partition.h -mysqld_DEPENDENCIES = @mysql_se_objs@ + sql_builtin.cc sql_tablespace.cc partition_info.cc + + gen_lex_hash_SOURCES = gen_lex_hash.cc gen_lex_hash_LDADD = $(LDADD) $(CXXLDFLAGS) mysql_tzinfo_to_sql_SOURCES = mysql_tzinfo_to_sql.cc @@ -162,6 +159,7 @@ sql_yacc.o: sql_yacc.cc sql_yacc.h $(HEADERS) lex_hash.h: gen_lex_hash$(EXEEXT) ./gen_lex_hash$(EXEEXT) > $@ +# the following three should eventually be moved out of this directory ha_berkeley.o: ha_berkeley.cc ha_berkeley.h $(CXXCOMPILE) @bdb_includes@ $(LM_CFLAGS) -c $< diff --git a/sql/ha_archive.cc b/sql/ha_archive.cc deleted file mode 100644 index 403855b6a01..00000000000 --- a/sql/ha_archive.cc +++ /dev/null @@ -1,1499 +0,0 @@ -/* Copyright (C) 2003 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -#ifdef USE_PRAGMA_IMPLEMENTATION -#pragma implementation // gcc: Class implementation -#endif - -#include "mysql_priv.h" - -#include "ha_archive.h" -#include - -/* - First, if you want to understand storage engines you should look at - ha_example.cc and ha_example.h. - This example was written as a test case for a customer who needed - a storage engine without indexes that could compress data very well. - So, welcome to a completely compressed storage engine. This storage - engine only does inserts. No replace, deletes, or updates. All reads are - complete table scans. Compression is done through azip (bzip compresses - better, but only marginally, if someone asks I could add support for - it too, but beaware that it costs a lot more in CPU time then azip). - - We keep a file pointer open for each instance of ha_archive for each read - but for writes we keep one open file handle just for that. We flush it - only if we have a read occur. azip handles compressing lots of records - at once much better then doing lots of little records between writes. - It is possible to not lock on writes but this would then mean we couldn't - handle bulk inserts as well (that is if someone was trying to read at - the same time since we would want to flush). - - A "meta" file is kept alongside the data file. This file serves two purpose. - The first purpose is to track the number of rows in the table. The second - purpose is to determine if the table was closed properly or not. When the - meta file is first opened it is marked as dirty. It is opened when the table - itself is opened for writing. When the table is closed the new count for rows - is written to the meta file and the file is marked as clean. If the meta file - is opened and it is marked as dirty, it is assumed that a crash occured. At - this point an error occurs and the user is told to rebuild the file. - A rebuild scans the rows and rewrites the meta file. If corruption is found - in the data file then the meta file is not repaired. - - At some point a recovery method for such a drastic case needs to be divised. - - Locks are row level, and you will get a consistant read. - - For performance as far as table scans go it is quite fast. I don't have - good numbers but locally it has out performed both Innodb and MyISAM. For - Innodb the question will be if the table can be fit into the buffer - pool. For MyISAM its a question of how much the file system caches the - MyISAM file. With enough free memory MyISAM is faster. Its only when the OS - doesn't have enough memory to cache entire table that archive turns out - to be any faster. For writes it is always a bit slower then MyISAM. It has no - internal limits though for row length. - - Examples between MyISAM (packed) and Archive. - - Table with 76695844 identical rows: - 29680807 a_archive.ARZ - 920350317 a.MYD - - - Table with 8991478 rows (all of Slashdot's comments): - 1922964506 comment_archive.ARZ - 2944970297 comment_text.MYD - - - TODO: - Add bzip optional support. - Allow users to set compression level. - Add truncate table command. - Implement versioning, should be easy. - Allow for errors, find a way to mark bad rows. - Talk to the azip guys, come up with a writable format so that updates are doable - without switching to a block method. - Add optional feature so that rows can be flushed at interval (which will cause less - compression but may speed up ordered searches). - Checkpoint the meta file to allow for faster rebuilds. - Dirty open (right now the meta file is repaired if a crash occured). - Option to allow for dirty reads, this would lower the sync calls, which would make - inserts a lot faster, but would mean highly arbitrary reads. - - -Brian -*/ -/* - Notes on file formats. - The Meta file is layed out as: - check - Just an int of 254 to make sure that the the file we are opening was - never corrupted. - version - The current version of the file format. - rows - This is an unsigned long long which is the number of rows in the data - file. - check point - Reserved for future use - auto increment - MAX value for autoincrement - dirty - Status of the file, whether or not its values are the latest. This - flag is what causes a repair to occur - - The data file: - check - Just an int of 254 to make sure that the the file we are opening was - never corrupted. - version - The current version of the file format. - data - The data is stored in a "row +blobs" format. -*/ - -/* If the archive storage engine has been inited */ -static bool archive_inited= FALSE; -/* Variables for archive share methods */ -pthread_mutex_t archive_mutex; -static HASH archive_open_tables; - -/* The file extension */ -#define ARZ ".ARZ" // The data file -#define ARN ".ARN" // Files used during an optimize call -#define ARM ".ARM" // Meta file -/* - uchar + uchar + ulonglong + ulonglong + ulonglong + ulonglong + uchar -*/ -#define META_BUFFER_SIZE sizeof(uchar) + sizeof(uchar) + sizeof(ulonglong) \ - + sizeof(ulonglong) + sizeof(ulonglong) + sizeof(ulonglong) + sizeof(uchar) - -/* - uchar + uchar -*/ -#define DATA_BUFFER_SIZE 2 // Size of the data used in the data file -#define ARCHIVE_CHECK_HEADER 254 // The number we use to determine corruption - -/* Static declarations for handerton */ -static handler *archive_create_handler(TABLE_SHARE *table); -/* - Number of rows that will force a bulk insert. -*/ -#define ARCHIVE_MIN_ROWS_TO_USE_BULK_INSERT 2 - - -/* dummy handlerton - only to have something to return from archive_db_init */ -handlerton archive_hton = { - MYSQL_HANDLERTON_INTERFACE_VERSION, - "ARCHIVE", - SHOW_OPTION_YES, - "Archive storage engine", - DB_TYPE_ARCHIVE_DB, - archive_db_init, - 0, /* slot */ - 0, /* savepoint size. */ - NULL, /* close_connection */ - NULL, /* savepoint */ - NULL, /* rollback to savepoint */ - NULL, /* releas savepoint */ - NULL, /* commit */ - NULL, /* rollback */ - NULL, /* prepare */ - NULL, /* recover */ - NULL, /* commit_by_xid */ - NULL, /* rollback_by_xid */ - NULL, /* create_cursor_read_view */ - NULL, /* set_cursor_read_view */ - NULL, /* close_cursor_read_view */ - archive_create_handler, /* Create a new handler */ - NULL, /* Drop a database */ - archive_db_end, /* Panic call */ - NULL, /* Start Consistent Snapshot */ - NULL, /* Flush logs */ - NULL, /* Show status */ - NULL, /* Partition flags */ - NULL, /* Alter table flags */ - NULL, /* Alter interface */ - NULL, /* fill_files_table */ - HTON_NO_FLAGS, - NULL, /* binlog_func */ - NULL, /* binlog_log_query */ - NULL /* release_temporary_latches */ - -}; - -static handler *archive_create_handler(TABLE_SHARE *table) -{ - return new ha_archive(table); -} - -/* - Used for hash table that tracks open tables. -*/ -static byte* archive_get_key(ARCHIVE_SHARE *share,uint *length, - my_bool not_used __attribute__((unused))) -{ - *length=share->table_name_length; - return (byte*) share->table_name; -} - - -/* - Initialize the archive handler. - - SYNOPSIS - archive_db_init() - void - - RETURN - FALSE OK - TRUE Error -*/ - -bool archive_db_init() -{ - DBUG_ENTER("archive_db_init"); - if (pthread_mutex_init(&archive_mutex, MY_MUTEX_INIT_FAST)) - goto error; - if (hash_init(&archive_open_tables, system_charset_info, 32, 0, 0, - (hash_get_key) archive_get_key, 0, 0)) - { - VOID(pthread_mutex_destroy(&archive_mutex)); - } - else - { - archive_inited= TRUE; - DBUG_RETURN(FALSE); - } -error: - have_archive_db= SHOW_OPTION_DISABLED; // If we couldn't use handler - DBUG_RETURN(TRUE); -} - -/* - Release the archive handler. - - SYNOPSIS - archive_db_end() - void - - RETURN - FALSE OK -*/ - -int archive_db_end(ha_panic_function type) -{ - if (archive_inited) - { - hash_free(&archive_open_tables); - VOID(pthread_mutex_destroy(&archive_mutex)); - } - archive_inited= 0; - return 0; -} - -ha_archive::ha_archive(TABLE_SHARE *table_arg) - :handler(&archive_hton, table_arg), delayed_insert(0), bulk_insert(0) -{ - /* Set our original buffer from pre-allocated memory */ - buffer.set((char *)byte_buffer, IO_SIZE, system_charset_info); - - /* The size of the offset value we will use for position() */ - ref_length = sizeof(my_off_t); -} - -/* - This method reads the header of a datafile and returns whether or not it was successful. -*/ -int ha_archive::read_data_header(azio_stream *file_to_read) -{ - uchar data_buffer[DATA_BUFFER_SIZE]; - DBUG_ENTER("ha_archive::read_data_header"); - - if (azrewind(file_to_read) == -1) - DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE); - - if (azread(file_to_read, data_buffer, DATA_BUFFER_SIZE) != DATA_BUFFER_SIZE) - DBUG_RETURN(errno ? errno : -1); - - DBUG_PRINT("ha_archive::read_data_header", ("Check %u", data_buffer[0])); - DBUG_PRINT("ha_archive::read_data_header", ("Version %u", data_buffer[1])); - - if ((data_buffer[0] != (uchar)ARCHIVE_CHECK_HEADER) && - (data_buffer[1] != (uchar)ARCHIVE_VERSION)) - DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE); - - DBUG_RETURN(0); -} - -/* - This method writes out the header of a datafile and returns whether or not it was successful. -*/ -int ha_archive::write_data_header(azio_stream *file_to_write) -{ - uchar data_buffer[DATA_BUFFER_SIZE]; - DBUG_ENTER("ha_archive::write_data_header"); - - data_buffer[0]= (uchar)ARCHIVE_CHECK_HEADER; - data_buffer[1]= (uchar)ARCHIVE_VERSION; - - if (azwrite(file_to_write, &data_buffer, DATA_BUFFER_SIZE) != - DATA_BUFFER_SIZE) - goto error; - DBUG_PRINT("ha_archive::write_data_header", ("Check %u", (uint)data_buffer[0])); - DBUG_PRINT("ha_archive::write_data_header", ("Version %u", (uint)data_buffer[1])); - - DBUG_RETURN(0); -error: - DBUG_RETURN(errno); -} - -/* - This method reads the header of a meta file and returns whether or not it was successful. - *rows will contain the current number of rows in the data file upon success. -*/ -int ha_archive::read_meta_file(File meta_file, ha_rows *rows, - ulonglong *auto_increment, - ulonglong *forced_flushes) -{ - uchar meta_buffer[META_BUFFER_SIZE]; - uchar *ptr= meta_buffer; - ulonglong check_point; - - DBUG_ENTER("ha_archive::read_meta_file"); - - VOID(my_seek(meta_file, 0, MY_SEEK_SET, MYF(0))); - if (my_read(meta_file, (byte*)meta_buffer, META_BUFFER_SIZE, 0) != META_BUFFER_SIZE) - DBUG_RETURN(-1); - - /* - Parse out the meta data, we ignore version at the moment - */ - - ptr+= sizeof(uchar)*2; // Move past header - *rows= (ha_rows)uint8korr(ptr); - ptr+= sizeof(ulonglong); // Move past rows - check_point= uint8korr(ptr); - ptr+= sizeof(ulonglong); // Move past check_point - *auto_increment= uint8korr(ptr); - ptr+= sizeof(ulonglong); // Move past auto_increment - *forced_flushes= uint8korr(ptr); - ptr+= sizeof(ulonglong); // Move past forced_flush - - DBUG_PRINT("ha_archive::read_meta_file", ("Check %d", (uint)meta_buffer[0])); - DBUG_PRINT("ha_archive::read_meta_file", ("Version %d", (uint)meta_buffer[1])); - DBUG_PRINT("ha_archive::read_meta_file", ("Rows %llu", *rows)); - DBUG_PRINT("ha_archive::read_meta_file", ("Checkpoint %llu", check_point)); - DBUG_PRINT("ha_archive::read_meta_file", ("Auto-Increment %llu", *auto_increment)); - DBUG_PRINT("ha_archive::read_meta_file", ("Forced Flushes %llu", *forced_flushes)); - DBUG_PRINT("ha_archive::read_meta_file", ("Dirty %d", (int)(*ptr))); - - if ((meta_buffer[0] != (uchar)ARCHIVE_CHECK_HEADER) || - ((bool)(*ptr)== TRUE)) - DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE); - - my_sync(meta_file, MYF(MY_WME)); - - DBUG_RETURN(0); -} - -/* - This method writes out the header of a meta file and returns whether or not it was successful. - By setting dirty you say whether or not the file represents the actual state of the data file. - Upon ::open() we set to dirty, and upon ::close() we set to clean. -*/ -int ha_archive::write_meta_file(File meta_file, ha_rows rows, - ulonglong auto_increment, - ulonglong forced_flushes, - bool dirty) -{ - uchar meta_buffer[META_BUFFER_SIZE]; - uchar *ptr= meta_buffer; - ulonglong check_point= 0; //Reserved for the future - - DBUG_ENTER("ha_archive::write_meta_file"); - - *ptr= (uchar)ARCHIVE_CHECK_HEADER; - ptr += sizeof(uchar); - *ptr= (uchar)ARCHIVE_VERSION; - ptr += sizeof(uchar); - int8store(ptr, (ulonglong)rows); - ptr += sizeof(ulonglong); - int8store(ptr, check_point); - ptr += sizeof(ulonglong); - int8store(ptr, auto_increment); - ptr += sizeof(ulonglong); - int8store(ptr, forced_flushes); - ptr += sizeof(ulonglong); - *ptr= (uchar)dirty; - DBUG_PRINT("ha_archive::write_meta_file", ("Check %d", - (uint)ARCHIVE_CHECK_HEADER)); - DBUG_PRINT("ha_archive::write_meta_file", ("Version %d", - (uint)ARCHIVE_VERSION)); - DBUG_PRINT("ha_archive::write_meta_file", ("Rows %llu", (ulonglong)rows)); - DBUG_PRINT("ha_archive::write_meta_file", ("Checkpoint %llu", check_point)); - DBUG_PRINT("ha_archive::write_meta_file", ("Auto Increment %llu", - auto_increment)); - DBUG_PRINT("ha_archive::write_meta_file", ("Forced Flushes %llu", - forced_flushes)); - DBUG_PRINT("ha_archive::write_meta_file", ("Dirty %d", (uint)dirty)); - - VOID(my_seek(meta_file, 0, MY_SEEK_SET, MYF(0))); - if (my_write(meta_file, (byte *)meta_buffer, META_BUFFER_SIZE, 0) != META_BUFFER_SIZE) - DBUG_RETURN(-1); - - my_sync(meta_file, MYF(MY_WME)); - - DBUG_RETURN(0); -} - - -/* - We create the shared memory space that we will use for the open table. - No matter what we try to get or create a share. This is so that a repair - table operation can occur. - - See ha_example.cc for a longer description. -*/ -ARCHIVE_SHARE *ha_archive::get_share(const char *table_name, - TABLE *table, int *rc) -{ - ARCHIVE_SHARE *share; - char meta_file_name[FN_REFLEN]; - uint length; - char *tmp_name; - DBUG_ENTER("ha_archive::get_share"); - - pthread_mutex_lock(&archive_mutex); - length=(uint) strlen(table_name); - - if (!(share=(ARCHIVE_SHARE*) hash_search(&archive_open_tables, - (byte*) table_name, - length))) - { - if (!my_multi_malloc(MYF(MY_WME | MY_ZEROFILL), - &share, sizeof(*share), - &tmp_name, length+1, - NullS)) - { - pthread_mutex_unlock(&archive_mutex); - *rc= HA_ERR_OUT_OF_MEM; - DBUG_RETURN(NULL); - } - - share->use_count= 0; - share->table_name_length= length; - share->table_name= tmp_name; - share->crashed= FALSE; - fn_format(share->data_file_name,table_name,"",ARZ,MY_REPLACE_EXT|MY_UNPACK_FILENAME); - fn_format(meta_file_name,table_name,"",ARM,MY_REPLACE_EXT|MY_UNPACK_FILENAME); - strmov(share->table_name,table_name); - /* - We will use this lock for rows. - */ - VOID(pthread_mutex_init(&share->mutex,MY_MUTEX_INIT_FAST)); - if ((share->meta_file= my_open(meta_file_name, O_RDWR, MYF(0))) == -1) - share->crashed= TRUE; - - /* - After we read, we set the file to dirty. When we close, we will do the - opposite. If the meta file will not open we assume it is crashed and - leave it up to the user to fix. - */ - if (read_meta_file(share->meta_file, &share->rows_recorded, - &share->auto_increment_value, - &share->forced_flushes)) - share->crashed= TRUE; - else - (void)write_meta_file(share->meta_file, share->rows_recorded, - share->auto_increment_value, - share->forced_flushes, - TRUE); - /* - It is expensive to open and close the data files and since you can't have - a gzip file that can be both read and written we keep a writer open - that is shared amoung all open tables. - */ - if (!(azopen(&(share->archive_write), share->data_file_name, - O_WRONLY|O_APPEND|O_BINARY))) - { - DBUG_PRINT("info", ("Could not open archive write file")); - share->crashed= TRUE; - } - VOID(my_hash_insert(&archive_open_tables, (byte*) share)); - thr_lock_init(&share->lock); - } - share->use_count++; - DBUG_PRINT("info", ("archive table %.*s has %d open handles now", - share->table_name_length, share->table_name, - share->use_count)); - if (share->crashed) - *rc= HA_ERR_CRASHED_ON_USAGE; - pthread_mutex_unlock(&archive_mutex); - - DBUG_RETURN(share); -} - - -/* - Free the share. - See ha_example.cc for a description. -*/ -int ha_archive::free_share(ARCHIVE_SHARE *share) -{ - int rc= 0; - DBUG_ENTER("ha_archive::free_share"); - DBUG_PRINT("info", ("archive table %.*s has %d open handles on entrance", - share->table_name_length, share->table_name, - share->use_count)); - - pthread_mutex_lock(&archive_mutex); - if (!--share->use_count) - { - hash_delete(&archive_open_tables, (byte*) share); - thr_lock_delete(&share->lock); - VOID(pthread_mutex_destroy(&share->mutex)); - /* - We need to make sure we don't reset the crashed state. - If we open a crashed file, wee need to close it as crashed unless - it has been repaired. - Since we will close the data down after this, we go on and count - the flush on close; - */ - share->forced_flushes++; - (void)write_meta_file(share->meta_file, share->rows_recorded, - share->auto_increment_value, - share->forced_flushes, - share->crashed ? TRUE :FALSE); - if (azclose(&(share->archive_write))) - rc= 1; - if (my_close(share->meta_file, MYF(0))) - rc= 1; - my_free((gptr) share, MYF(0)); - } - pthread_mutex_unlock(&archive_mutex); - - DBUG_RETURN(rc); -} - - -/* - We just implement one additional file extension. -*/ -static const char *ha_archive_exts[] = { - ARZ, - ARM, - NullS -}; - -const char **ha_archive::bas_ext() const -{ - return ha_archive_exts; -} - - -/* - When opening a file we: - Create/get our shared structure. - Init out lock. - We open the file we will read from. -*/ -int ha_archive::open(const char *name, int mode, uint open_options) -{ - int rc= 0; - DBUG_ENTER("ha_archive::open"); - - DBUG_PRINT("info", ("archive table was opened for crash %s", - (open_options & HA_OPEN_FOR_REPAIR) ? "yes" : "no")); - share= get_share(name, table, &rc); - - if (rc == HA_ERR_CRASHED_ON_USAGE && !(open_options & HA_OPEN_FOR_REPAIR)) - { - free_share(share); - DBUG_RETURN(rc); - } - else if (rc == HA_ERR_OUT_OF_MEM) - { - DBUG_RETURN(rc); - } - - thr_lock_data_init(&share->lock,&lock,NULL); - - if (!(azopen(&archive, share->data_file_name, O_RDONLY|O_BINARY))) - { - if (errno == EROFS || errno == EACCES) - DBUG_RETURN(my_errno= errno); - DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE); - } - - DBUG_PRINT("info", ("archive table was crashed %s", - rc == HA_ERR_CRASHED_ON_USAGE ? "yes" : "no")); - if (rc == HA_ERR_CRASHED_ON_USAGE && open_options & HA_OPEN_FOR_REPAIR) - { - DBUG_RETURN(0); - } - else - DBUG_RETURN(rc); -} - - -/* - Closes the file. - - SYNOPSIS - close(); - - IMPLEMENTATION: - - We first close this storage engines file handle to the archive and - then remove our reference count to the table (and possibly free it - as well). - - RETURN - 0 ok - 1 Error -*/ - -int ha_archive::close(void) -{ - int rc= 0; - DBUG_ENTER("ha_archive::close"); - - /* First close stream */ - if (azclose(&archive)) - rc= 1; - /* then also close share */ - rc|= free_share(share); - - DBUG_RETURN(rc); -} - - -/* - We create our data file here. The format is pretty simple. - You can read about the format of the data file above. - Unlike other storage engines we do not "pack" our data. Since we - are about to do a general compression, packing would just be a waste of - CPU time. If the table has blobs they are written after the row in the order - of creation. -*/ - -int ha_archive::create(const char *name, TABLE *table_arg, - HA_CREATE_INFO *create_info) -{ - File create_file; // We use to create the datafile and the metafile - char name_buff[FN_REFLEN]; - int error; - DBUG_ENTER("ha_archive::create"); - - auto_increment_value= (create_info->auto_increment_value ? - create_info->auto_increment_value -1 : - (ulonglong) 0); - - if ((create_file= my_create(fn_format(name_buff,name,"",ARM, - MY_REPLACE_EXT|MY_UNPACK_FILENAME),0, - O_RDWR | O_TRUNC,MYF(MY_WME))) < 0) - { - error= my_errno; - goto error; - } - - for (uint key= 0; key < table_arg->s->keys; key++) - { - KEY *pos= table_arg->key_info+key; - KEY_PART_INFO *key_part= pos->key_part; - KEY_PART_INFO *key_part_end= key_part + pos->key_parts; - - for (; key_part != key_part_end; key_part++) - { - Field *field= key_part->field; - - if (!(field->flags & AUTO_INCREMENT_FLAG)) - { - error= -1; - goto error; - } - } - } - - write_meta_file(create_file, 0, auto_increment_value, 0, FALSE); - my_close(create_file,MYF(0)); - - /* - We reuse name_buff since it is available. - */ - if ((create_file= my_create(fn_format(name_buff,name,"",ARZ, - MY_REPLACE_EXT|MY_UNPACK_FILENAME),0, - O_RDWR | O_TRUNC,MYF(MY_WME))) < 0) - { - error= my_errno; - goto error; - } - if (!azdopen(&archive, create_file, O_WRONLY|O_BINARY)) - { - error= errno; - goto error2; - } - if (write_data_header(&archive)) - { - error= errno; - goto error3; - } - - if (azclose(&archive)) - { - error= errno; - goto error2; - } - - DBUG_RETURN(0); - -error3: - /* We already have an error, so ignore results of azclose. */ - (void)azclose(&archive); -error2: - my_close(create_file, MYF(0)); - delete_table(name); -error: - /* Return error number, if we got one */ - DBUG_RETURN(error ? error : -1); -} - -/* - This is where the actual row is written out. -*/ -int ha_archive::real_write_row(byte *buf, azio_stream *writer) -{ - my_off_t written; - uint *ptr, *end; - DBUG_ENTER("ha_archive::real_write_row"); - - written= azwrite(writer, buf, table->s->reclength); - DBUG_PRINT("ha_archive::real_write_row", ("Wrote %d bytes expected %d", - written, table->s->reclength)); - if (!delayed_insert || !bulk_insert) - share->dirty= TRUE; - - if (written != (my_off_t)table->s->reclength) - DBUG_RETURN(errno ? errno : -1); - /* - We should probably mark the table as damagaged if the record is written - but the blob fails. - */ - for (ptr= table->s->blob_field, end= ptr + table->s->blob_fields ; - ptr != end ; - ptr++) - { - char *data_ptr; - uint32 size= ((Field_blob*) table->field[*ptr])->get_length(); - - if (size) - { - ((Field_blob*) table->field[*ptr])->get_ptr(&data_ptr); - written= azwrite(writer, data_ptr, (unsigned)size); - if (written != (my_off_t)size) - DBUG_RETURN(errno ? errno : -1); - } - } - DBUG_RETURN(0); -} - - -/* - Look at ha_archive::open() for an explanation of the row format. - Here we just write out the row. - - Wondering about start_bulk_insert()? We don't implement it for - archive since it optimizes for lots of writes. The only save - for implementing start_bulk_insert() is that we could skip - setting dirty to true each time. -*/ -int ha_archive::write_row(byte *buf) -{ - int rc; - byte *read_buf= NULL; - ulonglong temp_auto; - DBUG_ENTER("ha_archive::write_row"); - - if (share->crashed) - DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE); - - statistic_increment(table->in_use->status_var.ha_write_count, &LOCK_status); - if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT) - table->timestamp_field->set_time(); - pthread_mutex_lock(&share->mutex); - - if (table->next_number_field) - { - KEY *mkey= &table->s->key_info[0]; // We only support one key right now - update_auto_increment(); - temp_auto= table->next_number_field->val_int(); - - /* - Bad news, this will cause a search for the unique value which is very - expensive since we will have to do a table scan which will lock up - all other writers during this period. This could perhaps be optimized - in the future. - */ - if (temp_auto == share->auto_increment_value && - mkey->flags & HA_NOSAME) - { - rc= HA_ERR_FOUND_DUPP_KEY; - goto error; - } - - if (temp_auto < share->auto_increment_value && - mkey->flags & HA_NOSAME) - { - /* - First we create a buffer that we can use for reading rows, and can pass - to get_row(). - */ - if (!(read_buf= (byte*) my_malloc(table->s->reclength, MYF(MY_WME)))) - { - rc= HA_ERR_OUT_OF_MEM; - goto error; - } - /* - All of the buffer must be written out or we won't see all of the - data - */ - azflush(&(share->archive_write), Z_SYNC_FLUSH); - share->forced_flushes++; - /* - Set the position of the local read thread to the beginning postion. - */ - if (read_data_header(&archive)) - { - rc= HA_ERR_CRASHED_ON_USAGE; - goto error; - } - - /* - Now we read and check all of the rows. - if (!memcmp(table->next_number_field->ptr, mfield->ptr, mfield->max_length())) - if ((longlong)temp_auto == - mfield->val_int((char*)(read_buf + mfield->offset()))) - */ - Field *mfield= table->next_number_field; - - while (!(get_row(&archive, read_buf))) - { - if (!memcmp(read_buf + mfield->offset(), table->next_number_field->ptr, - mfield->max_length())) - { - rc= HA_ERR_FOUND_DUPP_KEY; - goto error; - } - } - } - else - { - if (temp_auto > share->auto_increment_value) - auto_increment_value= share->auto_increment_value= temp_auto; - } - } - - /* - Notice that the global auto_increment has been increased. - In case of a failed row write, we will never try to reuse the value. - */ - - share->rows_recorded++; - rc= real_write_row(buf, &(share->archive_write)); -error: - pthread_mutex_unlock(&share->mutex); - if (read_buf) - my_free((gptr) read_buf, MYF(0)); - - DBUG_RETURN(rc); -} - - -ulonglong ha_archive::get_auto_increment() -{ - return share->auto_increment_value + 1; -} - -/* Initialized at each key walk (called multiple times unlike rnd_init()) */ -int ha_archive::index_init(uint keynr, bool sorted) -{ - DBUG_ENTER("ha_archive::index_init"); - active_index= keynr; - DBUG_RETURN(0); -} - - -/* - No indexes, so if we get a request for an index search since we tell - the optimizer that we have unique indexes, we scan -*/ -int ha_archive::index_read(byte *buf, const byte *key, - uint key_len, enum ha_rkey_function find_flag) -{ - int rc; - DBUG_ENTER("ha_archive::index_read"); - rc= index_read_idx(buf, active_index, key, key_len, find_flag); - DBUG_RETURN(rc); -} - - -int ha_archive::index_read_idx(byte *buf, uint index, const byte *key, - uint key_len, enum ha_rkey_function find_flag) -{ - int rc= 0; - bool found= 0; - KEY *mkey= &table->s->key_info[index]; - current_k_offset= mkey->key_part->offset; - current_key= key; - current_key_len= key_len; - - - DBUG_ENTER("ha_archive::index_read_idx"); - - /* - All of the buffer must be written out or we won't see all of the - data - */ - pthread_mutex_lock(&share->mutex); - azflush(&(share->archive_write), Z_SYNC_FLUSH); - share->forced_flushes++; - pthread_mutex_unlock(&share->mutex); - - /* - Set the position of the local read thread to the beginning postion. - */ - if (read_data_header(&archive)) - { - rc= HA_ERR_CRASHED_ON_USAGE; - goto error; - } - - while (!(get_row(&archive, buf))) - { - if (!memcmp(current_key, buf + current_k_offset, current_key_len)) - { - found= 1; - break; - } - } - - if (found) - DBUG_RETURN(0); - -error: - DBUG_RETURN(rc ? rc : HA_ERR_END_OF_FILE); -} - - -int ha_archive::index_next(byte * buf) -{ - bool found= 0; - - DBUG_ENTER("ha_archive::index_next"); - - while (!(get_row(&archive, buf))) - { - if (!memcmp(current_key, buf+current_k_offset, current_key_len)) - { - found= 1; - break; - } - } - - DBUG_RETURN(found ? 0 : HA_ERR_END_OF_FILE); -} - -/* - All calls that need to scan the table start with this method. If we are told - that it is a table scan we rewind the file to the beginning, otherwise - we assume the position will be set. -*/ - -int ha_archive::rnd_init(bool scan) -{ - DBUG_ENTER("ha_archive::rnd_init"); - - if (share->crashed) - DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE); - - /* We rewind the file so that we can read from the beginning if scan */ - if (scan) - { - scan_rows= share->rows_recorded; - DBUG_PRINT("info", ("archive will retrieve %llu rows", scan_rows)); - records= 0; - - /* - If dirty, we lock, and then reset/flush the data. - I found that just calling azflush() doesn't always work. - */ - if (share->dirty == TRUE) - { - pthread_mutex_lock(&share->mutex); - if (share->dirty == TRUE) - { - DBUG_PRINT("info", ("archive flushing out rows for scan")); - azflush(&(share->archive_write), Z_SYNC_FLUSH); - share->forced_flushes++; - share->dirty= FALSE; - } - pthread_mutex_unlock(&share->mutex); - } - - if (read_data_header(&archive)) - DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE); - } - - DBUG_RETURN(0); -} - - -/* - This is the method that is used to read a row. It assumes that the row is - positioned where you want it. -*/ -int ha_archive::get_row(azio_stream *file_to_read, byte *buf) -{ - int read; // Bytes read, azread() returns int - uint *ptr, *end; - char *last; - size_t total_blob_length= 0; - DBUG_ENTER("ha_archive::get_row"); - - read= azread(file_to_read, buf, table->s->reclength); - DBUG_PRINT("ha_archive::get_row", ("Read %d bytes expected %d", read, - table->s->reclength)); - - if (read == Z_STREAM_ERROR) - DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE); - - /* If we read nothing we are at the end of the file */ - if (read == 0) - DBUG_RETURN(HA_ERR_END_OF_FILE); - - /* - If the record is the wrong size, the file is probably damaged, unless - we are dealing with a delayed insert or a bulk insert. - */ - if ((ulong) read != table->s->reclength) - DBUG_RETURN(HA_ERR_END_OF_FILE); - - /* Calculate blob length, we use this for our buffer */ - for (ptr= table->s->blob_field, end=ptr + table->s->blob_fields ; - ptr != end ; - ptr++) - { - if (ha_get_bit_in_read_set(((Field_blob*) table->field[*ptr])->fieldnr)) - total_blob_length += ((Field_blob*) table->field[*ptr])->get_length(); - } - - /* Adjust our row buffer if we need be */ - buffer.alloc(total_blob_length); - last= (char *)buffer.ptr(); - - /* Loop through our blobs and read them */ - for (ptr= table->s->blob_field, end=ptr + table->s->blob_fields ; - ptr != end ; - ptr++) - { - size_t size= ((Field_blob*) table->field[*ptr])->get_length(); - if (size) - { - if (ha_get_bit_in_read_set(((Field_blob*) table->field[*ptr])->fieldnr)) - { - read= azread(file_to_read, last, size); - if ((size_t) read != size) - DBUG_RETURN(HA_ERR_END_OF_FILE); - ((Field_blob*) table->field[*ptr])->set_ptr(size, last); - last += size; - } - else - { - (void)azseek(file_to_read, size, SEEK_CUR); - } - } - } - DBUG_RETURN(0); -} - - -/* - Called during ORDER BY. Its position is either from being called sequentially - or by having had ha_archive::rnd_pos() called before it is called. -*/ - -int ha_archive::rnd_next(byte *buf) -{ - int rc; - DBUG_ENTER("ha_archive::rnd_next"); - - if (share->crashed) - DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE); - - if (!scan_rows) - DBUG_RETURN(HA_ERR_END_OF_FILE); - scan_rows--; - - statistic_increment(table->in_use->status_var.ha_read_rnd_next_count, - &LOCK_status); - current_position= aztell(&archive); - rc= get_row(&archive, buf); - - - if (rc != HA_ERR_END_OF_FILE) - records++; - - DBUG_RETURN(rc); -} - - -/* - Thanks to the table flag HA_REC_NOT_IN_SEQ this will be called after - each call to ha_archive::rnd_next() if an ordering of the rows is - needed. -*/ - -void ha_archive::position(const byte *record) -{ - DBUG_ENTER("ha_archive::position"); - my_store_ptr(ref, ref_length, current_position); - DBUG_VOID_RETURN; -} - - -/* - This is called after a table scan for each row if the results of the - scan need to be ordered. It will take *pos and use it to move the - cursor in the file so that the next row that is called is the - correctly ordered row. -*/ - -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); - current_position= (my_off_t)my_get_ptr(pos, ref_length); - (void)azseek(&archive, current_position, SEEK_SET); - - DBUG_RETURN(get_row(&archive, buf)); -} - -/* - This method repairs the meta file. It does this by walking the datafile and - rewriting the meta file. Currently it does this by calling optimize with - the extended flag. -*/ -int ha_archive::repair(THD* thd, HA_CHECK_OPT* check_opt) -{ - DBUG_ENTER("ha_archive::repair"); - check_opt->flags= T_EXTEND; - int rc= optimize(thd, check_opt); - - if (rc) - DBUG_RETURN(HA_ERR_CRASHED_ON_REPAIR); - - share->crashed= FALSE; - DBUG_RETURN(0); -} - -/* - The table can become fragmented if data was inserted, read, and then - inserted again. What we do is open up the file and recompress it completely. -*/ -int ha_archive::optimize(THD* thd, HA_CHECK_OPT* check_opt) -{ - DBUG_ENTER("ha_archive::optimize"); - int rc; - azio_stream writer; - char writer_filename[FN_REFLEN]; - - /* Flush any waiting data */ - azflush(&(share->archive_write), Z_SYNC_FLUSH); - share->forced_flushes++; - - /* Lets create a file to contain the new data */ - fn_format(writer_filename, share->table_name, "", ARN, - MY_REPLACE_EXT|MY_UNPACK_FILENAME); - - if (!(azopen(&writer, writer_filename, O_CREAT|O_WRONLY|O_TRUNC|O_BINARY))) - DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE); - - /* - An extended rebuild is a lot more effort. We open up each row and re-record it. - Any dead rows are removed (aka rows that may have been partially recorded). - */ - - if (check_opt->flags == T_EXTEND) - { - DBUG_PRINT("info", ("archive extended rebuild")); - byte *buf; - - /* - First we create a buffer that we can use for reading rows, and can pass - to get_row(). - */ - if (!(buf= (byte*) my_malloc(table->s->reclength, MYF(MY_WME)))) - { - rc= HA_ERR_OUT_OF_MEM; - goto error; - } - - /* - Now we will rewind the archive file so that we are positioned at the - start of the file. - */ - rc= read_data_header(&archive); - - /* - Assuming now error from rewinding the archive file, we now write out the - new header for out data file. - */ - if (!rc) - rc= write_data_header(&writer); - - /* - On success of writing out the new header, we now fetch each row and - insert it into the new archive file. - */ - if (!rc) - { - share->rows_recorded= 0; - auto_increment_value= share->auto_increment_value= 0; - while (!(rc= get_row(&archive, buf))) - { - real_write_row(buf, &writer); - if (table->found_next_number_field) - { - Field *field= table->found_next_number_field; - ulonglong auto_value= - (ulonglong) field->val_int((char*)(buf + field->offset())); - if (share->auto_increment_value < auto_value) - auto_increment_value= share->auto_increment_value= - auto_value; - } - share->rows_recorded++; - } - } - DBUG_PRINT("info", ("recovered %llu archive rows", share->rows_recorded)); - - my_free((char*)buf, MYF(0)); - if (rc && rc != HA_ERR_END_OF_FILE) - goto error; - } - else - { - DBUG_PRINT("info", ("archive quick rebuild")); - /* - The quick method is to just read the data raw, and then compress it directly. - */ - int read; // Bytes read, azread() returns int - char block[IO_SIZE]; - if (azrewind(&archive) == -1) - { - rc= HA_ERR_CRASHED_ON_USAGE; - DBUG_PRINT("info", ("archive HA_ERR_CRASHED_ON_USAGE")); - goto error; - } - - while ((read= azread(&archive, block, IO_SIZE)) > 0) - azwrite(&writer, block, read); - } - - azclose(&writer); - share->dirty= FALSE; - share->forced_flushes= 0; - azclose(&(share->archive_write)); - DBUG_PRINT("info", ("Reopening archive data file")); - if (!(azopen(&(share->archive_write), share->data_file_name, - O_WRONLY|O_APPEND|O_BINARY))) - { - DBUG_PRINT("info", ("Could not open archive write file")); - rc= HA_ERR_CRASHED_ON_USAGE; - goto error; - } - - my_rename(writer_filename,share->data_file_name,MYF(0)); - - /* - Now we need to reopen our read descriptor since it has changed. - */ - azclose(&archive); - if (!(azopen(&archive, share->data_file_name, O_RDONLY|O_BINARY))) - { - rc= HA_ERR_CRASHED_ON_USAGE; - goto error; - } - - - DBUG_RETURN(0); - -error: - azclose(&writer); - - DBUG_RETURN(rc); -} - -/* - Below is an example of how to setup row level locking. -*/ -THR_LOCK_DATA **ha_archive::store_lock(THD *thd, - THR_LOCK_DATA **to, - enum thr_lock_type lock_type) -{ - if (lock_type == TL_WRITE_DELAYED) - delayed_insert= TRUE; - else - delayed_insert= FALSE; - - if (lock_type != TL_IGNORE && lock.type == TL_UNLOCK) - { - /* - Here is where we get into the guts of a row level lock. - If TL_UNLOCK is set - If we are not doing a LOCK TABLE or DISCARD/IMPORT - TABLESPACE, then allow multiple writers - */ - - if ((lock_type >= TL_WRITE_CONCURRENT_INSERT && - lock_type <= TL_WRITE) && !thd->in_lock_tables - && !thd->tablespace_op) - lock_type = TL_WRITE_ALLOW_WRITE; - - /* - In queries of type INSERT INTO t1 SELECT ... FROM t2 ... - MySQL would use the lock TL_READ_NO_INSERT on t2, and that - would conflict with TL_WRITE_ALLOW_WRITE, blocking all inserts - to t2. Convert the lock to a normal read lock to allow - concurrent inserts to t2. - */ - - if (lock_type == TL_READ_NO_INSERT && !thd->in_lock_tables) - lock_type = TL_READ; - - lock.type=lock_type; - } - - *to++= &lock; - - return to; -} - -void ha_archive::update_create_info(HA_CREATE_INFO *create_info) -{ - ha_archive::info(HA_STATUS_AUTO | HA_STATUS_CONST); - if (!(create_info->used_fields & HA_CREATE_USED_AUTO)) - { - create_info->auto_increment_value=auto_increment_value; - } -} - - -/* - Hints for optimizer, see ha_tina for more information -*/ -void ha_archive::info(uint flag) -{ - DBUG_ENTER("ha_archive::info"); - /* - This should be an accurate number now, though bulk and delayed inserts can - cause the number to be inaccurate. - */ - records= share->rows_recorded; - deleted= 0; - /* Costs quite a bit more to get all information */ - if (flag & HA_STATUS_TIME) - { - MY_STAT file_stat; // Stat information for the data file - - VOID(my_stat(share->data_file_name, &file_stat, MYF(MY_WME))); - - mean_rec_length= table->s->reclength + buffer.alloced_length(); - data_file_length= file_stat.st_size; - create_time= file_stat.st_ctime; - update_time= file_stat.st_mtime; - max_data_file_length= share->rows_recorded * mean_rec_length; - } - delete_length= 0; - index_file_length=0; - - if (flag & HA_STATUS_AUTO) - auto_increment_value= share->auto_increment_value; - - DBUG_VOID_RETURN; -} - - -/* - This method tells us that a bulk insert operation is about to occur. We set - a flag which will keep write_row from saying that its data is dirty. This in - turn will keep selects from causing a sync to occur. - Basically, yet another optimizations to keep compression working well. -*/ -void ha_archive::start_bulk_insert(ha_rows rows) -{ - DBUG_ENTER("ha_archive::start_bulk_insert"); - if (!rows || rows >= ARCHIVE_MIN_ROWS_TO_USE_BULK_INSERT) - bulk_insert= TRUE; - DBUG_VOID_RETURN; -} - - -/* - Other side of start_bulk_insert, is end_bulk_insert. Here we turn off the bulk insert - flag, and set the share dirty so that the next select will call sync for us. -*/ -int ha_archive::end_bulk_insert() -{ - DBUG_ENTER("ha_archive::end_bulk_insert"); - bulk_insert= FALSE; - share->dirty= TRUE; - DBUG_RETURN(0); -} - -/* - We cancel a truncate command. The only way to delete an archive table is to drop it. - This is done for security reasons. In a later version we will enable this by - allowing the user to select a different row format. -*/ -int ha_archive::delete_all_rows() -{ - DBUG_ENTER("ha_archive::delete_all_rows"); - DBUG_RETURN(0); -} - -/* - We just return state if asked. -*/ -bool ha_archive::is_crashed() const -{ - DBUG_ENTER("ha_archive::is_crashed"); - DBUG_RETURN(share->crashed); -} - -/* - Simple scan of the tables to make sure everything is ok. -*/ - -int ha_archive::check(THD* thd, HA_CHECK_OPT* check_opt) -{ - int rc= 0; - byte *buf; - const char *old_proc_info=thd->proc_info; - ha_rows count= share->rows_recorded; - DBUG_ENTER("ha_archive::check"); - - thd->proc_info= "Checking table"; - /* Flush any waiting data */ - azflush(&(share->archive_write), Z_SYNC_FLUSH); - share->forced_flushes++; - - /* - First we create a buffer that we can use for reading rows, and can pass - to get_row(). - */ - if (!(buf= (byte*) my_malloc(table->s->reclength, MYF(MY_WME)))) - rc= HA_ERR_OUT_OF_MEM; - - /* - Now we will rewind the archive file so that we are positioned at the - start of the file. - */ - if (!rc) - read_data_header(&archive); - - if (!rc) - while (!(rc= get_row(&archive, buf))) - count--; - - my_free((char*)buf, MYF(0)); - - thd->proc_info= old_proc_info; - - if ((rc && rc != HA_ERR_END_OF_FILE) || count) - { - share->crashed= FALSE; - DBUG_RETURN(HA_ADMIN_CORRUPT); - } - else - { - DBUG_RETURN(HA_ADMIN_OK); - } -} - -/* - Check and repair the table if needed. -*/ -bool ha_archive::check_and_repair(THD *thd) -{ - HA_CHECK_OPT check_opt; - DBUG_ENTER("ha_archive::check_and_repair"); - - check_opt.init(); - - DBUG_RETURN(repair(thd, &check_opt)); -} diff --git a/sql/ha_archive.h b/sql/ha_archive.h deleted file mode 100644 index 9b351b7e8da..00000000000 --- a/sql/ha_archive.h +++ /dev/null @@ -1,136 +0,0 @@ -/* Copyright (C) 2003 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -#ifdef USE_PRAGMA_INTERFACE -#pragma interface /* gcc class implementation */ -#endif - -#include -#include "../storage/archive/azlib.h" - -/* - Please read ha_archive.cc first. If you are looking for more general - answers on how storage engines work, look at ha_example.cc and - ha_example.h. -*/ - -typedef struct st_archive_share { - char *table_name; - char data_file_name[FN_REFLEN]; - uint table_name_length,use_count; - pthread_mutex_t mutex; - THR_LOCK lock; - File meta_file; /* Meta file we use */ - azio_stream archive_write; /* Archive file we are working with */ - bool dirty; /* Flag for if a flush should occur */ - bool crashed; /* Meta file is crashed */ - ha_rows rows_recorded; /* Number of rows in tables */ - ulonglong auto_increment_value; - ulonglong forced_flushes; - ulonglong mean_rec_length; -} ARCHIVE_SHARE; - -/* - Version for file format. - 1 - Initial Version -*/ -#define ARCHIVE_VERSION 2 - -class ha_archive: public handler -{ - THR_LOCK_DATA lock; /* MySQL lock */ - ARCHIVE_SHARE *share; /* Shared lock info */ - azio_stream archive; /* Archive file we are working with */ - my_off_t current_position; /* The position of the row we just read */ - byte byte_buffer[IO_SIZE]; /* Initial buffer for our string */ - String buffer; /* Buffer used for blob storage */ - ha_rows scan_rows; /* Number of rows left in scan */ - bool delayed_insert; /* If the insert is delayed */ - bool bulk_insert; /* If we are performing a bulk insert */ - const byte *current_key; - uint current_key_len; - uint current_k_offset; - -public: - ha_archive(TABLE_SHARE *table_arg); - ~ha_archive() - { - } - const char *table_type() const { return "ARCHIVE"; } - const char *index_type(uint inx) { return "NONE"; } - const char **bas_ext() const; - ulong table_flags() const - { - return (HA_REC_NOT_IN_SEQ | HA_NOT_EXACT_COUNT | HA_CAN_BIT_FIELD | - HA_FILE_BASED | HA_CAN_INSERT_DELAYED | HA_CAN_GEOMETRY); - } - ulong index_flags(uint idx, uint part, bool all_parts) const - { - return HA_ONLY_WHOLE_INDEX; - } - ulonglong get_auto_increment(); - uint max_supported_keys() const { return 1; } - uint max_supported_key_length() const { return sizeof(ulonglong); } - uint max_supported_key_part_length() const { return sizeof(ulonglong); } - int index_init(uint keynr, bool sorted); - virtual int index_read(byte * buf, const byte * key, - uint key_len, enum ha_rkey_function find_flag); - virtual int index_read_idx(byte * buf, uint index, const byte * key, - uint key_len, enum ha_rkey_function find_flag); - int index_next(byte * buf); - int open(const char *name, int mode, uint test_if_locked); - int close(void); - int write_row(byte * buf); - int real_write_row(byte *buf, azio_stream *writer); - int delete_all_rows(); - int rnd_init(bool scan=1); - int rnd_next(byte *buf); - int rnd_pos(byte * buf, byte *pos); - int get_row(azio_stream *file_to_read, byte *buf); - int read_meta_file(File meta_file, ha_rows *rows, - ulonglong *auto_increment, - ulonglong *forced_flushes); - int write_meta_file(File meta_file, ha_rows rows, - ulonglong auto_increment, - ulonglong forced_flushes, - bool dirty); - ARCHIVE_SHARE *get_share(const char *table_name, TABLE *table, int *rc); - int free_share(ARCHIVE_SHARE *share); - bool auto_repair() const { return 1; } // For the moment we just do this - int read_data_header(azio_stream *file_to_read); - int write_data_header(azio_stream *file_to_write); - void position(const byte *record); - void info(uint); - void update_create_info(HA_CREATE_INFO *create_info); - int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info); - int optimize(THD* thd, HA_CHECK_OPT* check_opt); - int repair(THD* thd, HA_CHECK_OPT* check_opt); - void start_bulk_insert(ha_rows rows); - int end_bulk_insert(); - enum row_type get_row_type() const - { - return ROW_TYPE_COMPRESSED; - } - THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to, - enum thr_lock_type lock_type); - bool is_crashed() const; - int check(THD* thd, HA_CHECK_OPT* check_opt); - bool check_and_repair(THD *thd); -}; - -bool archive_db_init(void); -int archive_db_end(ha_panic_function type); - diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc index 6ea4cc9aeb5..0fabd00faa3 100644 --- a/sql/ha_berkeley.cc +++ b/sql/ha_berkeley.cc @@ -56,10 +56,14 @@ #include #include #include + +#ifdef WITH_BERKELEY_STORAGE_ENGINE #include "ha_berkeley.h" #include "sql_manager.h" #include +#include + #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 */ @@ -2725,3 +2729,17 @@ bool ha_berkeley::check_if_incompatible_data(HA_CREATE_INFO *info, } +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; + +#endif diff --git a/sql/ha_blackhole.cc b/sql/ha_blackhole.cc deleted file mode 100644 index 2f5e8ee0abc..00000000000 --- a/sql/ha_blackhole.cc +++ /dev/null @@ -1,252 +0,0 @@ -/* Copyright (C) 2005 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - - -#ifdef USE_PRAGMA_IMPLEMENTATION -#pragma implementation // gcc: Class implementation -#endif - -#include "mysql_priv.h" -#include "ha_blackhole.h" - -/* Static declarations for handlerton */ - -static handler *blackhole_create_handler(TABLE_SHARE *table); - - -/* Blackhole storage engine handlerton */ - -handlerton blackhole_hton= { - MYSQL_HANDLERTON_INTERFACE_VERSION, - "BLACKHOLE", - SHOW_OPTION_YES, - "/dev/null storage engine (anything you write to it disappears)", - DB_TYPE_BLACKHOLE_DB, - NULL, - 0, /* slot */ - 0, /* savepoint size. */ - NULL, /* close_connection */ - NULL, /* savepoint */ - NULL, /* rollback to savepoint */ - NULL, /* release savepoint */ - NULL, /* commit */ - NULL, /* rollback */ - NULL, /* prepare */ - NULL, /* recover */ - NULL, /* commit_by_xid */ - NULL, /* rollback_by_xid */ - NULL, /* create_cursor_read_view */ - NULL, /* set_cursor_read_view */ - NULL, /* close_cursor_read_view */ - blackhole_create_handler, /* Create a new handler */ - NULL, /* Drop a database */ - NULL, /* Panic call */ - NULL, /* Start Consistent Snapshot */ - NULL, /* Flush logs */ - NULL, /* Show status */ - NULL, /* Partition flags */ - NULL, /* Alter table flags */ - NULL, /* Alter Tablespace */ - NULL, /* Fill FILES table */ - HTON_CAN_RECREATE, - NULL, /* binlog_func */ - NULL, /* binlog_log_query */ - NULL /* release_temporary_latches */ -}; - - -static handler *blackhole_create_handler(TABLE_SHARE *table) -{ - return new ha_blackhole(table); -} - - -/***************************************************************************** -** BLACKHOLE tables -*****************************************************************************/ - -ha_blackhole::ha_blackhole(TABLE_SHARE *table_arg) - :handler(&blackhole_hton, table_arg) -{} - - -static const char *ha_blackhole_exts[] = { - NullS -}; - -const char **ha_blackhole::bas_ext() const -{ - return ha_blackhole_exts; -} - -int ha_blackhole::open(const char *name, int mode, uint test_if_locked) -{ - DBUG_ENTER("ha_blackhole::open"); - thr_lock_init(&thr_lock); - thr_lock_data_init(&thr_lock,&lock,NULL); - DBUG_RETURN(0); -} - -int ha_blackhole::close(void) -{ - DBUG_ENTER("ha_blackhole::close"); - thr_lock_delete(&thr_lock); - DBUG_RETURN(0); -} - -int ha_blackhole::create(const char *name, TABLE *table_arg, - HA_CREATE_INFO *create_info) -{ - DBUG_ENTER("ha_blackhole::create"); - DBUG_RETURN(0); -} - -const char *ha_blackhole::index_type(uint key_number) -{ - DBUG_ENTER("ha_blackhole::index_type"); - DBUG_RETURN((table_share->key_info[key_number].flags & HA_FULLTEXT) ? - "FULLTEXT" : - (table_share->key_info[key_number].flags & HA_SPATIAL) ? - "SPATIAL" : - (table_share->key_info[key_number].algorithm == - HA_KEY_ALG_RTREE) ? "RTREE" : "BTREE"); -} - -int ha_blackhole::write_row(byte * buf) -{ - DBUG_ENTER("ha_blackhole::write_row"); - DBUG_RETURN(0); -} - -int ha_blackhole::rnd_init(bool scan) -{ - DBUG_ENTER("ha_blackhole::rnd_init"); - DBUG_RETURN(0); -} - - -int ha_blackhole::rnd_next(byte *buf) -{ - DBUG_ENTER("ha_blackhole::rnd_next"); - DBUG_RETURN(HA_ERR_END_OF_FILE); -} - - -int ha_blackhole::rnd_pos(byte * buf, byte *pos) -{ - DBUG_ENTER("ha_blackhole::rnd_pos"); - DBUG_ASSERT(0); - DBUG_RETURN(0); -} - - -void ha_blackhole::position(const byte *record) -{ - DBUG_ENTER("ha_blackhole::position"); - DBUG_ASSERT(0); - DBUG_VOID_RETURN; -} - - -void ha_blackhole::info(uint flag) -{ - DBUG_ENTER("ha_blackhole::info"); - - records= 0; - deleted= 0; - errkey= 0; - mean_rec_length= 0; - data_file_length= 0; - index_file_length= 0; - max_data_file_length= 0; - delete_length= 0; - if (flag & HA_STATUS_AUTO) - auto_increment_value= 1; - DBUG_VOID_RETURN; -} - -int ha_blackhole::external_lock(THD *thd, int lock_type) -{ - DBUG_ENTER("ha_blackhole::external_lock"); - DBUG_RETURN(0); -} - - -uint ha_blackhole::lock_count(void) const -{ - DBUG_ENTER("ha_blackhole::lock_count"); - DBUG_RETURN(0); -} - -THR_LOCK_DATA **ha_blackhole::store_lock(THD *thd, - THR_LOCK_DATA **to, - enum thr_lock_type lock_type) -{ - DBUG_ENTER("ha_blackhole::store_lock"); - DBUG_RETURN(to); -} - - -int ha_blackhole::index_read(byte * buf, const byte * key, - uint key_len, enum ha_rkey_function find_flag) -{ - DBUG_ENTER("ha_blackhole::index_read"); - DBUG_RETURN(0); -} - - -int ha_blackhole::index_read_idx(byte * buf, uint idx, const byte * key, - uint key_len, enum ha_rkey_function find_flag) -{ - DBUG_ENTER("ha_blackhole::index_read_idx"); - DBUG_RETURN(HA_ERR_END_OF_FILE); -} - - -int ha_blackhole::index_read_last(byte * buf, const byte * key, uint key_len) -{ - DBUG_ENTER("ha_blackhole::index_read_last"); - DBUG_RETURN(HA_ERR_END_OF_FILE); -} - - -int ha_blackhole::index_next(byte * buf) -{ - DBUG_ENTER("ha_blackhole::index_next"); - DBUG_RETURN(HA_ERR_END_OF_FILE); -} - - -int ha_blackhole::index_prev(byte * buf) -{ - DBUG_ENTER("ha_blackhole::index_prev"); - DBUG_RETURN(HA_ERR_END_OF_FILE); -} - - -int ha_blackhole::index_first(byte * buf) -{ - DBUG_ENTER("ha_blackhole::index_first"); - DBUG_RETURN(HA_ERR_END_OF_FILE); -} - - -int ha_blackhole::index_last(byte * buf) -{ - DBUG_ENTER("ha_blackhole::index_last"); - DBUG_RETURN(HA_ERR_END_OF_FILE); -} - diff --git a/sql/ha_blackhole.h b/sql/ha_blackhole.h deleted file mode 100644 index 15e12659aa0..00000000000 --- a/sql/ha_blackhole.h +++ /dev/null @@ -1,88 +0,0 @@ -/* Copyright (C) 2005 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -#ifdef USE_PRAGMA_INTERFACE -#pragma interface /* gcc class implementation */ -#endif - -/* - Class definition for the blackhole storage engine - "Dumbest named feature ever" -*/ -class ha_blackhole: public handler -{ - THR_LOCK_DATA lock; /* MySQL lock */ - THR_LOCK thr_lock; - -public: - ha_blackhole(TABLE_SHARE *table_arg); - ~ha_blackhole() - { - } - /* The name that will be used for display purposes */ - const char *table_type() const { return "BLACKHOLE"; } - /* - The name of the index type that will be used for display - don't implement this method unless you really have indexes - */ - const char *index_type(uint key_number); - const char **bas_ext() const; - ulong table_flags() const - { - return(HA_NULL_IN_KEY | HA_CAN_FULLTEXT | HA_CAN_SQL_HANDLER | - HA_DUPP_POS | HA_CAN_INDEX_BLOBS | HA_AUTO_PART_KEY | - HA_FILE_BASED | HA_CAN_GEOMETRY | HA_READ_RND_SAME | - HA_CAN_INSERT_DELAYED); - } - ulong index_flags(uint inx, uint part, bool all_parts) const - { - return ((table_share->key_info[inx].algorithm == HA_KEY_ALG_FULLTEXT) ? - 0 : HA_READ_NEXT | HA_READ_PREV | HA_READ_RANGE | - HA_READ_ORDER | HA_KEYREAD_ONLY); - } - /* The following defines can be increased if necessary */ -#define BLACKHOLE_MAX_KEY 64 /* Max allowed keys */ -#define BLACKHOLE_MAX_KEY_SEG 16 /* Max segments for key */ -#define BLACKHOLE_MAX_KEY_LENGTH 1000 - uint max_supported_keys() const { return BLACKHOLE_MAX_KEY; } - uint max_supported_key_length() const { return BLACKHOLE_MAX_KEY_LENGTH; } - uint max_supported_key_part_length() const { return BLACKHOLE_MAX_KEY_LENGTH; } - int open(const char *name, int mode, uint test_if_locked); - int close(void); - int write_row(byte * buf); - int rnd_init(bool scan); - int rnd_next(byte *buf); - int rnd_pos(byte * buf, byte *pos); - int index_read(byte * buf, const byte * key, - uint key_len, enum ha_rkey_function find_flag); - int index_read_idx(byte * buf, uint idx, const byte * key, - uint key_len, enum ha_rkey_function find_flag); - int index_read_last(byte * buf, const byte * key, uint key_len); - int index_next(byte * buf); - int index_prev(byte * buf); - int index_first(byte * buf); - int index_last(byte * buf); - void position(const byte *record); - void info(uint flag); - int external_lock(THD *thd, int lock_type); - uint lock_count(void) const; - int create(const char *name, TABLE *table_arg, - HA_CREATE_INFO *create_info); - THR_LOCK_DATA **store_lock(THD *thd, - THR_LOCK_DATA **to, - enum thr_lock_type lock_type); - bool has_transactions() { return 1; } -}; diff --git a/sql/ha_federated.cc b/sql/ha_federated.cc index 129a44b5721..f1d2b0025a9 100644 --- a/sql/ha_federated.cc +++ b/sql/ha_federated.cc @@ -351,9 +351,13 @@ #pragma implementation // gcc: Class implementation #endif +#ifdef WITH_FEDERATED_STORAGE_ENGINE #include "ha_federated.h" #include "m_string.h" + +#include + /* Variables for federated share methods */ static HASH federated_open_tables; // To track open tables pthread_mutex_t federated_mutex; // To init the hash @@ -2804,3 +2808,18 @@ int ha_federated::execute_simple_query(const char *query, int len) 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; + +#endif diff --git a/sql/ha_heap.cc b/sql/ha_heap.cc index f20dfe259fb..1223de37af8 100644 --- a/sql/ha_heap.cc +++ b/sql/ha_heap.cc @@ -706,3 +706,16 @@ bool ha_heap::check_if_incompatible_data(HA_CREATE_INFO *info, 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; diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index 1b0f4c34acc..e94b08cf4fb 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -42,6 +42,7 @@ have disables the InnoDB inlining in this file. */ #define MAX_ULONG_BIT ((ulong) 1 << (sizeof(ulong)*8-1)) +#ifdef WITH_INNOBASE_STORAGE_ENGINE #include "ha_innodb.h" pthread_mutex_t innobase_share_mutex, /* to protect innobase_open_files */ @@ -7533,3 +7534,19 @@ bool ha_innobase::check_if_incompatible_data( return COMPATIBLE_DATA_YES; } + + +mysql_declare_plugin(innobase) +{ + MYSQL_STORAGE_ENGINE_PLUGIN, + &innobase_hton, + innobase_hton.name, + "Innobase OY", + "InnoDB Storage Engine", + NULL, /* Plugin Init */ + NULL, /* Plugin Deinit */ + 0x0100 /* 1.0 */, +} +mysql_declare_plugin_end; + +#endif diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc index ec39ee00efc..9a0a4a9896f 100644 --- a/sql/ha_myisam.cc +++ b/sql/ha_myisam.cc @@ -31,6 +31,8 @@ #include "../storage/myisam/rt_index.h" #endif +#include + ulong myisam_recover_options= HA_RECOVER_NONE; /* bits in myisam_recover_options */ @@ -1787,3 +1789,17 @@ bool ha_myisam::check_if_incompatible_data(HA_CREATE_INFO *info, 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; diff --git a/sql/ha_myisammrg.cc b/sql/ha_myisammrg.cc index 0ce4e1d8bcb..8130a5d939a 100644 --- a/sql/ha_myisammrg.cc +++ b/sql/ha_myisammrg.cc @@ -28,6 +28,8 @@ #include "../storage/myisammrg/myrg_def.h" #endif +#include + /***************************************************************************** ** MyISAM MERGE tables *****************************************************************************/ @@ -573,3 +575,16 @@ bool ha_myisammrg::check_if_incompatible_data(HA_CREATE_INFO *info, */ 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; diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 28e026b8a10..83367fa4bee 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -27,6 +27,7 @@ #include "mysql_priv.h" #include +#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE #include "ha_ndbcluster.h" #include #include @@ -36,6 +37,8 @@ #include "ha_ndbcluster_binlog.h" #include "ha_ndbcluster_tables.h" +#include + #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) @@ -10146,3 +10149,19 @@ static int ndbcluster_fill_files_table(THD *thd, TABLE_LIST *tables, COND *cond) } 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; + +#endif diff --git a/sql/ha_ndbcluster_binlog.cc b/sql/ha_ndbcluster_binlog.cc index 60ccb661703..b248bb8534a 100644 --- a/sql/ha_ndbcluster_binlog.cc +++ b/sql/ha_ndbcluster_binlog.cc @@ -16,6 +16,7 @@ */ #include "mysql_priv.h" +#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE #include "ha_ndbcluster.h" #ifdef HAVE_NDB_BINLOG @@ -3510,3 +3511,4 @@ ndbcluster_show_status_binlog(THD* thd, stat_print_fn *stat_print, } #endif /* HAVE_NDB_BINLOG */ +#endif diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 3ee9a2954eb..fc9985cf87f 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -54,8 +54,11 @@ #include "mysql_priv.h" +#ifdef WITH_PARTITION_STORAGE_ENGINE #include "ha_partition.h" +#include + static const char *ha_par_ext= ".par"; #ifdef NOT_USED static int free_share(PARTITION_SHARE * share); @@ -5487,3 +5490,19 @@ static int free_share(PARTITION_SHARE *share) 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; + +#endif diff --git a/sql/handler.cc b/sql/handler.cc index 808dd0841c5..56938f2eff7 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -35,6 +35,7 @@ #define NDB_MAX_ATTRIBUTES_IN_TABLE 128 #include "ha_ndbcluster.h" #endif + #ifdef WITH_PARTITION_STORAGE_ENGINE #include "ha_partition.h" #endif @@ -43,7 +44,7 @@ #include "ha_innodb.h" #endif -extern handlerton *sys_table_types[]; +static handlerton *installed_htons[128]; #define BITMAP_STACKBUF_SIZE (128/8) @@ -138,30 +139,8 @@ handlerton *ha_resolve_by_name(THD *thd, LEX_STRING *name) } -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: @@ -169,13 +148,10 @@ const char *ha_get_storage_engine(enum legacy_db_type db_type) 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; } } @@ -190,8 +166,6 @@ static handler *create_default(TABLE_SHARE *table) 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: @@ -202,12 +176,9 @@ handlerton *ha_resolve_by_legacy_type(THD *thd, enum legacy_db_type db_type) 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; } } @@ -394,32 +365,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 */ @@ -436,7 +452,7 @@ static my_bool init_handlerton(THD *unused1, st_plugin_int *plugin, { if (plugin->state == PLUGIN_IS_UNINITIALIZED) { - ha_initialize_handlerton((handlerton *) plugin->plugin->info); + ha_initialize_handlerton(plugin); plugin->state= PLUGIN_IS_READY; } return FALSE; @@ -447,12 +463,15 @@ int ha_init() { int error= 0; 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); /* @@ -462,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); } diff --git a/sql/handler.h b/sql/handler.h index e93fdfe67e3..90bee61dc14 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -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 }; @@ -1545,8 +1546,8 @@ static inline bool ha_storage_engine_is_enabled(const handlerton *db_type) /* 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); diff --git a/sql/handlerton-win.cc b/sql/handlerton-win.cc deleted file mode 100644 index 9ce4eab2444..00000000000 --- a/sql/handlerton-win.cc +++ /dev/null @@ -1,72 +0,0 @@ -#include "mysql_priv.h" - -extern handlerton heap_hton; -extern handlerton myisam_hton; -extern handlerton myisammrg_hton; -extern handlerton binlog_hton; -#ifdef WITH_INNOBASE_STORAGE_ENGINE -extern handlerton innobase_hton; -#endif -#ifdef WITH_BERKELEY_STORAGE_ENGINE -extern handlerton berkeley_hton; -#endif -#ifdef WITH_EXAMPLE_STORAGE_ENGINE -extern handlerton example_hton; -#endif -#ifdef WITH_ARCHIVE_STORAGE_ENGINE -extern handlerton archive_hton; -#endif -#ifdef WITH_CSV_STORAGE_ENGINE -extern handlerton tina_hton; -#endif -#ifdef WITH_BLACKHOLE_STORAGE_ENGINE -extern handlerton blackhole_hton; -#endif -#ifdef WITH_FEDERATED_STORAGE_ENGINE -extern handlerton federated_hton; -#endif -#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE -extern handlerton ndbcluster_hton; -#endif -#ifdef WITH_PARTITION_STORAGE_ENGINE -extern handlerton partition_hton; -#endif - -/* - This array is used for processing compiled in engines. -*/ -handlerton *sys_table_types[]= -{ - &heap_hton, - &myisam_hton, -#ifdef WITH_INNOBASE_STORAGE_ENGINE - &innobase_hton, -#endif -#ifdef WITH_BERKELEY_STORAGE_ENGINE - &berkeley_hton, -#endif -#ifdef WITH_EXAMPLE_STORAGE_ENGINE - &example_hton, -#endif -#ifdef WITH_ARCHIVE_STORAGE_ENGINE - &archive_hton, -#endif -#ifdef WITH_CSV_STORAGE_ENGINE - &tina_hton, -#endif -#ifdef WITH_BLACKHOLE_STORAGE_ENGINE - &blackhole_hton, -#endif -#ifdef WITH_FEDERATED_STORAGE_ENGINE - &federated_hton, -#endif -#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE - &ndbcluster_hton, -#endif -#ifdef WITH_PARTITION_STORAGE_ENGINE - &partition_hton, -#endif - &myisammrg_hton, - &binlog_hton, - NULL -}; diff --git a/sql/handlerton.cc.in b/sql/handlerton.cc.in deleted file mode 100644 index 55af8cdd8cf..00000000000 --- a/sql/handlerton.cc.in +++ /dev/null @@ -1,14 +0,0 @@ - -#include "mysql_priv.h" - -extern handlerton heap_hton,myisam_hton,myisammrg_hton, - binlog_hton@mysql_se_decls@; - -/* - This array is used for processing compiled in engines. -*/ -handlerton *sys_table_types[]= -{ - &heap_hton,&myisam_hton@mysql_se_htons@,&myisammrg_hton,&binlog_hton,NULL -}; - diff --git a/sql/log.cc b/sql/log.cc index 5c67443d238..82f430f968f 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -34,6 +34,8 @@ #include "message.h" #endif +#include + /* max size of the log message */ #define MAX_LOG_BUFFER_SIZE 1024 #define MAX_USER_HOST_SIZE 512 @@ -4331,3 +4333,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; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 71067630535..0c7908c6b1a 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2703,12 +2703,6 @@ static int init_common_variables(const char *conf_file_name, int argc, 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; @@ -3240,17 +3247,6 @@ server."); 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); - } - /* Check that the default storage engine is actually available. */ diff --git a/sql/partition_info.cc b/sql/partition_info.cc index e2bf37d6ef3..9646e913851 100644 --- a/sql/partition_info.cc +++ b/sql/partition_info.cc @@ -21,9 +21,10 @@ #endif #include "mysql_priv.h" -#include "ha_partition.h" #ifdef WITH_PARTITION_STORAGE_ENGINE +#include "ha_partition.h" + partition_info *partition_info::get_clone() { diff --git a/sql/sql_builtin.cc.in b/sql/sql_builtin.cc.in new file mode 100644 index 00000000000..18705aa3dfb --- /dev/null +++ b/sql/sql_builtin.cc.in @@ -0,0 +1,13 @@ + +#include + +typedef struct st_mysql_plugin builtin_plugin[]; + +extern builtin_plugin + builtin_binlog_plugin@mysql_plugin_defs@; + +struct st_mysql_plugin *mysqld_builtins[]= +{ + builtin_binlog_plugin@mysql_plugin_defs@,(struct st_mysql_plugin *)0 +}; + diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index 4365d5b04ce..44b0fe1a2f1 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -21,7 +21,9 @@ */ #include "mysql_priv.h" +#ifdef WITH_INNOBASE_STORAGE_ENGINE #include "ha_innodb.h" +#endif #include "sql_select.h" #include "sp_head.h" #include "sql_trigger.h" diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 3d42bfea104..70dfb8bded9 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -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[]= @@ -540,6 +542,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; @@ -598,6 +647,8 @@ static byte *get_hash_key(const byte *buff, uint *length, int plugin_init(void) { int i; + struct st_mysql_plugin **builtins; + struct st_mysql_plugin *plugin; DBUG_ENTER("plugin_init"); if (initialized) @@ -617,6 +668,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; @@ -823,18 +884,10 @@ my_bool mysql_uninstall_plugin(THD *thd, LEX_STRING *name) 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); diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 95433828a1e..042c0397be3 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -111,6 +111,10 @@ static my_bool show_plugins(THD *thd, st_plugin_int *plugin, 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); @@ -3000,46 +3004,53 @@ int fill_schema_charsets(THD *thd, TABLE_LIST *tables, COND *cond) } -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("iter_schema_engines"); - DBUG_ENTER("fill_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, table); +} + + int fill_schema_collation(THD *thd, TABLE_LIST *tables, COND *cond) { CHARSET_INFO **cs; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index f570cbcd782..6a8a4f745ba 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -8173,7 +8173,7 @@ show_param: if (prepare_schema_table(YYTHD, lex, 0, SCH_OPEN_TABLES)) YYABORT; } - | PLUGIN_SYM + | opt_full PLUGIN_SYM { LEX *lex= Lex; WARN_DEPRECATED(yythd, "5.2", "SHOW PLUGIN", "'SHOW PLUGINS'"); diff --git a/storage/archive/Makefile.am b/storage/archive/Makefile.am index 415e0dc8f8f..0920fe1a897 100644 --- a/storage/archive/Makefile.am +++ b/storage/archive/Makefile.am @@ -14,20 +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 = @plugin_archive_shared_target@ +ha_archive_la_LDFLAGS = -module -rpath $(MYSQLLIBdir) +ha_archive_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN +ha_archive_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN +ha_archive_la_SOURCES = ha_archive.cc azio.c + + +EXTRA_LIBRARIES = libarchive.a +noinst_LIBRARIES = @plugin_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 -EXTRA_DIST = cmakelists.txt + # Don't update the files from bitkeeper %::SCCS/s.% diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc new file mode 100644 index 00000000000..3cbb388bba1 --- /dev/null +++ b/storage/archive/ha_archive.cc @@ -0,0 +1,1521 @@ +/* Copyright (C) 2003 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifdef USE_PRAGMA_IMPLEMENTATION +#pragma implementation // gcc: Class implementation +#endif + +#include "mysql_priv.h" +#include + +#include "ha_archive.h" +#include + +#include + +/* + First, if you want to understand storage engines you should look at + ha_example.cc and ha_example.h. + This example was written as a test case for a customer who needed + a storage engine without indexes that could compress data very well. + So, welcome to a completely compressed storage engine. This storage + engine only does inserts. No replace, deletes, or updates. All reads are + complete table scans. Compression is done through azip (bzip compresses + better, but only marginally, if someone asks I could add support for + it too, but beaware that it costs a lot more in CPU time then azip). + + We keep a file pointer open for each instance of ha_archive for each read + but for writes we keep one open file handle just for that. We flush it + only if we have a read occur. azip handles compressing lots of records + at once much better then doing lots of little records between writes. + It is possible to not lock on writes but this would then mean we couldn't + handle bulk inserts as well (that is if someone was trying to read at + the same time since we would want to flush). + + A "meta" file is kept alongside the data file. This file serves two purpose. + The first purpose is to track the number of rows in the table. The second + purpose is to determine if the table was closed properly or not. When the + meta file is first opened it is marked as dirty. It is opened when the table + itself is opened for writing. When the table is closed the new count for rows + is written to the meta file and the file is marked as clean. If the meta file + is opened and it is marked as dirty, it is assumed that a crash occured. At + this point an error occurs and the user is told to rebuild the file. + A rebuild scans the rows and rewrites the meta file. If corruption is found + in the data file then the meta file is not repaired. + + At some point a recovery method for such a drastic case needs to be divised. + + Locks are row level, and you will get a consistant read. + + For performance as far as table scans go it is quite fast. I don't have + good numbers but locally it has out performed both Innodb and MyISAM. For + Innodb the question will be if the table can be fit into the buffer + pool. For MyISAM its a question of how much the file system caches the + MyISAM file. With enough free memory MyISAM is faster. Its only when the OS + doesn't have enough memory to cache entire table that archive turns out + to be any faster. For writes it is always a bit slower then MyISAM. It has no + internal limits though for row length. + + Examples between MyISAM (packed) and Archive. + + Table with 76695844 identical rows: + 29680807 a_archive.ARZ + 920350317 a.MYD + + + Table with 8991478 rows (all of Slashdot's comments): + 1922964506 comment_archive.ARZ + 2944970297 comment_text.MYD + + + TODO: + Add bzip optional support. + Allow users to set compression level. + Add truncate table command. + Implement versioning, should be easy. + Allow for errors, find a way to mark bad rows. + Talk to the azip guys, come up with a writable format so that updates are doable + without switching to a block method. + Add optional feature so that rows can be flushed at interval (which will cause less + compression but may speed up ordered searches). + Checkpoint the meta file to allow for faster rebuilds. + Dirty open (right now the meta file is repaired if a crash occured). + Option to allow for dirty reads, this would lower the sync calls, which would make + inserts a lot faster, but would mean highly arbitrary reads. + + -Brian +*/ +/* + Notes on file formats. + The Meta file is layed out as: + check - Just an int of 254 to make sure that the the file we are opening was + never corrupted. + version - The current version of the file format. + rows - This is an unsigned long long which is the number of rows in the data + file. + check point - Reserved for future use + auto increment - MAX value for autoincrement + dirty - Status of the file, whether or not its values are the latest. This + flag is what causes a repair to occur + + The data file: + check - Just an int of 254 to make sure that the the file we are opening was + never corrupted. + version - The current version of the file format. + data - The data is stored in a "row +blobs" format. +*/ + +/* If the archive storage engine has been inited */ +static bool archive_inited= FALSE; +/* Variables for archive share methods */ +pthread_mutex_t archive_mutex; +static HASH archive_open_tables; + +/* The file extension */ +#define ARZ ".ARZ" // The data file +#define ARN ".ARN" // Files used during an optimize call +#define ARM ".ARM" // Meta file +/* + uchar + uchar + ulonglong + ulonglong + ulonglong + ulonglong + uchar +*/ +#define META_BUFFER_SIZE sizeof(uchar) + sizeof(uchar) + sizeof(ulonglong) \ + + sizeof(ulonglong) + sizeof(ulonglong) + sizeof(ulonglong) + sizeof(uchar) + +/* + uchar + uchar +*/ +#define DATA_BUFFER_SIZE 2 // Size of the data used in the data file +#define ARCHIVE_CHECK_HEADER 254 // The number we use to determine corruption + +/* Static declarations for handerton */ +static handler *archive_create_handler(TABLE_SHARE *table); +/* + Number of rows that will force a bulk insert. +*/ +#define ARCHIVE_MIN_ROWS_TO_USE_BULK_INSERT 2 + + +/* dummy handlerton - only to have something to return from archive_db_init */ +handlerton archive_hton = { + MYSQL_HANDLERTON_INTERFACE_VERSION, + "ARCHIVE", + SHOW_OPTION_YES, + "Archive storage engine", + DB_TYPE_ARCHIVE_DB, + archive_db_init, + 0, /* slot */ + 0, /* savepoint size. */ + NULL, /* close_connection */ + NULL, /* savepoint */ + NULL, /* rollback to savepoint */ + NULL, /* releas savepoint */ + NULL, /* commit */ + NULL, /* rollback */ + NULL, /* prepare */ + NULL, /* recover */ + NULL, /* commit_by_xid */ + NULL, /* rollback_by_xid */ + NULL, /* create_cursor_read_view */ + NULL, /* set_cursor_read_view */ + NULL, /* close_cursor_read_view */ + archive_create_handler, /* Create a new handler */ + NULL, /* Drop a database */ + archive_db_end, /* Panic call */ + NULL, /* Start Consistent Snapshot */ + NULL, /* Flush logs */ + NULL, /* Show status */ + NULL, /* Partition flags */ + NULL, /* Alter table flags */ + NULL, /* Alter interface */ + NULL, /* fill_files_table */ + HTON_NO_FLAGS, + NULL, /* binlog_func */ + NULL, /* binlog_log_query */ + NULL /* release_temporary_latches */ + +}; + +static handler *archive_create_handler(TABLE_SHARE *table) +{ + return new ha_archive(table); +} + +/* + Used for hash table that tracks open tables. +*/ +static byte* archive_get_key(ARCHIVE_SHARE *share,uint *length, + my_bool not_used __attribute__((unused))) +{ + *length=share->table_name_length; + return (byte*) share->table_name; +} + + +/* + Initialize the archive handler. + + SYNOPSIS + archive_db_init() + void + + RETURN + FALSE OK + TRUE Error +*/ + +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, + (hash_get_key) archive_get_key, 0, 0)) + { + VOID(pthread_mutex_destroy(&archive_mutex)); + } + else + { + archive_inited= TRUE; + DBUG_RETURN(FALSE); + } +error: + DBUG_RETURN(TRUE); +} + +/* + Release the archive handler. + + SYNOPSIS + archive_db_done() + void + + RETURN + FALSE OK +*/ + +int archive_db_done() +{ + if (archive_inited) + { + hash_free(&archive_open_tables); + VOID(pthread_mutex_destroy(&archive_mutex)); + } + archive_inited= 0; + 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) +{ + /* Set our original buffer from pre-allocated memory */ + buffer.set((char *)byte_buffer, IO_SIZE, system_charset_info); + + /* The size of the offset value we will use for position() */ + ref_length = sizeof(my_off_t); +} + +/* + This method reads the header of a datafile and returns whether or not it was successful. +*/ +int ha_archive::read_data_header(azio_stream *file_to_read) +{ + uchar data_buffer[DATA_BUFFER_SIZE]; + DBUG_ENTER("ha_archive::read_data_header"); + + if (azrewind(file_to_read) == -1) + DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE); + + if (azread(file_to_read, data_buffer, DATA_BUFFER_SIZE) != DATA_BUFFER_SIZE) + DBUG_RETURN(errno ? errno : -1); + + DBUG_PRINT("ha_archive::read_data_header", ("Check %u", data_buffer[0])); + DBUG_PRINT("ha_archive::read_data_header", ("Version %u", data_buffer[1])); + + if ((data_buffer[0] != (uchar)ARCHIVE_CHECK_HEADER) && + (data_buffer[1] != (uchar)ARCHIVE_VERSION)) + DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE); + + DBUG_RETURN(0); +} + +/* + This method writes out the header of a datafile and returns whether or not it was successful. +*/ +int ha_archive::write_data_header(azio_stream *file_to_write) +{ + uchar data_buffer[DATA_BUFFER_SIZE]; + DBUG_ENTER("ha_archive::write_data_header"); + + data_buffer[0]= (uchar)ARCHIVE_CHECK_HEADER; + data_buffer[1]= (uchar)ARCHIVE_VERSION; + + if (azwrite(file_to_write, &data_buffer, DATA_BUFFER_SIZE) != + DATA_BUFFER_SIZE) + goto error; + DBUG_PRINT("ha_archive::write_data_header", ("Check %u", (uint)data_buffer[0])); + DBUG_PRINT("ha_archive::write_data_header", ("Version %u", (uint)data_buffer[1])); + + DBUG_RETURN(0); +error: + DBUG_RETURN(errno); +} + +/* + This method reads the header of a meta file and returns whether or not it was successful. + *rows will contain the current number of rows in the data file upon success. +*/ +int ha_archive::read_meta_file(File meta_file, ha_rows *rows, + ulonglong *auto_increment, + ulonglong *forced_flushes) +{ + uchar meta_buffer[META_BUFFER_SIZE]; + uchar *ptr= meta_buffer; + ulonglong check_point; + + DBUG_ENTER("ha_archive::read_meta_file"); + + VOID(my_seek(meta_file, 0, MY_SEEK_SET, MYF(0))); + if (my_read(meta_file, (byte*)meta_buffer, META_BUFFER_SIZE, 0) != META_BUFFER_SIZE) + DBUG_RETURN(-1); + + /* + Parse out the meta data, we ignore version at the moment + */ + + ptr+= sizeof(uchar)*2; // Move past header + *rows= (ha_rows)uint8korr(ptr); + ptr+= sizeof(ulonglong); // Move past rows + check_point= uint8korr(ptr); + ptr+= sizeof(ulonglong); // Move past check_point + *auto_increment= uint8korr(ptr); + ptr+= sizeof(ulonglong); // Move past auto_increment + *forced_flushes= uint8korr(ptr); + ptr+= sizeof(ulonglong); // Move past forced_flush + + DBUG_PRINT("ha_archive::read_meta_file", ("Check %d", (uint)meta_buffer[0])); + DBUG_PRINT("ha_archive::read_meta_file", ("Version %d", (uint)meta_buffer[1])); + DBUG_PRINT("ha_archive::read_meta_file", ("Rows %llu", *rows)); + DBUG_PRINT("ha_archive::read_meta_file", ("Checkpoint %llu", check_point)); + DBUG_PRINT("ha_archive::read_meta_file", ("Auto-Increment %llu", *auto_increment)); + DBUG_PRINT("ha_archive::read_meta_file", ("Forced Flushes %llu", *forced_flushes)); + DBUG_PRINT("ha_archive::read_meta_file", ("Dirty %d", (int)(*ptr))); + + if ((meta_buffer[0] != (uchar)ARCHIVE_CHECK_HEADER) || + ((bool)(*ptr)== TRUE)) + DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE); + + my_sync(meta_file, MYF(MY_WME)); + + DBUG_RETURN(0); +} + +/* + This method writes out the header of a meta file and returns whether or not it was successful. + By setting dirty you say whether or not the file represents the actual state of the data file. + Upon ::open() we set to dirty, and upon ::close() we set to clean. +*/ +int ha_archive::write_meta_file(File meta_file, ha_rows rows, + ulonglong auto_increment, + ulonglong forced_flushes, + bool dirty) +{ + uchar meta_buffer[META_BUFFER_SIZE]; + uchar *ptr= meta_buffer; + ulonglong check_point= 0; //Reserved for the future + + DBUG_ENTER("ha_archive::write_meta_file"); + + *ptr= (uchar)ARCHIVE_CHECK_HEADER; + ptr += sizeof(uchar); + *ptr= (uchar)ARCHIVE_VERSION; + ptr += sizeof(uchar); + int8store(ptr, (ulonglong)rows); + ptr += sizeof(ulonglong); + int8store(ptr, check_point); + ptr += sizeof(ulonglong); + int8store(ptr, auto_increment); + ptr += sizeof(ulonglong); + int8store(ptr, forced_flushes); + ptr += sizeof(ulonglong); + *ptr= (uchar)dirty; + DBUG_PRINT("ha_archive::write_meta_file", ("Check %d", + (uint)ARCHIVE_CHECK_HEADER)); + DBUG_PRINT("ha_archive::write_meta_file", ("Version %d", + (uint)ARCHIVE_VERSION)); + DBUG_PRINT("ha_archive::write_meta_file", ("Rows %llu", (ulonglong)rows)); + DBUG_PRINT("ha_archive::write_meta_file", ("Checkpoint %llu", check_point)); + DBUG_PRINT("ha_archive::write_meta_file", ("Auto Increment %llu", + auto_increment)); + DBUG_PRINT("ha_archive::write_meta_file", ("Forced Flushes %llu", + forced_flushes)); + DBUG_PRINT("ha_archive::write_meta_file", ("Dirty %d", (uint)dirty)); + + VOID(my_seek(meta_file, 0, MY_SEEK_SET, MYF(0))); + if (my_write(meta_file, (byte *)meta_buffer, META_BUFFER_SIZE, 0) != META_BUFFER_SIZE) + DBUG_RETURN(-1); + + my_sync(meta_file, MYF(MY_WME)); + + DBUG_RETURN(0); +} + + +/* + We create the shared memory space that we will use for the open table. + No matter what we try to get or create a share. This is so that a repair + table operation can occur. + + See ha_example.cc for a longer description. +*/ +ARCHIVE_SHARE *ha_archive::get_share(const char *table_name, + TABLE *table, int *rc) +{ + ARCHIVE_SHARE *share; + char meta_file_name[FN_REFLEN]; + uint length; + char *tmp_name; + DBUG_ENTER("ha_archive::get_share"); + + pthread_mutex_lock(&archive_mutex); + length=(uint) strlen(table_name); + + if (!(share=(ARCHIVE_SHARE*) hash_search(&archive_open_tables, + (byte*) table_name, + length))) + { + if (!my_multi_malloc(MYF(MY_WME | MY_ZEROFILL), + &share, sizeof(*share), + &tmp_name, length+1, + NullS)) + { + pthread_mutex_unlock(&archive_mutex); + *rc= HA_ERR_OUT_OF_MEM; + DBUG_RETURN(NULL); + } + + share->use_count= 0; + share->table_name_length= length; + share->table_name= tmp_name; + share->crashed= FALSE; + fn_format(share->data_file_name,table_name,"",ARZ,MY_REPLACE_EXT|MY_UNPACK_FILENAME); + fn_format(meta_file_name,table_name,"",ARM,MY_REPLACE_EXT|MY_UNPACK_FILENAME); + strmov(share->table_name,table_name); + /* + We will use this lock for rows. + */ + VOID(pthread_mutex_init(&share->mutex,MY_MUTEX_INIT_FAST)); + if ((share->meta_file= my_open(meta_file_name, O_RDWR, MYF(0))) == -1) + share->crashed= TRUE; + + /* + After we read, we set the file to dirty. When we close, we will do the + opposite. If the meta file will not open we assume it is crashed and + leave it up to the user to fix. + */ + if (read_meta_file(share->meta_file, &share->rows_recorded, + &share->auto_increment_value, + &share->forced_flushes)) + share->crashed= TRUE; + else + (void)write_meta_file(share->meta_file, share->rows_recorded, + share->auto_increment_value, + share->forced_flushes, + TRUE); + /* + It is expensive to open and close the data files and since you can't have + a gzip file that can be both read and written we keep a writer open + that is shared amoung all open tables. + */ + if (!(azopen(&(share->archive_write), share->data_file_name, + O_WRONLY|O_APPEND|O_BINARY))) + { + DBUG_PRINT("info", ("Could not open archive write file")); + share->crashed= TRUE; + } + VOID(my_hash_insert(&archive_open_tables, (byte*) share)); + thr_lock_init(&share->lock); + } + share->use_count++; + DBUG_PRINT("info", ("archive table %.*s has %d open handles now", + share->table_name_length, share->table_name, + share->use_count)); + if (share->crashed) + *rc= HA_ERR_CRASHED_ON_USAGE; + pthread_mutex_unlock(&archive_mutex); + + DBUG_RETURN(share); +} + + +/* + Free the share. + See ha_example.cc for a description. +*/ +int ha_archive::free_share(ARCHIVE_SHARE *share) +{ + int rc= 0; + DBUG_ENTER("ha_archive::free_share"); + DBUG_PRINT("info", ("archive table %.*s has %d open handles on entrance", + share->table_name_length, share->table_name, + share->use_count)); + + pthread_mutex_lock(&archive_mutex); + if (!--share->use_count) + { + hash_delete(&archive_open_tables, (byte*) share); + thr_lock_delete(&share->lock); + VOID(pthread_mutex_destroy(&share->mutex)); + /* + We need to make sure we don't reset the crashed state. + If we open a crashed file, wee need to close it as crashed unless + it has been repaired. + Since we will close the data down after this, we go on and count + the flush on close; + */ + share->forced_flushes++; + (void)write_meta_file(share->meta_file, share->rows_recorded, + share->auto_increment_value, + share->forced_flushes, + share->crashed ? TRUE :FALSE); + if (azclose(&(share->archive_write))) + rc= 1; + if (my_close(share->meta_file, MYF(0))) + rc= 1; + my_free((gptr) share, MYF(0)); + } + pthread_mutex_unlock(&archive_mutex); + + DBUG_RETURN(rc); +} + + +/* + We just implement one additional file extension. +*/ +static const char *ha_archive_exts[] = { + ARZ, + ARM, + NullS +}; + +const char **ha_archive::bas_ext() const +{ + return ha_archive_exts; +} + + +/* + When opening a file we: + Create/get our shared structure. + Init out lock. + We open the file we will read from. +*/ +int ha_archive::open(const char *name, int mode, uint open_options) +{ + int rc= 0; + DBUG_ENTER("ha_archive::open"); + + DBUG_PRINT("info", ("archive table was opened for crash %s", + (open_options & HA_OPEN_FOR_REPAIR) ? "yes" : "no")); + share= get_share(name, table, &rc); + + if (rc == HA_ERR_CRASHED_ON_USAGE && !(open_options & HA_OPEN_FOR_REPAIR)) + { + free_share(share); + DBUG_RETURN(rc); + } + else if (rc == HA_ERR_OUT_OF_MEM) + { + DBUG_RETURN(rc); + } + + thr_lock_data_init(&share->lock,&lock,NULL); + + if (!(azopen(&archive, share->data_file_name, O_RDONLY|O_BINARY))) + { + if (errno == EROFS || errno == EACCES) + DBUG_RETURN(my_errno= errno); + DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE); + } + + DBUG_PRINT("info", ("archive table was crashed %s", + rc == HA_ERR_CRASHED_ON_USAGE ? "yes" : "no")); + if (rc == HA_ERR_CRASHED_ON_USAGE && open_options & HA_OPEN_FOR_REPAIR) + { + DBUG_RETURN(0); + } + else + DBUG_RETURN(rc); +} + + +/* + Closes the file. + + SYNOPSIS + close(); + + IMPLEMENTATION: + + We first close this storage engines file handle to the archive and + then remove our reference count to the table (and possibly free it + as well). + + RETURN + 0 ok + 1 Error +*/ + +int ha_archive::close(void) +{ + int rc= 0; + DBUG_ENTER("ha_archive::close"); + + /* First close stream */ + if (azclose(&archive)) + rc= 1; + /* then also close share */ + rc|= free_share(share); + + DBUG_RETURN(rc); +} + + +/* + We create our data file here. The format is pretty simple. + You can read about the format of the data file above. + Unlike other storage engines we do not "pack" our data. Since we + are about to do a general compression, packing would just be a waste of + CPU time. If the table has blobs they are written after the row in the order + of creation. +*/ + +int ha_archive::create(const char *name, TABLE *table_arg, + HA_CREATE_INFO *create_info) +{ + File create_file; // We use to create the datafile and the metafile + char name_buff[FN_REFLEN]; + int error; + DBUG_ENTER("ha_archive::create"); + + auto_increment_value= (create_info->auto_increment_value ? + create_info->auto_increment_value -1 : + (ulonglong) 0); + + if ((create_file= my_create(fn_format(name_buff,name,"",ARM, + MY_REPLACE_EXT|MY_UNPACK_FILENAME),0, + O_RDWR | O_TRUNC,MYF(MY_WME))) < 0) + { + error= my_errno; + goto error; + } + + for (uint key= 0; key < table_arg->s->keys; key++) + { + KEY *pos= table_arg->key_info+key; + KEY_PART_INFO *key_part= pos->key_part; + KEY_PART_INFO *key_part_end= key_part + pos->key_parts; + + for (; key_part != key_part_end; key_part++) + { + Field *field= key_part->field; + + if (!(field->flags & AUTO_INCREMENT_FLAG)) + { + error= -1; + goto error; + } + } + } + + write_meta_file(create_file, 0, auto_increment_value, 0, FALSE); + my_close(create_file,MYF(0)); + + /* + We reuse name_buff since it is available. + */ + if ((create_file= my_create(fn_format(name_buff,name,"",ARZ, + MY_REPLACE_EXT|MY_UNPACK_FILENAME),0, + O_RDWR | O_TRUNC,MYF(MY_WME))) < 0) + { + error= my_errno; + goto error; + } + if (!azdopen(&archive, create_file, O_WRONLY|O_BINARY)) + { + error= errno; + goto error2; + } + if (write_data_header(&archive)) + { + error= errno; + goto error3; + } + + if (azclose(&archive)) + { + error= errno; + goto error2; + } + + DBUG_RETURN(0); + +error3: + /* We already have an error, so ignore results of azclose. */ + (void)azclose(&archive); +error2: + my_close(create_file, MYF(0)); + delete_table(name); +error: + /* Return error number, if we got one */ + DBUG_RETURN(error ? error : -1); +} + +/* + This is where the actual row is written out. +*/ +int ha_archive::real_write_row(byte *buf, azio_stream *writer) +{ + my_off_t written; + uint *ptr, *end; + DBUG_ENTER("ha_archive::real_write_row"); + + written= azwrite(writer, buf, table->s->reclength); + DBUG_PRINT("ha_archive::real_write_row", ("Wrote %d bytes expected %d", + written, table->s->reclength)); + if (!delayed_insert || !bulk_insert) + share->dirty= TRUE; + + if (written != (my_off_t)table->s->reclength) + DBUG_RETURN(errno ? errno : -1); + /* + We should probably mark the table as damagaged if the record is written + but the blob fails. + */ + for (ptr= table->s->blob_field, end= ptr + table->s->blob_fields ; + ptr != end ; + ptr++) + { + char *data_ptr; + uint32 size= ((Field_blob*) table->field[*ptr])->get_length(); + + if (size) + { + ((Field_blob*) table->field[*ptr])->get_ptr(&data_ptr); + written= azwrite(writer, data_ptr, (unsigned)size); + if (written != (my_off_t)size) + DBUG_RETURN(errno ? errno : -1); + } + } + DBUG_RETURN(0); +} + + +/* + Look at ha_archive::open() for an explanation of the row format. + Here we just write out the row. + + Wondering about start_bulk_insert()? We don't implement it for + archive since it optimizes for lots of writes. The only save + for implementing start_bulk_insert() is that we could skip + setting dirty to true each time. +*/ +int ha_archive::write_row(byte *buf) +{ + int rc; + byte *read_buf= NULL; + ulonglong temp_auto; + DBUG_ENTER("ha_archive::write_row"); + + if (share->crashed) + DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE); + + 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); + + if (table->next_number_field) + { + KEY *mkey= &table->s->key_info[0]; // We only support one key right now + update_auto_increment(); + temp_auto= table->next_number_field->val_int(); + + /* + Bad news, this will cause a search for the unique value which is very + expensive since we will have to do a table scan which will lock up + all other writers during this period. This could perhaps be optimized + in the future. + */ + if (temp_auto == share->auto_increment_value && + mkey->flags & HA_NOSAME) + { + rc= HA_ERR_FOUND_DUPP_KEY; + goto error; + } + + if (temp_auto < share->auto_increment_value && + mkey->flags & HA_NOSAME) + { + /* + First we create a buffer that we can use for reading rows, and can pass + to get_row(). + */ + if (!(read_buf= (byte*) my_malloc(table->s->reclength, MYF(MY_WME)))) + { + rc= HA_ERR_OUT_OF_MEM; + goto error; + } + /* + All of the buffer must be written out or we won't see all of the + data + */ + azflush(&(share->archive_write), Z_SYNC_FLUSH); + share->forced_flushes++; + /* + Set the position of the local read thread to the beginning postion. + */ + if (read_data_header(&archive)) + { + rc= HA_ERR_CRASHED_ON_USAGE; + goto error; + } + + /* + Now we read and check all of the rows. + if (!memcmp(table->next_number_field->ptr, mfield->ptr, mfield->max_length())) + if ((longlong)temp_auto == + mfield->val_int((char*)(read_buf + mfield->offset()))) + */ + Field *mfield= table->next_number_field; + + while (!(get_row(&archive, read_buf))) + { + if (!memcmp(read_buf + mfield->offset(), table->next_number_field->ptr, + mfield->max_length())) + { + rc= HA_ERR_FOUND_DUPP_KEY; + goto error; + } + } + } + else + { + if (temp_auto > share->auto_increment_value) + auto_increment_value= share->auto_increment_value= temp_auto; + } + } + + /* + Notice that the global auto_increment has been increased. + In case of a failed row write, we will never try to reuse the value. + */ + + share->rows_recorded++; + rc= real_write_row(buf, &(share->archive_write)); +error: + pthread_mutex_unlock(&share->mutex); + if (read_buf) + my_free((gptr) read_buf, MYF(0)); + + DBUG_RETURN(rc); +} + + +ulonglong ha_archive::get_auto_increment() +{ + return share->auto_increment_value + 1; +} + +/* Initialized at each key walk (called multiple times unlike rnd_init()) */ +int ha_archive::index_init(uint keynr, bool sorted) +{ + DBUG_ENTER("ha_archive::index_init"); + active_index= keynr; + DBUG_RETURN(0); +} + + +/* + No indexes, so if we get a request for an index search since we tell + the optimizer that we have unique indexes, we scan +*/ +int ha_archive::index_read(byte *buf, const byte *key, + uint key_len, enum ha_rkey_function find_flag) +{ + int rc; + DBUG_ENTER("ha_archive::index_read"); + rc= index_read_idx(buf, active_index, key, key_len, find_flag); + DBUG_RETURN(rc); +} + + +int ha_archive::index_read_idx(byte *buf, uint index, const byte *key, + uint key_len, enum ha_rkey_function find_flag) +{ + int rc= 0; + bool found= 0; + KEY *mkey= &table->s->key_info[index]; + current_k_offset= mkey->key_part->offset; + current_key= key; + current_key_len= key_len; + + + DBUG_ENTER("ha_archive::index_read_idx"); + + /* + All of the buffer must be written out or we won't see all of the + data + */ + pthread_mutex_lock(&share->mutex); + azflush(&(share->archive_write), Z_SYNC_FLUSH); + share->forced_flushes++; + pthread_mutex_unlock(&share->mutex); + + /* + Set the position of the local read thread to the beginning postion. + */ + if (read_data_header(&archive)) + { + rc= HA_ERR_CRASHED_ON_USAGE; + goto error; + } + + while (!(get_row(&archive, buf))) + { + if (!memcmp(current_key, buf + current_k_offset, current_key_len)) + { + found= 1; + break; + } + } + + if (found) + DBUG_RETURN(0); + +error: + DBUG_RETURN(rc ? rc : HA_ERR_END_OF_FILE); +} + + +int ha_archive::index_next(byte * buf) +{ + bool found= 0; + + DBUG_ENTER("ha_archive::index_next"); + + while (!(get_row(&archive, buf))) + { + if (!memcmp(current_key, buf+current_k_offset, current_key_len)) + { + found= 1; + break; + } + } + + DBUG_RETURN(found ? 0 : HA_ERR_END_OF_FILE); +} + +/* + All calls that need to scan the table start with this method. If we are told + that it is a table scan we rewind the file to the beginning, otherwise + we assume the position will be set. +*/ + +int ha_archive::rnd_init(bool scan) +{ + DBUG_ENTER("ha_archive::rnd_init"); + + if (share->crashed) + DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE); + + /* We rewind the file so that we can read from the beginning if scan */ + if (scan) + { + scan_rows= share->rows_recorded; + DBUG_PRINT("info", ("archive will retrieve %llu rows", scan_rows)); + records= 0; + + /* + If dirty, we lock, and then reset/flush the data. + I found that just calling azflush() doesn't always work. + */ + if (share->dirty == TRUE) + { + pthread_mutex_lock(&share->mutex); + if (share->dirty == TRUE) + { + DBUG_PRINT("info", ("archive flushing out rows for scan")); + azflush(&(share->archive_write), Z_SYNC_FLUSH); + share->forced_flushes++; + share->dirty= FALSE; + } + pthread_mutex_unlock(&share->mutex); + } + + if (read_data_header(&archive)) + DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE); + } + + DBUG_RETURN(0); +} + + +/* + This is the method that is used to read a row. It assumes that the row is + positioned where you want it. +*/ +int ha_archive::get_row(azio_stream *file_to_read, byte *buf) +{ + int read; // Bytes read, azread() returns int + uint *ptr, *end; + char *last; + size_t total_blob_length= 0; + DBUG_ENTER("ha_archive::get_row"); + + read= azread(file_to_read, buf, table->s->reclength); + DBUG_PRINT("ha_archive::get_row", ("Read %d bytes expected %d", read, + table->s->reclength)); + + if (read == Z_STREAM_ERROR) + DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE); + + /* If we read nothing we are at the end of the file */ + if (read == 0) + DBUG_RETURN(HA_ERR_END_OF_FILE); + + /* + If the record is the wrong size, the file is probably damaged, unless + we are dealing with a delayed insert or a bulk insert. + */ + if ((ulong) read != table->s->reclength) + DBUG_RETURN(HA_ERR_END_OF_FILE); + + /* Calculate blob length, we use this for our buffer */ + for (ptr= table->s->blob_field, end=ptr + table->s->blob_fields ; + ptr != end ; + ptr++) + { + if (ha_get_bit_in_read_set(((Field_blob*) table->field[*ptr])->fieldnr)) + total_blob_length += ((Field_blob*) table->field[*ptr])->get_length(); + } + + /* Adjust our row buffer if we need be */ + buffer.alloc(total_blob_length); + last= (char *)buffer.ptr(); + + /* Loop through our blobs and read them */ + for (ptr= table->s->blob_field, end=ptr + table->s->blob_fields ; + ptr != end ; + ptr++) + { + size_t size= ((Field_blob*) table->field[*ptr])->get_length(); + if (size) + { + if (ha_get_bit_in_read_set(((Field_blob*) table->field[*ptr])->fieldnr)) + { + read= azread(file_to_read, last, size); + if ((size_t) read != size) + DBUG_RETURN(HA_ERR_END_OF_FILE); + ((Field_blob*) table->field[*ptr])->set_ptr(size, last); + last += size; + } + else + { + (void)azseek(file_to_read, size, SEEK_CUR); + } + } + } + DBUG_RETURN(0); +} + + +/* + Called during ORDER BY. Its position is either from being called sequentially + or by having had ha_archive::rnd_pos() called before it is called. +*/ + +int ha_archive::rnd_next(byte *buf) +{ + int rc; + DBUG_ENTER("ha_archive::rnd_next"); + + if (share->crashed) + DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE); + + if (!scan_rows) + DBUG_RETURN(HA_ERR_END_OF_FILE); + scan_rows--; + + ha_statistic_increment(&SSV::ha_read_rnd_next_count); + current_position= aztell(&archive); + rc= get_row(&archive, buf); + + + if (rc != HA_ERR_END_OF_FILE) + records++; + + DBUG_RETURN(rc); +} + + +/* + Thanks to the table flag HA_REC_NOT_IN_SEQ this will be called after + each call to ha_archive::rnd_next() if an ordering of the rows is + needed. +*/ + +void ha_archive::position(const byte *record) +{ + DBUG_ENTER("ha_archive::position"); + my_store_ptr(ref, ref_length, current_position); + DBUG_VOID_RETURN; +} + + +/* + This is called after a table scan for each row if the results of the + scan need to be ordered. It will take *pos and use it to move the + cursor in the file so that the next row that is called is the + correctly ordered row. +*/ + +int ha_archive::rnd_pos(byte * buf, byte *pos) +{ + DBUG_ENTER("ha_archive::rnd_pos"); + 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); + + DBUG_RETURN(get_row(&archive, buf)); +} + +/* + This method repairs the meta file. It does this by walking the datafile and + rewriting the meta file. Currently it does this by calling optimize with + the extended flag. +*/ +int ha_archive::repair(THD* thd, HA_CHECK_OPT* check_opt) +{ + DBUG_ENTER("ha_archive::repair"); + check_opt->flags= T_EXTEND; + int rc= optimize(thd, check_opt); + + if (rc) + DBUG_RETURN(HA_ERR_CRASHED_ON_REPAIR); + + share->crashed= FALSE; + DBUG_RETURN(0); +} + +/* + The table can become fragmented if data was inserted, read, and then + inserted again. What we do is open up the file and recompress it completely. +*/ +int ha_archive::optimize(THD* thd, HA_CHECK_OPT* check_opt) +{ + DBUG_ENTER("ha_archive::optimize"); + int rc; + azio_stream writer; + char writer_filename[FN_REFLEN]; + + /* Flush any waiting data */ + azflush(&(share->archive_write), Z_SYNC_FLUSH); + share->forced_flushes++; + + /* Lets create a file to contain the new data */ + fn_format(writer_filename, share->table_name, "", ARN, + MY_REPLACE_EXT|MY_UNPACK_FILENAME); + + if (!(azopen(&writer, writer_filename, O_CREAT|O_WRONLY|O_TRUNC|O_BINARY))) + DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE); + + /* + An extended rebuild is a lot more effort. We open up each row and re-record it. + Any dead rows are removed (aka rows that may have been partially recorded). + */ + + if (check_opt->flags == T_EXTEND) + { + DBUG_PRINT("info", ("archive extended rebuild")); + byte *buf; + + /* + First we create a buffer that we can use for reading rows, and can pass + to get_row(). + */ + if (!(buf= (byte*) my_malloc(table->s->reclength, MYF(MY_WME)))) + { + rc= HA_ERR_OUT_OF_MEM; + goto error; + } + + /* + Now we will rewind the archive file so that we are positioned at the + start of the file. + */ + rc= read_data_header(&archive); + + /* + Assuming now error from rewinding the archive file, we now write out the + new header for out data file. + */ + if (!rc) + rc= write_data_header(&writer); + + /* + On success of writing out the new header, we now fetch each row and + insert it into the new archive file. + */ + if (!rc) + { + share->rows_recorded= 0; + auto_increment_value= share->auto_increment_value= 0; + while (!(rc= get_row(&archive, buf))) + { + real_write_row(buf, &writer); + if (table->found_next_number_field) + { + Field *field= table->found_next_number_field; + ulonglong auto_value= + (ulonglong) field->val_int((char*)(buf + field->offset())); + if (share->auto_increment_value < auto_value) + auto_increment_value= share->auto_increment_value= + auto_value; + } + share->rows_recorded++; + } + } + DBUG_PRINT("info", ("recovered %llu archive rows", share->rows_recorded)); + + my_free((char*)buf, MYF(0)); + if (rc && rc != HA_ERR_END_OF_FILE) + goto error; + } + else + { + DBUG_PRINT("info", ("archive quick rebuild")); + /* + The quick method is to just read the data raw, and then compress it directly. + */ + int read; // Bytes read, azread() returns int + char block[IO_SIZE]; + if (azrewind(&archive) == -1) + { + rc= HA_ERR_CRASHED_ON_USAGE; + DBUG_PRINT("info", ("archive HA_ERR_CRASHED_ON_USAGE")); + goto error; + } + + while ((read= azread(&archive, block, IO_SIZE)) > 0) + azwrite(&writer, block, read); + } + + azclose(&writer); + share->dirty= FALSE; + share->forced_flushes= 0; + azclose(&(share->archive_write)); + DBUG_PRINT("info", ("Reopening archive data file")); + if (!(azopen(&(share->archive_write), share->data_file_name, + O_WRONLY|O_APPEND|O_BINARY))) + { + DBUG_PRINT("info", ("Could not open archive write file")); + rc= HA_ERR_CRASHED_ON_USAGE; + goto error; + } + + my_rename(writer_filename,share->data_file_name,MYF(0)); + + /* + Now we need to reopen our read descriptor since it has changed. + */ + azclose(&archive); + if (!(azopen(&archive, share->data_file_name, O_RDONLY|O_BINARY))) + { + rc= HA_ERR_CRASHED_ON_USAGE; + goto error; + } + + + DBUG_RETURN(0); + +error: + azclose(&writer); + + DBUG_RETURN(rc); +} + +/* + Below is an example of how to setup row level locking. +*/ +THR_LOCK_DATA **ha_archive::store_lock(THD *thd, + THR_LOCK_DATA **to, + enum thr_lock_type lock_type) +{ + if (lock_type == TL_WRITE_DELAYED) + delayed_insert= TRUE; + else + delayed_insert= FALSE; + + if (lock_type != TL_IGNORE && lock.type == TL_UNLOCK) + { + /* + Here is where we get into the guts of a row level lock. + If TL_UNLOCK is set + If we are not doing a LOCK TABLE or DISCARD/IMPORT + TABLESPACE, then allow multiple writers + */ + + if ((lock_type >= TL_WRITE_CONCURRENT_INSERT && + lock_type <= TL_WRITE) && !thd_in_lock_tables(thd) + && !thd_tablespace_op(thd)) + lock_type = TL_WRITE_ALLOW_WRITE; + + /* + In queries of type INSERT INTO t1 SELECT ... FROM t2 ... + MySQL would use the lock TL_READ_NO_INSERT on t2, and that + would conflict with TL_WRITE_ALLOW_WRITE, blocking all inserts + to t2. Convert the lock to a normal read lock to allow + concurrent inserts to t2. + */ + + if (lock_type == TL_READ_NO_INSERT && !thd_in_lock_tables(thd)) + lock_type = TL_READ; + + lock.type=lock_type; + } + + *to++= &lock; + + return to; +} + +void ha_archive::update_create_info(HA_CREATE_INFO *create_info) +{ + ha_archive::info(HA_STATUS_AUTO | HA_STATUS_CONST); + if (!(create_info->used_fields & HA_CREATE_USED_AUTO)) + { + create_info->auto_increment_value=auto_increment_value; + } +} + + +/* + Hints for optimizer, see ha_tina for more information +*/ +void ha_archive::info(uint flag) +{ + DBUG_ENTER("ha_archive::info"); + /* + This should be an accurate number now, though bulk and delayed inserts can + cause the number to be inaccurate. + */ + records= share->rows_recorded; + deleted= 0; + /* Costs quite a bit more to get all information */ + if (flag & HA_STATUS_TIME) + { + MY_STAT file_stat; // Stat information for the data file + + VOID(my_stat(share->data_file_name, &file_stat, MYF(MY_WME))); + + mean_rec_length= table->s->reclength + buffer.alloced_length(); + data_file_length= file_stat.st_size; + create_time= file_stat.st_ctime; + update_time= file_stat.st_mtime; + max_data_file_length= share->rows_recorded * mean_rec_length; + } + delete_length= 0; + index_file_length=0; + + if (flag & HA_STATUS_AUTO) + auto_increment_value= share->auto_increment_value; + + DBUG_VOID_RETURN; +} + + +/* + This method tells us that a bulk insert operation is about to occur. We set + a flag which will keep write_row from saying that its data is dirty. This in + turn will keep selects from causing a sync to occur. + Basically, yet another optimizations to keep compression working well. +*/ +void ha_archive::start_bulk_insert(ha_rows rows) +{ + DBUG_ENTER("ha_archive::start_bulk_insert"); + if (!rows || rows >= ARCHIVE_MIN_ROWS_TO_USE_BULK_INSERT) + bulk_insert= TRUE; + DBUG_VOID_RETURN; +} + + +/* + Other side of start_bulk_insert, is end_bulk_insert. Here we turn off the bulk insert + flag, and set the share dirty so that the next select will call sync for us. +*/ +int ha_archive::end_bulk_insert() +{ + DBUG_ENTER("ha_archive::end_bulk_insert"); + bulk_insert= FALSE; + share->dirty= TRUE; + DBUG_RETURN(0); +} + +/* + We cancel a truncate command. The only way to delete an archive table is to drop it. + This is done for security reasons. In a later version we will enable this by + allowing the user to select a different row format. +*/ +int ha_archive::delete_all_rows() +{ + DBUG_ENTER("ha_archive::delete_all_rows"); + DBUG_RETURN(0); +} + +/* + We just return state if asked. +*/ +bool ha_archive::is_crashed() const +{ + DBUG_ENTER("ha_archive::is_crashed"); + DBUG_RETURN(share->crashed); +} + +/* + Simple scan of the tables to make sure everything is ok. +*/ + +int ha_archive::check(THD* thd, HA_CHECK_OPT* check_opt) +{ + int rc= 0; + byte *buf; + const char *old_proc_info; + ha_rows count= share->rows_recorded; + DBUG_ENTER("ha_archive::check"); + + old_proc_info= thd_proc_info(thd, "Checking table"); + /* Flush any waiting data */ + azflush(&(share->archive_write), Z_SYNC_FLUSH); + share->forced_flushes++; + + /* + First we create a buffer that we can use for reading rows, and can pass + to get_row(). + */ + if (!(buf= (byte*) my_malloc(table->s->reclength, MYF(MY_WME)))) + rc= HA_ERR_OUT_OF_MEM; + + /* + Now we will rewind the archive file so that we are positioned at the + start of the file. + */ + if (!rc) + read_data_header(&archive); + + if (!rc) + while (!(rc= get_row(&archive, buf))) + count--; + + my_free((char*)buf, MYF(0)); + + thd_proc_info(thd, old_proc_info); + + if ((rc && rc != HA_ERR_END_OF_FILE) || count) + { + share->crashed= FALSE; + DBUG_RETURN(HA_ADMIN_CORRUPT); + } + else + { + DBUG_RETURN(HA_ADMIN_OK); + } +} + +/* + Check and repair the table if needed. +*/ +bool ha_archive::check_and_repair(THD *thd) +{ + HA_CHECK_OPT check_opt; + DBUG_ENTER("ha_archive::check_and_repair"); + + check_opt.init(); + + 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; diff --git a/storage/archive/ha_archive.h b/storage/archive/ha_archive.h new file mode 100644 index 00000000000..b64897ff046 --- /dev/null +++ b/storage/archive/ha_archive.h @@ -0,0 +1,136 @@ +/* Copyright (C) 2003 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifdef USE_PRAGMA_INTERFACE +#pragma interface /* gcc class implementation */ +#endif + +#include +#include "azlib.h" + +/* + Please read ha_archive.cc first. If you are looking for more general + answers on how storage engines work, look at ha_example.cc and + ha_example.h. +*/ + +typedef struct st_archive_share { + char *table_name; + char data_file_name[FN_REFLEN]; + uint table_name_length,use_count; + pthread_mutex_t mutex; + THR_LOCK lock; + File meta_file; /* Meta file we use */ + azio_stream archive_write; /* Archive file we are working with */ + bool dirty; /* Flag for if a flush should occur */ + bool crashed; /* Meta file is crashed */ + ha_rows rows_recorded; /* Number of rows in tables */ + ulonglong auto_increment_value; + ulonglong forced_flushes; + ulonglong mean_rec_length; +} ARCHIVE_SHARE; + +/* + Version for file format. + 1 - Initial Version +*/ +#define ARCHIVE_VERSION 2 + +class ha_archive: public handler +{ + THR_LOCK_DATA lock; /* MySQL lock */ + ARCHIVE_SHARE *share; /* Shared lock info */ + azio_stream archive; /* Archive file we are working with */ + my_off_t current_position; /* The position of the row we just read */ + byte byte_buffer[IO_SIZE]; /* Initial buffer for our string */ + String buffer; /* Buffer used for blob storage */ + ha_rows scan_rows; /* Number of rows left in scan */ + bool delayed_insert; /* If the insert is delayed */ + bool bulk_insert; /* If we are performing a bulk insert */ + const byte *current_key; + uint current_key_len; + uint current_k_offset; + +public: + ha_archive(TABLE_SHARE *table_arg); + ~ha_archive() + { + } + const char *table_type() const { return "ARCHIVE"; } + const char *index_type(uint inx) { return "NONE"; } + const char **bas_ext() const; + ulong table_flags() const + { + return (HA_REC_NOT_IN_SEQ | HA_NOT_EXACT_COUNT | HA_CAN_BIT_FIELD | + HA_FILE_BASED | HA_CAN_INSERT_DELAYED | HA_CAN_GEOMETRY); + } + ulong index_flags(uint idx, uint part, bool all_parts) const + { + return HA_ONLY_WHOLE_INDEX; + } + ulonglong get_auto_increment(); + uint max_supported_keys() const { return 1; } + uint max_supported_key_length() const { return sizeof(ulonglong); } + uint max_supported_key_part_length() const { return sizeof(ulonglong); } + int index_init(uint keynr, bool sorted); + virtual int index_read(byte * buf, const byte * key, + uint key_len, enum ha_rkey_function find_flag); + virtual int index_read_idx(byte * buf, uint index, const byte * key, + uint key_len, enum ha_rkey_function find_flag); + int index_next(byte * buf); + int open(const char *name, int mode, uint test_if_locked); + int close(void); + int write_row(byte * buf); + int real_write_row(byte *buf, azio_stream *writer); + int delete_all_rows(); + int rnd_init(bool scan=1); + int rnd_next(byte *buf); + int rnd_pos(byte * buf, byte *pos); + int get_row(azio_stream *file_to_read, byte *buf); + int read_meta_file(File meta_file, ha_rows *rows, + ulonglong *auto_increment, + ulonglong *forced_flushes); + int write_meta_file(File meta_file, ha_rows rows, + ulonglong auto_increment, + ulonglong forced_flushes, + bool dirty); + ARCHIVE_SHARE *get_share(const char *table_name, TABLE *table, int *rc); + int free_share(ARCHIVE_SHARE *share); + bool auto_repair() const { return 1; } // For the moment we just do this + int read_data_header(azio_stream *file_to_read); + int write_data_header(azio_stream *file_to_write); + void position(const byte *record); + void info(uint); + void update_create_info(HA_CREATE_INFO *create_info); + int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info); + int optimize(THD* thd, HA_CHECK_OPT* check_opt); + int repair(THD* thd, HA_CHECK_OPT* check_opt); + void start_bulk_insert(ha_rows rows); + int end_bulk_insert(); + enum row_type get_row_type() const + { + return ROW_TYPE_COMPRESSED; + } + THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to, + enum thr_lock_type lock_type); + bool is_crashed() const; + int check(THD* thd, HA_CHECK_OPT* check_opt); + bool check_and_repair(THD *thd); +}; + +bool archive_db_init(void); +int archive_db_end(ha_panic_function type); + diff --git a/storage/blackhole/Makefile.am b/storage/blackhole/Makefile.am new file mode 100644 index 00000000000..060eaffce66 --- /dev/null +++ b/storage/blackhole/Makefile.am @@ -0,0 +1,51 @@ +# Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +#called from the top level Makefile + +MYSQLDATAdir = $(localstatedir) +MYSQLSHAREdir = $(pkgdatadir) +MYSQLBASEdir= $(prefix) +MYSQLLIBdir= $(pkglibdir) +INCLUDES = -I$(top_srcdir)/include \ + -I$(top_srcdir)/regex \ + -I$(top_srcdir)/sql \ + -I$(srcdir) +WRAPLIBS= + +LDADD = + +DEFS = @DEFS@ + +noinst_HEADERS = ha_blackhole.h + +EXTRA_LTLIBRARIES = ha_blackhole.la +pkglib_LTLIBRARIES = @plugin_blackhole_shared_target@ +ha_blackhole_la_LDFLAGS=-module -rpath $(MYSQLLIBdir) +ha_blackhole_la_CXXFLAGS=$(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN +ha_blackhole_la_CFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN +ha_blackhole_la_SOURCES=ha_blackhole.cc + + +EXTRA_LIBRARIES = libblackhole.a +noinst_LIBRARIES = @plugin_blackhole_static_target@ +libblackhole_a_CXXFLAGS=$(AM_CFLAGS) +libblackhole_a_CFLAGS = $(AM_CFLAGS) +libblackhole_a_SOURCES= ha_blackhole.cc + + +# Don't update the files from bitkeeper +%::SCCS/s.% diff --git a/storage/blackhole/ha_blackhole.cc b/storage/blackhole/ha_blackhole.cc new file mode 100644 index 00000000000..31d0b0c3917 --- /dev/null +++ b/storage/blackhole/ha_blackhole.cc @@ -0,0 +1,266 @@ +/* Copyright (C) 2005 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + + +#ifdef USE_PRAGMA_IMPLEMENTATION +#pragma implementation // gcc: Class implementation +#endif + +#include "mysql_priv.h" +#include "ha_blackhole.h" + +#include + +/* Static declarations for handlerton */ + +static handler *blackhole_create_handler(TABLE_SHARE *table); + + +/* Blackhole storage engine handlerton */ + +handlerton blackhole_hton= { + MYSQL_HANDLERTON_INTERFACE_VERSION, + "BLACKHOLE", + SHOW_OPTION_YES, + "/dev/null storage engine (anything you write to it disappears)", + DB_TYPE_BLACKHOLE_DB, + NULL, + 0, /* slot */ + 0, /* savepoint size. */ + NULL, /* close_connection */ + NULL, /* savepoint */ + NULL, /* rollback to savepoint */ + NULL, /* release savepoint */ + NULL, /* commit */ + NULL, /* rollback */ + NULL, /* prepare */ + NULL, /* recover */ + NULL, /* commit_by_xid */ + NULL, /* rollback_by_xid */ + NULL, /* create_cursor_read_view */ + NULL, /* set_cursor_read_view */ + NULL, /* close_cursor_read_view */ + blackhole_create_handler, /* Create a new handler */ + NULL, /* Drop a database */ + NULL, /* Panic call */ + NULL, /* Start Consistent Snapshot */ + NULL, /* Flush logs */ + NULL, /* Show status */ + NULL, /* Partition flags */ + NULL, /* Alter table flags */ + NULL, /* Alter Tablespace */ + NULL, /* Fill FILES table */ + HTON_CAN_RECREATE, + NULL, /* binlog_func */ + NULL, /* binlog_log_query */ + NULL /* release_temporary_latches */ +}; + + +static handler *blackhole_create_handler(TABLE_SHARE *table) +{ + return new ha_blackhole(table); +} + + +/***************************************************************************** +** BLACKHOLE tables +*****************************************************************************/ + +ha_blackhole::ha_blackhole(TABLE_SHARE *table_arg) + :handler(&blackhole_hton, table_arg) +{} + + +static const char *ha_blackhole_exts[] = { + NullS +}; + +const char **ha_blackhole::bas_ext() const +{ + return ha_blackhole_exts; +} + +int ha_blackhole::open(const char *name, int mode, uint test_if_locked) +{ + DBUG_ENTER("ha_blackhole::open"); + thr_lock_init(&thr_lock); + thr_lock_data_init(&thr_lock,&lock,NULL); + DBUG_RETURN(0); +} + +int ha_blackhole::close(void) +{ + DBUG_ENTER("ha_blackhole::close"); + thr_lock_delete(&thr_lock); + DBUG_RETURN(0); +} + +int ha_blackhole::create(const char *name, TABLE *table_arg, + HA_CREATE_INFO *create_info) +{ + DBUG_ENTER("ha_blackhole::create"); + DBUG_RETURN(0); +} + +const char *ha_blackhole::index_type(uint key_number) +{ + DBUG_ENTER("ha_blackhole::index_type"); + DBUG_RETURN((table_share->key_info[key_number].flags & HA_FULLTEXT) ? + "FULLTEXT" : + (table_share->key_info[key_number].flags & HA_SPATIAL) ? + "SPATIAL" : + (table_share->key_info[key_number].algorithm == + HA_KEY_ALG_RTREE) ? "RTREE" : "BTREE"); +} + +int ha_blackhole::write_row(byte * buf) +{ + DBUG_ENTER("ha_blackhole::write_row"); + DBUG_RETURN(0); +} + +int ha_blackhole::rnd_init(bool scan) +{ + DBUG_ENTER("ha_blackhole::rnd_init"); + DBUG_RETURN(0); +} + + +int ha_blackhole::rnd_next(byte *buf) +{ + DBUG_ENTER("ha_blackhole::rnd_next"); + DBUG_RETURN(HA_ERR_END_OF_FILE); +} + + +int ha_blackhole::rnd_pos(byte * buf, byte *pos) +{ + DBUG_ENTER("ha_blackhole::rnd_pos"); + DBUG_ASSERT(0); + DBUG_RETURN(0); +} + + +void ha_blackhole::position(const byte *record) +{ + DBUG_ENTER("ha_blackhole::position"); + DBUG_ASSERT(0); + DBUG_VOID_RETURN; +} + + +void ha_blackhole::info(uint flag) +{ + DBUG_ENTER("ha_blackhole::info"); + + records= 0; + deleted= 0; + errkey= 0; + mean_rec_length= 0; + data_file_length= 0; + index_file_length= 0; + max_data_file_length= 0; + delete_length= 0; + if (flag & HA_STATUS_AUTO) + auto_increment_value= 1; + DBUG_VOID_RETURN; +} + +int ha_blackhole::external_lock(THD *thd, int lock_type) +{ + DBUG_ENTER("ha_blackhole::external_lock"); + DBUG_RETURN(0); +} + + +uint ha_blackhole::lock_count(void) const +{ + DBUG_ENTER("ha_blackhole::lock_count"); + DBUG_RETURN(0); +} + +THR_LOCK_DATA **ha_blackhole::store_lock(THD *thd, + THR_LOCK_DATA **to, + enum thr_lock_type lock_type) +{ + DBUG_ENTER("ha_blackhole::store_lock"); + DBUG_RETURN(to); +} + + +int ha_blackhole::index_read(byte * buf, const byte * key, + uint key_len, enum ha_rkey_function find_flag) +{ + DBUG_ENTER("ha_blackhole::index_read"); + DBUG_RETURN(0); +} + + +int ha_blackhole::index_read_idx(byte * buf, uint idx, const byte * key, + uint key_len, enum ha_rkey_function find_flag) +{ + DBUG_ENTER("ha_blackhole::index_read_idx"); + DBUG_RETURN(HA_ERR_END_OF_FILE); +} + + +int ha_blackhole::index_read_last(byte * buf, const byte * key, uint key_len) +{ + DBUG_ENTER("ha_blackhole::index_read_last"); + DBUG_RETURN(HA_ERR_END_OF_FILE); +} + + +int ha_blackhole::index_next(byte * buf) +{ + DBUG_ENTER("ha_blackhole::index_next"); + DBUG_RETURN(HA_ERR_END_OF_FILE); +} + + +int ha_blackhole::index_prev(byte * buf) +{ + DBUG_ENTER("ha_blackhole::index_prev"); + DBUG_RETURN(HA_ERR_END_OF_FILE); +} + + +int ha_blackhole::index_first(byte * buf) +{ + DBUG_ENTER("ha_blackhole::index_first"); + DBUG_RETURN(HA_ERR_END_OF_FILE); +} + + +int ha_blackhole::index_last(byte * buf) +{ + DBUG_ENTER("ha_blackhole::index_last"); + 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; diff --git a/storage/blackhole/ha_blackhole.h b/storage/blackhole/ha_blackhole.h new file mode 100644 index 00000000000..15e12659aa0 --- /dev/null +++ b/storage/blackhole/ha_blackhole.h @@ -0,0 +1,88 @@ +/* Copyright (C) 2005 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifdef USE_PRAGMA_INTERFACE +#pragma interface /* gcc class implementation */ +#endif + +/* + Class definition for the blackhole storage engine + "Dumbest named feature ever" +*/ +class ha_blackhole: public handler +{ + THR_LOCK_DATA lock; /* MySQL lock */ + THR_LOCK thr_lock; + +public: + ha_blackhole(TABLE_SHARE *table_arg); + ~ha_blackhole() + { + } + /* The name that will be used for display purposes */ + const char *table_type() const { return "BLACKHOLE"; } + /* + The name of the index type that will be used for display + don't implement this method unless you really have indexes + */ + const char *index_type(uint key_number); + const char **bas_ext() const; + ulong table_flags() const + { + return(HA_NULL_IN_KEY | HA_CAN_FULLTEXT | HA_CAN_SQL_HANDLER | + HA_DUPP_POS | HA_CAN_INDEX_BLOBS | HA_AUTO_PART_KEY | + HA_FILE_BASED | HA_CAN_GEOMETRY | HA_READ_RND_SAME | + HA_CAN_INSERT_DELAYED); + } + ulong index_flags(uint inx, uint part, bool all_parts) const + { + return ((table_share->key_info[inx].algorithm == HA_KEY_ALG_FULLTEXT) ? + 0 : HA_READ_NEXT | HA_READ_PREV | HA_READ_RANGE | + HA_READ_ORDER | HA_KEYREAD_ONLY); + } + /* The following defines can be increased if necessary */ +#define BLACKHOLE_MAX_KEY 64 /* Max allowed keys */ +#define BLACKHOLE_MAX_KEY_SEG 16 /* Max segments for key */ +#define BLACKHOLE_MAX_KEY_LENGTH 1000 + uint max_supported_keys() const { return BLACKHOLE_MAX_KEY; } + uint max_supported_key_length() const { return BLACKHOLE_MAX_KEY_LENGTH; } + uint max_supported_key_part_length() const { return BLACKHOLE_MAX_KEY_LENGTH; } + int open(const char *name, int mode, uint test_if_locked); + int close(void); + int write_row(byte * buf); + int rnd_init(bool scan); + int rnd_next(byte *buf); + int rnd_pos(byte * buf, byte *pos); + int index_read(byte * buf, const byte * key, + uint key_len, enum ha_rkey_function find_flag); + int index_read_idx(byte * buf, uint idx, const byte * key, + uint key_len, enum ha_rkey_function find_flag); + int index_read_last(byte * buf, const byte * key, uint key_len); + int index_next(byte * buf); + int index_prev(byte * buf); + int index_first(byte * buf); + int index_last(byte * buf); + void position(const byte *record); + void info(uint flag); + int external_lock(THD *thd, int lock_type); + uint lock_count(void) const; + int create(const char *name, TABLE *table_arg, + HA_CREATE_INFO *create_info); + THR_LOCK_DATA **store_lock(THD *thd, + THR_LOCK_DATA **to, + enum thr_lock_type lock_type); + bool has_transactions() { return 1; } +}; diff --git a/storage/csv/Makefile.am b/storage/csv/Makefile.am index 5573df720a3..0d3fd654745 100644 --- a/storage/csv/Makefile.am +++ b/storage/csv/Makefile.am @@ -25,15 +25,20 @@ INCLUDES = -I$(top_builddir)/include \ -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 = @plugin_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 = @plugin_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 diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc index aed861279d9..8b1cfe71fa2 100644 --- a/storage/csv/ha_tina.cc +++ b/storage/csv/ha_tina.cc @@ -1398,8 +1398,8 @@ bool ha_tina::check_if_incompatible_data(HA_CREATE_INFO *info, return COMPATIBLE_DATA_YES; } -#ifdef MYSQL_PLUGIN -mysql_declare_plugin + +mysql_declare_plugin(csv) { MYSQL_STORAGE_ENGINE_PLUGIN, &tina_hton, @@ -1411,4 +1411,4 @@ mysql_declare_plugin 0x0100 /* 1.0 */, } mysql_declare_plugin_end; -#endif + diff --git a/storage/example/Makefile.am b/storage/example/Makefile.am index 518d82abe2d..5565c5e85fc 100644 --- a/storage/example/Makefile.am +++ b/storage/example/Makefile.am @@ -1,15 +1,15 @@ # Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB -# +# # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -26,14 +26,26 @@ INCLUDES = -I$(top_srcdir)/include \ -I$(srcdir) WRAPLIBS= -pkglib_LIBRARIES = libexample.a - -noinst_HEADERS = ha_example.h -libexample_a_SOURCES = ha_example.cc -EXTRA_DIST = cmakelists.txt LDADD = -DEFS = -DMYSQL_SERVER @DEFS@ +DEFS = @DEFS@ + +noinst_HEADERS = ha_example.h + +EXTRA_LTLIBRARIES = ha_example.la +pkglib_LTLIBRARIES = @plugin_example_shared_target@ +ha_example_la_LDFLAGS = -module -rpath $(MYSQLLIBdir) +ha_example_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN +ha_example_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN +ha_example_la_SOURCES = ha_example.cc + + +EXTRA_LIBRARIES = libexample.a +noinst_LIBRARIES = @plugin_example_static_target@ +libexample_a_CXXFLAGS = $(AM_CFLAGS) +libexample_a_CFLAGS = $(AM_CFLAGS) +libexample_a_SOURCES= ha_example.cc + # Don't update the files from bitkeeper %::SCCS/s.% diff --git a/storage/example/ha_example.cc b/storage/example/ha_example.cc index 433fc3e78e0..a8c5c63606f 100644 --- a/storage/example/ha_example.cc +++ b/storage/example/ha_example.cc @@ -726,8 +726,8 @@ int ha_example::create(const char *name, TABLE *table_arg, DBUG_RETURN(0); } -#ifdef MYSQL_PLUGIN -mysql_declare_plugin + +mysql_declare_plugin(example) { MYSQL_STORAGE_ENGINE_PLUGIN, &example_hton, @@ -739,4 +739,4 @@ mysql_declare_plugin 0x0001 /* 0.1 */, } mysql_declare_plugin_end; -#endif + diff --git a/storage/innobase/Makefile.am b/storage/innobase/Makefile.am index 22796b45882..8504d587e09 100644 --- a/storage/innobase/Makefile.am +++ b/storage/innobase/Makefile.am @@ -79,5 +79,34 @@ EXTRA_DIST = include/btr0btr.h include/btr0btr.ic include/btr0cur.h include/btr include/ut0sort.h include/ut0ut.h include/ut0ut.ic \ cmakelists.txt +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.% -- cgit v1.2.1 From 35166137f087b79686e2b7411a89054ae8b53139 Mon Sep 17 00:00:00 2001 From: "acurtis@xiphis.org" <> Date: Thu, 20 Apr 2006 10:03:15 -0700 Subject: WL#3201 Fixes after first review --- config/ac-macros/ha_ndbcluster.m4 | 2 - config/ac-macros/plugins.m4 | 194 +++++++++++++++++++++++++------------- configure.in | 6 +- sql/ha_partition.cc | 2 +- sql/handler.cc | 3 + 5 files changed, 134 insertions(+), 73 deletions(-) diff --git a/config/ac-macros/ha_ndbcluster.m4 b/config/ac-macros/ha_ndbcluster.m4 index 1358807e000..c7e163e065f 100644 --- a/config/ac-macros/ha_ndbcluster.m4 +++ b/config/ac-macros/ha_ndbcluster.m4 @@ -307,9 +307,7 @@ 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 diff --git a/config/ac-macros/plugins.m4 b/config/ac-macros/plugins.m4 index 5969a85dc14..20d7e2cc11c 100644 --- a/config/ac-macros/plugins.m4 +++ b/config/ac-macros/plugins.m4 @@ -36,8 +36,8 @@ AC_DEFUN([_MYSQL_MODULE],[ dnl ],[ dnl m4_define([$2], [$1]) dnl _MYSQL_PLUGAPPEND([__mysql_plugin_list__],[$1]) dnl - AC_DEFUN([MYSQL_MODULE_NAME_]AS_TR_CPP([$1]), [$3]) dnl - AC_DEFUN([MYSQL_MODULE_DESC_]AS_TR_CPP([$1]), [$4]) dnl + m4_define([MYSQL_MODULE_NAME_]AS_TR_CPP([$1]), [$3]) dnl + m4_define([MYSQL_MODULE_DESC_]AS_TR_CPP([$1]), [$4]) dnl ifelse([$5], [], [], [ dnl _MYSQL_PLUGAPPEND_OPTS([$1], $5) dnl ]) dnl @@ -78,7 +78,7 @@ dnl --------------------------------------------------------------------------- AC_DEFUN([MYSQL_MODULE_DEFINE],[ dnl REQUIRE_PLUGIN([$1]) dnl - AC_DEFUN([MYSQL_MODULE_DEFINE_]AS_TR_CPP([$1]), [$2]) dnl + m4_define([MYSQL_MODULE_DEFINE_]AS_TR_CPP([$1]), [$2]) dnl ]) @@ -92,7 +92,7 @@ dnl --------------------------------------------------------------------------- AC_DEFUN([MYSQL_MODULE_DIRECTORY],[ dnl REQUIRE_PLUGIN([$1]) dnl - AC_DEFUN([MYSQL_MODULE_DIRECTORY_]AS_TR_CPP([$1]), [$2]) dnl + m4_define([MYSQL_MODULE_DIRECTORY_]AS_TR_CPP([$1]), [$2]) dnl ]) @@ -106,7 +106,7 @@ dnl --------------------------------------------------------------------------- AC_DEFUN([MYSQL_MODULE_STATIC],[ dnl REQUIRE_PLUGIN([$1]) dnl - AC_DEFUN([MYSQL_MODULE_STATIC_]AS_TR_CPP([$1]), [$2]) dnl + m4_define([MYSQL_MODULE_STATIC_]AS_TR_CPP([$1]), [$2]) dnl ]) @@ -120,7 +120,7 @@ dnl --------------------------------------------------------------------------- AC_DEFUN([MYSQL_MODULE_DYNAMIC],[ dnl REQUIRE_PLUGIN([$1]) dnl - AC_DEFUN([MYSQL_MODULE_DYNAMIC_]AS_TR_CPP([$1]), [$2]) dnl + m4_define([MYSQL_MODULE_DYNAMIC_]AS_TR_CPP([$1]), [$2]) dnl ]) @@ -216,7 +216,7 @@ AC_DEFUN([MYSQL_MODULE_ACTIONS],[ dnl m4_ifdef([$2],[ dnl m4_define([MYSQL_MODULE_ACTIONS_]AS_TR_CPP([$1]),m4_defn([$2])) dnl ],[ dnl - AC_DEFUN([MYSQL_MODULE_ACTIONS_]AS_TR_CPP([$1]), [$2]) dnl + m4_define([MYSQL_MODULE_ACTIONS_]AS_TR_CPP([$1]), [$2]) dnl ]) ]) @@ -235,8 +235,9 @@ AC_DEFUN([MYSQL_CONFIGURE_PLUGINS],[ dnl ],[ dnl m4_define([__mysql_plugin_configured__],[done]) dnl m4_ifdef([__mysql_plugin_list__],[ dnl - _MYSQL_CHECK_PLUGIN_ARGS([none]) + _MYSQL_CHECK_PLUGIN_ARGS([$1]) _MYSQL_CONFIGURE_PLUGINS(m4_bpatsubst(__mysql_plugin_list__, :, [,])) + _MYSQL_DO_PLUGIN_ACTIONS(m4_bpatsubst(__mysql_plugin_list__, :, [,])) ]) dnl ]) dnl ]) @@ -272,32 +273,33 @@ AC_DEFUN([_DO_MYSQL_CHECK_PLUGIN],[ dnl ]) AC_MSG_CHECKING([whether to use ]$3) dnl m4_ifdef([$10],[ - if test "[$mysql_module_]m4_bpatsubst([$1], -, _)" == "yes" -a \ - "[$with_module_]m4_bpatsubst([$1], -, _)" != "no" -o \ - "[$with_module_]m4_bpatsubst([$1], -, _)" == "yes"; then + if test "[$mysql_module_]m4_bpatsubst([$1], -, _)" = yes -a \ + "[$with_module_]m4_bpatsubst([$1], -, _)" != no -o \ + "[$with_module_]m4_bpatsubst([$1], -, _)" = yes; then AC_MSG_ERROR([disabled]) fi AC_MSG_RESULT([no]) dnl ],[ dnl m4_ifdef([$9],[ - if test "[$with_module_]m4_bpatsubst([$1], -, _)" == "no"; then + if test "[$with_module_]m4_bpatsubst([$1], -, _)" = no; then AC_MSG_ERROR([cannot disable mandatory module]) fi - [mysql_module_]m4_bpatsubst([$1], -, _)="yes" dnl + [mysql_module_]m4_bpatsubst([$1], -, _)=yes dnl ]) - if test "[$with_module_]m4_bpatsubst([$1], -, _)" != "no"; then - if test "[$mysql_module_]m4_bpatsubst([$1], -, _)" != "yes" -a \ - "[$with_module_]m4_bpatsubst([$1], -, _)" != "yes"; then dnl + if test "[$with_module_]m4_bpatsubst([$1], -, _)" != no; then + if test "[$mysql_module_]m4_bpatsubst([$1], -, _)" != yes -a \ + "[$with_module_]m4_bpatsubst([$1], -, _)" != yes; then dnl m4_ifdef([$8],[ dnl m4_ifdef([$6],[ mysql_plugin_dirs="$mysql_plugin_dirs $6" dnl ]) AC_SUBST([plugin_]m4_bpatsubst([$1], -, _)[_shared_target], "$8") AC_SUBST([plugin_]m4_bpatsubst([$1], -, _)[_static_target], [""]) - [with_module_]m4_bpatsubst([$1], -, _)="yes" dnl + [with_module_]m4_bpatsubst([$1], -, _)=yes + AC_MSG_RESULT([plugin]) dnl ],[ - AC_MSG_RESULT([cannot build dynamically]) - [with_module_]m4_bpatsubst([$1], -, _)="no" dnl + [with_module_]m4_bpatsubst([$1], -, _)=no + AC_MSG_RESULT([no]) dnl ]) else dnl m4_ifdef([$7],[ @@ -338,19 +340,47 @@ AC_DEFUN([_DO_MYSQL_CHECK_PLUGIN],[ dnl ]) dnl ]) mysql_plugin_defs="$mysql_plugin_defs, [builtin_]m4_bpatsubst([$2], -, _)" - [with_module_]m4_bpatsubst([$1], -, _)="yes" + [with_module_]m4_bpatsubst([$1], -, _)=yes + AC_MSG_RESULT([yes]) fi else AC_MSG_RESULT([no]) - fi + fi dnl + ]) dnl +]) - if test "[$with_module_]m4_bpatsubst([$1], -, _)" == "yes"; then - if test "[$plugin_]m4_bpatsubst([$1], -, _)[_static_target]" != ""; then - AC_MSG_RESULT([static]) - elif test "[$plugin_]m4_bpatsubst([$1], -, _)[_shared_target]" != ""; then - AC_MSG_RESULT([plugin]) - else - AC_MSG_ERROR([thats strange]) +AC_DEFUN([_MYSQL_DO_PLUGIN_ACTIONS],[ dnl + ifelse($#, 0, [], $#, 1, [ dnl + _MYSQL_PLUGIN_ACTIONS([$1]) dnl + ],[ dnl + _MYSQL_PLUGIN_ACTIONS([$1]) dnl + _MYSQL_DO_PLUGIN_ACTIONS(m4_shift($@)) dnl + ]) +]) + +AC_DEFUN([_MYSQL_PLUGIN_ACTIONS],[ dnl + _DO_MYSQL_PLUGIN_ACTIONS( + [$1], + [$1-plugin], + [MYSQL_MODULE_NAME_]AS_TR_CPP([$1]), + [MYSQL_MODULE_DESC_]AS_TR_CPP([$1]), + [MYSQL_MODULE_DEFINE_]AS_TR_CPP([$1]), + [MYSQL_MODULE_DIRECTORY_]AS_TR_CPP([$1]), + [MYSQL_MODULE_STATIC_]AS_TR_CPP([$1]), + [MYSQL_MODULE_DYNAMIC_]AS_TR_CPP([$1]), + [MYSQL_MODULE_MANDATORY_]AS_TR_CPP([$1]), + [MYSQL_MODULE_DISABLED_]AS_TR_CPP([$1]), + [MYSQL_MODULE_ACTIONS_]AS_TR_CPP([$1]) + ) dnl +]) + + +AC_DEFUN([_DO_MYSQL_PLUGIN_ACTIONS],[ dnl + m4_ifdef([$10], [], [ + if test "[$with_module_]m4_bpatsubst([$1], -, _)" = yes; then + if test -z "[$plugin_]m4_bpatsubst([$1], -, _)[_static_target]" -a \ + -z "[$plugin_]m4_bpatsubst([$1], -, _)[_shared_target]"; then + AC_MSG_ERROR([thats strange, $1 failed sanity check]) fi $11 fi dnl @@ -390,12 +420,13 @@ _MYSQL_MODULE_META_CHECK(m4_shift($@))]) dnl ]) AC_DEFUN([_MYSQL_CHECK_PLUGIN_META], [ - elif test "$mysql_modules" == "[$1]"; then dnl + [$1] ) dnl m4_ifdef([$2], [ - mysql_modules="m4_bpatsubst($2, :, [,])" dnl + mysql_modules='m4_bpatsubst($2, :, [ ])' dnl ],[ - mysql_modules="" dnl -]) dnl + mysql_modules='' dnl +]) + ;; dnl ]) @@ -410,7 +441,7 @@ AC_DEFUN([_MYSQL_PLUGAPPEND],[ dnl m4_undefine([__plugin_append_tmp__]) dnl ],[ dnl m4_define([$1], [$2]) dnl - $3 + $3 dnl ]) dnl ]) @@ -510,13 +541,30 @@ AC_DEFUN([_MYSQL_MODULE_ARGS_CHECK],[ dnl ]) AC_DEFUN([_MYSQL_CHECK_PLUGIN_ARG],[ dnl -m4_ifdef([$3], [], [AC_DEFUN([$3],[ ])]) - elif test "$plugin" == "[$1]"; then dnl -m4_ifdef([$2],[ + m4_ifdef([$3], [], [m4_define([$3],[ ])]) + [$1] ) dnl + m4_ifdef([$2],[ AC_MSG_ERROR([plugin $1 is disabled]) dnl -],[ - [mysql_module_]m4_bpatsubst([$1], -, _)="yes" dnl -]) dnl + ],[ + [mysql_module_]m4_bpatsubst([$1], -, _)=yes dnl + ]) + ;; dnl +]) + +AC_DEFUN([_MYSQL_SANE_VARS], [ dnl + ifelse($#, 0, [], $#, 1, [ dnl + _MYSQL_SANEVAR([$1]) dnl + ],[ dnl + _MYSQL_SANEVAR([$1]) dnl + _MYSQL_SANE_VARS(m4_shift($@)) dnl + ]) dnl +]) + +AC_DEFUN([_MYSQL_SANEVAR], [ + test -z "[$mysql_module_]m4_bpatsubst([$1], -, _)" && dnl +[mysql_module_]m4_bpatsubst([$1], -, _)='.' + test -z "[$with_module_]m4_bpatsubst([$1], -, _)" && dnl +[with_module_]m4_bpatsubst([$1], -, _)='.' dnl ]) AC_DEFUN([_MYSQL_CHECK_DEPENDENCIES], [ dnl @@ -530,32 +578,35 @@ AC_DEFUN([_MYSQL_CHECK_DEPENDENCIES], [ dnl AC_DEFUN([_MYSQL_CHECK_DEPENDS], [ dnl m4_ifdef([$2], [ - if test "[$mysql_module_]m4_bpatsubst([$1], -, _)" == "yes" -a \ - "[$with_module_]m4_bpatsubst([$1], -, _)" != "no" -o \ - "[$with_module_]m4_bpatsubst([$1], -, _)" == "yes"; then dnl + if test "[$mysql_module_]m4_bpatsubst([$1], -, _)" = yes -a \ + "[$with_module_]m4_bpatsubst([$1], -, _)" != no -o \ + "[$with_module_]m4_bpatsubst([$1], -, _)" = yes; then dnl _MYSQL_GEN_DEPENDS(m4_bpatsubst($2, :, [,])) - fi + fi dnl ]) dnl ]) AC_DEFUN([_MYSQL_GEN_DEPENDS], [ dnl - ifelse($#, 0, [], $#, 1, [ - [mysql_module_]m4_bpatsubst([$1], -, _)="yes" - if test "[$with_module_]m4_bpatsubst([$1], -, _)" == "no"; then - AC_MSG_ERROR([depends upon disabled module $1]) - fi dnl + ifelse($#, 0, [], $#, 1, [ dnl + _MYSQL_GEN_DEPEND([$1]) dnl + ],[ dnl + _MYSQL_GEN_DEPEND([$1]) dnl + _MYSQL_GEN_DEPENDS(m4_shift($@)) dnl + ]) dnl +]) + +AC_DEFUN([_MYSQL_GEN_DEPEND], [ dnl + m4_ifdef([MYSQL_MODULE_DISABLED_]AS_TR_CPP([$1]),[ + AC_MSG_ERROR([depends upon disabled module $1]) dnl ],[ - [mysql_module_]m4_bpatsubst([$1], -, _)="yes" - if test "[$with_module_]m4_bpatsubst([$1], -, _)" == "no"; then + [mysql_module_]m4_bpatsubst([$1], -, _)=yes + if test "[$with_module_]m4_bpatsubst([$1], -, _)" = no; then AC_MSG_ERROR([depends upon disabled module $1]) fi dnl - _MYSQL_GEN_DEPENDS(m4_shift($@)) dnl ]) dnl ]) - AC_DEFUN([_MYSQL_CHECK_PLUGIN_ARGS],[ - AC_ARG_WITH([modules], [ --with-modules=PLUGIN[[,PLUGIN..]] m4_text_wrap([Plugin modules to include in mysqld. (default is: $1) @@ -570,32 +621,43 @@ m4_bpatsubst(__mysql_plugin_list__, :, [ ])[.], [ ]) --without-module-PLUGIN m4_text_wrap([Disable the named module from being built. Otherwise, for modules which are not selected for inclusion in mysqld will be -built dynamically (if supported)],[ ])], -[mysql_modules="$withval"], [mysql_modules=['$1']]) +built dynamically (if supported)],[ ]) +],[mysql_modules="`echo $withval | tr ',.:;*[]' ' '`"], + [mysql_modules=['$1']]) m4_divert_once([HELP_VAR_END],[ Description of plugin modules: m4_indir([MYSQL_LIST_PLUGINS]) ]) - if test "$mysql_modules" == "all"; then - mysql_modules="m4_bpatsubst(__mysql_plugin_list__, :, [,])" - elif test "$mysql_modules" == "none"; then - mysql_modules="" dnl + case "$mysql_modules" in + all ) + mysql_modules='m4_bpatsubst(__mysql_plugin_list__, :, [ ])' + ;; + none ) + mysql_modules='' + ;; dnl m4_ifdef([__mysql_metaplugin_list__],[ dnl _MYSQL_MODULE_META_CHECK(m4_bpatsubst(__mysql_metaplugin_list__, :, [,])) dnl ]) - fi + esac - for plugin in `echo $mysql_modules | tr ",.:;" " "`; do - if test "$plugin" == "all" -o "$plugin" == "none"; then - AC_MSG_ERROR([bad module name: $plugin]) dnl + for plugin in $mysql_modules; do + case "$plugin" in + all ) + AC_MSG_ERROR([bad module name: $plugin]) + ;; + none ) + AC_MSG_ERROR([bad module name: $plugin]) + ;; dnl _MYSQL_MODULE_ARGS_CHECK(m4_bpatsubst(__mysql_plugin_list__, :, [,])) - else + * ) AC_MSG_ERROR([unknown plugin module: $plugin]) - fi + ;; + esac done - + + _MYSQL_SANE_VARS(m4_bpatsubst(__mysql_plugin_list__, :, [,])) _MYSQL_CHECK_DEPENDENCIES(m4_bpatsubst(__mysql_plugin_list__, :, [,])) ]) diff --git a/configure.in b/configure.in index 70d36ee84f5..0e4ea0422c3 100644 --- a/configure.in +++ b/configure.in @@ -123,8 +123,8 @@ MYSQL_MODULE_DIRECTORY(ndbcluster,[storage/ndb]) MYSQL_MODULE_STATIC(ndbcluster, [[\$(ndbcluster_libs) \$(ndbcluster_system_libs) \$(NDB_SCI_LIBS)]]) MYSQL_MODULE_ACTIONS(ndbcluster,[MYSQL_SETUP_NDBCLUSTER]) -MYSQL_STORAGE_ENGINE(partition, partition, [Partition Engine], - [MySQL Table Partitioning Engine], [max,max-no-ndb]) +MYSQL_STORAGE_ENGINE(partition, partition, [Partition Support], + [MySQL Partitioning Support], [max,max-no-ndb]) MYSQL_MODULE_MANDATORY(csv) dnl Used for logging MYSQL_MODULE_MANDATORY(heap) dnl Memory tables @@ -2624,8 +2624,6 @@ 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 dnl diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index fc9985cf87f..25b4b8f09f0 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -5498,7 +5498,7 @@ mysql_declare_plugin(partition) &partition_hton, partition_hton.name, "Mikael Ronstrom, MySQL AB", - "Partitioning Engine", + "Partitioning Support", NULL, /* Plugin Init */ NULL, /* Plugin Deinit */ 0x0100 /* 1.0 */, diff --git a/sql/handler.cc b/sql/handler.cc index 56938f2eff7..bf84ec16ea8 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -44,6 +44,9 @@ #include "ha_innodb.h" #endif +/* While we have legacy_db_type, we have this array to + check for dups and to find handlerton from legacy_db_type. + Remove when legacy_db_type is finally gone */ static handlerton *installed_htons[128]; #define BITMAP_STACKBUF_SIZE (128/8) -- cgit v1.2.1 From bdbb4afc6cd249ea362cd4f4ff9ad9e6881da719 Mon Sep 17 00:00:00 2001 From: "acurtis@xiphis.org" <> Date: Thu, 20 Apr 2006 10:37:37 -0700 Subject: WL#3201 cmake changes --- cmakelists.txt | 49 +++++++++++++++++++++------------------- sql/cmakelists.txt | 13 ++++++++--- storage/archive/cmakelists.txt | 2 +- storage/blackhole/cmakelists.txt | 5 ++++ 4 files changed, 42 insertions(+), 27 deletions(-) create mode 100644 storage/blackhole/cmakelists.txt diff --git a/cmakelists.txt b/cmakelists.txt index 0e91f49be90..28d75c62c41 100644 --- a/cmakelists.txt +++ b/cmakelists.txt @@ -9,52 +9,49 @@ SET(WITH_CSV_STORAGE_ENGINE TRUE) CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/include/mysql_version.h.in ${CMAKE_SOURCE_DIR}/include/mysql_version.h @ONLY) +SET(WITH_HEAP_STORAGE_ENGINE TRUE) +ADD_DEFINITIONS(-D WITH_HEAP_STORAGE_ENGINE) +SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_heap_plugin") + +SET(WITH_MYISAM_STORAGE_ENGINE TRUE) +ADD_DEFINITIONS(-D WITH_MYISAM_STORAGE_ENGINE) +SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_myisam_plugin") + +SET(WITH_MYISAMMRG_STORAGE_ENGINE TRUE) +ADD_DEFINITIONS(-D WITH_MYISAMMRG_STORAGE_ENGINE) +SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_myisammrg_plugin") + IF(WITH_ARCHIVE_STORAGE_ENGINE) ADD_DEFINITIONS(-D WITH_ARCHIVE_STORAGE_ENGINE) - SET (mysql_se_htons "${mysql_se_htons}, &archive_hton") - SET (mysql_se_decls "${mysql_se_decls}, archive_hton") - SET (mysql_se_ha_src ${mysql_se_ha_src} "../sql/ha_archive.cc") + SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_archive_plugin") ENDIF(WITH_ARCHIVE_STORAGE_ENGINE) IF(WITH_BLACKHOLE_STORAGE_ENGINE) ADD_DEFINITIONS(-D WITH_BLACKHOLE_STORAGE_ENGINE) - SET (mysql_se_htons "${mysql_se_htons}, &blackhole_hton") - SET (mysql_se_decls "${mysql_se_decls}, blackhole_hton") - SET (mysql_se_ha_src ${mysql_se_ha_src} "../sql/ha_blackhole.cc") + SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_blackhole_plugin") ENDIF(WITH_BLACKHOLE_STORAGE_ENGINE) IF(WITH_CSV_STORAGE_ENGINE) ADD_DEFINITIONS(-D WITH_CSV_STORAGE_ENGINE) - SET (mysql_se_htons "${mysql_se_htons}, &tina_hton") - SET (mysql_se_decls "${mysql_se_decls}, tina_hton") - SET (mysql_se_ha_src ${mysql_se_ha_src} "../storage/csv/ha_tina.cc") + SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_csv_plugin") ENDIF(WITH_CSV_STORAGE_ENGINE) IF(WITH_EXAMPLE_STORAGE_ENGINE) ADD_DEFINITIONS(-D WITH_EXAMPLE_STORAGE_ENGINE) - SET (mysql_se_htons "${mysql_se_htons}, &example_hton") - SET (mysql_se_decls "${mysql_se_decls}, example_hton") + SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_example_plugin") ENDIF(WITH_EXAMPLE_STORAGE_ENGINE) IF(WITH_INNOBASE_STORAGE_ENGINE) ADD_DEFINITIONS(-D WITH_INNOBASE_STORAGE_ENGINE) - SET (mysql_se_htons "${mysql_se_htons}, &innobase_hton") - SET (mysql_se_decls "${mysql_se_decls}, innobase_hton") - SET (mysql_se_ha_src ${mysql_se_ha_src} "../sql/ha_innodb.cc") + SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_innobase_plugin") ENDIF(WITH_INNOBASE_STORAGE_ENGINE) IF(WITH_PARTITION_STORAGE_ENGINE) ADD_DEFINITIONS(-D WITH_PARTITION_STORAGE_ENGINE) - SET (mysql_se_htons "${mysql_se_htons}, &partition_hton") - SET (mysql_se_decls "${mysql_se_decls}, partition_hton") - SET (mysql_se_ha_src ${mysql_se_ha_src} "../sql/ha_partition.cc") + SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_partition_plugin") ENDIF(WITH_PARTITION_STORAGE_ENGINE) IF(WITH_FEDERATED_STORAGE_ENGINE) ADD_DEFINITIONS(-D WITH_FEDERATED_STORAGE_ENGINE) - SET (mysql_se_htons "${mysql_se_htons}, &federated_hton") - SET (mysql_se_decls "${mysql_se_decls}, federated_hton") - SET (mysql_se_ha_src ${mysql_se_ha_src} "../sql/ha_federated.cc") + SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_federated_plugin") ENDIF(WITH_FEDERATED_STORAGE_ENGINE) IF(WITH_BERKELEY_STORAGE_ENGINE) ADD_DEFINITIONS(-D WITH_BERKELEY_STORAGE_ENGINE) - SET (mysql_se_htons "${mysql_se_htons}, &berkeley_hton") - SET (mysql_se_decls "${mysql_se_decls}, berkeley_hton") - SET (mysql_se_ha_src ${mysql_se_ha_src} "../sql/ha_berkeley.cc") + SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_berkeley_plugin") ENDIF(WITH_BERKELEY_STORAGE_ENGINE) CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/sql/handlerton.cc.in @@ -137,6 +134,12 @@ ENDIF(WITH_ARCHIVE_STORAGE_ENGINE) IF(WITH_BERKELEY_STORAGE_ENGINE) ADD_SUBDIRECTORY(storage/bdb) ENDIF(WITH_BERKELEY_STORAGE_ENGINE) +IF(WITH_BLACKHOLE_STORAGE_ENGINE) + ADD_SUBDIRECTORY(storage/blackhole) +ENDIF(WITH_BLACKHOLE_STORAGE_ENGINE) +IF(WITH_CSV_STORAGE_ENGINE) + ADD_SUBDIRECTORY(storage/csv) +ENDIF(WITH_CSV_STORAGE_ENGINE) IF(WITH_EXAMPLE_STORAGE_ENGINE) ADD_SUBDIRECTORY(storage/example) ENDIF(WITH_EXAMPLE_STORAGE_ENGINE) diff --git a/sql/cmakelists.txt b/sql/cmakelists.txt index 381d22c605c..05b1efdbe51 100644 --- a/sql/cmakelists.txt +++ b/sql/cmakelists.txt @@ -16,7 +16,7 @@ SET_SOURCE_FILES_PROPERTIES(${CMAKE_SOURCE_DIR}/sql/message.rc ${CMAKE_SOURCE_DIR}/sql/sql_yacc.h ${CMAKE_SOURCE_DIR}/sql/sql_yacc.cc ${CMAKE_SOURCE_DIR}/include/mysql_version.h - ${CMAKE_SOURCE_DIR}/sql/handlerton.cc + ${CMAKE_SOURCE_DIR}/sql/sql_builtin.cc ${CMAKE_SOURCE_DIR}/sql/lex_hash.h ${PROJECT_SOURCE_DIR}/include/mysqld_error.h ${PROJECT_SOURCE_DIR}/include/mysqld_ername.h @@ -29,7 +29,8 @@ ADD_DEFINITIONS(-DHAVE_ROW_BASED_REPLICATION -DMYSQL_SERVER ADD_EXECUTABLE(mysqld ../sql-common/client.c derror.cc des_key_file.cc discover.cc ../libmysql/errmsg.c field.cc field_conv.cc filesort.cc gstream.cc ha_heap.cc ha_myisam.cc ha_myisammrg.cc - ${mysql_se_ha_src} handler.cc hash_filo.cc hash_filo.h + ha_innodb.cc ha_partition.cc ha_federated.cc ha_berkeley.cc + handler.cc hash_filo.cc hash_filo.h hostname.cc init.cc item.cc item_buff.cc item_cmpfunc.cc item_create.cc item_func.cc item_geofunc.cc item_row.cc item_strfunc.cc item_subselect.cc item_sum.cc item_timefunc.cc @@ -59,13 +60,19 @@ ADD_EXECUTABLE(mysqld ../sql-common/client.c derror.cc des_key_file.cc ${PROJECT_SOURCE_DIR}/include/mysqld_ername.h ${PROJECT_SOURCE_DIR}/include/sql_state.h ${PROJECT_SOURCE_DIR}/include/mysql_version.h - ${PROJECT_SOURCE_DIR}/sql/handlerton.cc + ${PROJECT_SOURCE_DIR}/sql/sql_builtin.cc ${PROJECT_SOURCE_DIR}/sql/lex_hash.h) TARGET_LINK_LIBRARIES(mysqld heap myisam myisammrg mysys yassl zlib dbug yassl taocrypt strings vio regex wsock32) IF(WITH_ARCHIVE_STORAGE_ENGINE) TARGET_LINK_LIBRARIES(mysqld archive) ENDIF(WITH_ARCHIVE_STORAGE_ENGINE) +IF(WITH_BLACKHOLE_STORAGE_ENGINE) + TARGET_LINK_LIBRARIES(mysqld blackhole) +ENDIF(WITH_BLACKHOLE_STORAGE_ENGINE) +IF(WITH_CSV_STORAGE_ENGINE) + TARGET_LINK_LIBRARIES(mysqld csv) +ENDIF(WITH_CSV_STORAGE_ENGINE) IF(WITH_EXAMPLE_STORAGE_ENGINE) TARGET_LINK_LIBRARIES(mysqld example) ENDIF(WITH_EXAMPLE_STORAGE_ENGINE) diff --git a/storage/archive/cmakelists.txt b/storage/archive/cmakelists.txt index 4189781e73a..939f5562d50 100644 --- a/storage/archive/cmakelists.txt +++ b/storage/archive/cmakelists.txt @@ -2,5 +2,5 @@ SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX") SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX") INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/zlib) -ADD_LIBRARY(archive azio.c) +ADD_LIBRARY(archive azio.c ha_archive.cc ha_archive.h) TARGET_LINK_LIBRARIES(archive zlib mysys dbug strings) diff --git a/storage/blackhole/cmakelists.txt b/storage/blackhole/cmakelists.txt new file mode 100644 index 00000000000..29c0e1bb94b --- /dev/null +++ b/storage/blackhole/cmakelists.txt @@ -0,0 +1,5 @@ +SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX") +SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX") + +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include) +ADD_LIBRARY(blackhole ha_blackhole.cc ha_blackhole.h) -- cgit v1.2.1 From 91801e5cc051b60c1d9670438f614c73d759f7da Mon Sep 17 00:00:00 2001 From: "acurtis@xiphis.org" <> Date: Thu, 20 Apr 2006 10:44:21 -0700 Subject: WL#3201 handlerton -> sql_builtin --- cmakelists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmakelists.txt b/cmakelists.txt index 28d75c62c41..5edc33b9f5a 100644 --- a/cmakelists.txt +++ b/cmakelists.txt @@ -54,8 +54,8 @@ IF(WITH_BERKELEY_STORAGE_ENGINE) SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_berkeley_plugin") ENDIF(WITH_BERKELEY_STORAGE_ENGINE) -CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/sql/handlerton.cc.in - ${CMAKE_SOURCE_DIR}/sql/handlerton.cc @ONLY) +CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/sql/sql_builtin.cc.in + ${CMAKE_SOURCE_DIR}/sql/sql_builtin.cc @ONLY) SET(localstatedir "C:\\mysql\\data") CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/support-files/my-huge.cnf.sh -- cgit v1.2.1 From e2ac9dda830469aa32f646f32300af47b4094e9f Mon Sep 17 00:00:00 2001 From: "acurtis@xiphis.org" <> Date: Mon, 24 Apr 2006 14:32:45 -0700 Subject: WL#3201 post-merge fixes --- config/ac-macros/plugins.m4 | 18 ++++++++++++++++++ sql/sql_plugin.cc | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/config/ac-macros/plugins.m4 b/config/ac-macros/plugins.m4 index 20d7e2cc11c..8ea5aca2595 100644 --- a/config/ac-macros/plugins.m4 +++ b/config/ac-macros/plugins.m4 @@ -238,6 +238,7 @@ AC_DEFUN([MYSQL_CONFIGURE_PLUGINS],[ dnl _MYSQL_CHECK_PLUGIN_ARGS([$1]) _MYSQL_CONFIGURE_PLUGINS(m4_bpatsubst(__mysql_plugin_list__, :, [,])) _MYSQL_DO_PLUGIN_ACTIONS(m4_bpatsubst(__mysql_plugin_list__, :, [,])) + _MYSQL_POST_PLUGIN_FIXUP() ]) dnl ]) dnl ]) @@ -661,5 +662,22 @@ _MYSQL_MODULE_ARGS_CHECK(m4_bpatsubst(__mysql_plugin_list__, :, [,])) _MYSQL_CHECK_DEPENDENCIES(m4_bpatsubst(__mysql_plugin_list__, :, [,])) ]) +AC_DEFUN([_MYSQL_POST_PLUGIN_FIXUP],[ + for plugdir in $mysql_plugin_dirs; do + case "$plugdir" in + storage/* ) + mysql_se_dirs="$mysql_se_dirs `echo $plugdir | sed -e 's@^storage/@@'`" + ;; + plugin/* ) + mysql_pg_dirs="$mysql_pg_dirs `echo $plugdir | sed -e 's@^plugin/@@'`" + ;; + *) + AC_MSG_ERROR([don't know how to handle plugin dir $plugdir]) + ;; + esac + done + AC_SUBST(mysql_se_dirs) + AC_SUBST(mysql_pg_dirs) +]) dnl =========================================================================== diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 249ce6c9823..01faae22c57 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -531,7 +531,7 @@ static int plugin_initialize(struct st_plugin_int *plugin) switch (plugin->plugin->type) { case MYSQL_STORAGE_ENGINE_PLUGIN: - if (ha_initialize_handlerton((handlerton*) plugin->plugin->info)) + if (ha_initialize_handlerton(plugin)) { sql_print_error("Plugin '%s' handlerton init returned error.", plugin->name.str); -- cgit v1.2.1 From 281fb1cfc5358389e51e6dbac304b9d0fbfbbf86 Mon Sep 17 00:00:00 2001 From: "serg@sergbook.mysql.com" <> Date: Sat, 29 Apr 2006 09:33:34 -0700 Subject: make distcheck and cosmetic fixes --- config/ac-macros/ha_berkeley.m4 | 15 +- config/ac-macros/ha_ndbcluster.m4 | 2 +- config/ac-macros/misc.m4 | 8 +- config/ac-macros/plugins.m4 | 583 +++++++++++++++++++------------------- configure.in | 37 +-- plugin/Makefile.am | 4 +- sql/Makefile.am | 4 +- storage/archive/Makefile.am | 8 +- storage/blackhole/Makefile.am | 2 +- storage/example/Makefile.am | 2 +- storage/innobase/Makefile.am | 11 +- 11 files changed, 334 insertions(+), 342 deletions(-) diff --git a/config/ac-macros/ha_berkeley.m4 b/config/ac-macros/ha_berkeley.m4 index c389077ea8b..c7d99bd8e03 100644 --- a/config/ac-macros/ha_berkeley.m4 +++ b/config/ac-macros/ha_berkeley.m4 @@ -8,23 +8,20 @@ dnl --------------------------------------------------------------------------- AC_DEFUN([MYSQL_SETUP_BERKELEY_DB], [ AC_ARG_WITH([berkeley-db], - [ - --with-berkeley-db[=DIR] - Use BerkeleyDB located in DIR], + AS_HELP_STRING([--with-berkeley-db[[[[[=DIR]]]]]], + [Use BerkeleyDB located in DIR]), [bdb="$withval"], [bdb=yes]) AC_ARG_WITH([berkeley-db-includes], - [ - --with-berkeley-db-includes=DIR - Find Berkeley DB headers in DIR], + AS_HELP_STRING([--with-berkeley-db-includes=DIR], + [Find Berkeley DB headers in DIR]), [bdb_includes="$withval"], [bdb_includes=default]) AC_ARG_WITH([berkeley-db-libs], - [ - --with-berkeley-db-libs=DIR - Find Berkeley DB libraries in DIR], + AS_HELP_STRING([--with-berkeley-db-libs=DIR], + [Find Berkeley DB libraries in DIR]), [bdb_libs="$withval"], [bdb_libs=default]) diff --git a/config/ac-macros/ha_ndbcluster.m4 b/config/ac-macros/ha_ndbcluster.m4 index c7e163e065f..aee445f8d58 100644 --- a/config/ac-macros/ha_ndbcluster.m4 +++ b/config/ac-macros/ha_ndbcluster.m4 @@ -308,7 +308,7 @@ AC_DEFUN([MYSQL_SETUP_NDBCLUSTER], [ AC_SUBST(NDB_DEFS) AC_SUBST(ndb_cxxflags_fix) - AC_CONFIG_FILES(storage/ndb/Makefile storage/ndb/include/Makefile dnl + AC_CONFIG_FILES(storage/ndb/include/Makefile dnl storage/ndb/src/Makefile storage/ndb/src/common/Makefile dnl storage/ndb/docs/Makefile dnl storage/ndb/tools/Makefile dnl diff --git a/config/ac-macros/misc.m4 b/config/ac-macros/misc.m4 index d8199f5970e..a2f70071e2d 100644 --- a/config/ac-macros/misc.m4 +++ b/config/ac-macros/misc.m4 @@ -675,8 +675,8 @@ dnl Sets BIG_TABLES if --with-big-tables is used dnl --------------------------------------------------------------------------- AC_DEFUN([MYSQL_CHECK_BIG_TABLES], [ AC_ARG_WITH([big-tables], - [ - --with-big-tables Support tables with more than 4 G rows even on 32 bit platforms], + AS_HELP_STRING([--with-big-tables], + [Support tables with more than 4 G rows even on 32 bit platforms]), [bigtables="$withval"], [bigtables=no]) AC_MSG_CHECKING([for big tables support]) @@ -703,8 +703,8 @@ dnl Sets MAX_INDEXES dnl --------------------------------------------------------------------------- AC_DEFUN([MYSQL_CHECK_MAX_INDEXES], [ AC_ARG_WITH([max-indexes], - [ - --with-max-indexes=\# Sets the maximum number of indexes per table, default 64], + AS_HELP_STRING([--with-max-indexes=N], + [Sets the maximum number of indexes per table, default 64]), [max_indexes="$withval"], [max_indexes=64]) AC_MSG_CHECKING([max indexes per table]) diff --git a/config/ac-macros/plugins.m4 b/config/ac-macros/plugins.m4 index 8ea5aca2595..51f83e19e5f 100644 --- a/config/ac-macros/plugins.m4 +++ b/config/ac-macros/plugins.m4 @@ -20,28 +20,28 @@ dnl Adds module as member to configuration groups (if specified) dnl dnl --------------------------------------------------------------------------- -AC_DEFUN([MYSQL_MODULE],[ dnl +AC_DEFUN([MYSQL_MODULE],[ _MYSQL_MODULE( [$1], [__MYSQL_MODULE_]AS_TR_CPP([$1])[__], m4_default([$2], [$1 plugin]), m4_default([$3], [plugin for $1]), m4_default([$4], []), - ) dnl + ) ]) -AC_DEFUN([_MYSQL_MODULE],[ dnl - m4_ifdef([$2], [ dnl - AC_FATAL([[Duplicate MYSQL_MODULE declaration for ]][$3]) dnl +AC_DEFUN([_MYSQL_MODULE],[ + m4_ifdef([$2], [ + AC_FATAL([[Duplicate MYSQL_MODULE declaration for ]][$3]) ],[ dnl - m4_define([$2], [$1]) dnl - _MYSQL_PLUGAPPEND([__mysql_plugin_list__],[$1]) dnl - m4_define([MYSQL_MODULE_NAME_]AS_TR_CPP([$1]), [$3]) dnl - m4_define([MYSQL_MODULE_DESC_]AS_TR_CPP([$1]), [$4]) dnl - ifelse([$5], [], [], [ dnl - _MYSQL_PLUGAPPEND_OPTS([$1], $5) dnl - ]) dnl - ]) dnl + m4_define([$2], [$1]) + _MYSQL_PLUGAPPEND([__mysql_plugin_list__],[$1]) + m4_define([MYSQL_MODULE_NAME_]AS_TR_CPP([$1]), [$3]) + m4_define([MYSQL_MODULE_DESC_]AS_TR_CPP([$1]), [$4]) + ifelse([$5], [], [], [ + _MYSQL_PLUGAPPEND_OPTS([$1], $5) + ]) + ]) ]) @@ -53,18 +53,18 @@ dnl Short cut for storage engine declarations dnl dnl --------------------------------------------------------------------------- -AC_DEFUN([MYSQL_STORAGE_ENGINE],[ dnl - MYSQL_MODULE([$1], [$3], [$4], [[$5]]) dnl - MYSQL_MODULE_DEFINE([$1], [WITH_]AS_TR_CPP([$1])[_STORAGE_ENGINE]) dnl - ifelse([$2],[no],[],[ dnl - _MYSQL_LEGACY_STORAGE_ENGINE([$1],m4_default([$2], [$1-storage-engine])) dnl - ]) dnl +AC_DEFUN([MYSQL_STORAGE_ENGINE],[ + MYSQL_MODULE([$1], [$3], [$4], [[$5]]) + MYSQL_MODULE_DEFINE([$1], [WITH_]AS_TR_CPP([$1])[_STORAGE_ENGINE]) + ifelse([$2],[no],[],[ + _MYSQL_LEGACY_STORAGE_ENGINE([$1],m4_default([$2], [$1-storage-engine])) + ]) ]) AC_DEFUN([_MYSQL_LEGACY_STORAGE_ENGINE],[ if test "[${with_]m4_bpatsubst($2, -, _)[+set}]" = set; then [with_module_]m4_bpatsubst($1, -, _)="[$with_]m4_bpatsubst($2, -, _)" -fi dnl +fi ]) @@ -76,9 +76,9 @@ dnl When a plugin module is to be statically linked, define the C macro dnl dnl --------------------------------------------------------------------------- -AC_DEFUN([MYSQL_MODULE_DEFINE],[ dnl - REQUIRE_PLUGIN([$1]) dnl - m4_define([MYSQL_MODULE_DEFINE_]AS_TR_CPP([$1]), [$2]) dnl +AC_DEFUN([MYSQL_MODULE_DEFINE],[ + REQUIRE_PLUGIN([$1]) + m4_define([MYSQL_MODULE_DEFINE_]AS_TR_CPP([$1]), [$2]) ]) @@ -90,9 +90,9 @@ dnl Adds a directory to the build process dnl dnl --------------------------------------------------------------------------- -AC_DEFUN([MYSQL_MODULE_DIRECTORY],[ dnl - REQUIRE_PLUGIN([$1]) dnl - m4_define([MYSQL_MODULE_DIRECTORY_]AS_TR_CPP([$1]), [$2]) dnl +AC_DEFUN([MYSQL_MODULE_DIRECTORY],[ + REQUIRE_PLUGIN([$1]) + m4_define([MYSQL_MODULE_DIRECTORY_]AS_TR_CPP([$1]), [$2]) ]) @@ -104,9 +104,9 @@ dnl Declare the name for the static library dnl dnl --------------------------------------------------------------------------- -AC_DEFUN([MYSQL_MODULE_STATIC],[ dnl - REQUIRE_PLUGIN([$1]) dnl - m4_define([MYSQL_MODULE_STATIC_]AS_TR_CPP([$1]), [$2]) dnl +AC_DEFUN([MYSQL_MODULE_STATIC],[ + REQUIRE_PLUGIN([$1]) + m4_define([MYSQL_MODULE_STATIC_]AS_TR_CPP([$1]), [$2]) ]) @@ -118,9 +118,9 @@ dnl Declare the name for the shared library dnl dnl --------------------------------------------------------------------------- -AC_DEFUN([MYSQL_MODULE_DYNAMIC],[ dnl - REQUIRE_PLUGIN([$1]) dnl - m4_define([MYSQL_MODULE_DYNAMIC_]AS_TR_CPP([$1]), [$2]) dnl +AC_DEFUN([MYSQL_MODULE_DYNAMIC],[ + REQUIRE_PLUGIN([$1]) + m4_define([MYSQL_MODULE_DYNAMIC_]AS_TR_CPP([$1]), [$2]) ]) @@ -132,20 +132,20 @@ dnl Marks the specified plugin as a mandatory module dnl dnl --------------------------------------------------------------------------- -AC_DEFUN([MYSQL_MODULE_MANDATORY],[ dnl - REQUIRE_PLUGIN([$1]) dnl +AC_DEFUN([MYSQL_MODULE_MANDATORY],[ + REQUIRE_PLUGIN([$1]) _MYSQL_MODULE_MANDATORY([$1], [MYSQL_MODULE_MANDATORY_]AS_TR_CPP([$1]), [MYSQL_MODULE_DISABLED_]AS_TR_CPP([$1]) - ) dnl + ) ]) -AC_DEFUN([_MYSQL_MODULE_MANDATORY],[ dnl - m4_define([$2], [yes]) dnl - m4_ifdef([$3], [ dnl - AC_WARNING([syntax],[Mandatory plugin $1 has been disabled]) dnl - m4_undefine([$2]) dnl - ]) dnl +AC_DEFUN([_MYSQL_MODULE_MANDATORY],[ + m4_define([$2], [yes]) + m4_ifdef([$3], [ + AC_WARNING([syntax],[Mandatory plugin $1 has been disabled]) + m4_undefine([$2]) + ]) ]) @@ -157,20 +157,20 @@ dnl Marks the specified plugin as a disabled module dnl dnl --------------------------------------------------------------------------- -AC_DEFUN([MYSQL_MODULE_DISABLED],[ dnl - REQUIRE_PLUGIN([$1]) dnl +AC_DEFUN([MYSQL_MODULE_DISABLED],[ + REQUIRE_PLUGIN([$1]) _MYSQL_MODULE_DISABLED([$1], [MYSQL_MODULE_DISABLED_]AS_TR_CPP([$1]), [MYSQL_MODULE_MANDATORY_]AS_TR_CPP([$1]) - ) dnl + ) ]) -AC_DEFUN([_MYSQL_MODULE_DISABLED],[ dnl - m4_define([$2], [yes]) dnl - m4_ifdef([$3], [ dnl - AC_FATAL([attempt to disable mandatory plugin $1]) dnl - m4_undefine([$2]) dnl - ]) dnl +AC_DEFUN([_MYSQL_MODULE_DISABLED],[ + m4_define([$2], [yes]) + m4_ifdef([$3], [ + AC_FATAL([attempt to disable mandatory plugin $1]) + m4_undefine([$2]) + ]) ]) @@ -185,21 +185,21 @@ dnl here too! dnl dnl --------------------------------------------------------------------------- -AC_DEFUN([MYSQL_MODULE_DEPENDS],[ dnl - REQUIRE_PLUGIN([$1]) dnl - ifelse($#, 0, [], $#, 1, [ dnl - AC_FATAL([[bad number of arguments]]) dnl - ], $#, 2, [ dnl - _MYSQL_MODULE_DEPEND([$1],[$2]) dnl - ],[ dnl - _MYSQL_MODULE_DEPEND([$1],[$2]) dnl - MYSQL_MODULE_DEPENDS([$1], m4_shift(m4_shift($@))) dnl +AC_DEFUN([MYSQL_MODULE_DEPENDS],[ + REQUIRE_PLUGIN([$1]) + ifelse($#, 0, [], $#, 1, [ + AC_FATAL([[bad number of arguments]]) + ], $#, 2, [ + _MYSQL_MODULE_DEPEND([$1],[$2]) + ],[ + _MYSQL_MODULE_DEPEND([$1],[$2]) + MYSQL_MODULE_DEPENDS([$1], m4_shift(m4_shift($@))) ]) ]) -AC_DEFUN([_MYSQL_MODULE_DEPEND],[ dnl - REQUIRE_PLUGIN([$2]) dnl - _MYSQL_PLUGAPPEND([__mysql_plugdepends_$1__],[$2]) dnl +AC_DEFUN([_MYSQL_MODULE_DEPEND],[ + REQUIRE_PLUGIN([$2]) + _MYSQL_PLUGAPPEND([__mysql_plugdepends_$1__],[$2]) ]) @@ -211,12 +211,12 @@ dnl Declares additional actions required to configure the module dnl dnl --------------------------------------------------------------------------- -AC_DEFUN([MYSQL_MODULE_ACTIONS],[ dnl - REQUIRE_PLUGIN([$1]) dnl - m4_ifdef([$2],[ dnl - m4_define([MYSQL_MODULE_ACTIONS_]AS_TR_CPP([$1]),m4_defn([$2])) dnl - ],[ dnl - m4_define([MYSQL_MODULE_ACTIONS_]AS_TR_CPP([$1]), [$2]) dnl +AC_DEFUN([MYSQL_MODULE_ACTIONS],[ + REQUIRE_PLUGIN([$1]) + m4_ifdef([$2],[ + m4_define([MYSQL_MODULE_ACTIONS_]AS_TR_CPP([$1]),m4_defn([$2])) + ],[ + m4_define([MYSQL_MODULE_ACTIONS_]AS_TR_CPP([$1]), [$2]) ]) ]) @@ -229,33 +229,33 @@ dnl Called last, emits all required shell code to configure the modules dnl dnl --------------------------------------------------------------------------- -AC_DEFUN([MYSQL_CONFIGURE_PLUGINS],[ dnl - m4_ifdef([__mysql_plugin_configured__],[ dnl - AC_FATAL([cannot call [MYSQL_CONFIGURE_PLUGINS] multiple times]) dnl - ],[ dnl - m4_define([__mysql_plugin_configured__],[done]) dnl - m4_ifdef([__mysql_plugin_list__],[ dnl +AC_DEFUN([MYSQL_CONFIGURE_PLUGINS],[ + m4_ifdef([__mysql_plugin_configured__],[ + AC_FATAL([cannot call [MYSQL_CONFIGURE_PLUGINS] multiple times]) + ],[ + m4_define([__mysql_plugin_configured__],[done]) + m4_ifdef([__mysql_plugin_list__],[ _MYSQL_CHECK_PLUGIN_ARGS([$1]) _MYSQL_CONFIGURE_PLUGINS(m4_bpatsubst(__mysql_plugin_list__, :, [,])) _MYSQL_DO_PLUGIN_ACTIONS(m4_bpatsubst(__mysql_plugin_list__, :, [,])) _MYSQL_POST_PLUGIN_FIXUP() - ]) dnl - ]) dnl + ]) + ]) ]) -AC_DEFUN([_MYSQL_CONFIGURE_PLUGINS],[ dnl - ifelse($#, 0, [], $#, 1, [ dnl - _MYSQL_CHECK_PLUGIN([$1]) dnl - ],[ dnl - _MYSQL_CHECK_PLUGIN([$1]) dnl - _MYSQL_CONFIGURE_PLUGINS(m4_shift($@)) dnl +AC_DEFUN([_MYSQL_CONFIGURE_PLUGINS],[ + ifelse($#, 0, [], $#, 1, [ + _MYSQL_CHECK_PLUGIN([$1]) + ],[ + _MYSQL_CHECK_PLUGIN([$1]) + _MYSQL_CONFIGURE_PLUGINS(m4_shift($@)) ]) ]) -AC_DEFUN([_MYSQL_CHECK_PLUGIN],[ dnl +AC_DEFUN([_MYSQL_CHECK_PLUGIN],[ _DO_MYSQL_CHECK_PLUGIN( [$1], - [$1-plugin], + m4_bpatsubst([$1], -, _), [MYSQL_MODULE_NAME_]AS_TR_CPP([$1]), [MYSQL_MODULE_DESC_]AS_TR_CPP([$1]), [MYSQL_MODULE_DEFINE_]AS_TR_CPP([$1]), @@ -265,104 +265,111 @@ AC_DEFUN([_MYSQL_CHECK_PLUGIN],[ dnl [MYSQL_MODULE_MANDATORY_]AS_TR_CPP([$1]), [MYSQL_MODULE_DISABLED_]AS_TR_CPP([$1]), [MYSQL_MODULE_ACTIONS_]AS_TR_CPP([$1]) - ) dnl + ) ]) -AC_DEFUN([_DO_MYSQL_CHECK_PLUGIN],[ dnl - m4_ifdef([$5],[ dnl +AC_DEFUN([_DO_MYSQL_CHECK_PLUGIN],[ + m4_ifdef([$5],[ AH_TEMPLATE($5, [Include ]$4[ into mysqld]) ]) - AC_MSG_CHECKING([whether to use ]$3) dnl + AC_MSG_CHECKING([whether to use ]$3) m4_ifdef([$10],[ - if test "[$mysql_module_]m4_bpatsubst([$1], -, _)" = yes -a \ - "[$with_module_]m4_bpatsubst([$1], -, _)" != no -o \ - "[$with_module_]m4_bpatsubst([$1], -, _)" = yes; then + if test "[$mysql_module_]$2" = yes -a \ + "[$with_module_]$2" != no -o \ + "[$with_module_]$2" = yes; then AC_MSG_ERROR([disabled]) fi - AC_MSG_RESULT([no]) dnl - ],[ dnl + AC_MSG_RESULT([no]) + ],[ m4_ifdef([$9],[ - if test "[$with_module_]m4_bpatsubst([$1], -, _)" = no; then + if test "[$with_module_]$2" = no; then AC_MSG_ERROR([cannot disable mandatory module]) fi - [mysql_module_]m4_bpatsubst([$1], -, _)=yes dnl + [mysql_module_]$2=yes ]) - if test "[$with_module_]m4_bpatsubst([$1], -, _)" != no; then - if test "[$mysql_module_]m4_bpatsubst([$1], -, _)" != yes -a \ - "[$with_module_]m4_bpatsubst([$1], -, _)" != yes; then dnl - m4_ifdef([$8],[ dnl + if test "[$with_module_]$2" = no; then + AC_MSG_RESULT([no]) + else + if test "[$mysql_module_]$2" != yes -a \ + "[$with_module_]$2" != yes; then + m4_ifdef([$8],[ + m4_ifdef([$6],[ + if test -d "$srcdir/$6" ; then + mysql_plugin_dirs="$mysql_plugin_dirs $6" + ]) + AC_SUBST([plugin_]$2[_shared_target], "$8") + AC_SUBST([plugin_]$2[_static_target], [""]) + [with_module_]$2=yes + AC_MSG_RESULT([plugin]) m4_ifdef([$6],[ - mysql_plugin_dirs="$mysql_plugin_dirs $6" dnl + else + [mysql_module_]$2=no + AC_MSG_RESULT([no]) + fi ]) - AC_SUBST([plugin_]m4_bpatsubst([$1], -, _)[_shared_target], "$8") - AC_SUBST([plugin_]m4_bpatsubst([$1], -, _)[_static_target], [""]) - [with_module_]m4_bpatsubst([$1], -, _)=yes - AC_MSG_RESULT([plugin]) dnl ],[ - [with_module_]m4_bpatsubst([$1], -, _)=no - AC_MSG_RESULT([no]) dnl + [with_module_]$2=no + AC_MSG_RESULT([no]) ]) - else dnl + else m4_ifdef([$7],[ - ifelse(m4_bregexp($7, [^lib[^.]+\.a$]), -2, [ dnl + ifelse(m4_bregexp($7, [^lib[^.]+\.a$]), -2, [ m4_ifdef([$6],[ mysql_plugin_dirs="$mysql_plugin_dirs $6" - mysql_plugin_libs="$mysql_plugin_libs -L[\$(top_builddir)]/$6" dnl + mysql_plugin_libs="$mysql_plugin_libs -L[\$(top_builddir)]/$6" ]) - mysql_plugin_libs="$mysql_plugin_libs dnl -[-l]m4_bregexp($7, [^lib\([^.]+\)], [\1])" dnl - ], m4_bregexp($7, [^\\\$]), 0, [ dnl + mysql_plugin_libs="$mysql_plugin_libs +[-l]m4_bregexp($7, [^lib\([^.]+\)], [\1])" + ], m4_bregexp($7, [^\\\$]), 0, [ m4_ifdef([$6],[ - mysql_plugin_dirs="$mysql_plugin_dirs $6" dnl + mysql_plugin_dirs="$mysql_plugin_dirs $6" ]) - mysql_plugin_libs="$mysql_plugin_libs $7" dnl - ], [ dnl + mysql_plugin_libs="$mysql_plugin_libs $7" + ], [ m4_ifdef([$6],[ mysql_plugin_dirs="$mysql_plugin_dirs $6" - mysql_plugin_libs="$mysql_plugin_libs \$(top_builddir)/$6/$7" dnl + mysql_plugin_libs="$mysql_plugin_libs \$(top_builddir)/$6/$7" ],[ - mysql_plugin_libs="$mysql_plugin_libs $7" dnl - ]) dnl - ]) dnl + mysql_plugin_libs="$mysql_plugin_libs $7" + ]) + ]) m4_ifdef([$5],[ - AC_DEFINE($5) dnl + AC_DEFINE($5) ]) - AC_SUBST([plugin_]m4_bpatsubst([$1], -, _)[_static_target], "$7") - AC_SUBST([plugin_]m4_bpatsubst([$1], -, _)[_shared_target], [""]) dnl - ],[ dnl + AC_SUBST([plugin_]$2[_static_target], "$7") + AC_SUBST([plugin_]$2[_shared_target], [""]) + ],[ m4_ifdef([$6],[ - AC_FATAL([plugin directory specified without library for ]$3) dnl - ],[ dnl + AC_FATAL([plugin directory specified without library for ]$3) + ],[ m4_ifdef([$5],[ AC_DEFINE($5) - AC_SUBST([plugin_]m4_bpatsubst([$1], -, _)[_static_target], ["yes"]) - AC_SUBST([plugin_]m4_bpatsubst([$1], -, _)[_shared_target], [""]) dnl - ]) dnl - ]) dnl + AC_SUBST([plugin_]$2[_static_target], ["yes"]) + AC_SUBST([plugin_]$2[_shared_target], [""]) + ]) + ]) ]) - mysql_plugin_defs="$mysql_plugin_defs, [builtin_]m4_bpatsubst([$2], -, _)" - [with_module_]m4_bpatsubst([$1], -, _)=yes + mysql_plugin_defs="$mysql_plugin_defs, [builtin_]$2[_plugin]" + [with_module_]$2=yes AC_MSG_RESULT([yes]) fi - else - AC_MSG_RESULT([no]) - fi dnl - ]) dnl + fi + ]) ]) -AC_DEFUN([_MYSQL_DO_PLUGIN_ACTIONS],[ dnl - ifelse($#, 0, [], $#, 1, [ dnl - _MYSQL_PLUGIN_ACTIONS([$1]) dnl - ],[ dnl - _MYSQL_PLUGIN_ACTIONS([$1]) dnl - _MYSQL_DO_PLUGIN_ACTIONS(m4_shift($@)) dnl +AC_DEFUN([_MYSQL_DO_PLUGIN_ACTIONS],[ + ifelse($#, 0, [], $#, 1, [ + _MYSQL_PLUGIN_ACTIONS([$1]) + ],[ + _MYSQL_PLUGIN_ACTIONS([$1]) + _MYSQL_DO_PLUGIN_ACTIONS(m4_shift($@)) ]) ]) -AC_DEFUN([_MYSQL_PLUGIN_ACTIONS],[ dnl +AC_DEFUN([_MYSQL_PLUGIN_ACTIONS],[ _DO_MYSQL_PLUGIN_ACTIONS( [$1], - [$1-plugin], + m4_bpatsubst([$1], -, _), [MYSQL_MODULE_NAME_]AS_TR_CPP([$1]), [MYSQL_MODULE_DESC_]AS_TR_CPP([$1]), [MYSQL_MODULE_DEFINE_]AS_TR_CPP([$1]), @@ -372,20 +379,20 @@ AC_DEFUN([_MYSQL_PLUGIN_ACTIONS],[ dnl [MYSQL_MODULE_MANDATORY_]AS_TR_CPP([$1]), [MYSQL_MODULE_DISABLED_]AS_TR_CPP([$1]), [MYSQL_MODULE_ACTIONS_]AS_TR_CPP([$1]) - ) dnl + ) ]) -AC_DEFUN([_DO_MYSQL_PLUGIN_ACTIONS],[ dnl +AC_DEFUN([_DO_MYSQL_PLUGIN_ACTIONS],[ m4_ifdef([$10], [], [ - if test "[$with_module_]m4_bpatsubst([$1], -, _)" = yes; then - if test -z "[$plugin_]m4_bpatsubst([$1], -, _)[_static_target]" -a \ - -z "[$plugin_]m4_bpatsubst([$1], -, _)[_shared_target]"; then - AC_MSG_ERROR([thats strange, $1 failed sanity check]) + if test "[$with_module_]$2" = yes; then + if test -z "[$plugin_]$2[_static_target]" -a \ + -z "[$plugin_]$2[_shared_target]"; then + AC_MSG_ERROR([that's strange, $1 failed sanity check]) fi $11 - fi dnl - ]) dnl + fi + ]) ]) @@ -395,17 +402,17 @@ dnl Private helper macros dnl =========================================================================== -AC_DEFUN([REQUIRE_PLUGIN],[ dnl - _REQUIRE_PLUGIN([$1], [__MYSQL_MODULE_]AS_TR_CPP([$1])[__]) dnl +AC_DEFUN([REQUIRE_PLUGIN],[ + _REQUIRE_PLUGIN([$1], [__MYSQL_MODULE_]AS_TR_CPP([$1])[__]) ]) -define([_REQUIRE_PLUGIN],[ dnl - ifdef([$2],[ dnl - ifelse($2, [$1], [], [ dnl - AC_FATAL([[Misspelt MYSQL_MODULE declaration for ]][$1]) dnl - ]) dnl - ],[ dnl - AC_FATAL([[Missing MYSQL_MODULE declaration for ]][$1]) dnl +define([_REQUIRE_PLUGIN],[ + ifdef([$2],[ + ifelse($2, [$1], [], [ + AC_FATAL([[Misspelt MYSQL_MODULE declaration for ]][$1]) + ]) + ],[ + AC_FATAL([[Missing MYSQL_MODULE declaration for ]][$1]) ]) ]) @@ -413,85 +420,85 @@ define([_REQUIRE_PLUGIN],[ dnl dnl --------------------------------------------------------------------------- -AC_DEFUN([_MYSQL_MODULE_META_CHECK], [ifelse($#, 0, [], $#, 1, dnl -[_MYSQL_CHECK_PLUGIN_META([$1], [__mysql_]m4_bpatsubst($1, -, _)[_plugins__]) dnl -], dnl -[_MYSQL_CHECK_PLUGIN_META([$1], [__mysql_]m4_bpatsubst($1, -, _)[_plugins__]) dnl -_MYSQL_MODULE_META_CHECK(m4_shift($@))]) dnl +AC_DEFUN([_MYSQL_MODULE_META_CHECK], [ifelse($#, 0, [], $#, 1, +[_MYSQL_CHECK_PLUGIN_META([$1], [__mysql_]m4_bpatsubst($1, -, _)[_plugins__]) +], +[_MYSQL_CHECK_PLUGIN_META([$1], [__mysql_]m4_bpatsubst($1, -, _)[_plugins__]) +_MYSQL_MODULE_META_CHECK(m4_shift($@))]) ]) AC_DEFUN([_MYSQL_CHECK_PLUGIN_META], [ - [$1] ) dnl + [$1] ) m4_ifdef([$2], [ - mysql_modules='m4_bpatsubst($2, :, [ ])' dnl + mysql_modules='m4_bpatsubst($2, :, [ ])' ],[ - mysql_modules='' dnl + mysql_modules='' ]) - ;; dnl + ;; ]) dnl --------------------------------------------------------------------------- -AC_DEFUN([_MYSQL_PLUGAPPEND],[ dnl - m4_ifdef([$1],[ dnl - m4_define([__plugin_append_tmp__], m4_defn([$1])) dnl - m4_undefine([$1]) dnl - m4_define([$1], __plugin_append_tmp__[:$2]) dnl - m4_undefine([__plugin_append_tmp__]) dnl - ],[ dnl - m4_define([$1], [$2]) dnl - $3 dnl - ]) dnl +AC_DEFUN([_MYSQL_PLUGAPPEND],[ + m4_ifdef([$1],[ + m4_define([__plugin_append_tmp__], m4_defn([$1])) + m4_undefine([$1]) + m4_define([$1], __plugin_append_tmp__[:$2]) + m4_undefine([__plugin_append_tmp__]) + ],[ + m4_define([$1], [$2]) + $3 + ]) ]) -AC_DEFUN([_MYSQL_PLUGAPPEND_OPTS],[ dnl - ifelse($#, 0, [], $#, 1, [ dnl +AC_DEFUN([_MYSQL_PLUGAPPEND_OPTS],[ + ifelse($#, 0, [], $#, 1, [ AC_FATAL([[bad number of args]]) - ], $#, 2, [ dnl - _MYSQL_PLUGAPPEND_OPTONE([$1],[$2]) dnl - ],[ dnl - _MYSQL_PLUGAPPEND_OPTONE([$1],[$2]) dnl + ], $#, 2, [ + _MYSQL_PLUGAPPEND_OPTONE([$1],[$2]) + ],[ + _MYSQL_PLUGAPPEND_OPTONE([$1],[$2]) _MYSQL_PLUGAPPEND_OPTS([$1], m4_shift(m4_shift($@))) ]) ]) -AC_DEFUN([_MYSQL_PLUGAPPEND_OPTONE],[ dnl - ifelse([$2], [all], [ dnl - AC_FATAL([[protected plugin group: all]]) dnl - ],[ dnl - ifelse([$2], [none], [ dnl - AC_FATAL([[protected plugin group: none]]) dnl - ],[ dnl - _MYSQL_PLUGAPPEND([__mysql_$1_configs__],[$2]) dnl - _MYSQL_PLUGAPPEND([__mysql_]m4_bpatsubst($2, -, _)[_plugins__],[$1], [ dnl - _MYSQL_PLUGAPPEND([__mysql_metaplugin_list__],[$2]) dnl - ]) dnl - ]) dnl - ]) dnl +AC_DEFUN([_MYSQL_PLUGAPPEND_OPTONE],[ + ifelse([$2], [all], [ + AC_FATAL([[protected plugin group: all]]) + ],[ + ifelse([$2], [none], [ + AC_FATAL([[protected plugin group: none]]) + ],[ + _MYSQL_PLUGAPPEND([__mysql_$1_configs__],[$2]) + _MYSQL_PLUGAPPEND([__mysql_]m4_bpatsubst($2, -, _)[_plugins__],[$1], [ + _MYSQL_PLUGAPPEND([__mysql_metaplugin_list__],[$2]) + ]) + ]) + ]) ]) dnl --------------------------------------------------------------------------- -AC_DEFUN([MYSQL_LIST_PLUGINS],[ dnl - m4_ifdef([__mysql_plugin_list__],[ dnl - _MYSQL_LIST_PLUGINS(m4_bpatsubst(__mysql_plugin_list__, :, [,])) dnl - ]) dnl +AC_DEFUN([MYSQL_LIST_PLUGINS],[dnl + m4_ifdef([__mysql_plugin_list__],[dnl + _MYSQL_LIST_PLUGINS(m4_bpatsubst(__mysql_plugin_list__, :, [,]))dnl + ])dnl ]) -AC_DEFUN([_MYSQL_LIST_PLUGINS],[ dnl - ifelse($#, 0, [], $#, 1, [ dnl - MYSQL_SHOW_PLUGIN([$1]) dnl - ],[ dnl - MYSQL_SHOW_PLUGIN([$1]) dnl - _MYSQL_LIST_PLUGINS(m4_shift($@)) dnl - ]) dnl +AC_DEFUN([_MYSQL_LIST_PLUGINS],[dnl + ifelse($#, 0, [], $#, 1, [dnl + MYSQL_SHOW_PLUGIN([$1])dnl + ],[dnl + MYSQL_SHOW_PLUGIN([$1])dnl + _MYSQL_LIST_PLUGINS(m4_shift($@))dnl + ])dnl ]) -AC_DEFUN([MYSQL_SHOW_PLUGIN],[ dnl +AC_DEFUN([MYSQL_SHOW_PLUGIN],[ _MYSQL_SHOW_PLUGIN( [$1], [$1-plugin], @@ -508,19 +515,20 @@ AC_DEFUN([MYSQL_SHOW_PLUGIN],[ dnl ) ]) -AC_DEFUN([_MYSQL_SHOW_PLUGIN],[ - === Plug-in: $3 === +AC_DEFUN([_MYSQL_SHOW_PLUGIN],[dnl + === Plugin: $3 === Module Name: [$1] Description: $4 - Supports build: _PLUGIN_BUILD_TYPE([$7],[$8]) dnl + Supports build: _PLUGIN_BUILD_TYPE([$7],[$8])[]dnl m4_ifdef([$12],[ - Configurations: m4_bpatsubst($12, :, [, ])]) dnl + Configurations: m4_bpatsubst($12, :, [, ])])[]dnl m4_ifdef([$10],[ - Status: disabled], [ dnl + Status: disabled])[]dnl m4_ifdef([$9],[ - Status: mandatory])])]) + Status: mandatory])[]dnl +]) -AC_DEFUN([_PLUGIN_BUILD_TYPE], dnl +AC_DEFUN([_PLUGIN_BUILD_TYPE], [m4_ifdef([$1],[ifelse($1,[no],[],[static ]m4_ifdef([$2],[and dnl ]))])[]m4_ifdef([$2],[dynamic],[m4_ifdef([$1],[],[static])])]) @@ -528,108 +536,107 @@ AC_DEFUN([_PLUGIN_BUILD_TYPE], dnl dnl --------------------------------------------------------------------------- -AC_DEFUN([_MYSQL_MODULE_ARGS_CHECK],[ dnl - ifelse($#, 0, [], $#, 1, [ dnl +AC_DEFUN([_MYSQL_MODULE_ARGS_CHECK],[ + ifelse($#, 0, [], $#, 1, [ _MYSQL_CHECK_PLUGIN_ARG([$1], [MYSQL_MODULE_DISABLED_]AS_TR_CPP([$1]), - [MYSQL_MODULE_ACTIONS_]AS_TR_CPP([$1])) dnl - ],[ dnl + [MYSQL_MODULE_ACTIONS_]AS_TR_CPP([$1])) + ],[ _MYSQL_CHECK_PLUGIN_ARG([$1], [MYSQL_MODULE_DISABLED_]AS_TR_CPP([$1]), - [MYSQL_MODULE_ACTIONS_]AS_TR_CPP([$1])) dnl - _MYSQL_MODULE_ARGS_CHECK(m4_shift($@)) dnl - ]) dnl + [MYSQL_MODULE_ACTIONS_]AS_TR_CPP([$1])) + _MYSQL_MODULE_ARGS_CHECK(m4_shift($@)) + ]) ]) -AC_DEFUN([_MYSQL_CHECK_PLUGIN_ARG],[ dnl +AC_DEFUN([_MYSQL_CHECK_PLUGIN_ARG],[ m4_ifdef([$3], [], [m4_define([$3],[ ])]) - [$1] ) dnl + [$1] ) m4_ifdef([$2],[ - AC_MSG_ERROR([plugin $1 is disabled]) dnl + AC_MSG_ERROR([plugin $1 is disabled]) ],[ - [mysql_module_]m4_bpatsubst([$1], -, _)=yes dnl + [mysql_module_]m4_bpatsubst([$1], -, _)=yes ]) - ;; dnl + ;; ]) -AC_DEFUN([_MYSQL_SANE_VARS], [ dnl - ifelse($#, 0, [], $#, 1, [ dnl - _MYSQL_SANEVAR([$1]) dnl - ],[ dnl - _MYSQL_SANEVAR([$1]) dnl - _MYSQL_SANE_VARS(m4_shift($@)) dnl - ]) dnl +AC_DEFUN([_MYSQL_SANE_VARS], [ + ifelse($#, 0, [], $#, 1, [ + _MYSQL_SANEVAR([$1]) + ],[ + _MYSQL_SANEVAR([$1]) + _MYSQL_SANE_VARS(m4_shift($@)) + ]) ]) AC_DEFUN([_MYSQL_SANEVAR], [ - test -z "[$mysql_module_]m4_bpatsubst([$1], -, _)" && dnl + test -z "[$mysql_module_]m4_bpatsubst([$1], -, _)" && [mysql_module_]m4_bpatsubst([$1], -, _)='.' - test -z "[$with_module_]m4_bpatsubst([$1], -, _)" && dnl -[with_module_]m4_bpatsubst([$1], -, _)='.' dnl + test -z "[$with_module_]m4_bpatsubst([$1], -, _)" && +[with_module_]m4_bpatsubst([$1], -, _)='.' ]) -AC_DEFUN([_MYSQL_CHECK_DEPENDENCIES], [ dnl - ifelse($#, 0, [], $#, 1, [ dnl - _MYSQL_CHECK_DEPENDS([$1],[__mysql_plugdepends_$1__]) dnl - ],[ dnl - _MYSQL_CHECK_DEPENDS([$1],[__mysql_plugdepends_$1__]) dnl - _MYSQL_CHECK_DEPENDENCIES(m4_shift($@)) dnl - ]) dnl +AC_DEFUN([_MYSQL_CHECK_DEPENDENCIES], [ + ifelse($#, 0, [], $#, 1, [ + _MYSQL_CHECK_DEPENDS([$1],[__mysql_plugdepends_$1__]) + ],[ + _MYSQL_CHECK_DEPENDS([$1],[__mysql_plugdepends_$1__]) + _MYSQL_CHECK_DEPENDENCIES(m4_shift($@)) + ]) ]) -AC_DEFUN([_MYSQL_CHECK_DEPENDS], [ dnl +AC_DEFUN([_MYSQL_CHECK_DEPENDS], [ m4_ifdef([$2], [ if test "[$mysql_module_]m4_bpatsubst([$1], -, _)" = yes -a \ "[$with_module_]m4_bpatsubst([$1], -, _)" != no -o \ - "[$with_module_]m4_bpatsubst([$1], -, _)" = yes; then dnl + "[$with_module_]m4_bpatsubst([$1], -, _)" = yes; then _MYSQL_GEN_DEPENDS(m4_bpatsubst($2, :, [,])) - fi dnl - ]) dnl + fi + ]) ]) -AC_DEFUN([_MYSQL_GEN_DEPENDS], [ dnl - ifelse($#, 0, [], $#, 1, [ dnl - _MYSQL_GEN_DEPEND([$1]) dnl - ],[ dnl - _MYSQL_GEN_DEPEND([$1]) dnl - _MYSQL_GEN_DEPENDS(m4_shift($@)) dnl - ]) dnl +AC_DEFUN([_MYSQL_GEN_DEPENDS], [ + ifelse($#, 0, [], $#, 1, [ + _MYSQL_GEN_DEPEND([$1]) + ],[ + _MYSQL_GEN_DEPEND([$1]) + _MYSQL_GEN_DEPENDS(m4_shift($@)) + ]) ]) -AC_DEFUN([_MYSQL_GEN_DEPEND], [ dnl +AC_DEFUN([_MYSQL_GEN_DEPEND], [ m4_ifdef([MYSQL_MODULE_DISABLED_]AS_TR_CPP([$1]),[ - AC_MSG_ERROR([depends upon disabled module $1]) dnl + AC_MSG_ERROR([depends upon disabled module $1]) ],[ [mysql_module_]m4_bpatsubst([$1], -, _)=yes if test "[$with_module_]m4_bpatsubst([$1], -, _)" = no; then AC_MSG_ERROR([depends upon disabled module $1]) - fi dnl - ]) dnl + fi + ]) ]) AC_DEFUN([_MYSQL_CHECK_PLUGIN_ARGS],[ - AC_ARG_WITH([modules], [ - --with-modules=PLUGIN[[,PLUGIN..]] -m4_text_wrap([Plugin modules to include in mysqld. (default is: $1) -Must be configuration name or a comma seperated list of modules.], -[ ]) -m4_text_wrap([Available configurations are: ] -m4_bpatsubst(m4_ifdef([__mysql_metaplugin_list__], dnl -none:all:__mysql_metaplugin_list__,none:all), :, [ ])[.], -[ ]) -m4_text_wrap([Available plugin modules are: ] dnl -m4_bpatsubst(__mysql_plugin_list__, :, [ ])[.], [ ]) - --without-module-PLUGIN -m4_text_wrap([Disable the named module from being built. Otherwise, -for modules which are not selected for inclusion in mysqld will be -built dynamically (if supported)],[ ]) -],[mysql_modules="`echo $withval | tr ',.:;*[]' ' '`"], - [mysql_modules=['$1']]) + AC_ARG_WITH([modules], +AS_HELP_STRING([--with-modules=PLUGIN[[[[[,PLUGIN..]]]]]], + [Plugin modules to include in mysqld. (default is: $1) Must be a + configuration name or a comma separated list of modules.]) +AS_HELP_STRING([],[Available configurations are:] dnl +m4_bpatsubst([none:all]m4_ifdef([__mysql_metaplugin_list__], +__mysql_metaplugin_list__), :, [ ])[.]) +AS_HELP_STRING([],[Available plugin modules are:] dnl +m4_bpatsubst(__mysql_plugin_list__, :, [ ])[.]) +AS_HELP_STRING([--without-module-PLUGIN], + [Disable the named module from being built. Otherwise, for + modules which are not selected for inclusion in mysqld will be + built dynamically (if supported)]) +AS_HELP_STRING([--with-module-PLUGIN], + [Forces the named module to be linked into mysqld statically.]), + [mysql_modules="`echo $withval | tr ',.:;*[]' ' '`"], + [mysql_modules=['$1']]) m4_divert_once([HELP_VAR_END],[ Description of plugin modules: -m4_indir([MYSQL_LIST_PLUGINS]) -]) +MYSQL_LIST_PLUGINS]) case "$mysql_modules" in all ) @@ -637,20 +644,17 @@ m4_indir([MYSQL_LIST_PLUGINS]) ;; none ) mysql_modules='' - ;; dnl -m4_ifdef([__mysql_metaplugin_list__],[ dnl -_MYSQL_MODULE_META_CHECK(m4_bpatsubst(__mysql_metaplugin_list__, :, [,])) dnl + ;; +m4_ifdef([__mysql_metaplugin_list__],[ +_MYSQL_MODULE_META_CHECK(m4_bpatsubst(__mysql_metaplugin_list__, :, [,])) ]) esac for plugin in $mysql_modules; do case "$plugin" in - all ) + all | none ) AC_MSG_ERROR([bad module name: $plugin]) ;; - none ) - AC_MSG_ERROR([bad module name: $plugin]) - ;; dnl _MYSQL_MODULE_ARGS_CHECK(m4_bpatsubst(__mysql_plugin_list__, :, [,])) * ) AC_MSG_ERROR([unknown plugin module: $plugin]) @@ -675,6 +679,11 @@ AC_DEFUN([_MYSQL_POST_PLUGIN_FIXUP],[ AC_MSG_ERROR([don't know how to handle plugin dir $plugdir]) ;; esac + if test -f "$srcdir/$plugdir/configure" ; then + other_configures="$other_configures $plugdir/configure" + else + ac_config_files="$ac_config_files $plugdir/Makefile" + fi done AC_SUBST(mysql_se_dirs) AC_SUBST(mysql_pg_dirs) diff --git a/configure.in b/configure.in index 7a279cb0b39..c2e35c1b6b6 100644 --- a/configure.in +++ b/configure.in @@ -104,7 +104,6 @@ MYSQL_MODULE_ACTIONS(innobase, [ AC_SUBST(innodb_includes) AC_SUBST(innodb_libs) AC_SUBST(innodb_system_libs) - other_configures="$other_configures storage/innobase/configure" ]) MYSQL_STORAGE_ENGINE(myisam,no, [MyISAM Storage Engine], @@ -1712,7 +1711,7 @@ fi # If we should allow error injection tests AC_ARG_WITH(error-inject, - [ --with-error-inject Enable error injection in MySQL Server], + AC_HELP_STRING([--with-error-inject],[Enable error injection in MySQL Server]), [ with_error_inject=$withval ], [ with_error_inject=no ]) @@ -2338,14 +2337,14 @@ fi tools_dirs="" AC_ARG_WITH([mysqlmanager], - AC_HELP_STRING([--with-mysqlmanager], [Build the mysqlmanager binary: yes/no (default: build if server is built.)]), - [if test "x${withval}" != "xno"; then - tools_dirs="$tools_dirs server-tools" - fi], - [if test "x${with_server}" = "xyes"; then - tools_dirs="$tools_dirs server-tools" - fi] -) + AC_HELP_STRING([--with-mysqlmanager], [Build the mysqlmanager binary: yes/no (default: build if server is built.)]),,) + +if test "$with_mysqlmanager" = "yes" -o \ + '(' "$with_mysqlmanager:$with_server" = ":yes" -a \ + -d "$srcdir/server-tools" ')' ; then + tools_dirs="$tools_dirs server-tools" + AC_CONFIG_FILES(server-tools/Makefile server-tools/instance-manager/Makefile) +fi AC_SUBST(tools_dirs) @@ -2633,28 +2632,18 @@ AC_SUBST(MAKE_BINARY_DISTRIBUTION_OPTIONS) # Output results AC_CONFIG_FILES(Makefile extra/Makefile mysys/Makefile dnl - unittest/Makefile dnl - unittest/mytap/Makefile unittest/mytap/t/Makefile dnl + unittest/Makefile unittest/mytap/Makefile unittest/mytap/t/Makefile dnl unittest/mysys/Makefile unittest/examples/Makefile dnl - strings/Makefile regex/Makefile dnl - storage/Makefile dnl - storage/archive/Makefile storage/bdb/Makefile storage/blackhole/Makefile dnl - storage/csv/Makefile storage/example/Makefile storage/heap/Makefile dnl - storage/myisam/Makefile storage/myisammrg/Makefile dnl + strings/Makefile regex/Makefile storage/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/sql_builtin.cc sql-common/Makefile dnl - dbug/Makefile scripts/Makefile dnl - include/Makefile dnl - server-tools/Makefile server-tools/instance-manager/Makefile dnl + dbug/Makefile scripts/Makefile include/Makefile dnl tests/Makefile Docs/Makefile support-files/Makefile dnl support-files/MacOSX/Makefile mysql-test/Makefile dnl mysql-test/ndb/Makefile netware/Makefile dnl - include/mysql_version.h dnl - plugin/Makefile dnl - plugin/fulltext/Makefile dnl - win/Makefile) + include/mysql_version.h plugin/Makefile win/Makefile) AC_CONFIG_COMMANDS([default], , test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h) AC_OUTPUT diff --git a/plugin/Makefile.am b/plugin/Makefile.am index 8b421e0ad5a..deb73c988b3 100644 --- a/plugin/Makefile.am +++ b/plugin/Makefile.am @@ -18,10 +18,8 @@ AUTOMAKE_OPTIONS = foreign -# These are built from source in the Docs directory EXTRA_DIST = fulltext/configure.in -SUBDIRS = -DIST_SUBDIRS = . fulltext +SUBDIRS = @mysql_pg_dirs@ # Don't update the files from bitkeeper %::SCCS/s.% diff --git a/sql/Makefile.am b/sql/Makefile.am index 2665e3fcfd5..ba9b58c0c5e 100644 --- a/sql/Makefile.am +++ b/sql/Makefile.am @@ -52,10 +52,10 @@ noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \ ha_heap.h ha_myisam.h ha_myisammrg.h ha_partition.h \ ha_innodb.h ha_berkeley.h ha_federated.h \ ha_ndbcluster.h ha_ndbcluster_binlog.h \ - ha_ndbcluster_tables.h + ha_ndbcluster_tables.h \ opt_range.h protocol.h rpl_tblmap.h \ log.h sql_show.h rpl_rli.h \ - sql_select.h structs.h table.h sql_udf.h hash_filo.h\ + sql_select.h structs.h table.h sql_udf.h hash_filo.h \ lex.h lex_symbol.h sql_acl.h sql_crypt.h \ log_event.h sql_repl.h slave.h rpl_filter.h \ rpl_injector.h \ diff --git a/storage/archive/Makefile.am b/storage/archive/Makefile.am index 0920fe1a897..4263d8f2659 100644 --- a/storage/archive/Makefile.am +++ b/storage/archive/Makefile.am @@ -20,7 +20,7 @@ MYSQLDATAdir = $(localstatedir) MYSQLSHAREdir = $(pkgdatadir) MYSQLBASEdir= $(prefix) MYSQLLIBdir= $(pkglibdir) -INCLUDES = -I$(top_srcdir)/include \ +INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include \ -I$(top_srcdir)/regex \ -I$(top_srcdir)/sql \ -I$(srcdir) @ZLIB_INCLUDES@ @@ -50,9 +50,9 @@ 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 \ +archive_test_LDADD = $(top_builddir)/mysys/libmysys.a \ + $(top_builddir)/dbug/libdbug.a \ + $(top_builddir)/strings/libmystrings.a \ @ZLIB_LIBS@ archive_test_LDFLAGS = @NOINST_LDFLAGS@ diff --git a/storage/blackhole/Makefile.am b/storage/blackhole/Makefile.am index 060eaffce66..3a235bc86dd 100644 --- a/storage/blackhole/Makefile.am +++ b/storage/blackhole/Makefile.am @@ -20,7 +20,7 @@ MYSQLDATAdir = $(localstatedir) MYSQLSHAREdir = $(pkgdatadir) MYSQLBASEdir= $(prefix) MYSQLLIBdir= $(pkglibdir) -INCLUDES = -I$(top_srcdir)/include \ +INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include \ -I$(top_srcdir)/regex \ -I$(top_srcdir)/sql \ -I$(srcdir) diff --git a/storage/example/Makefile.am b/storage/example/Makefile.am index 5565c5e85fc..f97dcc09e6b 100644 --- a/storage/example/Makefile.am +++ b/storage/example/Makefile.am @@ -20,7 +20,7 @@ MYSQLDATAdir = $(localstatedir) MYSQLSHAREdir = $(pkgdatadir) MYSQLBASEdir= $(prefix) MYSQLLIBdir= $(pkglibdir) -INCLUDES = -I$(top_srcdir)/include \ +INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include \ -I$(top_srcdir)/regex \ -I$(top_srcdir)/sql \ -I$(srcdir) diff --git a/storage/innobase/Makefile.am b/storage/innobase/Makefile.am index 7a999b2f4fe..908f5d669a2 100644 --- a/storage/innobase/Makefile.am +++ b/storage/innobase/Makefile.am @@ -98,13 +98,12 @@ libinnobase.a: $(libinnobase_a_LIBADD) -rm -f $@ if test "$(host_os)" = "netware" ; \ then \ - $(libmysqld_a_AR) $@ $(libinnobase_a_LIBADD) ; \ + $(libinnobase_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 $@ ; \ + for arc in $(libinnobase_a_LIBADD); do \ + arpath=`echo $$arc|sed 's|[^/]*$$||'`; \ + $(AR) t $$arc|sed "s|^|$$arpath|"; \ + done | sort -u | xargs $(AR) cq $@ ; \ $(RANLIB) $@ ; \ fi -- cgit v1.2.1 From 506f9800bd9fed00efb7f65a3dbc6030e5cbc895 Mon Sep 17 00:00:00 2001 From: "serg@sergbook.mysql.com" <> Date: Sun, 30 Apr 2006 15:52:30 -0400 Subject: fixes --- .bzrignore | 3 ++ Makefile.am | 4 +-- config/ac-macros/plugins.m4 | 80 ++++++++++++++++++++++----------------------- configure.in | 5 +-- plugin/Makefile.am | 3 ++ plugin/fulltext/Makefile.am | 47 ++++---------------------- sql/sql_show.cc | 12 ++----- 7 files changed, 56 insertions(+), 98 deletions(-) diff --git a/.bzrignore b/.bzrignore index 751b823f1ea..cd5d285651e 100644 --- a/.bzrignore +++ b/.bzrignore @@ -1764,3 +1764,6 @@ unittest/examples/*.t unittest/mysys/*.t unittest/mytap/t/*.t unittest/unit +compile +libmysqld/sql_builtin.cc +sql/sql_builtin.cc diff --git a/Makefile.am b/Makefile.am index b9775577110..8709fca34c3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -24,11 +24,11 @@ EXTRA_DIST = INSTALL-SOURCE INSTALL-WIN-SOURCE \ SUBDIRS = . include @docs_dirs@ @zlib_dir@ \ @readline_topdir@ sql-common \ @thread_dirs@ pstack \ - @sql_union_dirs@ storage \ + @sql_union_dirs@ storage plugin \ @sql_server@ scripts @man_dirs@ tests \ netware @libmysqld_dirs@ \ mysql-test support-files @tools_dirs@ \ - plugin unittest win + unittest win DIST_SUBDIRS = $(SUBDIRS) BUILD diff --git a/config/ac-macros/plugins.m4 b/config/ac-macros/plugins.m4 index 51f83e19e5f..19b951ea467 100644 --- a/config/ac-macros/plugins.m4 +++ b/config/ac-macros/plugins.m4 @@ -32,8 +32,8 @@ AC_DEFUN([MYSQL_MODULE],[ AC_DEFUN([_MYSQL_MODULE],[ m4_ifdef([$2], [ - AC_FATAL([[Duplicate MYSQL_MODULE declaration for ]][$3]) - ],[ dnl + AC_FATAL([Duplicate MYSQL_MODULE declaration for $3]) + ],[ m4_define([$2], [$1]) _MYSQL_PLUGAPPEND([__mysql_plugin_list__],[$1]) m4_define([MYSQL_MODULE_NAME_]AS_TR_CPP([$1]), [$3]) @@ -57,13 +57,14 @@ AC_DEFUN([MYSQL_STORAGE_ENGINE],[ MYSQL_MODULE([$1], [$3], [$4], [[$5]]) MYSQL_MODULE_DEFINE([$1], [WITH_]AS_TR_CPP([$1])[_STORAGE_ENGINE]) ifelse([$2],[no],[],[ - _MYSQL_LEGACY_STORAGE_ENGINE([$1],m4_default([$2], [$1-storage-engine])) + _MYSQL_LEGACY_STORAGE_ENGINE( + m4_bpatsubst(m4_default([$2], [$1-storage-engine]), -, _)) ]) ]) AC_DEFUN([_MYSQL_LEGACY_STORAGE_ENGINE],[ -if test "[${with_]m4_bpatsubst($2, -, _)[+set}]" = set; then - [with_module_]m4_bpatsubst($1, -, _)="[$with_]m4_bpatsubst($2, -, _)" +if test "[${with_]$1[+set}]" = set; then + [with_module_]$1="[$with_]$1" fi ]) @@ -188,7 +189,7 @@ dnl --------------------------------------------------------------------------- AC_DEFUN([MYSQL_MODULE_DEPENDS],[ REQUIRE_PLUGIN([$1]) ifelse($#, 0, [], $#, 1, [ - AC_FATAL([[bad number of arguments]]) + AC_FATAL([bad number of arguments]) ], $#, 2, [ _MYSQL_MODULE_DEPEND([$1],[$2]) ],[ @@ -238,7 +239,8 @@ AC_DEFUN([MYSQL_CONFIGURE_PLUGINS],[ _MYSQL_CHECK_PLUGIN_ARGS([$1]) _MYSQL_CONFIGURE_PLUGINS(m4_bpatsubst(__mysql_plugin_list__, :, [,])) _MYSQL_DO_PLUGIN_ACTIONS(m4_bpatsubst(__mysql_plugin_list__, :, [,])) - _MYSQL_POST_PLUGIN_FIXUP() + AC_SUBST([mysql_se_dirs]) + AC_SUBST([mysql_pg_dirs]) ]) ]) ]) @@ -273,16 +275,19 @@ AC_DEFUN([_DO_MYSQL_CHECK_PLUGIN],[ AH_TEMPLATE($5, [Include ]$4[ into mysqld]) ]) AC_MSG_CHECKING([whether to use ]$3) + mysql_use_plugin_dir="" m4_ifdef([$10],[ if test "[$mysql_module_]$2" = yes -a \ "[$with_module_]$2" != no -o \ "[$with_module_]$2" = yes; then + AC_MSG_RESULT([error]) AC_MSG_ERROR([disabled]) fi AC_MSG_RESULT([no]) ],[ m4_ifdef([$9],[ if test "[$with_module_]$2" = no; then + AC_MSG_RESULT([error]) AC_MSG_ERROR([cannot disable mandatory module]) fi [mysql_module_]$2=yes @@ -295,7 +300,7 @@ AC_DEFUN([_DO_MYSQL_CHECK_PLUGIN],[ m4_ifdef([$8],[ m4_ifdef([$6],[ if test -d "$srcdir/$6" ; then - mysql_plugin_dirs="$mysql_plugin_dirs $6" + mysql_use_plugin_dir="$6" ]) AC_SUBST([plugin_]$2[_shared_target], "$8") AC_SUBST([plugin_]$2[_static_target], [""]) @@ -315,19 +320,19 @@ AC_DEFUN([_DO_MYSQL_CHECK_PLUGIN],[ m4_ifdef([$7],[ ifelse(m4_bregexp($7, [^lib[^.]+\.a$]), -2, [ m4_ifdef([$6],[ - mysql_plugin_dirs="$mysql_plugin_dirs $6" + mysql_use_plugin_dir="$6" mysql_plugin_libs="$mysql_plugin_libs -L[\$(top_builddir)]/$6" ]) mysql_plugin_libs="$mysql_plugin_libs [-l]m4_bregexp($7, [^lib\([^.]+\)], [\1])" ], m4_bregexp($7, [^\\\$]), 0, [ m4_ifdef([$6],[ - mysql_plugin_dirs="$mysql_plugin_dirs $6" + mysql_use_plugin_dir="$6" ]) mysql_plugin_libs="$mysql_plugin_libs $7" ], [ m4_ifdef([$6],[ - mysql_plugin_dirs="$mysql_plugin_dirs $6" + mysql_use_plugin_dir="$6" mysql_plugin_libs="$mysql_plugin_libs \$(top_builddir)/$6/$7" ],[ mysql_plugin_libs="$mysql_plugin_libs $7" @@ -340,7 +345,8 @@ AC_DEFUN([_DO_MYSQL_CHECK_PLUGIN],[ AC_SUBST([plugin_]$2[_shared_target], [""]) ],[ m4_ifdef([$6],[ - AC_FATAL([plugin directory specified without library for ]$3) + AC_MSG_RESULT([error]) + AC_MSG_ERROR([Plugin $1 does not support static linking]) ],[ m4_ifdef([$5],[ AC_DEFINE($5) @@ -353,6 +359,21 @@ AC_DEFUN([_DO_MYSQL_CHECK_PLUGIN],[ [with_module_]$2=yes AC_MSG_RESULT([yes]) fi + m4_ifdef([$6],[ + if test -n "$mysql_use_plugin_dir" ; then + mysql_plugin_dirs="$mysql_plugin_dirs $6" + if test -f "$srcdir/$6/configure" ; then + other_configures="$other_configures $6/configure" + else + AC_CONFIG_FILES($6/Makefile) + fi + ifelse(m4_substr($6, 0, 8), [storage/], + [mysql_se_dirs="$mysql_se_dirs ]m4_substr($6, 8)", + m4_substr($6, 0, 7), [plugin/], + [mysql_pg_dirs="$mysql_pg_dirs ]m4_substr($6, 7)", + [AC_FATAL([don't know how to handle plugin dir ]$6)]) + fi + ]) fi ]) ]) @@ -409,10 +430,10 @@ AC_DEFUN([REQUIRE_PLUGIN],[ define([_REQUIRE_PLUGIN],[ ifdef([$2],[ ifelse($2, [$1], [], [ - AC_FATAL([[Misspelt MYSQL_MODULE declaration for ]][$1]) + AC_FATAL([Misspelt MYSQL_MODULE declaration for $1]) ]) ],[ - AC_FATAL([[Missing MYSQL_MODULE declaration for ]][$1]) + AC_FATAL([Missing MYSQL_MODULE declaration for $1]) ]) ]) @@ -455,7 +476,7 @@ AC_DEFUN([_MYSQL_PLUGAPPEND],[ AC_DEFUN([_MYSQL_PLUGAPPEND_OPTS],[ ifelse($#, 0, [], $#, 1, [ - AC_FATAL([[bad number of args]]) + AC_FATAL([bad number of args]) ], $#, 2, [ _MYSQL_PLUGAPPEND_OPTONE([$1],[$2]) ],[ @@ -466,10 +487,10 @@ AC_DEFUN([_MYSQL_PLUGAPPEND_OPTS],[ AC_DEFUN([_MYSQL_PLUGAPPEND_OPTONE],[ ifelse([$2], [all], [ - AC_FATAL([[protected plugin group: all]]) + AC_FATAL([protected plugin group: all]) ],[ ifelse([$2], [none], [ - AC_FATAL([[protected plugin group: none]]) + AC_FATAL([protected plugin group: none]) ],[ _MYSQL_PLUGAPPEND([__mysql_$1_configs__],[$2]) _MYSQL_PLUGAPPEND([__mysql_]m4_bpatsubst($2, -, _)[_plugins__],[$1], [ @@ -516,7 +537,7 @@ AC_DEFUN([MYSQL_SHOW_PLUGIN],[ ]) AC_DEFUN([_MYSQL_SHOW_PLUGIN],[dnl - === Plugin: $3 === + === $3 === Module Name: [$1] Description: $4 Supports build: _PLUGIN_BUILD_TYPE([$7],[$8])[]dnl @@ -666,27 +687,4 @@ _MYSQL_MODULE_ARGS_CHECK(m4_bpatsubst(__mysql_plugin_list__, :, [,])) _MYSQL_CHECK_DEPENDENCIES(m4_bpatsubst(__mysql_plugin_list__, :, [,])) ]) -AC_DEFUN([_MYSQL_POST_PLUGIN_FIXUP],[ - for plugdir in $mysql_plugin_dirs; do - case "$plugdir" in - storage/* ) - mysql_se_dirs="$mysql_se_dirs `echo $plugdir | sed -e 's@^storage/@@'`" - ;; - plugin/* ) - mysql_pg_dirs="$mysql_pg_dirs `echo $plugdir | sed -e 's@^plugin/@@'`" - ;; - *) - AC_MSG_ERROR([don't know how to handle plugin dir $plugdir]) - ;; - esac - if test -f "$srcdir/$plugdir/configure" ; then - other_configures="$other_configures $plugdir/configure" - else - ac_config_files="$ac_config_files $plugdir/Makefile" - fi - done - AC_SUBST(mysql_se_dirs) - AC_SUBST(mysql_pg_dirs) -]) - dnl =========================================================================== diff --git a/configure.in b/configure.in index c2e35c1b6b6..78a0ea5f7b2 100644 --- a/configure.in +++ b/configure.in @@ -87,8 +87,7 @@ MYSQL_STORAGE_ENGINE(federated,,[Federated Storage Engine], MYSQL_MODULE(ftexample, [Simple Parser], [Simple full-text parser plugin]) MYSQL_MODULE_DIRECTORY(ftexample, [plugin/fulltext]) -MYSQL_MODULE_STATIC(ftexample, [libftexample.a]) -MYSQL_MODULE_DYNAMIC(ftexample, [ft_example.la]) +MYSQL_MODULE_DYNAMIC(ftexample, [mypluglib.la]) MYSQL_STORAGE_ENGINE(heap,no, [Memory Storage Engine], [In memory hashed tables]) @@ -101,8 +100,6 @@ MYSQL_MODULE_DIRECTORY(innobase, [storage/innobase]) MYSQL_MODULE_STATIC(innobase, [libinnobase.a]) MYSQL_MODULE_ACTIONS(innobase, [ AC_CHECK_LIB(rt, aio_read, [innodb_system_libs="-lrt"]) - AC_SUBST(innodb_includes) - AC_SUBST(innodb_libs) AC_SUBST(innodb_system_libs) ]) diff --git a/plugin/Makefile.am b/plugin/Makefile.am index deb73c988b3..6dee710103e 100644 --- a/plugin/Makefile.am +++ b/plugin/Makefile.am @@ -18,7 +18,10 @@ AUTOMAKE_OPTIONS = foreign +# extra plugin example files are listed here, to +# keep its Makefile.am cleaner as a template EXTRA_DIST = fulltext/configure.in + SUBDIRS = @mysql_pg_dirs@ # Don't update the files from bitkeeper diff --git a/plugin/fulltext/Makefile.am b/plugin/fulltext/Makefile.am index 331db7c98f8..4df5a1dc78a 100644 --- a/plugin/fulltext/Makefile.am +++ b/plugin/fulltext/Makefile.am @@ -1,44 +1,9 @@ #Makefile.am example for a plugin -#MYSQL_MODULE(ftexample, [Simple Parser], -# [Simple full-text parser plugin]) -#MYSQL_MODULE_DIRECTORY(ftexample, [plugin/fulltext]) -#MYSQL_MODULE_STATIC(ftexample, [libftexample.a]) -#MYSQL_MODULE_DYNAMIC(ftexample, [ft_example.la]) +pkglibdir=$(libdir)/mysql +INCLUDES= -I$(top_builddir)/include -I$(top_srcdir)/include +noinst_LTLIBRARIES= mypluglib.la +#pkglib_LTLIBRARIES= mypluglib.la +mypluglib_la_SOURCES= plugin_example.c +mypluglib_la_LDFLAGS= -module -rpath $(pkglibdir) - -#called from the top level Makefile - -MYSQLDATAdir = $(localstatedir) -MYSQLSHAREdir = $(pkgdatadir) -MYSQLBASEdir= $(prefix) -MYSQLLIBdir= $(pkglibdir) -INCLUDES = -I$(top_srcdir)/include \ - -I$(top_srcdir)/regex \ - -I$(top_srcdir)/sql \ - -I$(srcdir) -WRAPLIBS= - -LDADD = - -DEFS = @DEFS@ - -noinst_HEADERS = - -EXTRA_LTLIBRARIES = ft_example.la -pkglib_LTLIBRARIES = @plugin_ftexample_shared_target@ -ft_example_la_LDFLAGS = -module -rpath $(MYSQLLIBdir) -ft_example_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN -ft_example_la_CFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN -ft_example_la_SOURCES = plugin_example.c - - -EXTRA_LIBRARIES = libftexample.a -noinst_LIBRARIES = @plugin_ftexample_static_target@ -libftexample_a_CXXFLAGS=$(AM_CFLAGS) -libftexample_a_CFLAGS = $(AM_CFLAGS) -libftexample_a_SOURCES= plugin_example.c - - -# Don't update the files from bitkeeper -%::SCCS/s.% diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 042c0397be3..da5ed3e46f8 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -111,10 +111,6 @@ static my_bool show_plugins(THD *thd, st_plugin_int *plugin, 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); @@ -123,7 +119,7 @@ static my_bool show_plugins(THD *thd, st_plugin_int *plugin, make_version_string(version_buf, sizeof(version_buf), plug->version), cs); - + switch (plugin->state) { /* case PLUGIN_IS_FREED: does not happen */ @@ -3042,12 +3038,8 @@ static my_bool iter_schema_engines(THD *thd, st_plugin_int *plugin, 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, table); + MYSQL_STORAGE_ENGINE_PLUGIN, tables->table); } -- cgit v1.2.1 From 0736d183378695b26890e134f93113b646699cec Mon Sep 17 00:00:00 2001 From: "acurtis@xiphis.org" <> Date: Mon, 1 May 2006 21:33:09 -0700 Subject: WL#3201 post-review fixups end plugin/module naming schizophrenia fixup shell code and m4 macro comments cmakelists.txt included in EXTRA_DIST --- BUILD/SETUP.sh | 6 +- config/ac-macros/plugins.m4 | 551 ++++++++++++++++++++++-------------------- configure.in | 70 +++--- storage/archive/Makefile.am | 1 + storage/blackhole/Makefile.am | 1 + storage/csv/Makefile.am | 1 + storage/example/Makefile.am | 1 + 7 files changed, 330 insertions(+), 301 deletions(-) diff --git a/BUILD/SETUP.sh b/BUILD/SETUP.sh index d115e3c29dc..589e609beeb 100755 --- a/BUILD/SETUP.sh +++ b/BUILD/SETUP.sh @@ -147,9 +147,9 @@ static_link="$static_link --with-client-ldflags=-all-static" local_infile_configs="--enable-local-infile" -max_no_embedded_configs="$SSL_LIBRARY --with-modules=max" -max_no_ndb_configs="$SSL_LIBRARY --with-modules=max-no-ndb --with-embedded-server" -max_configs="$SSL_LIBRARY --with-modules=max --with-embedded-server" +max_no_embedded_configs="$SSL_LIBRARY --with-plugins=max" +max_no_ndb_configs="$SSL_LIBRARY --with-plugins=max-no-ndb --with-embedded-server" +max_configs="$SSL_LIBRARY --with-plugins=max --with-embedded-server" # # CPU and platform specific compilation flags. diff --git a/config/ac-macros/plugins.m4 b/config/ac-macros/plugins.m4 index 19b951ea467..0ca952c4354 100644 --- a/config/ac-macros/plugins.m4 +++ b/config/ac-macros/plugins.m4 @@ -1,45 +1,45 @@ dnl =========================================================================== -dnl Support for plugable mysql server modules +dnl Support for mysql server plugins dnl =========================================================================== dnl dnl WorkLog#3201 dnl -dnl Framework for pluggable static and dynamic modules for mysql +dnl Framework for pluggable static and dynamic plugins for mysql dnl dnl --------------------------------------------------------------------------- -dnl Macro: MYSQL_MODULE +dnl Macro: MYSQL_PLUGIN dnl -dnl Syntax: -dnl MYSQL_MODULE([name],[Plugin module name], -dnl [Plugin module description], +dnl SYNOPSIS +dnl MYSQL_PLUGIN([name],[Plugin name], +dnl [Plugin description], dnl [group,group...]) dnl -dnl What it does: -dnl First declaration for a plugin module (mandatory). -dnl Adds module as member to configuration groups (if specified) +dnl DESCRIPTION +dnl First declaration for a plugin (mandatory). +dnl Adds plugin as member to configuration groups (if specified) dnl dnl --------------------------------------------------------------------------- -AC_DEFUN([MYSQL_MODULE],[ - _MYSQL_MODULE( +AC_DEFUN([MYSQL_PLUGIN],[ + _MYSQL_PLUGIN( [$1], - [__MYSQL_MODULE_]AS_TR_CPP([$1])[__], + [__MYSQL_PLUGIN_]AS_TR_CPP([$1])[__], m4_default([$2], [$1 plugin]), m4_default([$3], [plugin for $1]), m4_default([$4], []), ) ]) -AC_DEFUN([_MYSQL_MODULE],[ +AC_DEFUN([_MYSQL_PLUGIN],[ m4_ifdef([$2], [ - AC_FATAL([Duplicate MYSQL_MODULE declaration for $3]) + AC_FATAL([Duplicate MYSQL_PLUGIN declaration for $3]) ],[ m4_define([$2], [$1]) _MYSQL_PLUGAPPEND([__mysql_plugin_list__],[$1]) - m4_define([MYSQL_MODULE_NAME_]AS_TR_CPP([$1]), [$3]) - m4_define([MYSQL_MODULE_DESC_]AS_TR_CPP([$1]), [$4]) + m4_define([MYSQL_PLUGIN_NAME_]AS_TR_CPP([$1]), [$3]) + m4_define([MYSQL_PLUGIN_DESC_]AS_TR_CPP([$1]), [$4]) ifelse([$5], [], [], [ - _MYSQL_PLUGAPPEND_OPTS([$1], $5) + _MYSQL_PLUGAPPEND_META([$1], $5) ]) ]) ]) @@ -48,14 +48,18 @@ AC_DEFUN([_MYSQL_MODULE],[ dnl --------------------------------------------------------------------------- dnl Macro: MYSQL_STORAGE_ENGINE dnl -dnl What it does: +dnl SYNOPSIS +dnl MYSQL_STORAGE_ENGINE([name],[legacy-option],[Storage engine name], +dnl [Storage engine description],[group,group...]) +dnl +dnl DESCRIPTION dnl Short cut for storage engine declarations dnl dnl --------------------------------------------------------------------------- AC_DEFUN([MYSQL_STORAGE_ENGINE],[ - MYSQL_MODULE([$1], [$3], [$4], [[$5]]) - MYSQL_MODULE_DEFINE([$1], [WITH_]AS_TR_CPP([$1])[_STORAGE_ENGINE]) + MYSQL_PLUGIN([$1], [$3], [$4], [[$5]]) + MYSQL_PLUGIN_DEFINE([$1], [WITH_]AS_TR_CPP([$1])[_STORAGE_ENGINE]) ifelse([$2],[no],[],[ _MYSQL_LEGACY_STORAGE_ENGINE( m4_bpatsubst(m4_default([$2], [$1-storage-engine]), -, _)) @@ -64,109 +68,127 @@ AC_DEFUN([MYSQL_STORAGE_ENGINE],[ AC_DEFUN([_MYSQL_LEGACY_STORAGE_ENGINE],[ if test "[${with_]$1[+set}]" = set; then - [with_module_]$1="[$with_]$1" + [with_plugin_]$1="[$with_]$1" fi ]) dnl --------------------------------------------------------------------------- -dnl Macro: MYSQL_MODULE_DEFINE +dnl Macro: MYSQL_PLUGIN_DEFINE +dnl +dnl SYNOPSIS +dnl MYSQL_PLUGIN_DEFILE([name],[MYSQL_CPP_DEFINE]) dnl -dnl What it does: -dnl When a plugin module is to be statically linked, define the C macro +dnl DESCRIPTION +dnl When a plugin is to be statically linked, define the C macro dnl dnl --------------------------------------------------------------------------- -AC_DEFUN([MYSQL_MODULE_DEFINE],[ - REQUIRE_PLUGIN([$1]) - m4_define([MYSQL_MODULE_DEFINE_]AS_TR_CPP([$1]), [$2]) +AC_DEFUN([MYSQL_PLUGIN_DEFINE],[ + MYSQL_REQUIRE_PLUGIN([$1]) + m4_define([MYSQL_PLUGIN_DEFINE_]AS_TR_CPP([$1]), [$2]) ]) dnl --------------------------------------------------------------------------- -dnl Macro: MYSQL_MODULE_DIRECTORY +dnl Macro: MYSQL_PLUGIN_DIRECTORY dnl -dnl What it does: +dnl SYNOPSIS +dnl MYSQL_PLUGIN_DIRECTORY([name],[plugin/dir]) +dnl +dnl DESCRIPTION dnl Adds a directory to the build process dnl dnl --------------------------------------------------------------------------- -AC_DEFUN([MYSQL_MODULE_DIRECTORY],[ - REQUIRE_PLUGIN([$1]) - m4_define([MYSQL_MODULE_DIRECTORY_]AS_TR_CPP([$1]), [$2]) +AC_DEFUN([MYSQL_PLUGIN_DIRECTORY],[ + MYSQL_REQUIRE_PLUGIN([$1]) + m4_define([MYSQL_PLUGIN_DIRECTORY_]AS_TR_CPP([$1]), [$2]) ]) dnl --------------------------------------------------------------------------- -dnl Macro: MYSQL_MODULE_STATIC +dnl Macro: MYSQL_PLUGIN_STATIC +dnl +dnl SYNOPSIS +dnl MYSQL_PLUGIN_STATIC([name],[libmyplugin.a]) dnl -dnl What it does: +dnl DESCRIPTION dnl Declare the name for the static library dnl dnl --------------------------------------------------------------------------- -AC_DEFUN([MYSQL_MODULE_STATIC],[ - REQUIRE_PLUGIN([$1]) - m4_define([MYSQL_MODULE_STATIC_]AS_TR_CPP([$1]), [$2]) +AC_DEFUN([MYSQL_PLUGIN_STATIC],[ + MYSQL_REQUIRE_PLUGIN([$1]) + m4_define([MYSQL_PLUGIN_STATIC_]AS_TR_CPP([$1]), [$2]) ]) dnl --------------------------------------------------------------------------- -dnl Macro: MYSQL_MODULE_DYNAMIC +dnl Macro: MYSQL_PLUGIN_DYNAMIC dnl -dnl What it does: +dnl SYNOPSIS +dnl MYSQL_PLUGIN_DYNAMIC([name],[myplugin.la]) +dnl +dnl DESCRIPTION dnl Declare the name for the shared library dnl dnl --------------------------------------------------------------------------- -AC_DEFUN([MYSQL_MODULE_DYNAMIC],[ - REQUIRE_PLUGIN([$1]) - m4_define([MYSQL_MODULE_DYNAMIC_]AS_TR_CPP([$1]), [$2]) +AC_DEFUN([MYSQL_PLUGIN_DYNAMIC],[ + MYSQL_REQUIRE_PLUGIN([$1]) + m4_define([MYSQL_PLUGIN_DYNAMIC_]AS_TR_CPP([$1]), [$2]) ]) dnl --------------------------------------------------------------------------- -dnl Macro: MYSQL_MODULE_MANDATORY +dnl Macro: MYSQL_PLUGIN_MANDATORY +dnl +dnl SYNOPSIS +dnl MYSQL_PLUGIN_MANDATORY([name]) dnl -dnl What it does: -dnl Marks the specified plugin as a mandatory module +dnl DESCRIPTION +dnl Marks the specified plugin as a mandatory plugin dnl dnl --------------------------------------------------------------------------- -AC_DEFUN([MYSQL_MODULE_MANDATORY],[ - REQUIRE_PLUGIN([$1]) - _MYSQL_MODULE_MANDATORY([$1], - [MYSQL_MODULE_MANDATORY_]AS_TR_CPP([$1]), - [MYSQL_MODULE_DISABLED_]AS_TR_CPP([$1]) +AC_DEFUN([MYSQL_PLUGIN_MANDATORY],[ + MYSQL_REQUIRE_PLUGIN([$1]) + _MYSQL_PLUGIN_MANDATORY([$1], + [MYSQL_PLUGIN_MANDATORY_]AS_TR_CPP([$1]), + [MYSQL_PLUGIN_DISABLED_]AS_TR_CPP([$1]) ) ]) -AC_DEFUN([_MYSQL_MODULE_MANDATORY],[ +AC_DEFUN([_MYSQL_PLUGIN_MANDATORY],[ m4_define([$2], [yes]) m4_ifdef([$3], [ - AC_WARNING([syntax],[Mandatory plugin $1 has been disabled]) + AC_FATAL([mandatory plugin $1 has been disabled]) m4_undefine([$2]) ]) ]) dnl --------------------------------------------------------------------------- -dnl Macro: MYSQL_MODULE_DISABLED +dnl Macro: MYSQL_PLUGIN_DISABLED dnl -dnl What it does: -dnl Marks the specified plugin as a disabled module +dnl SYNOPSIS +dnl MYSQL_PLUGIN_DISABLED([name]) +dnl +dnl DESCRIPTION +dnl Marks the specified plugin as a disabled plugin dnl dnl --------------------------------------------------------------------------- -AC_DEFUN([MYSQL_MODULE_DISABLED],[ - REQUIRE_PLUGIN([$1]) - _MYSQL_MODULE_DISABLED([$1], - [MYSQL_MODULE_DISABLED_]AS_TR_CPP([$1]), - [MYSQL_MODULE_MANDATORY_]AS_TR_CPP([$1]) +AC_DEFUN([MYSQL_PLUGIN_DISABLED],[ + MYSQL_REQUIRE_PLUGIN([$1]) + _MYSQL_PLUGIN_DISABLED([$1], + [MYSQL_PLUGIN_DISABLED_]AS_TR_CPP([$1]), + [MYSQL_PLUGIN_MANDATORY_]AS_TR_CPP([$1]) ) ]) -AC_DEFUN([_MYSQL_MODULE_DISABLED],[ +AC_DEFUN([_MYSQL_PLUGIN_DISABLED],[ m4_define([$2], [yes]) m4_ifdef([$3], [ AC_FATAL([attempt to disable mandatory plugin $1]) @@ -176,48 +198,54 @@ AC_DEFUN([_MYSQL_MODULE_DISABLED],[ dnl --------------------------------------------------------------------------- -dnl Macro: MYSQL_MODULE_DEPENDS +dnl Macro: MYSQL_PLUGIN_DEPENDS +dnl +dnl SYNOPSIS +dnl MYSQL_PLUGIN_DEPENDS([name],[prereq,prereq...]) dnl -dnl What it does: -dnl Enables other modules neccessary for this module +dnl DESCRIPTION +dnl Enables other plugins neccessary for the named plugin dnl Dependency checking is not recursive so if any -dnl required module requires further modules, list them +dnl required plugin requires further plugins, list them dnl here too! dnl dnl --------------------------------------------------------------------------- -AC_DEFUN([MYSQL_MODULE_DEPENDS],[ - REQUIRE_PLUGIN([$1]) - ifelse($#, 0, [], $#, 1, [ +AC_DEFUN([MYSQL_PLUGIN_DEPENDS],[ + MYSQL_REQUIRE_PLUGIN([$1]) + ifelse($#, 2, [ + _MYSQL_PLUGIN_DEPEND([$1], $2) + ], [ AC_FATAL([bad number of arguments]) - ], $#, 2, [ - _MYSQL_MODULE_DEPEND([$1],[$2]) - ],[ - _MYSQL_MODULE_DEPEND([$1],[$2]) - MYSQL_MODULE_DEPENDS([$1], m4_shift(m4_shift($@))) ]) ]) -AC_DEFUN([_MYSQL_MODULE_DEPEND],[ - REQUIRE_PLUGIN([$2]) - _MYSQL_PLUGAPPEND([__mysql_plugdepends_$1__],[$2]) +AC_DEFUN([_MYSQL_PLUGIN_DEPEND],[ + ifelse($#, 1, [], [$#:$2], [2:], [ + MYSQL_REQUIRE_PLUGIN([$2]) + _MYSQL_PLUGAPPEND([__mysql_plugdepends_$1__],[$2]) + _MYSQL_PLUGIN_DEPEND([$1], m4_shift(m4_shift($@))) + ]) ]) dnl --------------------------------------------------------------------------- -dnl Macro: MYSQL_MODULE_ACTIONS +dnl Macro: MYSQL_PLUGIN_ACTIONS +dnl +dnl SYNOPSIS +dnl MYSQL_PLUGIN_ACTIONS([name],[PLUGIN_CONFIGURE_STUFF]) dnl -dnl What it does: -dnl Declares additional actions required to configure the module +dnl DESCRIPTION +dnl Declares additional autoconf actions required to configure the plugin dnl dnl --------------------------------------------------------------------------- -AC_DEFUN([MYSQL_MODULE_ACTIONS],[ - REQUIRE_PLUGIN([$1]) +AC_DEFUN([MYSQL_PLUGIN_ACTIONS],[ + MYSQL_REQUIRE_PLUGIN([$1]) m4_ifdef([$2],[ - m4_define([MYSQL_MODULE_ACTIONS_]AS_TR_CPP([$1]),m4_defn([$2])) + m4_define([MYSQL_PLUGIN_ACTIONS_]AS_TR_CPP([$1]),m4_defn([$2])) ],[ - m4_define([MYSQL_MODULE_ACTIONS_]AS_TR_CPP([$1]), [$2]) + m4_define([MYSQL_PLUGIN_ACTIONS_]AS_TR_CPP([$1]), [$2]) ]) ]) @@ -225,20 +253,24 @@ AC_DEFUN([MYSQL_MODULE_ACTIONS],[ dnl --------------------------------------------------------------------------- dnl Macro: MYSQL_CONFIGURE_PLUGINS dnl -dnl What it does: -dnl Called last, emits all required shell code to configure the modules +dnl SYNOPSIS +dnl MYSQL_PLUGIN_DEPENDS([name,name...]) +dnl +dnl DESCRIPTION +dnl Used last, emits all required shell code to configure the plugins +dnl Argument is a list of default plugins or meta-plugin dnl dnl --------------------------------------------------------------------------- AC_DEFUN([MYSQL_CONFIGURE_PLUGINS],[ m4_ifdef([__mysql_plugin_configured__],[ - AC_FATAL([cannot call [MYSQL_CONFIGURE_PLUGINS] multiple times]) + AC_FATAL([cannot use [MYSQL_CONFIGURE_PLUGINS] multiple times]) ],[ m4_define([__mysql_plugin_configured__],[done]) m4_ifdef([__mysql_plugin_list__],[ _MYSQL_CHECK_PLUGIN_ARGS([$1]) _MYSQL_CONFIGURE_PLUGINS(m4_bpatsubst(__mysql_plugin_list__, :, [,])) - _MYSQL_DO_PLUGIN_ACTIONS(m4_bpatsubst(__mysql_plugin_list__, :, [,])) + _MYSQL_EMIT_PLUGIN_ACTIONS(m4_bpatsubst(__mysql_plugin_list__, :, [,])) AC_SUBST([mysql_se_dirs]) AC_SUBST([mysql_pg_dirs]) ]) @@ -247,56 +279,56 @@ AC_DEFUN([MYSQL_CONFIGURE_PLUGINS],[ AC_DEFUN([_MYSQL_CONFIGURE_PLUGINS],[ ifelse($#, 0, [], $#, 1, [ - _MYSQL_CHECK_PLUGIN([$1]) + _MYSQL_EMIT_CHECK_PLUGIN([$1]) ],[ - _MYSQL_CHECK_PLUGIN([$1]) + _MYSQL_EMIT_CHECK_PLUGIN([$1]) _MYSQL_CONFIGURE_PLUGINS(m4_shift($@)) ]) ]) -AC_DEFUN([_MYSQL_CHECK_PLUGIN],[ - _DO_MYSQL_CHECK_PLUGIN( +AC_DEFUN([_MYSQL_EMIT_CHECK_PLUGIN],[ + __MYSQL_EMIT_CHECK_PLUGIN( [$1], m4_bpatsubst([$1], -, _), - [MYSQL_MODULE_NAME_]AS_TR_CPP([$1]), - [MYSQL_MODULE_DESC_]AS_TR_CPP([$1]), - [MYSQL_MODULE_DEFINE_]AS_TR_CPP([$1]), - [MYSQL_MODULE_DIRECTORY_]AS_TR_CPP([$1]), - [MYSQL_MODULE_STATIC_]AS_TR_CPP([$1]), - [MYSQL_MODULE_DYNAMIC_]AS_TR_CPP([$1]), - [MYSQL_MODULE_MANDATORY_]AS_TR_CPP([$1]), - [MYSQL_MODULE_DISABLED_]AS_TR_CPP([$1]), - [MYSQL_MODULE_ACTIONS_]AS_TR_CPP([$1]) + [MYSQL_PLUGIN_NAME_]AS_TR_CPP([$1]), + [MYSQL_PLUGIN_DESC_]AS_TR_CPP([$1]), + [MYSQL_PLUGIN_DEFINE_]AS_TR_CPP([$1]), + [MYSQL_PLUGIN_DIRECTORY_]AS_TR_CPP([$1]), + [MYSQL_PLUGIN_STATIC_]AS_TR_CPP([$1]), + [MYSQL_PLUGIN_DYNAMIC_]AS_TR_CPP([$1]), + [MYSQL_PLUGIN_MANDATORY_]AS_TR_CPP([$1]), + [MYSQL_PLUGIN_DISABLED_]AS_TR_CPP([$1]), + [MYSQL_PLUGIN_ACTIONS_]AS_TR_CPP([$1]) ) ]) -AC_DEFUN([_DO_MYSQL_CHECK_PLUGIN],[ +AC_DEFUN([__MYSQL_EMIT_CHECK_PLUGIN],[ m4_ifdef([$5],[ AH_TEMPLATE($5, [Include ]$4[ into mysqld]) ]) AC_MSG_CHECKING([whether to use ]$3) mysql_use_plugin_dir="" m4_ifdef([$10],[ - if test "[$mysql_module_]$2" = yes -a \ - "[$with_module_]$2" != no -o \ - "[$with_module_]$2" = yes; then + if test "X[$mysql_plugin_]$2" = Xyes -a \ + "X[$with_plugin_]$2" != Xno -o \ + "X[$with_plugin_]$2" = Xyes; then AC_MSG_RESULT([error]) AC_MSG_ERROR([disabled]) fi AC_MSG_RESULT([no]) ],[ m4_ifdef([$9],[ - if test "[$with_module_]$2" = no; then + if test "X[$with_plugin_]$2" = Xno; then AC_MSG_RESULT([error]) - AC_MSG_ERROR([cannot disable mandatory module]) + AC_MSG_ERROR([cannot disable mandatory plugin]) fi - [mysql_module_]$2=yes + [mysql_plugin_]$2=yes ]) - if test "[$with_module_]$2" = no; then + if test "X[$with_plugin_]$2" = Xno; then AC_MSG_RESULT([no]) else - if test "[$mysql_module_]$2" != yes -a \ - "[$with_module_]$2" != yes; then + if test "X[$mysql_plugin_]$2" != Xyes -a \ + "X[$with_plugin_]$2" != Xyes; then m4_ifdef([$8],[ m4_ifdef([$6],[ if test -d "$srcdir/$6" ; then @@ -304,16 +336,16 @@ AC_DEFUN([_DO_MYSQL_CHECK_PLUGIN],[ ]) AC_SUBST([plugin_]$2[_shared_target], "$8") AC_SUBST([plugin_]$2[_static_target], [""]) - [with_module_]$2=yes + [with_plugin_]$2=yes AC_MSG_RESULT([plugin]) m4_ifdef([$6],[ else - [mysql_module_]$2=no + [mysql_plugin_]$2=no AC_MSG_RESULT([no]) fi ]) ],[ - [with_module_]$2=no + [with_plugin_]$2=no AC_MSG_RESULT([no]) ]) else @@ -356,7 +388,7 @@ AC_DEFUN([_DO_MYSQL_CHECK_PLUGIN],[ ]) ]) mysql_plugin_defs="$mysql_plugin_defs, [builtin_]$2[_plugin]" - [with_module_]$2=yes + [with_plugin_]$2=yes AC_MSG_RESULT([yes]) fi m4_ifdef([$6],[ @@ -378,40 +410,33 @@ AC_DEFUN([_DO_MYSQL_CHECK_PLUGIN],[ ]) ]) -AC_DEFUN([_MYSQL_DO_PLUGIN_ACTIONS],[ +AC_DEFUN([_MYSQL_EMIT_PLUGIN_ACTIONS],[ ifelse($#, 0, [], $#, 1, [ - _MYSQL_PLUGIN_ACTIONS([$1]) + _MYSQL_EMIT_PLUGIN_ACTION([$1]) ],[ - _MYSQL_PLUGIN_ACTIONS([$1]) - _MYSQL_DO_PLUGIN_ACTIONS(m4_shift($@)) + _MYSQL_EMIT_PLUGIN_ACTION([$1]) + _MYSQL_EMIT_PLUGIN_ACTIONS(m4_shift($@)) ]) ]) -AC_DEFUN([_MYSQL_PLUGIN_ACTIONS],[ - _DO_MYSQL_PLUGIN_ACTIONS( +AC_DEFUN([_MYSQL_EMIT_PLUGIN_ACTION],[ + __MYSQL_EMIT_PLUGIN_ACTION( [$1], m4_bpatsubst([$1], -, _), - [MYSQL_MODULE_NAME_]AS_TR_CPP([$1]), - [MYSQL_MODULE_DESC_]AS_TR_CPP([$1]), - [MYSQL_MODULE_DEFINE_]AS_TR_CPP([$1]), - [MYSQL_MODULE_DIRECTORY_]AS_TR_CPP([$1]), - [MYSQL_MODULE_STATIC_]AS_TR_CPP([$1]), - [MYSQL_MODULE_DYNAMIC_]AS_TR_CPP([$1]), - [MYSQL_MODULE_MANDATORY_]AS_TR_CPP([$1]), - [MYSQL_MODULE_DISABLED_]AS_TR_CPP([$1]), - [MYSQL_MODULE_ACTIONS_]AS_TR_CPP([$1]) + [MYSQL_PLUGIN_DISABLED_]AS_TR_CPP([$1]), + [MYSQL_PLUGIN_ACTIONS_]AS_TR_CPP([$1]) ) ]) -AC_DEFUN([_DO_MYSQL_PLUGIN_ACTIONS],[ - m4_ifdef([$10], [], [ - if test "[$with_module_]$2" = yes; then - if test -z "[$plugin_]$2[_static_target]" -a \ - -z "[$plugin_]$2[_shared_target]"; then +AC_DEFUN([__MYSQL_EMIT_PLUGIN_ACTION],[ + m4_ifdef([$3], [], [ + if test "X[$with_plugin_]$2" = Xyes; then + if test "X[$plugin_]$2[_static_target]" = X -a \ + "X[$plugin_]$2[_shared_target]" = X; then AC_MSG_ERROR([that's strange, $1 failed sanity check]) fi - $11 + $4 fi ]) ]) @@ -423,17 +448,23 @@ dnl Private helper macros dnl =========================================================================== -AC_DEFUN([REQUIRE_PLUGIN],[ - _REQUIRE_PLUGIN([$1], [__MYSQL_MODULE_]AS_TR_CPP([$1])[__]) +dnl SYNOPSIS +dnl MYSQL_REQUIRE_PLUGIN([name]) +dnl +dnl DESCRIPTION +dnl Checks that the specified plugin does exist + +AC_DEFUN([MYSQL_REQUIRE_PLUGIN],[ + _MYSQL_REQUIRE_PLUGIN([$1], [__MYSQL_PLUGIN_]AS_TR_CPP([$1])[__]) ]) -define([_REQUIRE_PLUGIN],[ +define([_MYSQL_REQUIRE_PLUGIN],[ ifdef([$2],[ ifelse($2, [$1], [], [ - AC_FATAL([Misspelt MYSQL_MODULE declaration for $1]) + AC_FATAL([Misspelt MYSQL_PLUGIN declaration for $1]) ]) ],[ - AC_FATAL([Missing MYSQL_MODULE declaration for $1]) + AC_FATAL([Missing MYSQL_PLUGIN declaration for $1]) ]) ]) @@ -441,19 +472,25 @@ define([_REQUIRE_PLUGIN],[ dnl --------------------------------------------------------------------------- -AC_DEFUN([_MYSQL_MODULE_META_CHECK], [ifelse($#, 0, [], $#, 1, -[_MYSQL_CHECK_PLUGIN_META([$1], [__mysql_]m4_bpatsubst($1, -, _)[_plugins__]) +dnl SYNOPSIS +dnl _MYSQL_EMIT_METAPLUGINS([name,name...]) +dnl +dnl DESCRIPTION +dnl Emits shell code for metaplugins + +AC_DEFUN([_MYSQL_EMIT_METAPLUGINS], [ifelse($#, 0, [], $#, 1, +[_MYSQL_EMIT_METAPLUGIN([$1], [__mysql_]m4_bpatsubst($1, -, _)[_plugins__]) ], -[_MYSQL_CHECK_PLUGIN_META([$1], [__mysql_]m4_bpatsubst($1, -, _)[_plugins__]) -_MYSQL_MODULE_META_CHECK(m4_shift($@))]) +[_MYSQL_EMIT_METAPLUGIN([$1], [__mysql_]m4_bpatsubst($1, -, _)[_plugins__]) +_MYSQL_EMIT_METAPLUGINS(m4_shift($@))]) ]) -AC_DEFUN([_MYSQL_CHECK_PLUGIN_META], [ +AC_DEFUN([_MYSQL_EMIT_METAPLUGIN], [ [$1] ) m4_ifdef([$2], [ - mysql_modules='m4_bpatsubst($2, :, [ ])' + mysql_plugins='m4_bpatsubst($2, :, [ ])' ],[ - mysql_modules='' + mysql_plugins='' ]) ;; ]) @@ -462,6 +499,12 @@ m4_ifdef([$2], [ dnl --------------------------------------------------------------------------- +dnl SYNOPSIS +dnl _MYSQL_PLUGAPPEND([name],[to-append]) +dnl +dnl DESCRIPTION +dnl Helper macro for appending to colon-delimited lists + AC_DEFUN([_MYSQL_PLUGAPPEND],[ m4_ifdef([$1],[ m4_define([__plugin_append_tmp__], m4_defn([$1])) @@ -474,29 +517,24 @@ AC_DEFUN([_MYSQL_PLUGAPPEND],[ ]) ]) -AC_DEFUN([_MYSQL_PLUGAPPEND_OPTS],[ - ifelse($#, 0, [], $#, 1, [ - AC_FATAL([bad number of args]) - ], $#, 2, [ - _MYSQL_PLUGAPPEND_OPTONE([$1],[$2]) - ],[ - _MYSQL_PLUGAPPEND_OPTONE([$1],[$2]) - _MYSQL_PLUGAPPEND_OPTS([$1], m4_shift(m4_shift($@))) - ]) -]) -AC_DEFUN([_MYSQL_PLUGAPPEND_OPTONE],[ - ifelse([$2], [all], [ +dnl SYNOPSIS +dnl _MYSQL_PLUGAPPEND_META([name],[meta,meta...]) +dnl +dnl DESCRIPTION +dnl Helper macro for adding plugins to meta plugins + +AC_DEFUN([_MYSQL_PLUGAPPEND_META],[ + ifelse($#, 1, [], [$#:$2], [2:], [], [$2], [all], [ AC_FATAL([protected plugin group: all]) + ], [$2], [none], [ + AC_FATAL([protected plugin group: none]) ],[ - ifelse([$2], [none], [ - AC_FATAL([protected plugin group: none]) - ],[ - _MYSQL_PLUGAPPEND([__mysql_$1_configs__],[$2]) - _MYSQL_PLUGAPPEND([__mysql_]m4_bpatsubst($2, -, _)[_plugins__],[$1], [ - _MYSQL_PLUGAPPEND([__mysql_metaplugin_list__],[$2]) - ]) + _MYSQL_PLUGAPPEND([__mysql_$1_configs__],[$2]) + _MYSQL_PLUGAPPEND([__mysql_]m4_bpatsubst($2, -, _)[_plugins__],[$1], [ + _MYSQL_PLUGAPPEND([__mysql_metaplugin_list__],[$2]) ]) + _MYSQL_PLUGAPPEND_META([$1], m4_shift(m4_shift($@))) ]) ]) @@ -504,6 +542,12 @@ AC_DEFUN([_MYSQL_PLUGAPPEND_OPTONE],[ dnl --------------------------------------------------------------------------- +dnl SYNOPSIS +dnl MYSQL_LIST_PLUGINS +dnl +dnl DESCRIPTION +dnl Emits formatted list of declared plugins + AC_DEFUN([MYSQL_LIST_PLUGINS],[dnl m4_ifdef([__mysql_plugin_list__],[dnl _MYSQL_LIST_PLUGINS(m4_bpatsubst(__mysql_plugin_list__, :, [,]))dnl @@ -523,22 +567,22 @@ AC_DEFUN([MYSQL_SHOW_PLUGIN],[ _MYSQL_SHOW_PLUGIN( [$1], [$1-plugin], - [MYSQL_MODULE_NAME_]AS_TR_CPP([$1]), - [MYSQL_MODULE_DESC_]AS_TR_CPP([$1]), - [MYSQL_MODULE_DEFINE_]AS_TR_CPP([$1]), - [MYSQL_MODULE_DIRECTORY_]AS_TR_CPP([$1]), - [MYSQL_MODULE_STATIC_]AS_TR_CPP([$1]), - [MYSQL_MODULE_DYNAMIC_]AS_TR_CPP([$1]), - [MYSQL_MODULE_MANDATORY_]AS_TR_CPP([$1]), - [MYSQL_MODULE_DISABLED_]AS_TR_CPP([$1]), - [MYSQL_MODULE_ACTIONS_]AS_TR_CPP([$1]), + [MYSQL_PLUGIN_NAME_]AS_TR_CPP([$1]), + [MYSQL_PLUGIN_DESC_]AS_TR_CPP([$1]), + [MYSQL_PLUGIN_DEFINE_]AS_TR_CPP([$1]), + [MYSQL_PLUGIN_DIRECTORY_]AS_TR_CPP([$1]), + [MYSQL_PLUGIN_STATIC_]AS_TR_CPP([$1]), + [MYSQL_PLUGIN_DYNAMIC_]AS_TR_CPP([$1]), + [MYSQL_PLUGIN_MANDATORY_]AS_TR_CPP([$1]), + [MYSQL_PLUGIN_DISABLED_]AS_TR_CPP([$1]), + [MYSQL_PLUGIN_ACTIONS_]AS_TR_CPP([$1]), __mysql_[$1]_configs__, ) ]) AC_DEFUN([_MYSQL_SHOW_PLUGIN],[dnl === $3 === - Module Name: [$1] + Plugin Name: [$1] Description: $4 Supports build: _PLUGIN_BUILD_TYPE([$7],[$8])[]dnl m4_ifdef([$12],[ @@ -557,134 +601,115 @@ AC_DEFUN([_PLUGIN_BUILD_TYPE], dnl --------------------------------------------------------------------------- -AC_DEFUN([_MYSQL_MODULE_ARGS_CHECK],[ - ifelse($#, 0, [], $#, 1, [ - _MYSQL_CHECK_PLUGIN_ARG([$1], - [MYSQL_MODULE_DISABLED_]AS_TR_CPP([$1]), - [MYSQL_MODULE_ACTIONS_]AS_TR_CPP([$1])) - ],[ - _MYSQL_CHECK_PLUGIN_ARG([$1], - [MYSQL_MODULE_DISABLED_]AS_TR_CPP([$1]), - [MYSQL_MODULE_ACTIONS_]AS_TR_CPP([$1])) - _MYSQL_MODULE_ARGS_CHECK(m4_shift($@)) - ]) -]) - -AC_DEFUN([_MYSQL_CHECK_PLUGIN_ARG],[ - m4_ifdef([$3], [], [m4_define([$3],[ ])]) +AC_DEFUN([_MYSQL_EMIT_PLUGINS],[ + ifelse($#, 0, [], [$#:$1], [1:], [], [ + m4_ifdef([MYSQL_PLUGIN_ACTIONS_]AS_TR_CPP([$1]), [], [ + m4_define([MYSQL_PLUGIN_ACTIONS_]AS_TR_CPP([$1]),[ ]) + ]) [$1] ) - m4_ifdef([$2],[ + m4_ifdef([MYSQL_PLUGIN_DISABLED_]AS_TR_CPP([$1]),[ AC_MSG_ERROR([plugin $1 is disabled]) - ],[ - [mysql_module_]m4_bpatsubst([$1], -, _)=yes - ]) + ],[ + [mysql_plugin_]m4_bpatsubst([$1], -, _)=yes + ]) ;; -]) - -AC_DEFUN([_MYSQL_SANE_VARS], [ - ifelse($#, 0, [], $#, 1, [ - _MYSQL_SANEVAR([$1]) - ],[ - _MYSQL_SANEVAR([$1]) - _MYSQL_SANE_VARS(m4_shift($@)) + _MYSQL_EMIT_PLUGINS(m4_shift($@)) ]) ]) -AC_DEFUN([_MYSQL_SANEVAR], [ - test -z "[$mysql_module_]m4_bpatsubst([$1], -, _)" && -[mysql_module_]m4_bpatsubst([$1], -, _)='.' - test -z "[$with_module_]m4_bpatsubst([$1], -, _)" && -[with_module_]m4_bpatsubst([$1], -, _)='.' -]) - -AC_DEFUN([_MYSQL_CHECK_DEPENDENCIES], [ - ifelse($#, 0, [], $#, 1, [ - _MYSQL_CHECK_DEPENDS([$1],[__mysql_plugdepends_$1__]) - ],[ - _MYSQL_CHECK_DEPENDS([$1],[__mysql_plugdepends_$1__]) - _MYSQL_CHECK_DEPENDENCIES(m4_shift($@)) +AC_DEFUN([_MYSQL_EMIT_PLUGIN_DEPENDS], [ + ifelse($#, 0, [], [$#:$1], [1:], [], [ + _MYSQL_EMIT_CHECK_DEPENDS(m4_bpatsubst([$1], -, _), + [__mysql_plugdepends_$1__]) + _MYSQL_EMIT_PLUGIN_DEPENDS(m4_shift($@)) ]) ]) -AC_DEFUN([_MYSQL_CHECK_DEPENDS], [ +AC_DEFUN([_MYSQL_EMIT_CHECK_DEPENDS], [ m4_ifdef([$2], [ - if test "[$mysql_module_]m4_bpatsubst([$1], -, _)" = yes -a \ - "[$with_module_]m4_bpatsubst([$1], -, _)" != no -o \ - "[$with_module_]m4_bpatsubst([$1], -, _)" = yes; then - _MYSQL_GEN_DEPENDS(m4_bpatsubst($2, :, [,])) + if test "X[$mysql_plugin_]$1" = Xyes -a \ + "X[$with_plugin_]$1" != Xno -o \ + "X[$with_plugin_]$1" = Xyes; then + _MYSQL_EMIT_PLUGIN_DEPENDENCIES(m4_bpatsubst($2, :, [,])) fi ]) ]) -AC_DEFUN([_MYSQL_GEN_DEPENDS], [ - ifelse($#, 0, [], $#, 1, [ - _MYSQL_GEN_DEPEND([$1]) - ],[ - _MYSQL_GEN_DEPEND([$1]) - _MYSQL_GEN_DEPENDS(m4_shift($@)) +AC_DEFUN([_MYSQL_EMIT_PLUGIN_DEPENDENCIES], [ + ifelse($#, 0, [], [ + m4_ifdef([MYSQL_PLUGIN_DISABLED_]AS_TR_CPP([$1]),[ + AC_MSG_ERROR([depends upon disabled plugin $1]) + ],[ + [mysql_plugin_]m4_bpatsubst([$1], -, _)=yes + if test "X[$with_plugin_]m4_bpatsubst([$1], -, _)" = Xno; then + AC_MSG_ERROR([depends upon disabled plugin $1]) + fi + ]) + _MYSQL_EMIT_PLUGIN_DEPENDENCIES(m4_shift($@)) ]) ]) -AC_DEFUN([_MYSQL_GEN_DEPEND], [ - m4_ifdef([MYSQL_MODULE_DISABLED_]AS_TR_CPP([$1]),[ - AC_MSG_ERROR([depends upon disabled module $1]) - ],[ - [mysql_module_]m4_bpatsubst([$1], -, _)=yes - if test "[$with_module_]m4_bpatsubst([$1], -, _)" = no; then - AC_MSG_ERROR([depends upon disabled module $1]) - fi - ]) -]) +dnl SYNOPSIS +dnl _MYSQL_CHECK_PLUGIN_ARGS([plugin],[plugin]...) +dnl +dnl DESCRIPTION +dnl Emits shell script for checking configure arguments +dnl Arguments to this macro is default value for selected plugins AC_DEFUN([_MYSQL_CHECK_PLUGIN_ARGS],[ - AC_ARG_WITH([modules], -AS_HELP_STRING([--with-modules=PLUGIN[[[[[,PLUGIN..]]]]]], - [Plugin modules to include in mysqld. (default is: $1) Must be a - configuration name or a comma separated list of modules.]) -AS_HELP_STRING([],[Available configurations are:] dnl -m4_bpatsubst([none:all]m4_ifdef([__mysql_metaplugin_list__], -__mysql_metaplugin_list__), :, [ ])[.]) -AS_HELP_STRING([],[Available plugin modules are:] dnl + __MYSQL_CHECK_PLUGIN_ARGS(m4_default([$1], [none])) +]) + +AC_DEFUN([__MYSQL_CHECK_PLUGIN_ARGS],[ + AC_ARG_WITH([plugins], +AS_HELP_STRING([--with-plugins=PLUGIN[[[[[,PLUGIN..]]]]]], + [Plugins to include in mysqld. (default is: $1) Must be a + configuration name or a comma separated list of plugins.]) +AS_HELP_STRING([], + [Available configurations are:] dnl +m4_bpatsubst([none:]m4_ifdef([__mysql_metaplugin_list__], + __mysql_metaplugin_list__:)[all], :, [ ])[.]) +AS_HELP_STRING([], + [Available plugins are:] dnl m4_bpatsubst(__mysql_plugin_list__, :, [ ])[.]) -AS_HELP_STRING([--without-module-PLUGIN], - [Disable the named module from being built. Otherwise, for - modules which are not selected for inclusion in mysqld will be +AS_HELP_STRING([--without-plugin-PLUGIN], + [Disable the named plugin from being built. Otherwise, for + plugins which are not selected for inclusion in mysqld will be built dynamically (if supported)]) -AS_HELP_STRING([--with-module-PLUGIN], - [Forces the named module to be linked into mysqld statically.]), - [mysql_modules="`echo $withval | tr ',.:;*[]' ' '`"], - [mysql_modules=['$1']]) +AS_HELP_STRING([--with-plugin-PLUGIN], + [Forces the named plugin to be linked into mysqld statically.]), + [mysql_plugins="`echo $withval | tr ',.:;*[]' ' '`"], + [mysql_plugins=['$1']]) m4_divert_once([HELP_VAR_END],[ -Description of plugin modules: +Description of plugins: MYSQL_LIST_PLUGINS]) - case "$mysql_modules" in + case "$mysql_plugins" in all ) - mysql_modules='m4_bpatsubst(__mysql_plugin_list__, :, [ ])' + mysql_plugins='m4_bpatsubst(__mysql_plugin_list__, :, [ ])' ;; none ) - mysql_modules='' + mysql_plugins='' ;; m4_ifdef([__mysql_metaplugin_list__],[ -_MYSQL_MODULE_META_CHECK(m4_bpatsubst(__mysql_metaplugin_list__, :, [,])) +_MYSQL_EMIT_METAPLUGINS(m4_bpatsubst(__mysql_metaplugin_list__, :, [,])) ]) esac - for plugin in $mysql_modules; do + for plugin in $mysql_plugins; do case "$plugin" in all | none ) - AC_MSG_ERROR([bad module name: $plugin]) + AC_MSG_ERROR([bad plugin name: $plugin]) ;; -_MYSQL_MODULE_ARGS_CHECK(m4_bpatsubst(__mysql_plugin_list__, :, [,])) +_MYSQL_EMIT_PLUGINS(m4_bpatsubst(__mysql_plugin_list__, :, [,])) * ) - AC_MSG_ERROR([unknown plugin module: $plugin]) + AC_MSG_ERROR([unknown plugin: $plugin]) ;; esac done - _MYSQL_SANE_VARS(m4_bpatsubst(__mysql_plugin_list__, :, [,])) - _MYSQL_CHECK_DEPENDENCIES(m4_bpatsubst(__mysql_plugin_list__, :, [,])) + _MYSQL_EMIT_PLUGIN_DEPENDS(m4_bpatsubst(__mysql_plugin_list__, :, [,])) ]) dnl =========================================================================== diff --git a/configure.in b/configure.in index 78a0ea5f7b2..c027e41ed7c 100644 --- a/configure.in +++ b/configure.in @@ -54,81 +54,81 @@ romanian russian serbian slovak spanish swedish ukrainian" MYSQL_STORAGE_ENGINE(archive,, [Archive Storage Engine], [Archive Storage Engine], [max,max-no-ndb]) -MYSQL_MODULE_DIRECTORY(archive, [storage/archive]) -MYSQL_MODULE_STATIC(archive, [libarchive.a]) -MYSQL_MODULE_DYNAMIC(archive, [ha_archive.la]) +MYSQL_PLUGIN_DIRECTORY(archive, [storage/archive]) +MYSQL_PLUGIN_STATIC(archive, [libarchive.a]) +MYSQL_PLUGIN_DYNAMIC(archive, [ha_archive.la]) MYSQL_STORAGE_ENGINE(berkeley, berkeley-db, [BerkeleyDB Storage Engine], [Transactional Tables using BerkeleyDB], [max,max-no-ndb]) -MYSQL_MODULE_DIRECTORY(berkeley,[storage/bdb]) -MYSQL_MODULE_STATIC(berkeley, [[\$(bdb_libs_with_path)]]) -MYSQL_MODULE_ACTIONS(berkeley, [MYSQL_SETUP_BERKELEY_DB]) +MYSQL_PLUGIN_DIRECTORY(berkeley,[storage/bdb]) +MYSQL_PLUGIN_STATIC(berkeley, [[\$(bdb_libs_with_path)]]) +MYSQL_PLUGIN_ACTIONS(berkeley, [MYSQL_SETUP_BERKELEY_DB]) MYSQL_STORAGE_ENGINE(blackhole,,[Blackhole Storage Engine], [Basic Write-only Read-never tables], [max,max-no-ndb]) -MYSQL_MODULE_DIRECTORY(blackhole, [storage/blackhole]) -MYSQL_MODULE_STATIC(blackhole, [libblackhole.a]) -MYSQL_MODULE_DYNAMIC(blackhole, [ha_blackhole.la]) +MYSQL_PLUGIN_DIRECTORY(blackhole, [storage/blackhole]) +MYSQL_PLUGIN_STATIC(blackhole, [libblackhole.a]) +MYSQL_PLUGIN_DYNAMIC(blackhole, [ha_blackhole.la]) MYSQL_STORAGE_ENGINE(csv,, [CSV Storage Engine], [Stores tables in text CSV format]) -MYSQL_MODULE_DIRECTORY(csv, [storage/csv]) -MYSQL_MODULE_STATIC(csv, [libcsv.a]) +MYSQL_PLUGIN_DIRECTORY(csv, [storage/csv]) +MYSQL_PLUGIN_STATIC(csv, [libcsv.a]) +MYSQL_PLUGIN_MANDATORY(csv) dnl Used for logging MYSQL_STORAGE_ENGINE(example,, [Example Storage Engine], [Skeleton for Storage Engines for developers], [max,max-no-ndb]) -MYSQL_MODULE_DIRECTORY(example, [storage/example]) -MYSQL_MODULE_STATIC(example, [libexample.a]) -MYSQL_MODULE_DYNAMIC(example, [ha_example.la]) +MYSQL_PLUGIN_DIRECTORY(example, [storage/example]) +MYSQL_PLUGIN_STATIC(example, [libexample.a]) +MYSQL_PLUGIN_DYNAMIC(example, [ha_example.la]) MYSQL_STORAGE_ENGINE(federated,,[Federated Storage Engine], [Connects to tables on remote MySQL servers], [max,max-no-ndb]) -MYSQL_MODULE(ftexample, [Simple Parser], +MYSQL_PLUGIN(ftexample, [Simple Parser], [Simple full-text parser plugin]) -MYSQL_MODULE_DIRECTORY(ftexample, [plugin/fulltext]) -MYSQL_MODULE_DYNAMIC(ftexample, [mypluglib.la]) +MYSQL_PLUGIN_DIRECTORY(ftexample, [plugin/fulltext]) +MYSQL_PLUGIN_DYNAMIC(ftexample, [mypluglib.la]) MYSQL_STORAGE_ENGINE(heap,no, [Memory Storage Engine], [In memory hashed tables]) -MYSQL_MODULE_DIRECTORY(heap, [storage/heap]) -MYSQL_MODULE_STATIC(heap, [libheap.a]) +MYSQL_PLUGIN_DIRECTORY(heap, [storage/heap]) +MYSQL_PLUGIN_STATIC(heap, [libheap.a]) +MYSQL_PLUGIN_MANDATORY(heap) dnl Memory tables MYSQL_STORAGE_ENGINE(innobase, innodb, [InnoDB Storage Engine], [Transactional Tables using InnoDB], [max,max-no-ndb]) -MYSQL_MODULE_DIRECTORY(innobase, [storage/innobase]) -MYSQL_MODULE_STATIC(innobase, [libinnobase.a]) -MYSQL_MODULE_ACTIONS(innobase, [ +MYSQL_PLUGIN_DIRECTORY(innobase, [storage/innobase]) +MYSQL_PLUGIN_STATIC(innobase, [libinnobase.a]) +MYSQL_PLUGIN_ACTIONS(innobase, [ AC_CHECK_LIB(rt, aio_read, [innodb_system_libs="-lrt"]) AC_SUBST(innodb_system_libs) ]) MYSQL_STORAGE_ENGINE(myisam,no, [MyISAM Storage Engine], [Traditional non-transactional MySQL tables]) -MYSQL_MODULE_DIRECTORY(myisam, [storage/myisam]) -MYSQL_MODULE_STATIC(myisam, [libmyisam.a]) +MYSQL_PLUGIN_DIRECTORY(myisam, [storage/myisam]) +MYSQL_PLUGIN_STATIC(myisam, [libmyisam.a]) +MYSQL_PLUGIN_MANDATORY(myisam) dnl Default MYSQL_STORAGE_ENGINE(myisammrg,no,[MyISAM MERGE Engine], [Merge multiple MySQL tables into one]) -MYSQL_MODULE_DIRECTORY(myisammrg,[storage/myisammrg]) -MYSQL_MODULE_STATIC(myisammrg, [libmyisammrg.a]) +MYSQL_PLUGIN_DIRECTORY(myisammrg,[storage/myisammrg]) +MYSQL_PLUGIN_STATIC(myisammrg, [libmyisammrg.a]) +MYSQL_PLUGIN_MANDATORY(myisammrg) MYSQL_STORAGE_ENGINE(ndbcluster, ndbcluster, [Cluster Storage Engine], [High Availability Clustered tables], [max]) -MYSQL_MODULE_DIRECTORY(ndbcluster,[storage/ndb]) -MYSQL_MODULE_STATIC(ndbcluster, [[\$(ndbcluster_libs) \$(ndbcluster_system_libs) \$(NDB_SCI_LIBS)]]) -MYSQL_MODULE_ACTIONS(ndbcluster,[MYSQL_SETUP_NDBCLUSTER]) +MYSQL_PLUGIN_DIRECTORY(ndbcluster,[storage/ndb]) +MYSQL_PLUGIN_STATIC(ndbcluster, [[\$(ndbcluster_libs) \$(ndbcluster_system_libs) \$(NDB_SCI_LIBS)]]) +MYSQL_PLUGIN_ACTIONS(ndbcluster,[MYSQL_SETUP_NDBCLUSTER]) MYSQL_STORAGE_ENGINE(partition, partition, [Partition Support], [MySQL Partitioning Support], [max,max-no-ndb]) -MYSQL_MODULE_MANDATORY(csv) dnl Used for logging -MYSQL_MODULE_MANDATORY(heap) dnl Memory tables -MYSQL_MODULE_MANDATORY(myisam) dnl Default -MYSQL_MODULE_MANDATORY(myisammrg) - dnl -- ndbcluster requires partition to be enabled -MYSQL_MODULE_DEPENDS(ndbcluster, partition) +MYSQL_PLUGIN_DEPENDS(ndbcluster, [partition]) + ##### ##### diff --git a/storage/archive/Makefile.am b/storage/archive/Makefile.am index 4263d8f2659..85577f406da 100644 --- a/storage/archive/Makefile.am +++ b/storage/archive/Makefile.am @@ -57,5 +57,6 @@ archive_test_LDADD = $(top_builddir)/mysys/libmysys.a \ archive_test_LDFLAGS = @NOINST_LDFLAGS@ +EXTRA_DIST = cmakelists.txt # Don't update the files from bitkeeper %::SCCS/s.% diff --git a/storage/blackhole/Makefile.am b/storage/blackhole/Makefile.am index 3a235bc86dd..902d57c1668 100644 --- a/storage/blackhole/Makefile.am +++ b/storage/blackhole/Makefile.am @@ -47,5 +47,6 @@ libblackhole_a_CFLAGS = $(AM_CFLAGS) libblackhole_a_SOURCES= ha_blackhole.cc +EXTRA_DIST = cmakelists.txt # Don't update the files from bitkeeper %::SCCS/s.% diff --git a/storage/csv/Makefile.am b/storage/csv/Makefile.am index 0d3fd654745..a2afeba137f 100644 --- a/storage/csv/Makefile.am +++ b/storage/csv/Makefile.am @@ -41,5 +41,6 @@ noinst_LIBRARIES = @plugin_csv_static_target@ libcsv_a_CXXFLAGS = $(AM_CFLAGS) libcsv_a_SOURCES = ha_tina.cc +EXTRA_DIST = cmakelists.txt # Don't update the files from bitkeeper %::SCCS/s.% diff --git a/storage/example/Makefile.am b/storage/example/Makefile.am index f97dcc09e6b..9c4bedb2160 100644 --- a/storage/example/Makefile.am +++ b/storage/example/Makefile.am @@ -47,5 +47,6 @@ libexample_a_CFLAGS = $(AM_CFLAGS) libexample_a_SOURCES= ha_example.cc +EXTRA_DIST = cmakelists.txt # Don't update the files from bitkeeper %::SCCS/s.% -- cgit v1.2.1