List:Commits« Previous MessageNext Message »
From:antony Date:January 7 2006 8:44pm
Subject:bk commit into 5.1 tree (acurtis:1.2047)
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.2047 06/01/07 12:43:49 acurtis@stripped +19 -0
  Configure cleanups and changes
  Allow for Archive, 

  storage/innobase/Makefile.am
    1.10 06/01/07 12:43:35 acurtis@stripped +29 -0
    Rather than have lots of libraries, generate one library for all of Innodb

  storage/example/ha_example.cc
    1.29 06/01/07 12:43:35 acurtis@stripped +5 -1
    allow to be built both as plugin or as static

  storage/example/Makefile.am
    1.5 06/01/07 12:43:35 acurtis@stripped +14 -5
    Single makefile for both plugin and static builds

  storage/csv/ha_tina.cc
    1.28 06/01/07 12:43:35 acurtis@stripped +9 -10
    allow to be built both as plugin or as static

  storage/csv/Makefile.am
    1.5 06/01/07 12:43:35 acurtis@stripped +12 -4
    Single makefile for both plugin and static builds

  storage/archive/ha_archive.h
    1.37 06/01/07 12:43:35 acurtis@stripped +2 -2
    allow to be built both as plugin or as static

  storage/archive/ha_archive.cc
    1.72 06/01/07 12:43:35 acurtis@stripped +42 -16
    allow to be built both as plugin or as static

  storage/archive/Makefile.am
    1.2 06/01/07 12:43:34 acurtis@stripped +38 -8
    Single makefile for both plugin and static builds

  sql/sql_plugin.cc
    1.9 06/01/07 12:43:34 acurtis@stripped +41 -4
    Add code for uninstalling storage engines (currently not really possible
    due to ref-counting issues)

  sql/sql_lex.h
    1.214 06/01/07 12:43:34 acurtis@stripped +6 -0
    Don't bother including all the types when not building mysqld

  sql/sql_class.h
    1.281 06/01/07 12:43:34 acurtis@stripped +5 -1
    Don't bother including all the types when not building mysqld

  sql/sql_class.cc
    1.232 06/01/07 12:43:34 acurtis@stripped +20 -0
    new funcs for plugins

  sql/mysql_priv.h
    1.363 06/01/07 12:43:34 acurtis@stripped +13 -0
    Don't bother including all the types when not building mysqld

  sql/item.h
    1.187 06/01/07 12:43:34 acurtis@stripped +2 -1
    Don't bother including all the types when not building mysqld

  sql/handler.h
    1.175 06/01/07 12:43:34 acurtis@stripped +9 -2
    Ensure that there are no db_type collisions
    new method handler::ha_statistic_increment() so that storage engines
    do not need to know THD type

  sql/handler.cc
    1.204 06/01/07 12:43:34 acurtis@stripped +74 -47
    Ensure that there are no db_type collisions
    new method handler::ha_statistic_increment() so that storage engines
    do not need to know THD type

  sql/Makefile.am
    1.130 06/01/07 12:43:34 acurtis@stripped +2 -2
    remove ha_archive

  configure.in
    1.331 06/01/07 12:43:34 acurtis@stripped +35 -62
    Lets do checks for user-requested storage engines earlier.

  config/ac-macros/storage.m4
    1.4 06/01/07 12:43:34 acurtis@stripped +28 -10
    Allow user to choose a storage engine to be built as a plugin
    at configure time

  storage/archive/ha_archive.h
    1.36 06/01/07 02:51:34 acurtis@stripped +0 -0
    Rename: sql/ha_archive.h -> storage/archive/ha_archive.h

  storage/archive/ha_archive.cc
    1.71 06/01/07 02:51:31 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

--- 1.330/configure.in	2005-12-31 01:13:33 -08:00
+++ 1.331/configure.in	2006-01-07 12:43:34 -08:00
@@ -666,6 +666,41 @@
 AC_TYPE_SIZE_T
 
 #--------------------------------------------------------------------
+# Check for requested features
+#--------------------------------------------------------------------
+
+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
 #--------------------------------------------------------------------
 
@@ -2390,68 +2425,6 @@
 MYSQL_CHECK_BIG_TABLES
 MYSQL_CHECK_MAX_INDEXES
 MYSQL_CHECK_REPLICATION
-
-MYSQL_STORAGE_ENGINE(innobase,,innodb,,,,storage/innobase,ha_innodb.o,[ dnl
-  \$(top_builddir)/storage/innobase/usr/libusr.a dnl
-  \$(top_builddir)/storage/innobase/srv/libsrv.a dnl
-  \$(top_builddir)/storage/innobase/dict/libdict.a dnl
-  \$(top_builddir)/storage/innobase/que/libque.a dnl
-  \$(top_builddir)/storage/innobase/srv/libsrv.a dnl
-  \$(top_builddir)/storage/innobase/ibuf/libibuf.a dnl
-  \$(top_builddir)/storage/innobase/row/librow.a dnl
-  \$(top_builddir)/storage/innobase/pars/libpars.a dnl
-  \$(top_builddir)/storage/innobase/btr/libbtr.a dnl
-  \$(top_builddir)/storage/innobase/trx/libtrx.a dnl
-  \$(top_builddir)/storage/innobase/read/libread.a dnl
-  \$(top_builddir)/storage/innobase/usr/libusr.a dnl
-  \$(top_builddir)/storage/innobase/buf/libbuf.a dnl
-  \$(top_builddir)/storage/innobase/ibuf/libibuf.a dnl
-  \$(top_builddir)/storage/innobase/eval/libeval.a dnl
-  \$(top_builddir)/storage/innobase/log/liblog.a dnl
-  \$(top_builddir)/storage/innobase/fsp/libfsp.a dnl
-  \$(top_builddir)/storage/innobase/fut/libfut.a dnl
-  \$(top_builddir)/storage/innobase/fil/libfil.a dnl
-  \$(top_builddir)/storage/innobase/lock/liblock.a dnl
-  \$(top_builddir)/storage/innobase/mtr/libmtr.a dnl
-  \$(top_builddir)/storage/innobase/page/libpage.a dnl
-  \$(top_builddir)/storage/innobase/rem/librem.a dnl
-  \$(top_builddir)/storage/innobase/thr/libthr.a dnl
-  \$(top_builddir)/storage/innobase/sync/libsync.a dnl
-  \$(top_builddir)/storage/innobase/data/libdata.a dnl
-  \$(top_builddir)/storage/innobase/mach/libmach.a dnl
-  \$(top_builddir)/storage/innobase/ha/libha.a dnl
-  \$(top_builddir)/storage/innobase/dyn/libdyn.a dnl
-  \$(top_builddir)/storage/innobase/mem/libmem.a dnl
-  \$(top_builddir)/storage/innobase/sync/libsync.a dnl
-  \$(top_builddir)/storage/innobase/ut/libut.a dnl
-  \$(top_builddir)/storage/innobase/os/libos.a dnl
-  \$(top_builddir)/storage/innobase/ut/libut.a],[
-  AC_CHECK_LIB(rt, aio_read, [innodb_system_libs="-lrt"])
-  AC_SUBST(innodb_includes)
-  AC_SUBST(innodb_libs)
-  AC_SUBST(innodb_system_libs)
-  other_configures="$other_configures storage/innobase/configure"
-])
-
-MYSQL_STORAGE_ENGINE(berkeley,,berkeley-db,,,,storage/bdb,,,[
-  MYSQL_SETUP_BERKELEY_DB
-])
-MYSQL_STORAGE_ENGINE(example,,,,,no,storage/example,,,[
-  AC_CONFIG_FILES(storage/example/Makefile)
-])
-MYSQL_STORAGE_ENGINE(archive,,,,,,storage/archive,,
- \$(top_builddir)/storage/archive/libarchive.a, [
-  AC_CONFIG_FILES(storage/archive/Makefile)
-])
-MYSQL_STORAGE_ENGINE(csv,,,,,no,storage/csv,,,[
-  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	2005-12-31 01:13:33 -08:00
+++ 1.130/sql/Makefile.am	2006-01-07 12:43:34 -08:00
@@ -99,8 +99,8 @@
 			sp_cache.cc parse_file.cc sql_trigger.cc \
 			sql_plugin.cc sql_binlog.cc \
 			handlerton.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_partition.cc ha_partition.h

--- 1.203/sql/handler.cc	2006-01-06 03:21:09 -08:00
+++ 1.204/sql/handler.cc	2006-01-07 12:43:34 -08:00
@@ -44,6 +44,7 @@
 #endif
 
 extern handlerton *sys_table_types[];
+static handlerton *installed_htons[128];
 
 #define BITMAP_STACKBUF_SIZE (128/8)
 
@@ -133,30 +134,8 @@
 }
 
 
-struct plugin_find_dbtype_st
-{
-  enum legacy_db_type db_type;
-  handlerton *hton;
-};
-
-
-static my_bool plugin_find_dbtype(THD *unused, st_plugin_int *plugin,
-                                  void *arg)
-{
-  handlerton *types= (handlerton *) plugin->plugin->info;
-  if (types->db_type == ((struct plugin_find_dbtype_st *)arg)->db_type)
-  {
-    ((struct plugin_find_dbtype_st *)arg)->hton= types;
-    return TRUE;
-  }
-  return FALSE;
-}
-
-
 const char *ha_get_storage_engine(enum legacy_db_type db_type)
 {
-  struct plugin_find_dbtype_st info;
-  
   switch (db_type)
   {
   case DB_TYPE_DEFAULT:
@@ -164,13 +143,10 @@
   case DB_TYPE_UNKNOWN:
     return "UNKNOWN";
   default:
-    info.db_type= db_type;
-
-    if (!plugin_foreach(NULL, plugin_find_dbtype, 
-                        MYSQL_STORAGE_ENGINE_PLUGIN, &info))
-      return "*NONE*";
-
-    return info.hton->name;
+    if (db_type > DB_TYPE_UNKNOWN && db_type < DB_TYPE_DEFAULT &&
+        installed_htons[db_type])
+      return installed_htons[db_type]->name;
+    return "*NONE*";
   }
 }
 
@@ -185,8 +161,6 @@
 
 handlerton *ha_resolve_by_legacy_type(THD *thd, enum legacy_db_type db_type)
 {
-  struct plugin_find_dbtype_st info;
-
   switch (db_type)
   {
   case DB_TYPE_DEFAULT:
@@ -197,12 +171,9 @@
   case DB_TYPE_UNKNOWN:
     return NULL;
   default:
-    info.db_type= db_type;
-    if (!plugin_foreach(NULL, plugin_find_dbtype, 
-                        MYSQL_STORAGE_ENGINE_PLUGIN, &info))
-      return NULL;
-
-    return info.hton;
+    if (db_type > DB_TYPE_UNKNOWN && db_type < DB_TYPE_DEFAULT)
+      return installed_htons[db_type];
+    return NULL;
   }
 }
 
@@ -387,24 +358,38 @@
 }
 
 
-static void ha_was_inited_ok(handlerton *ht)
+int ha_finalize_handlerton(handlerton *hton)
 {
-  uint tmp= ht->savepoint_offset;
-  ht->savepoint_offset= savepoint_alloc_size;
-  savepoint_alloc_size+= tmp;
-  ht->slot= total_ha++;
-  if (ht->prepare)
-    total_ha_2pc++;
+  DBUG_ENTER("ha_finalize_handlerton");
+
+  if (hton == NULL)
+    DBUG_RETURN(1);
+
+  switch (hton->state)
+  {
+  case SHOW_OPTION_NO:
+  case SHOW_OPTION_DISABLED:
+    break;
+  case SHOW_OPTION_YES:
+    if (hton->panic && hton->panic(HA_PANIC_CLOSE))
+      DBUG_RETURN(1);
+    if (installed_htons[hton->db_type] == hton)
+      installed_htons[hton->db_type]= NULL;
+    break;
+  };
+  DBUG_RETURN(0);
 }
 
 
-int ha_initialize_handlerton(handlerton *hton)
+int ha_initialize_handlerton(char *name, handlerton *hton)
 {
   DBUG_ENTER("ha_initialize_handlerton");
 
   if (hton == NULL)
     DBUG_RETURN(1);
 
+  hton->name= name; /* sanity */
+
   switch (hton->state)
   {
   case SHOW_OPTION_NO:
@@ -412,7 +397,40 @@
   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])
+      {
+        unsigned long code= 0xdeadc0de;
+
+        /* simple hash - derive a unique number from the name */
+
+        for (;*name; name++) 
+        {
+          code= (*name ^ (code << 1)) ^ ((code & 0x80000000) ? 0 : 0x00208001);
+          code= (code << 1) ^ ((code & 0x80000000) ? 0 : 0x00208001);
+          code= (code << 1) ^ ((code & 0x80000000) ? 0 : 0x00208001);
+        }
+        
+        while (code & 127 < DB_TYPE_FIRST_DYNAMIC ||
+               code & 127 >= DB_TYPE_DEFAULT ||
+               installed_htons[code & 127])
+          code= (code << 1) ^ ((code & 0x80000000) ? 0 : 0x00208001);
+
+        if (hton->db_type >= DB_TYPE_UNKNOWN)
+          sql_print_warning("Storage engine '%s' has conflicting typecode. "
+                            "Assigning value %d.", hton->name, code & 127);
+        hton->db_type= (enum legacy_db_type) (code & 127);
+      }
+      installed_htons[hton->db_type]= hton;
       break;
     }
     /* fall through */
@@ -429,7 +447,8 @@
 {
   if (plugin->state == PLUGIN_IS_UNINITIALIZED)
   {
-    ha_initialize_handlerton((handlerton *) plugin->plugin->info);
+    ha_initialize_handlerton(plugin->name.str,
+                             (handlerton *) plugin->plugin->info);
     plugin->state= PLUGIN_IS_READY;
   }
   return FALSE;
@@ -443,6 +462,8 @@
   show_table_alias_st *table_alias;
   total_ha= savepoint_alloc_size= 0;
 
+  bzero(installed_htons, sizeof(installed_htons));
+
   if (ha_init_errors())
     return 1;
 
@@ -1433,6 +1454,12 @@
 /****************************************************************************
 ** General handler functions
 ****************************************************************************/
+
+
+void handler::ha_statistic_increment(ulong SSV::*offset) const
+{
+  statistic_increment(table->in_use->status_var.*offset, &LOCK_status);
+}
 
 /*
   Open database-handler.

--- 1.174/sql/handler.h	2005-12-26 03:54:47 -08:00
+++ 1.175/sql/handler.h	2006-01-07 12:43:34 -08:00
@@ -198,6 +198,7 @@
   DB_TYPE_BLACKHOLE_DB,
   DB_TYPE_PARTITION_DB,
   DB_TYPE_BINLOG,
+  DB_TYPE_FIRST_DYNAMIC=32,
   DB_TYPE_DEFAULT=127 // Must be last
 };
 
@@ -818,6 +819,9 @@
 } HANDLER_BUFFER;
 
 
+typedef struct system_status_var SSV;
+
+
 class handler :public Sql_alloc
 {
 #ifdef WITH_PARTITION_STORAGE_ENGINE
@@ -839,6 +843,8 @@
   virtual int rnd_init(bool scan) =0;
   virtual int rnd_end() { return 0; }
 
+  void ha_statistic_increment(ulong SSV::*offset) const;
+
 private:
   virtual int reset() { return extra(HA_EXTRA_RESET); }
 public:
@@ -1470,7 +1476,7 @@
  virtual bool check_if_incompatible_data(HA_CREATE_INFO *create_info,
 					 uint table_changes)
  { return COMPATIBLE_DATA_NO; }
-
+  
 private:
 
   /*
@@ -1545,7 +1551,8 @@
 /* basic stuff */
 int ha_init(void);
 int ha_register_builtin_plugins();
-int ha_initialize_handlerton(handlerton *hton);
+int ha_initialize_handlerton(char *name, handlerton *hton);
+int ha_finalize_handlerton(handlerton *hton);
 
 TYPELIB *ha_known_exts(void);
 int ha_panic(enum ha_panic_function flag);

--- 1.186/sql/item.h	2005-12-26 03:53:40 -08:00
+++ 1.187/sql/item.h	2006-01-07 12:43:34 -08:00
@@ -1936,7 +1936,7 @@
   virtual Item *real_item() { return ref; }
 };
 
-
+#ifdef MYSQL_SERVER
 #include "gstream.h"
 #include "spatial.h"
 #include "item_sum.h"
@@ -1949,6 +1949,7 @@
 #include "item_uniq.h"
 #include "item_subselect.h"
 #include "item_xmlfunc.h"
+#endif
 
 class Item_copy_string :public Item
 {

--- 1.362/sql/mysql_priv.h	2005-12-31 00:23:08 -08:00
+++ 1.363/sql/mysql_priv.h	2006-01-07 12:43:34 -08:00
@@ -477,6 +477,10 @@
 }
 #define current_thd _current_thd()
 
+my_bool thd_in_lock_tables(const THD *thd);
+my_bool thd_tablespace_op(const THD *thd);
+const char *thd_proc_info(THD *thd, const char *info);
+
 /*
   External variables
 */
@@ -507,7 +511,9 @@
 class sys_var;
 #include "item.h"
 extern my_decimal decimal_zero;
+#ifdef MYSQL_SERVER
 typedef Comp_creator* (*chooser_compare_func_creator)(bool invert);
+#endif
 /* sql_parse.cc */
 void free_items(Item *item);
 void cleanup_items(Item *item);
@@ -546,6 +552,7 @@
 #include "sql_class.h"
 #include "sql_acl.h"
 #include "tztime.h"
+#ifdef MYSQL_SERVER
 #include "opt_range.h"
 
 #ifdef HAVE_QUERY_CACHE
@@ -835,6 +842,8 @@
 Field *
 find_field_in_table_sef(TABLE *table, const char *name);
 
+#endif /* MYSQL_SERVER */
+
 #ifdef HAVE_OPENSSL
 #include <openssl/des.h>
 struct st_des_keyblock
@@ -852,6 +861,7 @@
 bool load_des_key_file(const char *file_name);
 #endif /* HAVE_OPENSSL */
 
+#ifdef MYSQL_SERVER
 /* sql_do.cc */
 bool mysql_do(THD *thd, List<Item> &values);
 
@@ -1112,6 +1122,7 @@
 int key_rec_cmp(void *key_info, byte *a, byte *b);
 
 bool init_errmessage(void);
+#endif /* MYSQL_SERVER */
 void sql_perror(const char *message);
 
 void vprint_msg_to_log(enum loglevel level, const char *format, va_list args);
@@ -1123,6 +1134,7 @@
 
 bool fn_format_relative_to_data_home(my_string to, const char *name,
 				     const char *dir, const char *extension);
+#ifdef MYSQL_SERVER
 File open_binlog(IO_CACHE *log, const char *log_file_name,
                  const char **errmsg);
 
@@ -1668,4 +1680,5 @@
 #define check_stack_overrun(A, B, C) 0
 #endif
 
+#endif /* MYSQL_SERVER */
 #endif /* MYSQL_CLIENT */

--- 1.231/sql/sql_class.cc	2006-01-04 07:24:43 -08:00
+++ 1.232/sql/sql_class.cc	2006-01-07 12:43:34 -08:00
@@ -168,6 +168,26 @@
 }
 
 
+my_bool thd_in_lock_tables(const THD *thd)
+{
+  return thd->in_lock_tables;
+}
+
+
+my_bool thd_tablespace_op(const THD *thd)
+{
+  return thd->tablespace_op;
+}
+
+
+const char *thd_proc_info(THD *thd, const char *info)
+{
+  const char *old_info= thd->proc_info;
+  thd->proc_info= info;
+  return old_info;
+}
+
+
 /*
   Pass nominal parameters to Statement constructor only to ensure that
   the destructor works OK in case of error. The main_mem_root will be

--- 1.280/sql/sql_class.h	2005-12-21 20:10:55 -08:00
+++ 1.281/sql/sql_class.h	2006-01-07 12:43:34 -08:00
@@ -171,6 +171,7 @@
 
 class delayed_insert;
 class select_result;
+class Time_zone;
 
 #define THD_SENTRY_MAGIC 0xfeedd1ff
 #define THD_SENTRY_GONE  0xdeadbeef
@@ -343,6 +344,8 @@
 #define last_system_status_var com_stmt_close
 
 
+#ifdef MYSQL_SERVER
+
 void free_tmp_table(THD *thd, TABLE *entry);
 
 
@@ -353,7 +356,6 @@
 #define INIT_ARENA_DBUG_INFO
 #endif
 
-
 class Query_arena
 {
 public:
@@ -1901,3 +1903,5 @@
 /* Functions in sql_class.cc */
 
 void add_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var);
+
+#endif /* MYSQL_SERVER */

--- 1.213/sql/sql_lex.h	2005-12-26 03:53:40 -08:00
+++ 1.214/sql/sql_lex.h	2006-01-07 12:43:34 -08:00
@@ -27,6 +27,7 @@
 class sp_pcontext;
 class partition_info;
 
+#ifdef MYSQL_SERVER
 /*
   The following hack is needed because mysql_yacc.cc does not define
   YYSTYPE before including this file
@@ -41,6 +42,7 @@
 #include "sql_yacc.h"
 #define LEX_YYSTYPE YYSTYPE *
 #endif
+#endif
 
 /*
   When a command is added here, be sure it's also added in mysqld.cc
@@ -109,6 +111,8 @@
 */
 #define DESCRIBE_PARTITIONS	4
 
+#ifdef MYSQL_SERVER
+
 enum enum_sp_suid_behaviour
 {
   SP_IS_DEFAULT_SUID= 0,
@@ -1085,3 +1089,5 @@
 extern pthread_key(LEX*,THR_LEX);
 
 #define current_lex (current_thd->lex)
+
+#endif

--- 1.3/config/ac-macros/storage.m4	2005-12-21 14:57:53 -08:00
+++ 1.4/config/ac-macros/storage.m4	2006-01-07 12:43:34 -08:00
@@ -21,9 +21,14 @@
 m4_default([$5], [WITH_]AS_TR_CPP([$1])[_STORAGE_ENGINE]),
 m4_default([$6], $1[_hton]),              dnl hton
 m4_default([$7], []),                     dnl path to the code
-m4_default([$8], [ha_$1.o]),             dnl path to the handler in
-m4_default([$9], []),                    dnl path to extra libraries
-[$10],                                     dnl code-if-set
+m4_default([$8], [ha_$1.o]),              dnl path to the handler in
+m4_default([$9], []),                     dnl path to extra libraries
+m4_default([$10], no),                    dnl plugin support
+[$11],                                    dnl code-if-set
+[lib$1.a],                                dnl path to the handler in
+[ha_$1][_static_target],
+[ha_$1.la],                               dnl path to the handler in
+[ha_$1][_shared_target],
 )])
 
 AC_DEFUN([_MYSQL_STORAGE_ENGINE],
@@ -33,19 +38,32 @@
 AC_CACHE_CHECK([whether to use $2], [mysql_cv_use_]m4_bpatsubst([$3], -, _),
 [mysql_cv_use_]m4_bpatsubst([$3], -, _)=[$with_]m4_bpatsubst([$3], -, _))
 AH_TEMPLATE([$5], [Build $2])
-if test "[$mysql_cv_use_]m4_bpatsubst([$3], -, _)" != no; then
-if test "$6" != "no"
-then
+if test "[$mysql_cv_use_]m4_bpatsubst([$3], -, _)" != "no"; then
+[$13]=""
+[$15]=""
+if test "[$mysql_cv_use_]m4_bpatsubst([$3], -, _)" == "plugin"; then
+  if test "$10" == "yes"; then
+    mysql_se_plugins="$mysql_se_plugins $7"
+    [$15]="$14"
+  else
+    AC_MSG_ERROR([$2 is not available as a plugin.])
+  fi
+elif test "[$mysql_cv_use_]m4_bpatsubst([$3], -, _)" == "yes"; then
   AC_DEFINE([$5])
   mysql_se_decls="${mysql_se_decls},$6"
   mysql_se_htons="${mysql_se_htons},&$6"
-  mysql_se_objs="$mysql_se_objs $8"
+  if test "$10" != "yes"; then
+    mysql_se_objs="$mysql_se_objs $8"
+  fi
   mysql_se_dirs="$mysql_se_dirs $7"
   mysql_se_libs="$mysql_se_libs $9"
-else
-  mysql_se_plugins="$mysql_se_plugins $7"
+  [$13]="$12"
+elif test "[$mysql_cv_use_]m4_bpatsubst([$3], -, _)" != "no"; then
+  AC_MSG_ERROR([Invalid option for --with-$3. See the Installation chapter in the Reference Manual.])
 fi
-$10
+AC_SUBST([$13])
+AC_SUBST([$15])
+$11
 fi
 ])
 

--- 1.4/storage/csv/Makefile.am	2006-01-05 05:16:22 -08:00
+++ 1.5/storage/csv/Makefile.am	2006-01-07 12:43:35 -08:00
@@ -26,15 +26,23 @@
                         -I$(srcdir)
 WRAPLIBS=
 
-pkglib_LTLIBRARIES =	ha_csv.la
+LDADD =
+
+DEFS =                  @DEFS@
 
-ha_csv_la_LDFLAGS =	-module
 noinst_HEADERS	  =	ha_tina.h
+
+EXTRA_LTLIBRARIES =	ha_csv.la
+pkglib_LTLIBRARIES =	@ha_csv_shared_target@
+ha_csv_la_LDFLAGS =	-module -rpath $(MYSQLLIBdir)
+ha_csv_la_CXXFLAGS =	$(AM_CFLAGS) -DMYSQL_PLUGIN
 ha_csv_la_SOURCES =	ha_tina.cc
 
-LDADD =
 
-DEFS =                  -DMYSQL_SERVER @DEFS@
+EXTRA_LIBRARIES =	libcsv.a
+noinst_LIBRARIES =	@ha_csv_static_target@
+libcsv_a_CXXFLAGS =	$(AM_CFLAGS) -DMYSQL_SERVER
+libcsv_a_SOURCES =	ha_tina.cc
 
 # Don't update the files from bitkeeper
 %::SCCS/s.%

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

--- 1.70/sql/ha_archive.cc	2005-12-27 18:55:55 -08:00
+++ 1.72/storage/archive/ha_archive.cc	2006-01-07 12:43:35 -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. 
@@ -145,7 +150,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 */
@@ -198,9 +203,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,
@@ -214,7 +221,6 @@
     DBUG_RETURN(FALSE);
   }
 error:
-  have_archive_db= SHOW_OPTION_DISABLED;	// If we couldn't use handler
   DBUG_RETURN(TRUE);
 }
 
@@ -222,14 +228,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)
   {
@@ -240,6 +246,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)
 {
@@ -660,7 +672,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);
@@ -788,8 +800,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);
 
@@ -825,8 +836,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);
 
@@ -976,8 +986,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;
 
     /* 
@@ -988,7 +998,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;
@@ -1085,11 +1095,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);
 
@@ -1113,7 +1123,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)  
   {
@@ -1145,3 +1155,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.35/sql/ha_archive.h	2005-12-23 12:22:21 -08:00
+++ 1.37/storage/archive/ha_archive.h	2006-01-07 12:43:35 -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
@@ -109,6 +109,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.27/storage/csv/ha_tina.cc	2005-12-21 12:50:44 -08:00
+++ 1.28/storage/csv/ha_tina.cc	2006-01-07 12:43:35 -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;
@@ -527,7 +529,7 @@
   int size;
   DBUG_ENTER("ha_tina::write_row");
 
-  statistic_increment(table->in_use->status_var.ha_write_count, &LOCK_status);
+  ha_statistic_increment(&SSV::ha_write_count);
 
   if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT)
     table->timestamp_field->set_time();
@@ -564,8 +566,7 @@
   int size;
   DBUG_ENTER("ha_tina::update_row");
 
-  statistic_increment(table->in_use->status_var.ha_read_rnd_next_count,
-		      &LOCK_status);
+  ha_statistic_increment(&SSV::ha_read_rnd_next_count);
 
   if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
     table->timestamp_field->set_time();
@@ -593,8 +594,7 @@
 int ha_tina::delete_row(const byte * buf)
 {
   DBUG_ENTER("ha_tina::delete_row");
-  statistic_increment(table->in_use->status_var.ha_delete_count,
-                      &LOCK_status);
+  ha_statistic_increment(&SSV::ha_delete_count);
 
   if (chain_append())
     DBUG_RETURN(-1);
@@ -742,8 +742,7 @@
 {
   DBUG_ENTER("ha_tina::rnd_next");
 
-  statistic_increment(table->in_use->status_var.ha_read_rnd_next_count,
-		      &LOCK_status);
+  ha_statistic_increment(&SSV::ha_read_rnd_next_count);
 
   current_position= next_position;
   if (!share->mapped_file)
@@ -780,8 +779,7 @@
 int ha_tina::rnd_pos(byte * buf, byte *pos)
 {
   DBUG_ENTER("ha_tina::rnd_pos");
-  statistic_increment(table->in_use->status_var.ha_read_rnd_next_count,
-		      &LOCK_status);
+  ha_statistic_increment(&SSV::ha_read_rnd_next_count);
   current_position= my_get_ptr(pos,ref_length);
   DBUG_RETURN(find_current_row(buf));
 }
@@ -944,6 +942,7 @@
   DBUG_RETURN(0);
 }
 
+#ifdef MYSQL_PLUGIN
 mysql_declare_plugin
 {
   MYSQL_STORAGE_ENGINE_PLUGIN,
@@ -956,4 +955,4 @@
   0x0100 /* 1.0 */,
 }
 mysql_declare_plugin_end;
-
+#endif

--- 1.28/storage/example/ha_example.cc	2005-12-22 00:19:12 -08:00
+++ 1.29/storage/example/ha_example.cc	2006-01-07 12:43:35 -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();
@@ -722,6 +724,8 @@
   DBUG_RETURN(0);
 }
 
+
+#ifdef MYSQL_PLUGIN
 mysql_declare_plugin
 {
   MYSQL_STORAGE_ENGINE_PLUGIN,
@@ -734,4 +738,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-01-07 12:43:34 -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) -DMYSQL_SERVER
+libarchive_a_CFLAGS =	$(AM_CFLAGS)
+libarchive_a_SOURCES =	ha_archive.cc azio.c
+
+
+archive_test_SOURCES =	archive_test.c azio.c
+archive_test_CFLAGS =	$(AM_CFLAGS)
+archive_test_LDADD =	$(top_srcdir)/mysys/libmysys.a \
 			$(top_srcdir)/dbug/libdbug.a \
 			$(top_srcdir)/strings/libmystrings.a \
 			@ZLIB_LIBS@
-pkglib_LIBRARIES =	libarchive.a
-noinst_PROGRAMS	=	archive_test
-archive_test_LDFLAGS = @NOINST_LDFLAGS@
-noinst_HEADERS =	azlib.h
-libarchive_a_SOURCES =	azio.c
+archive_test_LDFLAGS =	@NOINST_LDFLAGS@
+
 
 # Don't update the files from bitkeeper
 %::SCCS/s.%

--- 1.9/storage/innobase/Makefile.am	2005-12-16 03:45:37 -08:00
+++ 1.10/storage/innobase/Makefile.am	2006-01-07 12:43:35 -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.8/sql/sql_plugin.cc	2006-01-01 14:13:12 -08:00
+++ 1.9/sql/sql_plugin.cc	2006-01-07 12:43:34 -08:00
@@ -437,7 +437,8 @@
   switch (plugin->plugin->type)
   {
   case MYSQL_STORAGE_ENGINE_PLUGIN:
-    if (ha_initialize_handlerton((handlerton*) plugin->plugin->info))
+    if (ha_initialize_handlerton(plugin->name.str,
+                                 (handlerton*) plugin->plugin->info))
     {
       sql_print_error("Plugin '%s' handlerton init returned error.",
                       plugin->name.str);
@@ -455,6 +456,44 @@
   DBUG_RETURN(1);
 }
 
+static int plugin_finalize(struct st_plugin_int *plugin)
+{
+  int rc;
+  DBUG_ENTER("plugin_finalize");
+  
+  if (plugin->plugin->deinit)
+  {
+    if ((rc= plugin->plugin->deinit()))
+    {
+      sql_print_error("Plugin '%s' deinit function returned error rc=%d",
+                      plugin->name.str, rc);
+      DBUG_PRINT("warning", ("Plugin '%s' deinit function returned error rc=%d",
+                             plugin->name.str, rc))
+      goto err;
+    }
+  }
+  
+  switch (plugin->plugin->type)
+  {
+  case MYSQL_STORAGE_ENGINE_PLUGIN:
+    if (ha_finalize_handlerton((handlerton*) plugin->plugin->info))
+    {
+      sql_print_error("Plugin '%s' handlerton deinit returned error.",
+                      plugin->name.str);
+      DBUG_PRINT("warning", ("Plugin '%s' handlerton deinit returned error.",
+                             plugin->name.str))
+      goto err;
+    }
+    break;
+  default:
+    break;
+  }
+
+  DBUG_RETURN(0);
+err:
+  DBUG_RETURN(1);
+}
+
 static void plugin_call_initializer(void)
 {
   uint i;
@@ -744,7 +783,7 @@
     goto err;
   }
   
-  if (plugin->ref_count)
+  if (plugin->ref_count || plugin_finalize(plugin))
   {
     plugin->state= PLUGIN_IS_DELETED;
     push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
@@ -752,8 +791,6 @@
   }
   else
   {
-    if (plugin->plugin->deinit)
-      plugin->plugin->deinit();
     plugin_del(name);
   }
 
Thread
bk commit into 5.1 tree (acurtis:1.2047)antony7 Jan