MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:tomas Date:April 26 2007 11:38am
Subject:bk commit into 5.1 tree (tomas:1.2504)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of tomas. When tomas 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-26 13:38:51+02:00, tomas@stripped +9 -0
  Merge whalegate.ndb.mysql.com:/home/tomas/mysql-5.1-telco-gca
  into  whalegate.ndb.mysql.com:/home/tomas/mysql-5.1-telco-6.1
  MERGE: 1.2403.9.34

  sql/ha_ndbcluster.cc@stripped, 2007-04-26 13:38:46+02:00, tomas@stripped +0 -0
    Auto merged
    MERGE: 1.397.1.12

  storage/ndb/include/ndbapi/NdbDictionary.hpp@stripped, 2007-04-26 13:38:46+02:00, tomas@stripped +0 -0
    Auto merged
    MERGE: 1.87.1.2

  storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp@stripped, 2007-04-26 13:38:47+02:00, tomas@stripped +0 -0
    Auto merged
    MERGE: 1.112.1.4

  storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp@stripped, 2007-04-26 13:38:47+02:00, tomas@stripped +0 -0
    Auto merged
    MERGE: 1.45.1.3

  storage/ndb/src/kernel/blocks/dblqh/Dblqh.hpp@stripped, 2007-04-26 13:38:47+02:00, tomas@stripped +0 -0
    Auto merged
    MERGE: 1.57.1.1

  storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp@stripped, 2007-04-26 13:38:47+02:00, tomas@stripped +0 -0
    Auto merged
    MERGE: 1.129.1.7

  storage/ndb/src/ndbapi/NdbDictionary.cpp@stripped, 2007-04-26 13:38:47+02:00, tomas@stripped +0 -0
    Auto merged
    MERGE: 1.67.1.1

  storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp@stripped, 2007-04-26 13:38:47+02:00, tomas@stripped +0 -0
    Auto merged
    MERGE: 1.157.1.4

  storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp@stripped, 2007-04-26 13:38:47+02:00, tomas@stripped +0 -0
    Auto merged
    MERGE: 1.71.1.1

# 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:	tomas
# Host:	whalegate.ndb.mysql.com
# Root:	/home/tomas/mysql-5.1-telco-6.1/RESYNC

--- 1.89/storage/ndb/include/ndbapi/NdbDictionary.hpp	2007-04-12 16:04:58 +02:00
+++ 1.90/storage/ndb/include/ndbapi/NdbDictionary.hpp	2007-04-26 13:38:46 +02:00
@@ -923,6 +923,14 @@
     void setTemporary(bool); 
 
     /**
+     * Only table with varpart do support online add column
+     *   Add property so that table wo/ varsize column(s) still
+     *   allocates varpart-ref, so that later online add column is possible
+     */
+    bool getForceVarPart() const;
+    void setForceVarPart(bool);
+
+    /**
      * Check if any of column in bitmaps are disk columns
      *   returns bitmap of different columns
      *     bit 0 = atleast 1 pk column is set

--- 1.116/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp	2007-03-09 12:17:30 +01:00
+++ 1.117/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp	2007-04-26 13:38:47 +02:00
@@ -449,6 +449,8 @@
 	!!(tablePtr.p->m_bits & TableRecord::TR_RowChecksum));
   w.add(DictTabInfo::TableTemporaryFlag, 
 	!!(tablePtr.p->m_bits & TableRecord::TR_Temporary));
+  w.add(DictTabInfo::ForceVarPartFlag,
+	!!(tablePtr.p->m_bits & TableRecord::TR_ForceVarPart));
   
   w.add(DictTabInfo::MinLoadFactor, tablePtr.p->minLoadFactor);
   w.add(DictTabInfo::MaxLoadFactor, tablePtr.p->maxLoadFactor);
@@ -5503,8 +5505,8 @@
     req->tableType = tabPtr.p->tableType;
     req->primaryTableId = tabPtr.p->primaryTableId;
     req->tablespace_id= tabPtr.p->m_tablespace_id;
-    //req->tablespace_id= tablespace_id;
     req->logPartId = logPart;
+    req->forceVarPartFlag = !!(tabPtr.p->m_bits& TableRecord::TR_ForceVarPart);
     sendSignal(DBLQH_REF, GSN_LQHFRAGREQ, signal, 
 	       LqhFragReq::SignalLength, JBB);
   }
@@ -6119,6 +6121,8 @@
     (c_tableDesc.RowGCIFlag ? TableRecord::TR_RowGCI : 0);
   tablePtr.p->m_bits |= 
     (c_tableDesc.TableTemporaryFlag ? TableRecord::TR_Temporary : 0);
+  tablePtr.p->m_bits |=
+    (c_tableDesc.ForceVarPartFlag ? TableRecord::TR_ForceVarPart : 0);
   tablePtr.p->minLoadFactor = c_tableDesc.MinLoadFactor;
   tablePtr.p->maxLoadFactor = c_tableDesc.MaxLoadFactor;
   tablePtr.p->fragmentType = (DictTabInfo::FragmentType)c_tableDesc.FragmentType;

--- 1.48/storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp	2007-03-09 12:17:31 +01:00
+++ 1.49/storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp	2007-04-26 13:38:47 +02:00
@@ -236,10 +236,11 @@
     /* Is the table logged (i.e. data survives system restart) */
     enum Bits
     {
-      TR_Logged = 0x1,
-      TR_RowGCI = 0x2,
-      TR_RowChecksum = 0x4,
-      TR_Temporary = 0x8
+      TR_Logged       = 0x1,
+      TR_RowGCI       = 0x2,
+      TR_RowChecksum  = 0x4,
+      TR_Temporary    = 0x8,
+      TR_ForceVarPart = 0x10
     };
     Uint16 m_bits;
 

--- 1.58/storage/ndb/src/kernel/blocks/dblqh/Dblqh.hpp	2007-02-21 14:49:49 +01:00
+++ 1.59/storage/ndb/src/kernel/blocks/dblqh/Dblqh.hpp	2007-04-26 13:38:47 +02:00
@@ -459,7 +459,8 @@
     Uint32 maxRowsHigh;
     Uint32 minRowsLow;
     Uint32 minRowsHigh;
-  };// Size 128 bytes
+    Uint32 forceVarPartFlag;
+  };
   typedef Ptr<AddFragRecord> AddFragRecordPtr;
   
   /* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ */

--- 1.142/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp	2007-03-13 21:45:52 +01:00
+++ 1.143/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp	2007-04-26 13:38:47 +02:00
@@ -1071,6 +1071,7 @@
   Uint32 primaryTableId = req->primaryTableId;
   Uint32 tablespace= req->tablespace_id;
   Uint32 logPart = req->logPartId;
+  Uint32 forceVarPartFlag = req->forceVarPartFlag;
 
   if (signal->getLength() < 20)
   {
@@ -1190,6 +1191,7 @@
   addfragptr.p->tableType = tableType;
   addfragptr.p->primaryTableId = primaryTableId;
   addfragptr.p->tablespace_id= tablespace;
+  addfragptr.p->forceVarPartFlag = forceVarPartFlag;
   //
   addfragptr.p->tupConnectptr = RNIL;
   addfragptr.p->tuxConnectptr = RNIL;
@@ -1340,6 +1342,7 @@
       tupFragReq->checksumIndicator = addfragptr.p->checksumIndicator;
       tupFragReq->globalCheckpointIdIndicator = addfragptr.p->GCPIndicator;
       tupFragReq->tablespaceid = addfragptr.p->tablespace_id;
+      tupFragReq->forceVarPartFlag = addfragptr.p->forceVarPartFlag;
       sendSignal(fragptr.p->tupBlockref, GSN_TUPFRAGREQ,
 		 signal, TupFragReq::SignalLength, JBB);
       return;

--- 1.68/storage/ndb/src/ndbapi/NdbDictionary.cpp	2007-02-21 14:57:08 +01:00
+++ 1.69/storage/ndb/src/ndbapi/NdbDictionary.cpp	2007-04-26 13:38:47 +02:00
@@ -703,6 +703,16 @@
   return m_impl.m_row_gci;
 }
 
+void
+NdbDictionary::Table::setForceVarPart(bool val){
+  m_impl.m_force_var_part = val;
+}
+
+bool 
+NdbDictionary::Table::getForceVarPart() const {
+  return m_impl.m_force_var_part;
+}
+
 int
 NdbDictionary::Table::aggregate(NdbError& error)
 {

--- 1.161/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp	2007-04-12 16:04:58 +02:00
+++ 1.162/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp	2007-04-26 13:38:47 +02:00
@@ -2105,6 +2105,7 @@
   impl->m_temporary = tableDesc->TableTemporaryFlag;
   impl->m_row_gci = tableDesc->RowGCIFlag;
   impl->m_row_checksum = tableDesc->RowChecksumFlag;
+  impl->m_force_var_part = tableDesc->ForceVarPartFlag;
   impl->m_kvalue = tableDesc->TableKValue;
   impl->m_minLoadFactor = tableDesc->MinLoadFactor;
   impl->m_maxLoadFactor = tableDesc->MaxLoadFactor;
@@ -2569,6 +2570,7 @@
   tmpTab->MinRowsLow = (Uint32)(impl.m_min_rows & 0xFFFFFFFF);
   tmpTab->DefaultNoPartFlag = impl.m_default_no_part_flag;
   tmpTab->LinearHashFlag = impl.m_linear_flag;
+  tmpTab->ForceVarPartFlag = impl.m_force_var_part;
 
   if (impl.m_ts_name.length())
   {

--- 1.72/storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp	2007-02-21 14:57:08 +01:00
+++ 1.73/storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp	2007-04-26 13:38:47 +02:00
@@ -199,6 +199,7 @@
   bool m_temporary;
   bool m_row_gci;
   bool m_row_checksum;
+  bool m_force_var_part;
   int m_kvalue;
   int m_minLoadFactor;
   int m_maxLoadFactor;

--- 1.408/sql/ha_ndbcluster.cc	2007-04-25 15:29:21 +02:00
+++ 1.409/sql/ha_ndbcluster.cc	2007-04-26 13:38:46 +02:00
@@ -655,6 +655,26 @@
 
 
 /*
+  Check if MySQL field type forces var part in ndb storage
+*/
+static bool field_type_forces_var_part(enum_field_types type)
+{
+  switch (type) {
+  case MYSQL_TYPE_VAR_STRING:
+  case MYSQL_TYPE_VARCHAR:
+    return TRUE;
+  case MYSQL_TYPE_TINY_BLOB:
+  case MYSQL_TYPE_BLOB:
+  case MYSQL_TYPE_MEDIUM_BLOB:
+  case MYSQL_TYPE_LONG_BLOB:
+  case MYSQL_TYPE_GEOMETRY:
+    return FALSE;
+  default:
+    return FALSE;
+  }
+}
+
+/*
   Instruct NDB to set the value of the hidden primary key
 */
 
@@ -4757,14 +4777,14 @@
 
 int ha_ndbcluster::create(const char *name, 
                           TABLE *form, 
-                          HA_CREATE_INFO *info)
+                          HA_CREATE_INFO *create_info)
 {
   THD *thd= current_thd;
   NDBTAB tab;
   NDBCOL col;
   uint pack_length, length, i, pk_length= 0;
   const void *data= NULL, *pack_data= NULL;
-  bool create_from_engine= (info->table_options & HA_OPTION_CREATE_FROM_ENGINE);
+  bool create_from_engine= (create_info->table_options & HA_OPTION_CREATE_FROM_ENGINE);
   bool is_truncate= (thd->lex->sql_command == SQLCOM_TRUNCATE);
   char tablespace[FN_LEN];
 
@@ -4788,7 +4808,7 @@
       if (!(m_table= ndbtab_g.get_table()))
 	ERR_RETURN(dict->getNdbError());
       if ((get_tablespace_name(thd, tablespace, FN_LEN)))
-	info->tablespace= tablespace;    
+	create_info->tablespace= tablespace;    
       m_table= NULL;
     }
     DBUG_PRINT("info", ("Dropping and re-creating table for TRUNCATE"));
@@ -4829,7 +4849,7 @@
 
   DBUG_PRINT("table", ("name: %s", m_tabname));  
   tab.setName(m_tabname);
-  tab.setLogging(!(info->options & HA_LEX_CREATE_TMP_TABLE));    
+  tab.setLogging(!(create_info->options & HA_LEX_CREATE_TMP_TABLE));    
    
   // Save frm data for this table
   if (readfrm(name, &data, &length))
@@ -4844,20 +4864,93 @@
   my_free((char*)data, MYF(0));
   my_free((char*)pack_data, MYF(0));
   
+  /*
+    Check for disk options
+  */
+  if (create_info->storage_media == HA_SM_DISK)
+  { 
+    if (create_info->tablespace)
+      tab.setTablespaceName(create_info->tablespace);
+    else
+      tab.setTablespaceName("DEFAULT-TS");
+  }
+  else if (create_info->tablespace)
+  {
+    if (create_info->storage_media == HA_SM_MEMORY)
+    {
+      push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
+			  ER_ILLEGAL_HA_CREATE_OPTION,
+			  ER(ER_ILLEGAL_HA_CREATE_OPTION),
+			  ndbcluster_hton_name,
+			  "TABLESPACE currently only supported for "
+			  "STORAGE DISK");
+      DBUG_RETURN(HA_ERR_UNSUPPORTED);
+    }
+    tab.setTablespaceName(create_info->tablespace);
+    create_info->storage_media = HA_SM_DISK;  //if use tablespace, that also means store on disk
+  }
+
+  /*
+    Handle table row type
+
+    Default is to let table rows have var part reference so that online 
+    add column can be performed in the future.  Explicitly setting row 
+    type to fixed will omit var part reference, which will save data 
+    memory in ndb, but at the cost of not being able to online add 
+    column to this table
+  */
+  switch (create_info->row_type) {
+  case ROW_TYPE_FIXED:
+    tab.setForceVarPart(FALSE);
+    break;
+  case ROW_TYPE_DYNAMIC:
+    /* fall through, treat as default */
+  default:
+    /* fall through, treat as default */
+  case ROW_TYPE_DEFAULT:
+    tab.setForceVarPart(TRUE);
+    break;
+  }
+
+  /*
+    Setup columns
+  */
   for (i= 0; i < form->s->fields; i++) 
   {
     Field *field= form->field[i];
     DBUG_PRINT("info", ("name: %s, type: %u, pack_length: %d", 
                         field->field_name, field->real_type(),
                         field->pack_length()));
-    if ((my_errno= create_ndb_column(col, field, info)))
+    if ((my_errno= create_ndb_column(col, field, create_info)))
       DBUG_RETURN(my_errno);
  
-    if (info->storage_media == HA_SM_DISK)
+    if (create_info->storage_media == HA_SM_DISK)
       col.setStorageType(NdbDictionary::Column::StorageTypeDisk);
     else
       col.setStorageType(NdbDictionary::Column::StorageTypeMemory);
 
+    switch (create_info->row_type) {
+    case ROW_TYPE_FIXED:
+      if (field_type_forces_var_part(field->type()))
+      {
+        push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
+                            ER_ILLEGAL_HA_CREATE_OPTION,
+                            ER(ER_ILLEGAL_HA_CREATE_OPTION),
+                            ndbcluster_hton_name,
+                            "Row format FIXED incompatible with "
+                            "variable sized attribute");
+        DBUG_RETURN(HA_ERR_UNSUPPORTED);
+      }
+      break;
+    case ROW_TYPE_DYNAMIC:
+      /*
+        Future: make columns dynamic in this case
+      */
+      break;
+    default:
+      break;
+    }
+
     tab.addColumn(col);
     if (col.getPrimaryKey())
       pk_length += (field->pack_length() + 3) / 4;
@@ -4871,29 +4964,6 @@
     for (; key_part != end; key_part++)
       tab.getColumn(key_part->fieldnr-1)->setStorageType(
                              NdbDictionary::Column::StorageTypeMemory);
-  }
-
-  if (info->storage_media == HA_SM_DISK)
-  { 
-    if (info->tablespace)
-      tab.setTablespaceName(info->tablespace);
-    else
-      tab.setTablespaceName("DEFAULT-TS");
-  }
-  else if (info->tablespace)
-  {
-    if (info->storage_media == HA_SM_MEMORY)
-    {
-      push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
-			  ER_ILLEGAL_HA_CREATE_OPTION,
-			  ER(ER_ILLEGAL_HA_CREATE_OPTION),
-			  ndbcluster_hton_name,
-			  "TABLESPACE currently only supported for "
-			  "STORAGE DISK"); 
-      DBUG_RETURN(HA_ERR_UNSUPPORTED);
-    }
-    tab.setTablespaceName(info->tablespace);
-    info->storage_media = HA_SM_DISK;  //if use tablespace, that also means store on disk
   }
 
   // No primary key, create shadow key as 64 bit, auto increment  
Thread
bk commit into 5.1 tree (tomas:1.2504)tomas26 Apr