List:Commits« Previous MessageNext Message »
From:antony Date:January 24 2006 12:04am
Subject:bk commit into 5.1 tree (acurtis:1.2069)
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.2069 06/01/23 16:04:32 acurtis@stripped +23 -0
  plugable fixes

  storage/innobase/Makefile.am
    1.10 06/01/23 16:04:28 acurtis@stripped +29 -0
    consolidate libraries

  storage/example/ha_example.cc
    1.31 06/01/23 16:04:28 acurtis@stripped +5 -1
    plugable

  storage/example/Makefile.am
    1.5 06/01/23 16:04:28 acurtis@stripped +13 -4
    plugable

  storage/csv/ha_tina.cc
    1.33 06/01/23 16:04:28 acurtis@stripped +4 -1
    plugable

  storage/csv/Makefile.am
    1.6 06/01/23 16:04:28 acurtis@stripped +9 -4
    pluggable

  storage/archive/ha_archive.h
    1.42 06/01/23 16:04:28 acurtis@stripped +2 -2
    plugable

  storage/archive/ha_archive.cc
    1.77 06/01/23 16:04:28 acurtis@stripped +42 -16
    plugable

  storage/archive/Makefile.am
    1.2 06/01/23 16:04:27 acurtis@stripped +37 -7
    pluggable

  sql/sql_plugin.cc
    1.11 06/01/23 16:04:27 acurtis@stripped +51 -12
    pluggable init/deinit

  sql/log.cc
    1.189 06/01/23 16:04:27 acurtis@stripped +3 -1
    fix compiler warnings

  sql/handler.h
    1.184 06/01/23 16:04:27 acurtis@stripped +3 -1
    pluggable

  sql/handler.cc
    1.214 06/01/23 16:04:27 acurtis@stripped +68 -50
    fix compiler warnings
    pluggable

  sql/ha_partition.cc
    1.24 06/01/23 16:04:27 acurtis@stripped +3 -1
    fix compiler warnings

  sql/ha_myisammrg.cc
    1.79 06/01/23 16:04:27 acurtis@stripped +3 -1
    fix compiler warnings

  sql/ha_myisam.cc
    1.171 06/01/23 16:04:27 acurtis@stripped +3 -1
    fix compiler warnings

  sql/ha_innodb.cc
    1.251 06/01/23 16:04:27 acurtis@stripped +4 -1
    fix compiler warnings

  sql/ha_heap.cc
    1.80 06/01/23 16:04:27 acurtis@stripped +3 -1
    fix compiler warnings

  sql/ha_federated.cc
    1.50 06/01/23 16:04:27 acurtis@stripped +3 -1
    fix compiler warnings

  sql/ha_blackhole.cc
    1.27 06/01/23 16:04:27 acurtis@stripped +3 -1
    fix compiler warnings

  sql/ha_berkeley.cc
    1.169 06/01/23 16:04:27 acurtis@stripped +3 -1
    fix compiler warnings

  sql/Makefile.am
    1.129 06/01/23 16:04:27 acurtis@stripped +2 -2
    ha_archive has moved

  configure.in
    1.334 06/01/23 16:04:27 acurtis@stripped +40 -67
    pluggable

  config/ac-macros/storage.m4
    1.5 06/01/23 16:04:27 acurtis@stripped +24 -9
    pluggable

  storage/archive/ha_archive.h
    1.41 06/01/23 14:05:42 acurtis@stripped +0 -0
    Rename: sql/ha_archive.h -> storage/archive/ha_archive.h

  storage/archive/ha_archive.cc
    1.76 06/01/23 14:05:42 acurtis@stripped +0 -0
    Rename: sql/ha_archive.cc -> storage/archive/ha_archive.cc

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

--- 1.333/configure.in	2006-01-20 07:36:57 -08:00
+++ 1.334/configure.in	2006-01-23 16:04:27 -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/archive/libexample.a,yes,[
+  AC_CONFIG_FILES(storage/example/Makefile)
+])
+MYSQL_STORAGE_ENGINE(archive,,,,,,storage/archive,,
+ \$(top_builddir)/storage/archive/libarchive.a,yes,[
+  AC_CONFIG_FILES(storage/archive/Makefile)
+])
+MYSQL_STORAGE_ENGINE(csv,,,,,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.128/sql/Makefile.am	2006-01-13 08:04:32 -08:00
+++ 1.129/sql/Makefile.am	2006-01-23 16:04:27 -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.168/sql/ha_berkeley.cc	2006-01-16 23:37:22 -08:00
+++ 1.169/sql/ha_berkeley.cc	2006-01-23 16:04:27 -08:00
@@ -152,7 +152,9 @@
   NULL, /* Partition flags */
   NULL, /* Alter table flags */
   NULL, /* Alter Tablespace */
-  HTON_CLOSE_CURSORS_AT_COMMIT | HTON_FLUSH_AFTER_RENAME
+  HTON_CLOSE_CURSORS_AT_COMMIT | HTON_FLUSH_AFTER_RENAME,
+  NULL, /* Binlog operations */
+  NULL, /* Binlog log query */
 };
 
 handler *berkeley_create_handler(TABLE_SHARE *table)

--- 1.79/sql/ha_heap.cc	2006-01-16 23:37:22 -08:00
+++ 1.80/sql/ha_heap.cc	2006-01-23 16:04:27 -08:00
@@ -57,7 +57,9 @@
   NULL,    /* Partition flags */
   NULL,    /* Alter table flags */
   NULL,    /* Alter Tablespace */
-  HTON_CAN_RECREATE
+  HTON_CAN_RECREATE,
+  NULL,    /* Binlog operations */
+  NULL,    /* Binlog log query */
 };
 
 static handler *heap_create_handler(TABLE_SHARE *table)

--- 1.170/sql/ha_myisam.cc	2006-01-19 13:40:51 -08:00
+++ 1.171/sql/ha_myisam.cc	2006-01-23 16:04:27 -08:00
@@ -89,7 +89,9 @@
   NULL,    /* Partition flags */
   NULL,    /* Alter table flags */
   NULL,    /* Alter Tablespace */
-  HTON_CAN_RECREATE
+  HTON_CAN_RECREATE,
+  NULL,    /* Binlog operations */
+  NULL,    /* Binlog log query */
 };
 
 

--- 1.78/sql/ha_myisammrg.cc	2006-01-16 23:37:23 -08:00
+++ 1.79/sql/ha_myisammrg.cc	2006-01-23 16:04:27 -08:00
@@ -67,7 +67,9 @@
   NULL,    /* Partition flags */
   NULL,    /* Alter table flags */
   NULL,    /* Alter Tablespace */
-  HTON_CAN_RECREATE
+  HTON_CAN_RECREATE,
+  NULL,    /* Binlog operations */
+  NULL,    /* Binlog log query */
 };
 
 static handler *myisammrg_create_handler(TABLE_SHARE *table)

--- 1.213/sql/handler.cc	2006-01-19 13:40:51 -08:00
+++ 1.214/sql/handler.cc	2006-01-23 16:04:27 -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,76 @@
 }
 
 
-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])
+      {
+        uint32 crc, idx;
+        const uchar nul= 0;
+
+        crc= crc32(0, (const uchar *)plugin->name.str, plugin->name.length);
+
+        idx= (crc % (127 - 32)) + 32;
+        while (installed_htons[idx])
+          idx= ((idx - 31) % (127 - 32)) + 32;
+
+        if (hton->db_type != DB_TYPE_UNKNOWN)
+          sql_print_warning("Storage engine '%s' has conflicting typecode. "
+                            "Assigning value %d.", hton->name, idx);
+        hton->db_type= (enum legacy_db_type) idx;
+      }
+      installed_htons[hton->db_type]= hton;
       break;
     }
     /* fall through */
@@ -429,7 +445,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,6 +458,8 @@
   handlerton **types;
   show_table_alias_st *table_alias;
   total_ha= savepoint_alloc_size= 0;
+
+  bzero(installed_htons, sizeof(installed_htons));
 
   if (ha_init_errors())
     return 1;

--- 1.183/sql/handler.h	2006-01-19 13:40:51 -08:00
+++ 1.184/sql/handler.h	2006-01-23 16:04:27 -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
 };
 
@@ -1787,7 +1788,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.188/sql/log.cc	2006-01-20 04:50:49 -08:00
+++ 1.189/sql/log.cc	2006-01-23 16:04:27 -08:00
@@ -101,7 +101,9 @@
   NULL,                         /* Partition flags */
   NULL,                         /* Alter table flags */
   NULL,                         /* Alter Tablespace */
-  HTON_NOT_USER_SELECTABLE | HTON_HIDDEN
+  HTON_NOT_USER_SELECTABLE | HTON_HIDDEN,
+  NULL,                         /* Binlog operations */
+  NULL,                         /* Binlog log query */
 };
 
 

--- 1.4/config/ac-macros/storage.m4	2006-01-19 13:40:51 -08:00
+++ 1.5/config/ac-macros/storage.m4	2006-01-23 16:04:27 -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
 ])
 

--- 1.5/storage/csv/Makefile.am	2006-01-19 13:40:51 -08:00
+++ 1.6/storage/csv/Makefile.am	2006-01-23 16:04:28 -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-01-23 16:04:28 -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.75/sql/ha_archive.cc	2006-01-16 23:37:21 -08:00
+++ 1.77/storage/archive/ha_archive.cc	2006-01-23 16:04:28 -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 */
@@ -204,9 +209,11 @@
     TRUE        Error
 */
 
-bool archive_db_init()
+int archive_db_init()
 {
   DBUG_ENTER("archive_db_init");
+  if (archive_inited)
+    DBUG_RETURN(FALSE);
   if (pthread_mutex_init(&archive_mutex, MY_MUTEX_INIT_FAST))
     goto error;
   if (hash_init(&archive_open_tables, system_charset_info, 32, 0, 0,
@@ -220,7 +227,6 @@
     DBUG_RETURN(FALSE);
   }
 error:
-  have_archive_db= SHOW_OPTION_DISABLED;	// If we couldn't use handler
   DBUG_RETURN(TRUE);
 }
 
@@ -228,14 +234,14 @@
   Release the archive handler.
 
   SYNOPSIS
-    archive_db_end()
+    archive_db_done()
     void
 
   RETURN
     FALSE       OK
 */
 
-int archive_db_end(ha_panic_function type)
+int archive_db_done()
 {
   if (archive_inited)
   {
@@ -246,6 +252,12 @@
   return 0;
 }
 
+
+int archive_db_end(ha_panic_function type)
+{
+  return archive_db_done();
+}
+
 ha_archive::ha_archive(TABLE_SHARE *table_arg)
   :handler(&archive_hton, table_arg), delayed_insert(0), bulk_insert(0)
 {
@@ -716,7 +728,7 @@
   if (share->crashed)
       DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE);
 
-  statistic_increment(table->in_use->status_var.ha_write_count, &LOCK_status);
+  ha_statistic_increment(&SSV::ha_write_count);
   if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT)
     table->timestamp_field->set_time();
   pthread_mutex_lock(&share->mutex);
@@ -1028,8 +1040,7 @@
     DBUG_RETURN(HA_ERR_END_OF_FILE);
   scan_rows--;
 
-  statistic_increment(table->in_use->status_var.ha_read_rnd_next_count,
-		      &LOCK_status);
+  ha_statistic_increment(&SSV::ha_read_rnd_next_count);
   current_position= aztell(&archive);
   rc= get_row(&archive, buf);
 
@@ -1065,8 +1076,7 @@
 int ha_archive::rnd_pos(byte * buf, byte *pos)
 {
   DBUG_ENTER("ha_archive::rnd_pos");
-  statistic_increment(table->in_use->status_var.ha_read_rnd_next_count,
-		      &LOCK_status);
+  ha_statistic_increment(&SSV::ha_read_rnd_next_count);
   current_position= (my_off_t)my_get_ptr(pos, ref_length);
   (void)azseek(&archive, current_position, SEEK_SET);
 
@@ -1225,8 +1235,8 @@
     */
 
     if ((lock_type >= TL_WRITE_CONCURRENT_INSERT &&
-         lock_type <= TL_WRITE) && !thd->in_lock_tables
-        && !thd->tablespace_op)
+         lock_type <= TL_WRITE) && !thd_in_lock_tables(thd)
+        && !thd_tablespace_op(thd))
       lock_type = TL_WRITE_ALLOW_WRITE;
 
     /* 
@@ -1237,7 +1247,7 @@
       concurrent inserts to t2. 
     */
 
-    if (lock_type == TL_READ_NO_INSERT && !thd->in_lock_tables) 
+    if (lock_type == TL_READ_NO_INSERT && !thd_in_lock_tables(thd)) 
       lock_type = TL_READ;
 
     lock.type=lock_type;
@@ -1346,11 +1356,11 @@
 {
   int rc= 0;
   byte *buf; 
-  const char *old_proc_info=thd->proc_info;
+  const char *old_proc_info;
   ha_rows count= share->rows_recorded;
   DBUG_ENTER("ha_archive::check");
 
-  thd->proc_info= "Checking table";
+  old_proc_info= thd_proc_info(thd, "Checking table");
   /* Flush any waiting data */
   azflush(&(share->archive_write), Z_SYNC_FLUSH);
 
@@ -1374,7 +1384,7 @@
 
   my_free((char*)buf, MYF(0));
 
-  thd->proc_info= old_proc_info;
+  thd_proc_info(thd, old_proc_info);
 
   if ((rc && rc != HA_ERR_END_OF_FILE) || count)  
   {
@@ -1406,3 +1416,19 @@
     DBUG_RETURN(HA_ADMIN_OK);
   }
 }
+
+
+#ifdef MYSQL_PLUGIN
+mysql_declare_plugin
+{
+  MYSQL_STORAGE_ENGINE_PLUGIN,
+  &archive_hton,
+  archive_hton.name,
+  "Brian Aker, MySQL AB",
+  "Archive Storage Engine",
+  archive_db_init, /* Plugin Init */
+  archive_db_done, /* Plugin Deinit */
+  0x0100 /* 1.0 */,
+}
+mysql_declare_plugin_end;
+#endif

--- 1.40/sql/ha_archive.h	2006-01-11 22:58:57 -08:00
+++ 1.42/storage/archive/ha_archive.h	2006-01-23 16:04:28 -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.32/storage/csv/ha_tina.cc	2006-01-22 13:51:35 -08:00
+++ 1.33/storage/csv/ha_tina.cc	2006-01-23 16:04:28 -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;
@@ -1017,6 +1019,7 @@
   DBUG_RETURN(0);
 }
 
+#ifdef MYSQL_PLUGIN
 mysql_declare_plugin
 {
   MYSQL_STORAGE_ENGINE_PLUGIN,
@@ -1029,4 +1032,4 @@
   0x0100 /* 1.0 */,
 }
 mysql_declare_plugin_end;
-
+#endif

--- 1.30/storage/example/ha_example.cc	2006-01-16 23:37:30 -08:00
+++ 1.31/storage/example/ha_example.cc	2006-01-23 16:04:28 -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();
@@ -725,6 +727,8 @@
   DBUG_RETURN(0);
 }
 
+
+#ifdef MYSQL_PLUGIN
 mysql_declare_plugin
 {
   MYSQL_STORAGE_ENGINE_PLUGIN,
@@ -737,4 +741,4 @@
   0x0001 /* 0.1 */,
 }
 mysql_declare_plugin_end;
-
+#endif

--- 1.26/sql/ha_blackhole.cc	2006-01-16 23:37:22 -08:00
+++ 1.27/sql/ha_blackhole.cc	2006-01-23 16:04:27 -08:00
@@ -60,7 +60,9 @@
   NULL,    /* Partition flags */
   NULL,    /* Alter table flags */
   NULL,    /* Alter Tablespace */
-  HTON_CAN_RECREATE
+  HTON_CAN_RECREATE,
+  NULL,    /* Binlog operations */
+  NULL,    /* Binlog log query */
 };
 
 

--- 1.1/storage/archive/Makefile.am	2005-12-22 19:49:59 -08:00
+++ 1.2/storage/archive/Makefile.am	2006-01-23 16:04:27 -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-01-23 16:04:28 -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.250/sql/ha_innodb.cc	2006-01-16 23:37:22 -08:00
+++ 1.251/sql/ha_innodb.cc	2006-01-23 16:04:27 -08:00
@@ -237,7 +237,10 @@
   innobase_show_status,		/* Show status */
   NULL,                         /* Partition flags */
   NULL,                         /* Alter table flags */
-  HTON_NO_FLAGS
+  NULL,                         /* Alter tablespace */
+  HTON_NO_FLAGS,
+  NULL,                         /* Binlog operations */
+  NULL,                         /* Binlog log query */
 };
 
 

--- 1.10/sql/sql_plugin.cc	2006-01-07 05:49:42 -08:00
+++ 1.11/sql/sql_plugin.cc	2006-01-23 16:04:27 -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);

--- 1.23/sql/ha_partition.cc	2006-01-18 07:25:48 -08:00
+++ 1.24/sql/ha_partition.cc	2006-01-23 16:04:27 -08:00
@@ -101,7 +101,9 @@
   partition_flags, /* Partition flags */
   alter_table_flags, /* Partition flags */
   NULL, /* Alter Tablespace */
-  HTON_NOT_USER_SELECTABLE | HTON_HIDDEN
+  HTON_NOT_USER_SELECTABLE | HTON_HIDDEN,
+  NULL, /* Binlog operations */
+  NULL, /* Binlog log query */
 };
 
 /*

--- 1.49/sql/ha_federated.cc	2006-01-16 23:37:22 -08:00
+++ 1.50/sql/ha_federated.cc	2006-01-23 16:04:27 -08:00
@@ -397,7 +397,9 @@
   NULL,    /* Partition flags */
   NULL,    /* Alter table flags */
   NULL,    /* Alter Tablespace */
-  HTON_ALTER_NOT_SUPPORTED
+  HTON_ALTER_NOT_SUPPORTED,
+  NULL,    /* Binlog operations */
+  NULL,    /* Binlog log query */
 };
 
 
Thread
bk commit into 5.1 tree (acurtis:1.2069)antony24 Jan