List:Commits« Previous MessageNext Message »
From:antony Date:February 2 2006 9:45pm
Subject:bk commit into 5.1 tree (acurtis:1.2128)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of antony. When antony does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2128 06/02/02 13:45:24 acurtis@stripped +17 -0
  Build enhancements and build support for plugin storage engines

  BUILD/compile-amd64-debug
    1.1 06/02/02 13:45:18 acurtis@stripped +13 -0
    New BitKeeper file ``BUILD/compile-amd64-debug''

  storage/archive/ha_archive.h
    1.42 06/02/02 13:45:18 acurtis@stripped +2 -2
    support plugin

  storage/archive/ha_archive.cc
    1.78 06/02/02 13:45:18 acurtis@stripped +44 -17
    support plugin

  BUILD/compile-amd64-debug
    1.0 06/02/02 13:45:18 acurtis@stripped +0 -0
    BitKeeper file /home/antony/work2/mysql-5.1-plugable.4/BUILD/compile-amd64-debug

  storage/innobase/Makefile.am
    1.10 06/02/02 13:45:17 acurtis@stripped +29 -0
    consolidate libraries

  storage/example/ha_example.cc
    1.32 06/02/02 13:45:17 acurtis@stripped +5 -1
    support plugin

  storage/example/Makefile.am
    1.5 06/02/02 13:45:17 acurtis@stripped +13 -4
    support plugin

  storage/csv/ha_tina.cc
    1.34 06/02/02 13:45:17 acurtis@stripped +4 -1
    support plugin

  storage/csv/Makefile.am
    1.6 06/02/02 13:45:17 acurtis@stripped +9 -4
    support plugin

  storage/archive/Makefile.am
    1.2 06/02/02 13:45:17 acurtis@stripped +37 -7
    support plugin

  sql/sql_plugin.cc
    1.11 06/02/02 13:45:17 acurtis@stripped +51 -12
    handlerton initialization/finalization

  sql/mysqld.cc
    1.528 06/02/02 13:45:17 acurtis@stripped +13 -11
    storage engines must be initialized before use

  sql/handler.h
    1.188 06/02/02 13:45:17 acurtis@stripped +3 -1
    handlerton initialization/finalization

  sql/handler.cc
    1.214 06/02/02 13:45:17 acurtis@stripped +73 -53
    handlerton initialization/finalization
    handle legacy_db_type better

  sql/ha_innodb.cc
    1.254 06/02/02 13:45:17 acurtis@stripped +1 -0
    missing NULL

  sql/Makefile.am
    1.130 06/02/02 13:45:17 acurtis@stripped +2 -2
    archive has a new home

  configure.in
    1.336 06/02/02 13:45:17 acurtis@stripped +40 -67
    configure changes - Makefiles are always built in example, archive and csv 

  config/ac-macros/storage.m4
    1.5 06/02/02 13:45:17 acurtis@stripped +24 -9
    support plugin storage engine

  storage/archive/ha_archive.cc
    1.77 06/02/02 10:00:26 acurtis@stripped +0 -0
    Rename: sql/ha_archive.cc -> storage/archive/ha_archive.cc

  storage/archive/ha_archive.h
    1.41 06/02/02 10:00:23 acurtis@stripped +0 -0
    Rename: sql/ha_archive.h -> storage/archive/ha_archive.h

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	acurtis
# Host:	localhost.(none)
# Root:	/home/antony/work2/mysql-5.1-plugable.4

--- 1.335/configure.in	2006-02-01 04:33:31 -08:00
+++ 1.336/configure.in	2006-02-02 13:45:17 -08:00
@@ -660,6 +660,46 @@
 AC_TYPE_SIZE_T
 
 #--------------------------------------------------------------------
+# Check for requested features
+#--------------------------------------------------------------------
+
+MYSQL_CHECK_BIG_TABLES
+MYSQL_CHECK_MAX_INDEXES
+MYSQL_CHECK_REPLICATION
+
+
+MYSQL_STORAGE_ENGINE(example,,,,,,storage/example,,
+ \$(top_builddir)/storage/example/libexample.a,yes)
+AC_CONFIG_FILES(storage/example/Makefile)
+
+MYSQL_STORAGE_ENGINE(archive,,,,,,storage/archive,,
+ \$(top_builddir)/storage/archive/libarchive.a,yes)
+AC_CONFIG_FILES(storage/archive/Makefile)
+
+MYSQL_STORAGE_ENGINE(csv,,,,,tina_hton,storage/csv,,
+  \$(top_builddir)/storage/csv/libcsv.a,yes)
+AC_CONFIG_FILES(storage/csv/Makefile)
+
+MYSQL_STORAGE_ENGINE(blackhole)
+MYSQL_STORAGE_ENGINE(federated)
+MYSQL_STORAGE_ENGINE(ndbcluster,,ndbcluster,,,,storage/ndb,,,,[
+  MYSQL_SETUP_NDBCLUSTER
+])
+MYSQL_STORAGE_ENGINE(partition,,partition)
+MYSQL_STORAGE_ENGINE(berkeley,,berkeley-db,,,,storage/bdb,,,,[
+  MYSQL_SETUP_BERKELEY_DB
+])
+MYSQL_STORAGE_ENGINE(innobase,,innodb,,,,storage/innobase,ha_innodb.o,
+ \$(top_builddir)/storage/innobase/libinnodb.a,,[
+  AC_CHECK_LIB(rt, aio_read, [innodb_system_libs="-lrt"])
+  AC_SUBST(innodb_includes)
+  AC_SUBST(innodb_libs)
+  AC_SUBST(innodb_system_libs)
+  other_configures="$other_configures storage/innobase/configure"
+])
+
+
+#--------------------------------------------------------------------
 # Check for system header files
 #--------------------------------------------------------------------
 
@@ -2384,73 +2424,6 @@
 AC_SUBST(readline_basedir)
 AC_SUBST(readline_link)
 AC_SUBST(readline_h_ln_cmd)
-
-MYSQL_CHECK_BIG_TABLES
-MYSQL_CHECK_MAX_INDEXES
-MYSQL_CHECK_REPLICATION
-
-MYSQL_STORAGE_ENGINE(innobase,,innodb,,,,storage/innobase,ha_innodb.o,[ dnl
-  \$(top_builddir)/storage/innobase/usr/libusr.a dnl
-  \$(top_builddir)/storage/innobase/srv/libsrv.a dnl
-  \$(top_builddir)/storage/innobase/dict/libdict.a dnl
-  \$(top_builddir)/storage/innobase/que/libque.a dnl
-  \$(top_builddir)/storage/innobase/srv/libsrv.a dnl
-  \$(top_builddir)/storage/innobase/ibuf/libibuf.a dnl
-  \$(top_builddir)/storage/innobase/row/librow.a dnl
-  \$(top_builddir)/storage/innobase/pars/libpars.a dnl
-  \$(top_builddir)/storage/innobase/btr/libbtr.a dnl
-  \$(top_builddir)/storage/innobase/trx/libtrx.a dnl
-  \$(top_builddir)/storage/innobase/read/libread.a dnl
-  \$(top_builddir)/storage/innobase/usr/libusr.a dnl
-  \$(top_builddir)/storage/innobase/buf/libbuf.a dnl
-  \$(top_builddir)/storage/innobase/ibuf/libibuf.a dnl
-  \$(top_builddir)/storage/innobase/eval/libeval.a dnl
-  \$(top_builddir)/storage/innobase/log/liblog.a dnl
-  \$(top_builddir)/storage/innobase/fsp/libfsp.a dnl
-  \$(top_builddir)/storage/innobase/fut/libfut.a dnl
-  \$(top_builddir)/storage/innobase/fil/libfil.a dnl
-  \$(top_builddir)/storage/innobase/lock/liblock.a dnl
-  \$(top_builddir)/storage/innobase/mtr/libmtr.a dnl
-  \$(top_builddir)/storage/innobase/page/libpage.a dnl
-  \$(top_builddir)/storage/innobase/rem/librem.a dnl
-  \$(top_builddir)/storage/innobase/thr/libthr.a dnl
-  \$(top_builddir)/storage/innobase/sync/libsync.a dnl
-  \$(top_builddir)/storage/innobase/data/libdata.a dnl
-  \$(top_builddir)/storage/innobase/mach/libmach.a dnl
-  \$(top_builddir)/storage/innobase/ha/libha.a dnl
-  \$(top_builddir)/storage/innobase/dyn/libdyn.a dnl
-  \$(top_builddir)/storage/innobase/mem/libmem.a dnl
-  \$(top_builddir)/storage/innobase/sync/libsync.a dnl
-  \$(top_builddir)/storage/innobase/ut/libut.a dnl
-  \$(top_builddir)/storage/innobase/os/libos.a dnl
-  \$(top_builddir)/storage/innobase/ut/libut.a],[
-  AC_CHECK_LIB(rt, aio_read, [innodb_system_libs="-lrt"])
-  AC_SUBST(innodb_includes)
-  AC_SUBST(innodb_libs)
-  AC_SUBST(innodb_system_libs)
-  other_configures="$other_configures storage/innobase/configure"
-])
-
-MYSQL_STORAGE_ENGINE(berkeley,,berkeley-db,,,,storage/bdb,,,[
-  MYSQL_SETUP_BERKELEY_DB
-])
-MYSQL_STORAGE_ENGINE(example,,,,,no,storage/example,,,[
-  AC_CONFIG_FILES(storage/example/Makefile)
-])
-MYSQL_STORAGE_ENGINE(archive,,,,,,storage/archive,,
- \$(top_builddir)/storage/archive/libarchive.a, [
-  AC_CONFIG_FILES(storage/archive/Makefile)
-])
-MYSQL_STORAGE_ENGINE(csv,,,"yes",,tina_hton,storage/csv,no,
-  \$(top_builddir)/storage/csv/libcsv.a,[
-  AC_CONFIG_FILES(storage/csv/Makefile)
-])
-MYSQL_STORAGE_ENGINE(blackhole)
-MYSQL_STORAGE_ENGINE(federated)
-MYSQL_STORAGE_ENGINE(ndbcluster,,ndbcluster,,,,storage/ndb,,,[
-  MYSQL_SETUP_NDBCLUSTER
-])
-MYSQL_STORAGE_ENGINE(partition,,partition)
 
 # If we have threads generate some library functions and test programs
 sql_server_dirs=

--- 1.129/sql/Makefile.am	2006-01-20 03:54:22 -08:00
+++ 1.130/sql/Makefile.am	2006-02-02 13:45:17 -08:00
@@ -102,8 +102,8 @@
                         event_executor.cc event.cc event_timed.cc \
 			sql_plugin.cc sql_binlog.cc \
 			handlerton.cc sql_tablespace.cc
-EXTRA_mysqld_SOURCES =	ha_innodb.cc ha_berkeley.cc ha_archive.cc \
-			ha_innodb.h  ha_berkeley.h  ha_archive.h \
+EXTRA_mysqld_SOURCES =	ha_innodb.cc ha_berkeley.cc \
+			ha_innodb.h  ha_berkeley.h  \
 			ha_blackhole.cc ha_federated.cc ha_ndbcluster.cc \
 			ha_blackhole.h  ha_federated.h  ha_ndbcluster.h \
 			ha_ndbcluster_binlog.cc ha_ndbcluster_binlog.h \

--- 1.213/sql/handler.cc	2006-01-19 13:40:51 -08:00
+++ 1.214/sql/handler.cc	2006-02-02 13:45:17 -08:00
@@ -44,6 +44,7 @@
 #endif
 
 extern handlerton *sys_table_types[];
+static handlerton *installed_htons[128];
 
 #define BITMAP_STACKBUF_SIZE (128/8)
 
@@ -63,8 +64,9 @@
   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
   NULL, NULL, NULL,
   create_default,
-  NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-  HTON_NO_FLAGS
+  NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+  HTON_NO_FLAGS,
+  NULL, NULL,
 };
 
 static SHOW_COMP_OPTION have_yes= SHOW_OPTION_YES;
@@ -133,30 +135,8 @@
 }
 
 
-struct plugin_find_dbtype_st
-{
-  enum legacy_db_type db_type;
-  handlerton *hton;
-};
-
-
-static my_bool plugin_find_dbtype(THD *unused, st_plugin_int *plugin,
-                                  void *arg)
-{
-  handlerton *types= (handlerton *) plugin->plugin->info;
-  if (types->db_type == ((struct plugin_find_dbtype_st *)arg)->db_type)
-  {
-    ((struct plugin_find_dbtype_st *)arg)->hton= types;
-    return TRUE;
-  }
-  return FALSE;
-}
-
-
 const char *ha_get_storage_engine(enum legacy_db_type db_type)
 {
-  struct plugin_find_dbtype_st info;
-  
   switch (db_type)
   {
   case DB_TYPE_DEFAULT:
@@ -164,13 +144,10 @@
   case DB_TYPE_UNKNOWN:
     return "UNKNOWN";
   default:
-    info.db_type= db_type;
-
-    if (!plugin_foreach(NULL, plugin_find_dbtype, 
-                        MYSQL_STORAGE_ENGINE_PLUGIN, &info))
+    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;
   }
 }
 
@@ -185,8 +162,6 @@
 
 handlerton *ha_resolve_by_legacy_type(THD *thd, enum legacy_db_type db_type)
 {
-  struct plugin_find_dbtype_st info;
-
   switch (db_type)
   {
   case DB_TYPE_DEFAULT:
@@ -197,12 +172,9 @@
   case DB_TYPE_UNKNOWN:
     return NULL;
   default:
-    info.db_type= db_type;
-    if (!plugin_foreach(NULL, plugin_find_dbtype, 
-                        MYSQL_STORAGE_ENGINE_PLUGIN, &info))
+    if (db_type > DB_TYPE_UNKNOWN && db_type < DB_TYPE_DEFAULT)
+      return installed_htons[db_type];
       return NULL;
-
-    return info.hton;
   }
 }
 
@@ -387,32 +359,77 @@
 }
 
 
-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 */
@@ -429,7 +446,7 @@
 {
   if (plugin->state == PLUGIN_IS_UNINITIALIZED)
   {
-    ha_initialize_handlerton((handlerton *) plugin->plugin->info);
+    ha_initialize_handlerton(plugin);
     plugin->state= PLUGIN_IS_READY;
   }
   return FALSE;
@@ -442,12 +459,15 @@
   handlerton **types;
   show_table_alias_st *table_alias;
   total_ha= savepoint_alloc_size= 0;
+  DBUG_ENTER("ha_init");
+
+  bzero(installed_htons, sizeof(installed_htons));
 
   if (ha_init_errors())
-    return 1;
+    DBUG_RETURN(1);
 
   if (plugin_foreach(NULL, init_handlerton, MYSQL_STORAGE_ENGINE_PLUGIN, 0))
-    return 1;
+    DBUG_RETURN(1);
 
   DBUG_ASSERT(total_ha < MAX_HA);
   /*
@@ -457,7 +477,7 @@
   */
   opt_using_transactions= total_ha>(ulong)opt_bin_log;
   savepoint_alloc_size+= sizeof(SAVEPOINT);
-  return error;
+  DBUG_RETURN(error);
 }
 
 

--- 1.187/sql/handler.h	2006-02-01 05:52:27 -08:00
+++ 1.188/sql/handler.h	2006-02-02 13:45:17 -08:00
@@ -237,6 +237,7 @@
   DB_TYPE_BLACKHOLE_DB,
   DB_TYPE_PARTITION_DB,
   DB_TYPE_BINLOG,
+  DB_TYPE_FIRST_DYNAMIC=32,
   DB_TYPE_DEFAULT=127 // Must be last
 };
 
@@ -1947,7 +1948,8 @@
 /* basic stuff */
 int ha_init(void);
 int ha_register_builtin_plugins();
-int ha_initialize_handlerton(handlerton *hton);
+int ha_initialize_handlerton(st_plugin_int *plugin);
+int ha_finalize_handlerton(st_plugin_int *plugin);
 
 TYPELIB *ha_known_exts(void);
 int ha_panic(enum ha_panic_function flag);

--- 1.527/sql/mysqld.cc	2006-01-30 04:31:18 -08:00
+++ 1.528/sql/mysqld.cc	2006-02-02 13:45:17 -08:00
@@ -3085,6 +3085,19 @@
     }
   }
 
+  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)
     opt_old_log_format= TRUE;
@@ -3250,17 +3263,6 @@
       INSERT ... SELECT. This will change when we have row level logging.
     */
     using_update_log=1;
-  }
-
-  if (xid_cache_init())
-  {
-    sql_print_error("Out of memory");
-    unireg_abort(1);
-  }
-  if (ha_init())
-  {
-    sql_print_error("Can't init databases");
-    unireg_abort(1);
   }
 
   /*

--- 1.4/config/ac-macros/storage.m4	2006-01-19 13:40:51 -08:00
+++ 1.5/config/ac-macros/storage.m4	2006-02-02 13:45:17 -08:00
@@ -23,7 +23,12 @@
 m4_default([$7], []),                     dnl path to the code
 m4_default([$8], [ha_$1.o]),             dnl path to the handler in
 m4_default([$9], []),                    dnl path to extra libraries
-[$10],                                     dnl code-if-set
+m4_default([$10], no),                    dnl plugin support
+[$11],                                    dnl code-if-set
+[lib$1.a],                                dnl path to the handler in
+[ha_$1][_static_target],
+[ha_$1.la],                               dnl path to the handler in
+[ha_$1][_shared_target],
 )])
 
 AC_DEFUN([_MYSQL_STORAGE_ENGINE],
@@ -33,22 +38,32 @@
 AC_CACHE_CHECK([whether to use $2], [mysql_cv_use_]m4_bpatsubst([$3], -, _),
 [mysql_cv_use_]m4_bpatsubst([$3], -, _)=[$with_]m4_bpatsubst([$3], -, _))
 AH_TEMPLATE([$5], [Build $2])
-if test "[$mysql_cv_use_]m4_bpatsubst([$3], -, _)" != no; then
-if test "$6" != "no"
-then
+if test "[$mysql_cv_use_]m4_bpatsubst([$3], -, _)" != "no"; then
+[$13]=""
+[$15]=""
+if test "[$mysql_cv_use_]m4_bpatsubst([$3], -, _)" == "plugin"; then
+  if test "$10" == "yes"; then
+    mysql_se_plugins="$mysql_se_plugins $7"
+    [$15]="$14"
+  else
+    AC_MSG_ERROR([$2 is not available as a plugin.])
+  fi
+elif test "[$mysql_cv_use_]m4_bpatsubst([$3], -, _)" == "yes"; then
   AC_DEFINE([$5])
   mysql_se_decls="${mysql_se_decls},$6"
   mysql_se_htons="${mysql_se_htons},&$6"
-  if test "$8" != "no"
-  then
+  if test "$10" != "yes"; then
     mysql_se_objs="$mysql_se_objs $8"
   fi
   mysql_se_dirs="$mysql_se_dirs $7"
   mysql_se_libs="$mysql_se_libs $9"
-else
-  mysql_se_plugins="$mysql_se_plugins $7"
+  [$13]="$12"
+elif test "[$mysql_cv_use_]m4_bpatsubst([$3], -, _)" != "no"; then
+  AC_MSG_ERROR([Invalid option for --with-$3. See the Installation chapter in the Reference Manual.])
 fi
-$10
+AC_SUBST([$13])
+AC_SUBST([$15])
+$11
 fi
 ])
 
--- New file ---
+++ BUILD/compile-amd64-debug	06/02/02 13:45:18
#! /bin/sh

path=`dirname $0`
. "$path/SETUP.sh" $@ --with-debug=full

extra_flags="$amd64_cflags $debug_cflags"
c_warnings="$c_warnings $debug_extra_warnings"
cxx_warnings="$cxx_warnings $debug_extra_warnings"
extra_configs="$amd64_configs $debug_configs "

extra_configs="$extra_configs"

. "$path/FINISH.sh"


--- 1.5/storage/csv/Makefile.am	2006-01-19 13:40:51 -08:00
+++ 1.6/storage/csv/Makefile.am	2006-02-02 13:45:17 -08:00
@@ -24,15 +24,20 @@
 			-I$(top_srcdir)/regex \
 			-I$(top_srcdir)/sql \
                         -I$(srcdir)
-
-pkglib_LIBRARIES =	libcsv.a
-
 LDADD =
 
 DEFS =	@DEFS@
+noinst_HEADERS	  =	ha_tina.h
+
+EXTRA_LTLIBRARIES =	ha_csv.la
+pkglib_LTLIBRARIES =	@ha_csv_shared_target@
+ha_csv_la_LDFLAGS =	-module -rpath $(MYSQLLIBdir)
+ha_csv_la_CXXFLAGS =	$(AM_CFLAGS) -DMYSQL_PLUGIN
+ha_csv_la_SOURCES =	ha_tina.cc
 
+EXTRA_LIBRARIES =	libcsv.a
+noinst_LIBRARIES =	@ha_csv_static_target@
 libcsv_a_CXXFLAGS =	$(AM_CFLAGS)
-noinst_HEADERS = 	ha_tina.h
 libcsv_a_SOURCES =	ha_tina.cc
 
 # Don't update the files from bitkeeper

--- 1.4/storage/example/Makefile.am	2006-01-05 05:16:22 -08:00
+++ 1.5/storage/example/Makefile.am	2006-02-02 13:45:17 -08:00
@@ -26,15 +26,24 @@
                         -I$(srcdir)
 WRAPLIBS=
 
-pkglib_LTLIBRARIES =	ha_example.la
+LDADD =
+
+DEFS =                  @DEFS@
 
-ha_example_la_LDFLAGS =	-module
 noinst_HEADERS	      =	ha_example.h
+
+EXTRA_LTLIBRARIES =	ha_example.la
+pkglib_LTLIBRARIES =	@ha_example_shared_target@
+ha_example_la_LDFLAGS =	-module -rpath $(MYSQLLIBdir)
+ha_example_la_CXXFLAGS=	$(AM_CFLAGS) -DMYSQL_PLUGIN
 ha_example_la_SOURCES =	ha_example.cc
 
-LDADD =
 
-DEFS =                  -DMYSQL_SERVER @DEFS@
+EXTRA_LIBRARIES =	libexample.a
+noinst_LIBRARIES =	@ha_example_static_target@
+libexample_a_CXXFLAGS =	$(AM_CFLAGS)
+libexample_a_SOURCES =	ha_example.cc
+
 
 # Don't update the files from bitkeeper
 %::SCCS/s.%

--- 1.76/sql/ha_archive.cc	2006-01-30 04:09:02 -08:00
+++ 1.78/storage/archive/ha_archive.cc	2006-02-02 13:45:18 -08:00
@@ -19,10 +19,15 @@
 #endif
 
 #include "mysql_priv.h"
+#include <myisam.h>
 
 #include "ha_archive.h"
 #include <my_dir.h>
 
+#ifdef MYSQL_PLUGIN
+#include <plugin.h>
+#endif
+
 /*
   First, if you want to understand storage engines you should look at 
   ha_example.cc and ha_example.h. 
@@ -148,7 +153,7 @@
   SHOW_OPTION_YES,
   "Archive storage engine", 
   DB_TYPE_ARCHIVE_DB,
-  archive_db_init,
+  (bool (*)())archive_db_init,
   0,       /* slot */
   0,       /* savepoint size. */
   NULL,    /* close_connection */
@@ -172,7 +177,8 @@
   NULL,    /* Show status */
   NULL,    /* Partition flags */
   NULL,    /* Alter table flags */
-  NULL,    /* Alter interface */
+  NULL,    /* Alter tablespace */
+  NULL,    /* fill FILES table */
   HTON_NO_FLAGS
 };
 
@@ -204,9 +210,11 @@
     TRUE        Error
 */
 
-bool archive_db_init()
+int archive_db_init()
 {
   DBUG_ENTER("archive_db_init");
+  if (archive_inited)
+    DBUG_RETURN(FALSE);
   if (pthread_mutex_init(&archive_mutex, MY_MUTEX_INIT_FAST))
     goto error;
   if (hash_init(&archive_open_tables, system_charset_info, 32, 0, 0,
@@ -220,7 +228,6 @@
     DBUG_RETURN(FALSE);
   }
 error:
-  have_archive_db= SHOW_OPTION_DISABLED;	// If we couldn't use handler
   DBUG_RETURN(TRUE);
 }
 
@@ -228,14 +235,14 @@
   Release the archive handler.
 
   SYNOPSIS
-    archive_db_end()
+    archive_db_done()
     void
 
   RETURN
     FALSE       OK
 */
 
-int archive_db_end(ha_panic_function type)
+int archive_db_done()
 {
   if (archive_inited)
   {
@@ -246,6 +253,12 @@
   return 0;
 }
 
+
+int archive_db_end(ha_panic_function type)
+{
+  return archive_db_done();
+}
+
 ha_archive::ha_archive(TABLE_SHARE *table_arg)
   :handler(&archive_hton, table_arg), delayed_insert(0), bulk_insert(0)
 {
@@ -716,7 +729,7 @@
   if (share->crashed)
       DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE);
 
-  statistic_increment(table->in_use->status_var.ha_write_count, &LOCK_status);
+  ha_statistic_increment(&SSV::ha_write_count);
   if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT)
     table->timestamp_field->set_time();
   pthread_mutex_lock(&share->mutex);
@@ -1028,8 +1041,7 @@
     DBUG_RETURN(HA_ERR_END_OF_FILE);
   scan_rows--;
 
-  statistic_increment(table->in_use->status_var.ha_read_rnd_next_count,
-		      &LOCK_status);
+  ha_statistic_increment(&SSV::ha_read_rnd_next_count);
   current_position= aztell(&archive);
   rc= get_row(&archive, buf);
 
@@ -1065,8 +1077,7 @@
 int ha_archive::rnd_pos(byte * buf, byte *pos)
 {
   DBUG_ENTER("ha_archive::rnd_pos");
-  statistic_increment(table->in_use->status_var.ha_read_rnd_next_count,
-		      &LOCK_status);
+  ha_statistic_increment(&SSV::ha_read_rnd_next_count);
   current_position= (my_off_t)my_get_ptr(pos, ref_length);
   (void)azseek(&archive, current_position, SEEK_SET);
 
@@ -1225,8 +1236,8 @@
     */
 
     if ((lock_type >= TL_WRITE_CONCURRENT_INSERT &&
-         lock_type <= TL_WRITE) && !thd->in_lock_tables
-        && !thd->tablespace_op)
+         lock_type <= TL_WRITE) && !thd_in_lock_tables(thd)
+        && !thd_tablespace_op(thd))
       lock_type = TL_WRITE_ALLOW_WRITE;
 
     /* 
@@ -1237,7 +1248,7 @@
       concurrent inserts to t2. 
     */
 
-    if (lock_type == TL_READ_NO_INSERT && !thd->in_lock_tables) 
+    if (lock_type == TL_READ_NO_INSERT && !thd_in_lock_tables(thd)) 
       lock_type = TL_READ;
 
     lock.type=lock_type;
@@ -1346,11 +1357,11 @@
 {
   int rc= 0;
   byte *buf; 
-  const char *old_proc_info=thd->proc_info;
+  const char *old_proc_info;
   ha_rows count= share->rows_recorded;
   DBUG_ENTER("ha_archive::check");
 
-  thd->proc_info= "Checking table";
+  old_proc_info= thd_proc_info(thd, "Checking table");
   /* Flush any waiting data */
   azflush(&(share->archive_write), Z_SYNC_FLUSH);
 
@@ -1374,7 +1385,7 @@
 
   my_free((char*)buf, MYF(0));
 
-  thd->proc_info= old_proc_info;
+  thd_proc_info(thd, old_proc_info);
 
   if ((rc && rc != HA_ERR_END_OF_FILE) || count)  
   {
@@ -1406,3 +1417,19 @@
     DBUG_RETURN(HA_ADMIN_OK);
   }
 }
+
+
+#ifdef MYSQL_PLUGIN
+mysql_declare_plugin
+{
+  MYSQL_STORAGE_ENGINE_PLUGIN,
+  &archive_hton,
+  archive_hton.name,
+  "Brian Aker, MySQL AB",
+  "Archive Storage Engine",
+  archive_db_init, /* Plugin Init */
+  archive_db_done, /* Plugin Deinit */
+  0x0100 /* 1.0 */,
+}
+mysql_declare_plugin_end;
+#endif

--- 1.40/sql/ha_archive.h	2006-01-11 22:58:57 -08:00
+++ 1.42/storage/archive/ha_archive.h	2006-02-02 13:45:18 -08:00
@@ -19,7 +19,7 @@
 #endif
 
 #include <zlib.h>
-#include "../storage/archive/azlib.h"
+#include "azlib.h"
 
 /*
   Please read ha_archive.cc first. If you are looking for more general
@@ -125,6 +125,6 @@
   bool check_and_repair(THD *thd);
 };
 
-bool archive_db_init(void);
+int archive_db_init(void);
 int archive_db_end(ha_panic_function type);
 

--- 1.33/storage/csv/ha_tina.cc	2006-01-27 19:16:19 -08:00
+++ 1.34/storage/csv/ha_tina.cc	2006-02-02 13:45:17 -08:00
@@ -51,7 +51,9 @@
 #include "ha_tina.h"
 #include <sys/mman.h>
 
+#ifdef MYSQL_PLUGIN
 #include <plugin.h>
+#endif
 
 /* Stuff for shares */
 pthread_mutex_t tina_mutex;
@@ -1018,6 +1020,7 @@
   DBUG_RETURN(0);
 }
 
+#ifdef MYSQL_PLUGIN
 mysql_declare_plugin
 {
   MYSQL_STORAGE_ENGINE_PLUGIN,
@@ -1030,4 +1033,4 @@
   0x0100 /* 1.0 */,
 }
 mysql_declare_plugin_end;
-
+#endif

--- 1.31/storage/example/ha_example.cc	2006-02-01 16:02:05 -08:00
+++ 1.32/storage/example/ha_example.cc	2006-02-02 13:45:17 -08:00
@@ -70,7 +70,9 @@
 #include "mysql_priv.h"
 #include "ha_example.h"
 
+#ifdef MYSQL_PLUGIN
 #include <plugin.h>
+#endif
 
 static handler* example_create_handler(TABLE_SHARE *table);
 static int example_init_func();
@@ -726,6 +728,8 @@
   DBUG_RETURN(0);
 }
 
+
+#ifdef MYSQL_PLUGIN
 mysql_declare_plugin
 {
   MYSQL_STORAGE_ENGINE_PLUGIN,
@@ -738,4 +742,4 @@
   0x0001 /* 0.1 */,
 }
 mysql_declare_plugin_end;
-
+#endif

--- 1.1/storage/archive/Makefile.am	2005-12-22 19:49:59 -08:00
+++ 1.2/storage/archive/Makefile.am	2006-02-02 13:45:17 -08:00
@@ -14,18 +14,48 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-INCLUDES =		-I$(top_builddir)/include -I$(top_srcdir)/include \
-			@ZLIB_INCLUDES@
+#called from the top level Makefile
 
-LDADD =			libarchive.a $(top_srcdir)/mysys/libmysys.a \
+MYSQLDATAdir =          $(localstatedir)
+MYSQLSHAREdir =         $(pkgdatadir)
+MYSQLBASEdir=           $(prefix)
+MYSQLLIBdir=            $(pkglibdir)
+INCLUDES =              -I$(top_srcdir)/include \
+			-I$(top_srcdir)/regex \
+			-I$(top_srcdir)/sql \
+                        -I$(srcdir) @ZLIB_INCLUDES@
+WRAPLIBS=
+
+LDADD =
+
+DEFS =                  @DEFS@
+
+noinst_HEADERS =	ha_archive.h azlib.h
+noinst_PROGRAMS	=	archive_test
+
+EXTRA_LTLIBRARIES =	ha_archive.la
+pkglib_LTLIBRARIES =	@ha_archive_shared_target@
+ha_archive_la_LDFLAGS =	-module -rpath $(MYSQLLIBdir)
+ha_archive_la_CXXFLAGS=	$(AM_CFLAGS) -DMYSQL_PLUGIN
+ha_archive_la_CFLAGS =	$(AM_CFLAGS)
+ha_archive_la_SOURCES =	ha_archive.cc azio.c
+
+
+EXTRA_LIBRARIES =	libarchive.a
+noinst_LIBRARIES =	@ha_archive_static_target@
+libarchive_a_CXXFLAGS =	$(AM_CFLAGS)
+libarchive_a_CFLAGS =	$(AM_CFLAGS)
+libarchive_a_SOURCES =	ha_archive.cc azio.c
+
+
+archive_test_SOURCES =	archive_test.c azio.c
+archive_test_CFLAGS =	$(AM_CFLAGS)
+archive_test_LDADD =	$(top_srcdir)/mysys/libmysys.a \
 			$(top_srcdir)/dbug/libdbug.a \
 			$(top_srcdir)/strings/libmystrings.a \
 			@ZLIB_LIBS@
-pkglib_LIBRARIES =	libarchive.a
-noinst_PROGRAMS	=	archive_test
 archive_test_LDFLAGS = @NOINST_LDFLAGS@
-noinst_HEADERS =	azlib.h
-libarchive_a_SOURCES =	azio.c
+
 
 # Don't update the files from bitkeeper
 %::SCCS/s.%

--- 1.9/storage/innobase/Makefile.am	2005-12-16 03:45:37 -08:00
+++ 1.10/storage/innobase/Makefile.am	2006-02-02 13:45:17 -08:00
@@ -78,5 +78,34 @@
 		include/ut0mem.h include/ut0mem.ic include/ut0rnd.h include/ut0rnd.ic \
 		include/ut0sort.h include/ut0ut.h include/ut0ut.ic
 
+noinst_LIBRARIES =	libinnodb.a
+libinnodb_a_LIBADD =	usr/libusr.a srv/libsrv.a dict/libdict.a \
+			que/libque.a srv/libsrv.a ibuf/libibuf.a \
+			row/librow.a pars/libpars.a btr/libbtr.a \
+			trx/libtrx.a read/libread.a usr/libusr.a \
+			buf/libbuf.a ibuf/libibuf.a eval/libeval.a \
+			log/liblog.a fsp/libfsp.a fut/libfut.a \
+			fil/libfil.a lock/liblock.a mtr/libmtr.a \
+			page/libpage.a rem/librem.a thr/libthr.a \
+			sync/libsync.a data/libdata.a mach/libmach.a \
+			ha/libha.a dyn/libdyn.a mem/libmem.a \
+			ut/libut.a os/libos.a ut/libut.a
+libinnodb_a_SOURCES =	
+
+
+libinnodb.a:		$(libinnodb_a_LIBADD)
+		-rm -f $@
+		if test "$(host_os)" = "netware" ; \
+		then \
+		  $(libmysqld_a_AR) $@ $(libinnodb_a_LIBADD) ; \
+		else \
+		  (for arc in $(libinnodb_a_LIBADD); do \
+		    arpath=`echo $$arc|sed 's|[^/]*$$||'`; \
+		    $(AR) t $$arc|xargs -n 1 find $$arpath -name; \
+		    $(AR) t $$arc|xargs -n 1 find `dirname $$arpath` -path \*/`basename $$arpath`/\* -name; \
+		  done ) | sort -u | xargs $(AR) cq $@ ; \
+		  $(RANLIB) $@	; \
+		fi
+
 # Don't update the files from bitkeeper
 %::SCCS/s.%

--- 1.253/sql/ha_innodb.cc	2006-02-01 16:35:09 -08:00
+++ 1.254/sql/ha_innodb.cc	2006-02-02 13:45:17 -08:00
@@ -237,6 +237,7 @@
   innobase_show_status,		/* Show status */
   NULL,                         /* Partition flags */
   NULL,                         /* Alter table flags */
+  NULL,                         /* Alter tablespace */
   NULL,                         /* Fill FILES table */
   HTON_NO_FLAGS
 };

--- 1.10/sql/sql_plugin.cc	2006-01-07 05:49:42 -08:00
+++ 1.11/sql/sql_plugin.cc	2006-02-02 13:45:17 -08:00
@@ -517,7 +517,7 @@
   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);
@@ -535,6 +535,53 @@
   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;
@@ -818,18 +865,10 @@
     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);
Thread
bk commit into 5.1 tree (acurtis:1.2128)antony2 Feb