List:Internals« Previous MessageNext Message »
From:jonas.oreland Date:April 6 2005 2:24pm
Subject:bk commit into 5.1-ndb tree (joreland:1.1822)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1-ndb repository of jonas. When jonas 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.1822 05/04/06 16:23:58 joreland@stripped +10 -0
  wl2220 - ndb diskdata
    add tablespace parameter to table

  ndb/src/ndbapi/ndberror.c
    1.36 05/04/06 16:23:55 joreland@stripped +12 -0
    fix error codes

  ndb/src/ndbapi/NdbDictionaryImpl.hpp
    1.34 05/04/06 16:23:54 joreland@stripped +7 -0
    Add tablespace parameter to table

  ndb/src/ndbapi/NdbDictionaryImpl.cpp
    1.69 05/04/06 16:23:54 joreland@stripped +31 -2
    Add tablespace parameter to table

  ndb/src/kernel/blocks/dbdict/Dbdict.hpp
    1.27 05/04/06 16:23:54 joreland@stripped +2 -1
    Add tablespace parameter to table

  ndb/src/kernel/blocks/dbdict/Dbdict.cpp
    1.64 05/04/06 16:23:54 joreland@stripped +21 -7
    Add tablespace parameter to table

  ndb/src/common/debugger/signaldata/DictTabInfo.cpp
    1.13 05/04/06 16:23:54 joreland@stripped +4 -0
    Add tablespace parameter to table

  ndb/include/ndbapi/NdbDictionary.hpp
    1.39 05/04/06 16:23:54 joreland@stripped +6 -1
    Add tablespace parameter to table

  ndb/include/kernel/signaldata/DictTabInfo.hpp
    1.23 05/04/06 16:23:54 joreland@stripped +6 -2
    Add tablespace parameter to table

  ndb/include/kernel/signaldata/CreateTable.hpp
    1.6 05/04/06 16:23:54 joreland@stripped +3 -1
    Fix of error codes

  ndb/include/kernel/signaldata/CreateFilegroup.hpp
    1.15 05/04/06 16:23:54 joreland@stripped +8 -9
    Fix of error codes

# 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:	joreland
# Host:	eel.ndb.mysql.com
# Root:	/home/jonas/src/mysql-5.1-ndb-dd

--- 1.14/ndb/include/kernel/signaldata/CreateFilegroup.hpp	Wed Apr  6 15:42:07 2005
+++ 1.15/ndb/include/kernel/signaldata/CreateFilegroup.hpp	Wed Apr  6 16:23:54 2005
@@ -63,8 +63,8 @@
     NotMaster = 702,
     NoMoreObjectRecords = 710,
     InvalidFormat = 740,
-    OutOfFilegroupRecords = 745,
-    InvalidExtentSize = 746,
+    OutOfFilegroupRecords = 749,
+    InvalidExtentSize = 748,
     InvalidUndoBufferSize = 747
   };
   
@@ -146,13 +146,12 @@
     Busy = 701,
     NotMaster = 702,
     NoMoreObjectRecords = 710,
-    InvalidFormat = 740,
-    NoSuchFilegroup = 741,
-    InvalidFilegroupVersion = 742,
-    FilenameAlreadyExists = 743,
-    OutOfFilesInFilegroup = 744,
-    OutOfFileRecords = 745,
-    InvalidFileType = 746
+    InvalidFormat = 752,
+    NoSuchFilegroup = 753,
+    InvalidFilegroupVersion = 754,
+    FilenameAlreadyExists = 760,
+    OutOfFileRecords = 751,
+    InvalidFileType = 750
   };
   
   Uint32 senderData;

--- 1.5/ndb/include/kernel/signaldata/CreateTable.hpp	Thu Mar 31 20:59:24 2005
+++ 1.6/ndb/include/kernel/signaldata/CreateTable.hpp	Wed Apr  6 16:23:54 2005
@@ -93,7 +93,9 @@
     NullablePrimaryKey = 740,
     InvalidCharset = 743,
     InvalidTablespace = 755,
-    VarsizeBitfieldNotSupported = 757
+    VarsizeBitfieldNotSupported = 757,
+    NotATablespace = 758,
+    InvalidTablespaceVersion = 759
   };
 
 private:

--- 1.22/ndb/include/kernel/signaldata/DictTabInfo.hpp	Wed Apr  6 15:42:07 2005
+++ 1.23/ndb/include/kernel/signaldata/DictTabInfo.hpp	Wed Apr  6 16:23:54 2005
@@ -90,9 +90,9 @@
     CopyTable           = 3, // Between DICT's
     ReadTableFromDiskSR = 4, // Local in DICT
     GetTabInfoConf      = 5,
-    AlterTableFromAPI  = 6
+    AlterTableFromAPI   = 6
   };
-
+  
   enum KeyValues {
     TableName          = 1,  // String, Mandatory
     TableId            = 2,  //Mandatory between DICT's otherwise not allowed
@@ -120,6 +120,8 @@
     FragmentCount      = 128, // No of fragments in table (!fragment replicas)
     FragmentDataLen    = 129,
     FragmentData       = 130, // CREATE_FRAGMENTATION reply
+    TablespaceId       = 131,
+    TablespaceVersion  = 132,
     TableEnd           = 999,
     
     AttributeName          = 1000, // String, Mandatory
@@ -284,6 +286,8 @@
     Uint32 UpdateTriggerId;
     Uint32 DeleteTriggerId;
     Uint32 CustomTriggerId;
+    Uint32 TablespaceId;
+    Uint32 TablespaceVersion;
     Uint32 FrmLen;
     char   FrmData[MAX_FRM_DATA_SIZE];
     Uint32 FragmentCount;

--- 1.38/ndb/include/ndbapi/NdbDictionary.hpp	Wed Apr  6 15:42:07 2005
+++ 1.39/ndb/include/ndbapi/NdbDictionary.hpp	Wed Apr  6 16:23:54 2005
@@ -151,7 +151,8 @@
   };
 
   class Table; // forward declaration
-  
+  class Tablespace; // forward declaration
+
   /**
    * @class Column
    * @brief Represents a column in an NDB Cluster table
@@ -725,6 +726,10 @@
      * find the key faster but consume more memory.
      */
     void setMaxLoadFactor(int);
+
+    void setTablespace(const char * name);
+    void setTablespace(const class Tablespace &);
+    const char * getTablespace() const;
 
     /**
      * Get table object type

--- 1.12/ndb/src/common/debugger/signaldata/DictTabInfo.cpp	Wed Apr  6 15:42:07 2005
+++ 1.13/ndb/src/common/debugger/signaldata/DictTabInfo.cpp	Wed Apr  6 16:23:54 2005
@@ -47,6 +47,8 @@
   DTIMAP(Table, FragmentCount, FragmentCount),
   DTIMAP2(Table, FragmentDataLen, FragmentDataLen, 0, MAX_FRAGMENT_DATA_BYTES),
   DTIMAPB(Table, FragmentData, FragmentData, 0, MAX_FRAGMENT_DATA_BYTES, FragmentDataLen),
+  DTIMAP(Table, TablespaceId, TablespaceId),
+  DTIMAP(Table, TablespaceVersion, TablespaceVersion),
   DTIBREAK(AttributeName)
 };
 
@@ -124,6 +126,8 @@
   FragmentCount = 0;
   FragmentDataLen = 0;
   memset(FragmentData, 0, sizeof(FragmentData));
+  TablespaceId = RNIL;
+  TablespaceVersion = ~0;
 }
 
 void

--- 1.63/ndb/src/kernel/blocks/dbdict/Dbdict.cpp	Wed Apr  6 15:42:07 2005
+++ 1.64/ndb/src/kernel/blocks/dbdict/Dbdict.cpp	Wed Apr  6 16:23:54 2005
@@ -395,7 +395,12 @@
   
   w.add(DictTabInfo::FrmLen, frm.size());
   w.add(DictTabInfo::FrmData, frmData, frm.size());
-  
+
+  w.add(DictTabInfo::TablespaceId, tablePtr.p->m_tablespace_id);
+  FilegroupPtr tsPtr;
+  ndbrequire(c_filegroup_hash.find(tsPtr, tablePtr.p->m_tablespace_id));
+  w.add(DictTabInfo::TablespaceVersion, tsPtr.p->m_version);
+
   AttributeRecordPtr attrPtr;
   LocalDLFifoList<AttributeRecord> list(c_attributeRecordPool, 
 				    tablePtr.p->m_attributes);
@@ -5135,7 +5140,7 @@
   tablePtr.p->tableType = (DictTabInfo::TableType)tableDesc.TableType;
   tablePtr.p->kValue = tableDesc.TableKValue;
   tablePtr.p->fragmentCount = tableDesc.FragmentCount;
-  tablePtr.p->m_tablespace_id = 4; //XXX
+  tablePtr.p->m_tablespace_id = tableDesc.TablespaceId; 
   
   {
     Rope frm(c_rope_pool, tablePtr.p->frmData);
@@ -5161,7 +5166,7 @@
   tablePtr.p->buildTriggerId = RNIL;
   tablePtr.p->indexLocal = 0;
   
-  handleTabInfo(it, parseP);
+  handleTabInfo(it, parseP, tableDesc.TablespaceVersion);
   
   if(parseP->errorCode != 0)
   {
@@ -5173,7 +5178,8 @@
 }//handleTabInfoInit()
 
 void Dbdict::handleTabInfo(SimpleProperties::Reader & it,
-			   ParseDictTabInfoRecord * parseP)
+			   ParseDictTabInfoRecord * parseP,
+			   Uint32 tablespaceVersion)
 {
   TableRecordPtr tablePtr = parseP->tablePtr;
   
@@ -5404,11 +5410,19 @@
   if(counts[3] || counts[4])
   {
     FilegroupPtr tablespacePtr;
-    if(!c_filegroup_hash.find(tablespacePtr, tablePtr.p->m_tablespace_id) ||
-       tablespacePtr.p->m_type != DictTabInfo::Tablespace)
+    if(!c_filegroup_hash.find(tablespacePtr, tablePtr.p->m_tablespace_id))
     {
-      ndbout_c("%d %d", counts[3], counts[4]);
       tabRequire(false, CreateTableRef::InvalidTablespace);
+    }
+    
+    if(tablespacePtr.p->m_type != DictTabInfo::Tablespace)
+    {
+      tabRequire(false, CreateTableRef::NotATablespace);
+    }
+    
+    if(tablespacePtr.p->m_version != tablespaceVersion)
+    {
+      tabRequire(false, CreateTableRef::InvalidTablespaceVersion);
     }
   }
   

--- 1.26/ndb/src/kernel/blocks/dbdict/Dbdict.hpp	Wed Apr  6 15:42:07 2005
+++ 1.27/ndb/src/kernel/blocks/dbdict/Dbdict.hpp	Wed Apr  6 16:23:54 2005
@@ -1836,7 +1836,8 @@
   void handleTabInfoInit(SimpleProperties::Reader &, 
 			 ParseDictTabInfoRecord *,
 			 bool checkExist = true);
-  void handleTabInfo(SimpleProperties::Reader & it, ParseDictTabInfoRecord *);
+  void handleTabInfo(SimpleProperties::Reader & it, ParseDictTabInfoRecord *,
+		     Uint32 tablespaceVersion);
   
   void handleAddTableFailure(Signal* signal,
                              Uint32 failureLine,

--- 1.68/ndb/src/ndbapi/NdbDictionaryImpl.cpp	Wed Apr  6 15:42:07 2005
+++ 1.69/ndb/src/ndbapi/NdbDictionaryImpl.cpp	Wed Apr  6 16:23:54 2005
@@ -356,6 +356,7 @@
   m_fragmentCount = 0;
   m_keyLenInWords = 0;
   m_noOfBlobs = 0;
+  m_tablespace_id = ~0;
 }
 
 bool
@@ -415,8 +416,8 @@
     DBUG_PRINT("info",("m_maxLoadFactor %d != %d",m_maxLoadFactor,obj.m_maxLoadFactor));
     DBUG_RETURN(false);
   }
-  
-   DBUG_RETURN(true);
+
+  DBUG_RETURN(true);
 }
 
 void
@@ -453,6 +454,10 @@
   m_id = org.m_id;
   m_version = org.m_version;
   m_status = org.m_status;
+
+  m_tablespace_name = org.m_tablespace_name;
+  m_tablespace_id= org.m_tablespace_id;
+  m_tablespace_version = org.m_tablespace_version;
 }
 
 void NdbTableImpl::setName(const char * name)
@@ -1471,6 +1476,9 @@
 	impl->m_columns[i]->m_distributionKey = true;
     }
   }
+
+  impl->m_tablespace_id = tableDesc.TablespaceId;
+  impl->m_tablespace_version = tableDesc.TablespaceVersion;
   
   * ret = impl;
 
@@ -1659,6 +1667,27 @@
 					  fragmentTypeMapping,
 					  DictTabInfo::AllNodesSmallTable);
   tmpTab.TableVersion = rand();
+
+  if(impl.m_tablespace_id != ~(Uint32)0)
+  {
+    tmpTab.TablespaceId = impl.m_tablespace_id;
+    tmpTab.TablespaceVersion = impl.m_tablespace_version;
+  }
+  else if(impl.m_tablespace_name.length())
+  {
+    NdbTablespaceImpl tmp;
+    if(get_filegroup(tmp, NdbDictionary::Object::Tablespace, 
+		     impl.m_tablespace_name.c_str()) == 0)
+    {
+      tmpTab.TablespaceId = tmp.m_id;
+      tmpTab.TablespaceVersion = tmp.m_version;
+    }
+    else 
+    {
+      // error set by get filegroup
+      return -1;
+    }
+  }
 
   SimpleProperties::UnpackStatus s;
   s = SimpleProperties::pack(w, 

--- 1.33/ndb/src/ndbapi/NdbDictionaryImpl.hpp	Wed Apr  6 15:42:07 2005
+++ 1.34/ndb/src/ndbapi/NdbDictionaryImpl.hpp	Wed Apr  6 16:23:54 2005
@@ -178,6 +178,13 @@
    * Return count
    */
   Uint32 get_nodes(Uint32 hashValue, const Uint16** nodes) const ;
+
+  /**
+   * Disk stuff
+   */
+  BaseString m_tablespace_name;
+  Uint32 m_tablespace_id;
+  Uint32 m_tablespace_version;
 };
 
 class NdbIndexImpl : public NdbDictionary::Index, public NdbDictObjectImpl {

--- 1.35/ndb/src/ndbapi/ndberror.c	Thu Mar 31 20:59:24 2005
+++ 1.36/ndb/src/ndbapi/ndberror.c	Wed Apr  6 16:23:55 2005
@@ -347,9 +347,21 @@
   { 743,  SE, "Unsupported character set in table or index" },
   { 744,  SE, "Character string is invalid for given character set" },
   { 745,  SE, "Distribution key not supported for char attribute (use binary attribute)" },
+  { 747,  SE, "Invalid undo buffer size" },
+  { 748,  SE, "Invalid extent size" },
+  { 749,  SE, "Out of filegroup records" },
+  { 750,  SE, "Invalid file type" },
+  { 751,  SE, "Out of file records" },
+  { 752,  SE, "Invalid file format" },
+  { 753,  SE, "Invalid filegroup for file" },
+  { 754,  SE, "Invalid filegroup version when creating file" },
   { 755,  SE, "Invalid tablespace" },
   { 756,  SE, "Index on disk column is not supported" },
   { 757,  SE, "Varsize bitfield not supported" },
+  { 758,  SE, "Tablespace has changed" },
+  { 759,  SE, "Invalid tablespace version " },
+  { 760,  SE, "File already exists", },
+  
   { 241,  SE, "Invalid schema object version" },
   { 283,  SE, "Table is being dropped" },
   { 284,  SE, "Table not defined in transaction coordinator" },
Thread
bk commit into 5.1-ndb tree (joreland:1.1822)jonas.oreland6 Apr