List:Commits« Previous MessageNext Message »
From:Sergey Vojtovich Date:October 6 2006 10:31am
Subject:bk commit into 5.1 tree (svoj:1.2346)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of svoj. When svoj 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@stripped, 2006-10-06 15:31:11+05:00, svoj@april.(none) +1 -0
  Merge mysql.com:/home/svoj/devel/mysql/BUG22937/mysql-5.0-engines
  into  mysql.com:/home/svoj/devel/mysql/BUG22937/mysql-5.1-engines
  MERGE: 1.1810.1697.170

  storage/myisammrg/ha_myisammrg.cc@stripped, 2006-10-06 15:31:04+05:00, svoj@april.(none) +0 -0
    Auto merged
    MERGE: 1.59.5.2

  storage/myisammrg/ha_myisammrg.cc@stripped, 2006-10-06 15:31:04+05:00, svoj@april.(none) +0 -0
    Merge rename: sql/ha_myisammrg.cc -> storage/myisammrg/ha_myisammrg.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:	svoj
# Host:	april.(none)
# Root:	/home/svoj/devel/mysql/BUG22937/mysql-5.1-engines/RESYNC

--- 1.59.5.1/sql/ha_myisammrg.cc	2006-10-06 15:31:19 +05:00
+++ 1.103/storage/myisammrg/ha_myisammrg.cc	2006-10-06 15:31:19 +05:00
@@ -19,48 +19,31 @@
 #pragma implementation				// gcc: Class implementation
 #endif
 
+#define MYSQL_SERVER 1
 #include "mysql_priv.h"
+#include <mysql/plugin.h>
 #include <m_ctype.h>
 #include "ha_myisammrg.h"
-#ifndef MASTER
-#include "../srclib/myisammrg/myrg_def.h"
-#else
-#include "../myisammrg/myrg_def.h"
-#endif
+#include "myrg_def.h"
+
 
 /*****************************************************************************
 ** MyISAM MERGE tables
 *****************************************************************************/
 
-/* MyISAM MERGE handlerton */
+static handler *myisammrg_create_handler(TABLE_SHARE *table,
+                                         MEM_ROOT *mem_root);
 
-handlerton myisammrg_hton= {
-  "MRG_MYISAM",
-  SHOW_OPTION_YES,
-  "Collection of identical MyISAM tables", 
-  DB_TYPE_MRG_MYISAM,
-  NULL,
-  0,       /* slot */
-  0,       /* savepoint size. */
-  NULL,    /* close_connection */
-  NULL,    /* savepoint */
-  NULL,    /* rollback to savepoint */
-  NULL,    /* release savepoint */
-  NULL,    /* commit */
-  NULL,    /* rollback */
-  NULL,    /* prepare */
-  NULL,    /* recover */
-  NULL,    /* commit_by_xid */
-  NULL,    /* rollback_by_xid */
-  NULL,    /* create_cursor_read_view */
-  NULL,    /* set_cursor_read_view */
-  NULL,    /* close_cursor_read_view */
-  HTON_CAN_RECREATE
-};
+static handler *myisammrg_create_handler(handlerton *hton,
+                                         TABLE_SHARE *table,
+                                         MEM_ROOT *mem_root)
+{
+  return new (mem_root) ha_myisammrg(hton, table);
+}
 
 
-ha_myisammrg::ha_myisammrg(TABLE *table_arg)
-  :handler(&myisammrg_hton, table_arg), file(0)
+ha_myisammrg::ha_myisammrg(handlerton *hton, TABLE_SHARE *table_arg)
+  :handler(hton, table_arg), file(0)
 {}
 
 static const char *ha_myisammrg_exts[] = {
@@ -91,13 +74,14 @@ int ha_myisammrg::open(const char *name,
   char name_buff[FN_REFLEN];
 
   DBUG_PRINT("info", ("ha_myisammrg::open"));
-  if (!(file=myrg_open(fn_format(name_buff,name,"","",2 | 4), mode,
-		       test_if_locked)))
+  if (!(file=myrg_open(fn_format(name_buff,name,"","",
+                                 MY_UNPACK_FILENAME|MY_APPEND_EXT),
+                       mode, test_if_locked)))
   {
     DBUG_PRINT("info", ("ha_myisammrg::open exit %d", my_errno));
     return (my_errno ? my_errno : -1);
   }
-  DBUG_PRINT("info", ("ha_myisammrg::open myrg_extrafunc..."))
+  DBUG_PRINT("info", ("ha_myisammrg::open myrg_extrafunc..."));
   myrg_extrafunc(file, query_cache_invalidate_by_MyISAM_filename_ref);
   if (!(test_if_locked == HA_OPEN_WAIT_IF_LOCKED ||
 	test_if_locked == HA_OPEN_ABORT_IF_LOCKED))
@@ -106,10 +90,10 @@ int ha_myisammrg::open(const char *name,
   if (!(test_if_locked & HA_OPEN_WAIT_IF_LOCKED))
     myrg_extra(file,HA_EXTRA_WAIT_LOCK,0);
 
-  if (table->s->reclength != mean_rec_length && mean_rec_length)
+  if (table->s->reclength != stats.mean_rec_length && stats.mean_rec_length)
   {
     DBUG_PRINT("error",("reclength: %d  mean_rec_length: %d",
-			table->s->reclength, mean_rec_length));
+			table->s->reclength, stats.mean_rec_length));
     goto err;
   }
 #if !defined(BIG_TABLES) || SIZEOF_OFF_T == 4
@@ -238,11 +222,13 @@ int ha_myisammrg::index_next_same(byte *
   return error;
 }
 
+
 int ha_myisammrg::rnd_init(bool scan)
 {
-  return myrg_extra(file,HA_EXTRA_RESET,0);
+  return myrg_reset(file);
 }
 
+
 int ha_myisammrg::rnd_next(byte *buf)
 {
   statistic_increment(table->in_use->status_var.ha_read_rnd_next_count,
@@ -252,6 +238,7 @@ int ha_myisammrg::rnd_next(byte *buf)
   return error;
 }
 
+
 int ha_myisammrg::rnd_pos(byte * buf, byte *pos)
 {
   statistic_increment(table->in_use->status_var.ha_read_rnd_count,
@@ -283,19 +270,18 @@ void ha_myisammrg::info(uint flag)
     The following fails if one has not compiled MySQL with -DBIG_TABLES
     and one has more than 2^32 rows in the merge tables.
   */
-  records = (ha_rows) info.records;
-  deleted = (ha_rows) info.deleted;
+  stats.records = (ha_rows) info.records;
+  stats.deleted = (ha_rows) info.deleted;
 #if !defined(BIG_TABLES) || SIZEOF_OFF_T == 4
   if ((info.records >= (ulonglong) 1 << 32) ||
       (info.deleted >= (ulonglong) 1 << 32))
     table->s->crashed= 1;
 #endif
-  data_file_length=info.data_file_length;
+  stats.data_file_length=info.data_file_length;
   errkey  = info.errkey;
   table->s->keys_in_use.set_prefix(table->s->keys);
   table->s->db_options_in_use= info.options;
-  table->s->is_view= 1;
-  mean_rec_length= info.reclength;
+  stats.mean_rec_length= info.reclength;
   
   /* 
     The handler::block_size is used all over the code in index scan cost
@@ -313,11 +299,11 @@ void ha_myisammrg::info(uint flag)
     TODO: In 5.2 index scan cost calculation will be factored out into a
     virtual function in class handler and we'll be able to remove this hack.
   */
-  block_size= 0;
+  stats.block_size= 0;
   if (file->tables)
-    block_size= myisam_block_size / file->tables;
+    stats.block_size= myisam_block_size / file->tables;
   
-  update_time=0;
+  stats.update_time= 0;
 #if SIZEOF_OFF_T > 4
   ref_length=6;					// Should be big enough
 #else
@@ -356,6 +342,10 @@ int ha_myisammrg::extra(enum ha_extra_fu
   return myrg_extra(file,operation,0);
 }
 
+int ha_myisammrg::reset(void)
+{
+  return myrg_reset(file);
+}
 
 /* To be used with WRITE_CACHE, EXTRA_CACHE and BULK_INSERT_BEGIN */
 
@@ -481,9 +471,9 @@ int ha_myisammrg::create(const char *nam
   for (pos= table_names; tables; tables= tables->next_local)
   {
     const char *table_name;
-    TABLE **tbl= 0;
+    TABLE *tbl= 0;
     if (create_info->options & HA_LEX_CREATE_TMP_TABLE)
-      tbl= find_temporary_table(thd, tables->db, tables->table_name);
+      tbl= find_temporary_table(thd, tables);
     if (!tbl)
     {
       /*
@@ -497,8 +487,8 @@ int ha_myisammrg::create(const char *nam
         This means that it might not be possible to move the DATADIR of
         an embedded server without changing the paths in the .MRG file.
       */
-      uint length= my_snprintf(buff, FN_REFLEN, "%s/%s/%s", mysql_data_home,
-			       tables->db, tables->table_name);
+      uint length= build_table_filename(buff, sizeof(buff),
+                                        tables->db, tables->table_name, "", 0);
       /*
         If a MyISAM table is in the same directory as the MERGE table,
         we use the table name without a path. This means that the
@@ -512,11 +502,13 @@ int ha_myisammrg::create(const char *nam
           DBUG_RETURN(HA_ERR_OUT_OF_MEM);
     }
     else
-      table_name= (*tbl)->s->path;
+      table_name= tbl->s->path.str;
     *pos++= table_name;
   }
   *pos=0;
-  DBUG_RETURN(myrg_create(fn_format(buff,name,"","",2+4+16),
+  DBUG_RETURN(myrg_create(fn_format(buff,name,"","",
+                                    MY_RESOLVE_SYMLINKS|
+                                    MY_UNPACK_FILENAME|MY_APPEND_EXT),
 			  table_names,
                           create_info->merge_insert_method,
                           (my_bool) 0));
@@ -528,6 +520,7 @@ void ha_myisammrg::append_create_info(St
   const char *current_db;
   uint db_length;
   THD *thd= current_thd;
+  MYRG_TABLE *open_table, *first;
 
   if (file->merge_insert_method != MERGE_INSERT_DISABLED)
   {
@@ -535,10 +528,9 @@ void ha_myisammrg::append_create_info(St
     packet->append(get_type(&merge_insert_method,file->merge_insert_method-1));
   }
   packet->append(STRING_WITH_LEN(" UNION=("));
-  MYRG_TABLE *open_table,*first;
 
-  current_db= table->s->db;
-  db_length= (uint) strlen(current_db);
+  current_db= table->s->db.str;
+  db_length=  table->s->db.length;
 
   for (first=open_table=file->open_tables ;
        open_table != file->end_table ;
@@ -560,3 +552,54 @@ void ha_myisammrg::append_create_info(St
   }
   packet->append(')');
 }
+
+
+bool ha_myisammrg::check_if_incompatible_data(HA_CREATE_INFO *info,
+					      uint table_changes)
+{
+  /*
+    For myisammrg, we should always re-generate the mapping file as this
+    is trivial to do
+  */
+  return COMPATIBLE_DATA_NO;
+}
+
+extern int myrg_panic(enum ha_panic_function flag);
+int myisammrg_panic(handlerton *hton, ha_panic_function flag)
+{
+  return myrg_panic(flag);
+}
+
+static int myisammrg_init(void *p)
+{
+  handlerton *myisammrg_hton;
+
+  myisammrg_hton= (handlerton *)p;
+
+  myisammrg_hton->state= have_merge_db;
+  myisammrg_hton->db_type= DB_TYPE_MRG_MYISAM;
+  myisammrg_hton->create= myisammrg_create_handler;
+  myisammrg_hton->panic= myisammrg_panic;
+  myisammrg_hton->flags=  HTON_CAN_RECREATE|HTON_NO_PARTITION;
+
+  return 0;
+}
+
+struct st_mysql_storage_engine myisammrg_storage_engine=
+{ MYSQL_HANDLERTON_INTERFACE_VERSION };
+
+mysql_declare_plugin(myisammrg)
+{
+  MYSQL_STORAGE_ENGINE_PLUGIN,
+  &myisammrg_storage_engine,
+  "MRG_MYISAM",
+  "MySQL AB",
+  "Collection of identical MyISAM tables",
+  myisammrg_init, /* Plugin Init */
+  NULL, /* Plugin Deinit */
+  0x0100, /* 1.0 */
+  NULL,                       /* status variables                */
+  NULL,                       /* system variables                */
+  NULL                        /* config options                  */
+}
+mysql_declare_plugin_end;
Thread
bk commit into 5.1 tree (svoj:1.2346)Sergey Vojtovich6 Oct