List:Commits« Previous MessageNext Message »
From:Martin Skold Date:January 16 2007 2:51pm
Subject:bk commit into 5.1 tree (mskold:1.2334)
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-01-16 14:51:31+01:00, mskold@stripped +6 -0
  Added support for field format and field storage (WL#3680)

  mysql-test/r/ndb_field_flag.result@stripped, 2007-01-16 14:50:18+01:00, mskold@stripped +47
-10
    Added support for field format and field storage (WL#3680)

  mysql-test/r/ndb_partition_key.result@stripped, 2007-01-16 14:50:18+01:00, mskold@stripped
+4 -4
    Added support for field format and field storage (WL#3680)

  mysql-test/t/ndb_field_flag.test@stripped, 2007-01-16 14:51:11+01:00, mskold@stripped +24 -3
    Added support for field format and field storage (WL#3680)

  sql/field.cc@stripped, 2007-01-16 14:50:17+01:00, mskold@stripped +2 -8
    Added support for field format and field storage (WL#3680)

  sql/field.h@stripped, 2007-01-16 14:50:17+01:00, mskold@stripped +12 -0
    Added support for field format and field storage (WL#3680)

  sql/ha_ndbcluster.cc@stripped, 2007-01-16 14:50:17+01:00, mskold@stripped +85 -7
    Added support for field format and field storage (WL#3680)

# 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.366/sql/field.cc	2007-01-16 14:51:41 +01:00
+++ 1.367/sql/field.cc	2007-01-16 14:51:42 +01:00
@@ -9286,14 +9286,8 @@ create_field::create_field(Field *old_fi
   field_name=change=old_field->field_name;
   length=     old_field->field_length;
   flags=      old_field->flags;
-  {
-    enum ha_storage_media loc_storage_type= (enum ha_storage_media)
-      ((flags >> FIELD_STORAGE_FLAGS) & STORAGE_TYPE_MASK);
-    enum field_format_type loc_field_format= (enum field_format_type)
-      ((flags >> FIELD_FORMAT_FLAGS) & FIELD_FORMAT_MASK);
-    field_storage_type= loc_storage_type;
-    field_format= loc_field_format;
-  }
+  field_storage_type= old_field->field_storage_type();
+  field_format= old_field->field_format();
   unireg_check=old_field->unireg_check;
   pack_length=old_field->pack_length();
   key_length= old_field->key_length();

--- 1.202/sql/field.h	2007-01-16 14:51:42 +01:00
+++ 1.203/sql/field.h	2007-01-16 14:51:42 +01:00
@@ -392,6 +392,18 @@ public:
     return field_length / charset()->mbmaxlen;
   }
 
+  inline  enum ha_storage_media field_storage_type() const
+  {
+    return (enum ha_storage_media) 
+      ((flags >> FIELD_STORAGE_FLAGS) & STORAGE_TYPE_MASK);
+  }
+
+  inline enum field_format_type field_format() const
+  {
+    return (enum field_format_type)
+      ((flags >> FIELD_FORMAT_FLAGS) & FIELD_FORMAT_MASK);
+  }
+
   /* Hash value */
   virtual void hash(ulong *nr, ulong *nr2);
   friend bool reopen_table(THD *,struct st_table *,bool);

--- 1.6/mysql-test/r/ndb_partition_key.result	2007-01-16 14:51:42 +01:00
+++ 1.7/mysql-test/r/ndb_partition_key.result	2007-01-16 14:51:42 +01:00
@@ -59,10 +59,10 @@ Row Checksum: 1
 Row GCI: 1
 TableStatus: Retrieved
 -- Attributes -- 
-a Int PRIMARY KEY AT=FIXED ST=MEMORY DYNAMIC
-b Char(10;latin1_bin) PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY DYNAMIC
-c Int PRIMARY KEY AT=FIXED ST=MEMORY DYNAMIC
-d Int NULL AT=FIXED ST=MEMORY DYNAMIC
+a Int PRIMARY KEY AT=FIXED ST=MEMORY
+b Char(10;latin1_bin) PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY
+c Int PRIMARY KEY AT=FIXED ST=MEMORY
+d Int NULL AT=FIXED ST=MEMORY
 
 -- Indexes -- 
 PRIMARY KEY(a, b, c) - UniqueHashIndex

--- 1.367/sql/ha_ndbcluster.cc	2007-01-16 14:51:42 +01:00
+++ 1.368/sql/ha_ndbcluster.cc	2007-01-16 14:51:42 +01:00
@@ -4815,21 +4815,69 @@ int ha_ndbcluster::create(const char *na
   for (i= 0; i < form->s->fields; i++) 
   {
     Field *field= form->field[i];
-    DBUG_PRINT("info", ("name: %s, type: %u, pack_length: %d", 
+    DBUG_PRINT("info", ("name: %s, type: %u, storage: %u, format: %u, pack_length: %d", 
                         field->field_name, field->real_type(),
+			field->field_storage_type(),
+			field->field_format(),
                         field->pack_length()));
     if ((my_errno= create_ndb_column(col, field, info)))
       DBUG_RETURN(my_errno);
- 
-    if (info->storage_media == HA_SM_DISK)
+
+    switch (field->field_storage_type()) {
+    case(HA_SM_DEFAULT):
+      if (info->storage_media == HA_SM_DISK)
+	col.setStorageType(NdbDictionary::Column::StorageTypeDisk);
+      else
+	col.setStorageType(NdbDictionary::Column::StorageTypeMemory);
+      break;
+    case(HA_SM_DISK):
+      info->storage_media= HA_SM_DISK;
       col.setStorageType(NdbDictionary::Column::StorageTypeDisk);
-    else
-    {
+      break;
+    case(HA_SM_MEMORY):
       col.setStorageType(NdbDictionary::Column::StorageTypeMemory);
-      col.setDynamic(info->row_type==ROW_TYPE_DYNAMIC);
-col.setDynamic(true); // For testing dynattr
+      break;
     }
 
+    switch (field->field_format()) {
+    case(FIELD_FORMAT_TYPE_FIXED):
+      col.setDynamic(false);
+      break;
+    case(FIELD_FORMAT_TYPE_DYNAMIC):
+      col.setDynamic(true);
+      break;
+    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);
+	}
+      else
+	col.setDynamic(info->row_type==ROW_TYPE_DYNAMIC);
+      break;
+    }
+    DBUG_PRINT("info", ("Column %s is declared %s", field->field_name,
(col.getDynamic())?"dynamic":"static"));
+    if (col.getStorageType() == NdbDictionary::Column::StorageTypeDisk)
+    {
+      if (col.getDynamic())
+      {
+	DBUG_PRINT("info", ("Dynamic disk stored column %s changed to static",
field->field_name));
+	col.setDynamic(false);
+      }
+      if (field->field_format() == FIELD_FORMAT_TYPE_DYNAMIC)
+      {
+	push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+			    ER_ILLEGAL_HA_CREATE_OPTION,
+			    "DYNAMIC field %s declared with "
+			    "STORAGE DISK is not supported, "
+			    "field will become STATIC",
+			    field->field_name);
+      }
+    }
     tab.addColumn(col);
     if (col.getPrimaryKey())
       pk_length += (field->pack_length() + 3) / 4;
@@ -4841,8 +4889,21 @@ col.setDynamic(true); // For testing dyn
     KEY_PART_INFO *key_part= key_info->key_part;
     KEY_PART_INFO *end= key_part + key_info->key_parts;
     for (; key_part != end; key_part++)
+    {
+      if (key_part->field->field_storage_type() == HA_SM_DISK)
+      {
+	push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
+			    ER_ILLEGAL_HA_CREATE_OPTION,
+			    ER(ER_ILLEGAL_HA_CREATE_OPTION),
+			    ndbcluster_hton_name,
+			    "Index on field "
+			    "declared with "
+			    "STORAGE DISK is not supported");
+	DBUG_RETURN(HA_ERR_UNSUPPORTED);
+      }
       tab.getColumn(key_part->fieldnr-1)->setStorageType(
                              NdbDictionary::Column::StorageTypeMemory);
+    }
   }
 
   if (info->storage_media == HA_SM_DISK)
@@ -4867,6 +4928,12 @@ col.setDynamic(true); // For testing dyn
     tab.setTablespaceName(info->tablespace);
     info->storage_media = HA_SM_DISK;  //if use tablespace, that also means store on
disk
   }
+  
+  DBUG_PRINT("info", ("Table %s is %s stored with tables space %s",
+		      m_tabname,
+		      (info->storage_media == HA_SM_DISK)?"disk":"memory",
+		      (info->storage_media == HA_SM_DISK)?
+		      tab.getTablespaceName():"undefined"));
 
   // No primary key, create shadow key as 64 bit, auto increment  
   if (form->s->primary_key == MAX_KEY) 
@@ -5224,6 +5291,17 @@ int ha_ndbcluster::create_ndb_index(cons
   for (; key_part != end; key_part++) 
   {
     Field *field= key_part->field;
+    if (field->field_storage_type() == HA_SM_DISK)
+    {
+      push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
+			  ER_ILLEGAL_HA_CREATE_OPTION,
+			  ER(ER_ILLEGAL_HA_CREATE_OPTION),
+			  ndbcluster_hton_name,
+			  "Index on field "
+			  "declared with "
+			  "STORAGE DISK is not supported");
+      DBUG_RETURN(HA_ERR_UNSUPPORTED);    
+    }
     DBUG_PRINT("info", ("attr: %s", field->field_name));
     ndb_index.addColumnName(field->field_name);
   }

--- 1.3/mysql-test/r/ndb_field_flag.result	2007-01-16 14:51:42 +01:00
+++ 1.4/mysql-test/r/ndb_field_flag.result	2007-01-16 14:51:42 +01:00
@@ -1,5 +1,17 @@
 drop table if exists t1;
-create table t1 (a int field_format DYNAMIC STORAGE DISK) engine NDB;
+CREATE LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile.dat'
+INITIAL_SIZE 1M
+UNDO_BUFFER_SIZE = 1M
+ENGINE=NDB;
+CREATE TABLESPACE ts1
+ADD DATAFILE 'datafile.dat'
+USE LOGFILE GROUP lg1
+INITIAL_SIZE 6M
+ENGINE NDB;
+create table t1 (a int field_format DYNAMIC STORAGE DISK) TABLESPACE ts1 engine NDB;
+Warnings:
+Warning	1466	DYNAMIC field a declared with STORAGE DISK is not supported, field will
become STATIC
 select column_name, column_storage, column_format from information_schema.columns
 where table_name = "t1";
 column_name	column_storage	column_format
@@ -8,7 +20,7 @@ show create table t1;
 Table	Create Table
 t1	CREATE TABLE `t1` (
   `a` int(11) STORAGE DISK FIELD_FORMAT DYNAMIC DEFAULT NULL
-) ENGINE=ndbcluster DEFAULT CHARSET=latin1
+) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
 drop table t1;
 create table t1 (a int field_format DYNAMIC,
 a1 int field_format FIXED,
@@ -22,7 +34,11 @@ e CHAR(100) field_format FIXED,
 e1 CHAR(100) field_format DYNAMIC,
 f CHAR(100) NOT NULL field_format FIXED,
 f1 char(100) NOT NULL field_format DYNAMIC storage DISK,
-index (b)) engine NDB;
+index (b)) TABLESPACE ts1 engine NDB;
+Warnings:
+Warning	1466	DYNAMIC field d1 declared with STORAGE DISK is not supported, field will
become STATIC
+Warning	1466	DYNAMIC field e1 declared with STORAGE DISK is not supported, field will
become STATIC
+Warning	1466	DYNAMIC field f1 declared with STORAGE DISK is not supported, field will
become STATIC
 insert into t1 (b, b1, d,d1,f,f1) values
 (1,1,"1","1","1","1"),
 (2,2,"2","2","2","2"),
@@ -44,7 +60,7 @@ t1	CREATE TABLE `t1` (
   `f` char(100) NOT NULL FIELD_FORMAT FIXED,
   `f1` char(100) NOT NULL STORAGE DISK FIELD_FORMAT DYNAMIC,
   KEY `b` (`b`)
-) ENGINE=ndbcluster DEFAULT CHARSET=latin1
+) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
 select column_name, column_storage, column_format from information_schema.columns
 where table_name = "t1";
 column_name	column_storage	column_format
@@ -77,7 +93,7 @@ t1	CREATE TABLE `t1` (
   `f` char(100) NOT NULL FIELD_FORMAT FIXED,
   `f1` char(100) NOT NULL STORAGE DISK FIELD_FORMAT DYNAMIC,
   KEY `b` (`b`)
-) ENGINE=ndbcluster DEFAULT CHARSET=latin1
+) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
 alter table t1 change column a a int storage memory;
 show create table t1;
 Table	Create Table
@@ -95,9 +111,13 @@ t1	CREATE TABLE `t1` (
   `f` char(100) NOT NULL FIELD_FORMAT FIXED,
   `f1` char(100) NOT NULL STORAGE DISK FIELD_FORMAT DYNAMIC,
   KEY `b` (`b`)
-) ENGINE=ndbcluster DEFAULT CHARSET=latin1
+) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
 alter table t1 change column b b int NOT NULL storage memory;
 alter table t1 add column a2 int field_format FIXED;
+Warnings:
+Warning	1466	DYNAMIC field d1 declared with STORAGE DISK is not supported, field will
become STATIC
+Warning	1466	DYNAMIC field e1 declared with STORAGE DISK is not supported, field will
become STATIC
+Warning	1466	DYNAMIC field f1 declared with STORAGE DISK is not supported, field will
become STATIC
 show create table t1;
 Table	Create Table
 t1	CREATE TABLE `t1` (
@@ -115,8 +135,13 @@ t1	CREATE TABLE `t1` (
   `f1` char(100) NOT NULL STORAGE DISK FIELD_FORMAT DYNAMIC,
   `a2` int(11) FIELD_FORMAT FIXED DEFAULT NULL,
   KEY `b` (`b`)
-) ENGINE=ndbcluster DEFAULT CHARSET=latin1
+) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
 alter table t1 add column c2 VARCHAR(100) field_format DYNAMIC;
+Warnings:
+Warning	1466	DYNAMIC field d1 declared with STORAGE DISK is not supported, field will
become STATIC
+Warning	1466	DYNAMIC field e1 declared with STORAGE DISK is not supported, field will
become STATIC
+Warning	1466	DYNAMIC field f1 declared with STORAGE DISK is not supported, field will
become STATIC
+Warning	1466	DYNAMIC field c2 declared with STORAGE DISK is not supported, field will
become STATIC
 show create table t1;
 Table	Create Table
 t1	CREATE TABLE `t1` (
@@ -135,8 +160,13 @@ t1	CREATE TABLE `t1` (
   `a2` int(11) FIELD_FORMAT FIXED DEFAULT NULL,
   `c2` varchar(100) FIELD_FORMAT DYNAMIC DEFAULT NULL,
   KEY `b` (`b`)
-) ENGINE=ndbcluster DEFAULT CHARSET=latin1
+) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
 alter table t1 add column c3 VARCHAR(100) field_format FIXED;
+Warnings:
+Warning	1466	DYNAMIC field d1 declared with STORAGE DISK is not supported, field will
become STATIC
+Warning	1466	DYNAMIC field e1 declared with STORAGE DISK is not supported, field will
become STATIC
+Warning	1466	DYNAMIC field f1 declared with STORAGE DISK is not supported, field will
become STATIC
+Warning	1466	DYNAMIC field c2 declared with STORAGE DISK is not supported, field will
become STATIC
 show create table t1;
 Table	Create Table
 t1	CREATE TABLE `t1` (
@@ -156,8 +186,15 @@ t1	CREATE TABLE `t1` (
   `c2` varchar(100) FIELD_FORMAT DYNAMIC DEFAULT NULL,
   `c3` varchar(100) FIELD_FORMAT FIXED DEFAULT NULL,
   KEY `b` (`b`)
-) ENGINE=ndbcluster DEFAULT CHARSET=latin1
+) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
 drop table t1;
-create table t1 (a int storage disk field_format FIXED) engine NDB;
+create table t1 (a int storage disk field_format FIXED) TABLESPACE ts1 engine NDB;
 alter table t1 change column a a int storage memory field_format DYNAMIC;
 drop table t1;
+ALTER TABLESPACE ts1
+DROP DATAFILE 'datafile.dat'
+ENGINE NDB;
+drop tablespace ts1
+engine ndb;
+drop logfile group lg1
+engine ndb;

--- 1.4/mysql-test/t/ndb_field_flag.test	2007-01-16 14:51:42 +01:00
+++ 1.5/mysql-test/t/ndb_field_flag.test	2007-01-16 14:51:42 +01:00
@@ -5,7 +5,19 @@
 drop table if exists t1;
 --enable_warnings
 
-create table t1 (a int field_format DYNAMIC STORAGE DISK) engine NDB;
+CREATE LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile.dat'
+INITIAL_SIZE 1M
+UNDO_BUFFER_SIZE = 1M
+ENGINE=NDB;
+
+CREATE TABLESPACE ts1
+ADD DATAFILE 'datafile.dat'
+USE LOGFILE GROUP lg1
+INITIAL_SIZE 6M
+ENGINE NDB;
+
+create table t1 (a int field_format DYNAMIC STORAGE DISK) TABLESPACE ts1 engine NDB;
 select column_name, column_storage, column_format from information_schema.columns
 where table_name = "t1";
 show create table t1;
@@ -23,7 +35,7 @@ create table t1 (a int field_format DYNA
                  e1 CHAR(100) field_format DYNAMIC,
                  f CHAR(100) NOT NULL field_format FIXED,
                  f1 char(100) NOT NULL field_format DYNAMIC storage DISK,
-                 index (b)) engine NDB;
+                 index (b)) TABLESPACE ts1 engine NDB;
 insert into t1 (b, b1, d,d1,f,f1) values
 (1,1,"1","1","1","1"),
 (2,2,"2","2","2","2"),
@@ -45,7 +57,16 @@ alter table t1 add column c3 VARCHAR(100
 show create table t1;
 
 drop table t1;
-create table t1 (a int storage disk field_format FIXED) engine NDB;
+create table t1 (a int storage disk field_format FIXED) TABLESPACE ts1 engine NDB;
 alter table t1 change column a a int storage memory field_format DYNAMIC;
 drop table t1;
 
+ALTER TABLESPACE ts1
+DROP DATAFILE 'datafile.dat'
+ENGINE NDB;
+
+drop tablespace ts1
+engine ndb;
+
+drop logfile group lg1
+engine ndb;
Thread
bk commit into 5.1 tree (mskold:1.2334)Martin Skold16 Jan