List:Commits« Previous MessageNext Message »
From:Martin Skold Date:April 12 2007 10:06pm
Subject:bk commit into 5.1 tree (mskold:1.2340)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of marty. When marty 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, 2007-04-12 22:06:12+02:00, mskold@stripped +2 -0
  ha_ndbcluster.cc:
    Fixed bug that incorrectly created all fields on disk after one is found
  table.cc:
    Fixed memory leak when opening tables with field format or storage specified

  sql/ha_ndbcluster.cc@stripped, 2007-04-12 21:59:45+02:00, mskold@stripped +33 -13
    Fixed bug that incorrectly created all fields on disk after one is found

  sql/table.cc@stripped, 2007-04-12 22:00:36+02:00, mskold@stripped +2 -0
    Fixed memory leak when opening tables with field format or storage specified

# 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:	mskold
# Host:	linux.site
# Root:	/windows/Linux_space/MySQL/mysql-5.1-wl3627

--- 1.269/sql/table.cc	2007-04-12 22:06:25 +02:00
+++ 1.270/sql/table.cc	2007-04-12 22:06:25 +02:00
@@ -1290,6 +1290,8 @@ static int open_binary_frm(THD *thd, TAB
   if (use_hash)
     (void) hash_check(&share->name_hash);
 #endif
+  if (buff)
+    my_free(buff, MYF(0));
   DBUG_RETURN (0);
 
  err:

--- 1.372/sql/ha_ndbcluster.cc	2007-04-12 22:06:25 +02:00
+++ 1.373/sql/ha_ndbcluster.cc	2007-04-12 22:06:25 +02:00
@@ -644,6 +644,25 @@ static bool ndb_supported_type(enum_fiel
 }
 #endif /* !DBUG_OFF */
 
+/*
+  Check if MySQL field type is mapped to a dynamic Ndb attribute
+*/
+static bool field_type_is_dynamic(enum_field_types type)
+{
+  switch (type) {
+  case MYSQL_TYPE_VAR_STRING:
+  case MYSQL_TYPE_VARCHAR:
+  case MYSQL_TYPE_TINY_BLOB:
+  case MYSQL_TYPE_BLOB:    
+  case MYSQL_TYPE_MEDIUM_BLOB:   
+  case MYSQL_TYPE_LONG_BLOB:  
+  case MYSQL_TYPE_GEOMETRY:
+    return TRUE;
+  default:
+    break;
+  }
+  return FALSE;
+}
 
 /*
   Instruct NDB to set the value of the hidden primary key
@@ -4735,7 +4754,7 @@ int ha_ndbcluster::create(const char *na
   bool create_from_engine= (info->table_options & HA_OPTION_CREATE_FROM_ENGINE);
   bool is_truncate= (thd->lex->sql_command == SQLCOM_TRUNCATE);
   char tablespace[FN_LEN];
-  bool disk_storage= FALSE;
+  bool disk_storage= FALSE, use_tablespace= FALSE;
 
   DBUG_ENTER("ha_ndbcluster::create");
   DBUG_PRINT("enter", ("name: %s", name));
@@ -4814,7 +4833,7 @@ int ha_ndbcluster::create(const char *na
   my_free((char*)pack_data, MYF(0));
   
   if (info->storage_media == HA_SM_DISK)
-    disk_storage= TRUE;
+     disk_storage= use_tablespace= TRUE;
 
   for (i= 0; i < form->s->fields; i++) 
   {
@@ -4835,7 +4854,7 @@ int ha_ndbcluster::create(const char *na
 	col.setStorageType(NdbDictionary::Column::StorageTypeMemory);
       break;
     case(HA_SM_DISK):
-      disk_storage= true;
+      use_tablespace= true;
       col.setStorageType(NdbDictionary::Column::StorageTypeDisk);
       break;
     case(HA_SM_MEMORY):
@@ -4853,13 +4872,11 @@ int ha_ndbcluster::create(const char *na
     case(FIELD_FORMAT_TYPE_DEFAULT):
     default:
       if (info->row_type==ROW_TYPE_DEFAULT)
-	switch(field->type()) {
-	case(MYSQL_TYPE_VARCHAR):
-	  col.setDynamic(true);
-	  break;
-	default:
-	  col.setDynamic(false);
-	}
+      {
+        bool is_dynamic= field_type_is_dynamic(field->type());
+	
+        col.setDynamic(is_dynamic);     
+      }
       else
 	col.setDynamic(info->row_type==ROW_TYPE_DYNAMIC);
       break;
@@ -4910,7 +4927,7 @@ int ha_ndbcluster::create(const char *na
     }
   }
 
-  if (disk_storage)
+  if (use_tablespace)
   { 
     if (info->tablespace)
       tab.setTablespaceName(info->tablespace);
@@ -4929,14 +4946,17 @@ int ha_ndbcluster::create(const char *na
 			  "STORAGE DISK"); 
       DBUG_RETURN(HA_ERR_UNSUPPORTED);
     }
-    disk_storage= TRUE;  //if use tablespace, that also means store on disk
+    /*
+      if use tablespace, that also means store on disk    
+    */
+    use_tablespace= disk_storage= TRUE;
     tab.setTablespaceName(info->tablespace);
   }
   
   DBUG_PRINT("info", ("Table %s is %s stored with tables space %s",
 		      m_tabname,
 		      (disk_storage)?"disk":"memory",
-		      (disk_storage)?tab.getTablespaceName():"undefined"));
+		      (use_tablespace)?tab.getTablespaceName():"undefined"));
 
   // No primary key, create shadow key as 64 bit, auto increment  
   if (form->s->primary_key == MAX_KEY) 
Thread
bk commit into 5.1 tree (mskold:1.2340)Martin Skold12 Apr