List:Commits« Previous MessageNext Message »
From:jonas Date:November 1 2007 3:05pm
Subject:bk commit into 5.1 tree (jonas:1.2676) BUG#31723
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 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@stripped, 2007-11-01 16:05:45+01:00, jonas@stripped +3 -0
  ndb - bug#31723
    fix restore from drop6p>=3

  storage/ndb/tools/restore/Restore.cpp@stripped, 2007-11-01 16:05:43+01:00, jonas@stripped +118 -70
    Add support for restore from drop6p>=3

  storage/ndb/tools/restore/Restore.hpp@stripped, 2007-11-01 16:05:43+01:00, jonas@stripped +1 -0
    Add support for restore from drop6p>=3

  storage/ndb/tools/restore/restore_main.cpp@stripped, 2007-11-01 16:05:43+01:00, jonas@stripped +3 -1
    Add support for restore from drop6p>=3

diff -Nrup a/storage/ndb/tools/restore/Restore.cpp b/storage/ndb/tools/restore/Restore.cpp
--- a/storage/ndb/tools/restore/Restore.cpp	2007-09-12 14:04:58 +02:00
+++ b/storage/ndb/tools/restore/Restore.cpp	2007-11-01 16:05:43 +01:00
@@ -166,7 +166,8 @@ RestoreMetaData::readMetaTableDesc() {
   
   // Read section header 
   Uint32 sz = sizeof(sectionInfo) >> 2;
-  if (m_fileHeader.NdbVersion < NDBD_ROWID_VERSION)
+  if (m_fileHeader.NdbVersion < NDBD_ROWID_VERSION ||
+      m_fileHeader.NdbVersion == DROP6_VERSION)
   {
     sz = 2;
     sectionInfo[2] = htonl(DictTabInfo::UserTable);
@@ -500,8 +501,10 @@ bool
 RestoreMetaData::parseTableDescriptor(const Uint32 * data, Uint32 len)
 {
   NdbTableImpl* tableImpl = 0;
-  int ret = NdbDictInterface::parseTableInfo(&tableImpl, data, len, false,
-                                             m_fileHeader.NdbVersion);
+  int ret = NdbDictInterface::parseTableInfo
+    (&tableImpl, data, len, false,
+     m_fileHeader.NdbVersion == DROP6_VERSION ? MAKE_VERSION(5,1,2) :
+     m_fileHeader.NdbVersion);
   
   if (ret != 0) {
     err << "parseTableInfo " << " failed" << endl;
@@ -680,77 +683,121 @@ RestoreDataIterator::getNextTuple(int  &
     attr_data->void_value = NULL;
   }
 
-  while (ptr + 2 < buf_ptr + dataLength) {
-    typedef BackupFormat::DataFile::VariableData VarData;
-    VarData * data = (VarData *)ptr;
-    Uint32 sz = ntohl(data->Sz);
-    Uint32 attrId = ntohl(data->Id); // column_no
-
-    AttributeData * attr_data = m_tuple.getData(attrId);
-    const AttributeDesc * attr_desc = m_tuple.getDesc(attrId);
-    
-    // just a reminder - remove when backwards compat implemented
-    if(m_currentTable->backupVersion < MAKE_VERSION(5,1,3) && 
-       attr_desc->m_column->getNullable()){
-      const Uint32 ind = attr_desc->m_nullBitIndex;
-      if(BitmaskImpl::get(m_currentTable->m_nullBitmaskSize, 
-			  buf_ptr,ind)){
-	attr_data->null = true;
-	attr_data->void_value = NULL;
-	continue;
+  if (unlikely(m_currentTable->backupVersion == DROP6_VERSION))
+  {
+    for(i = 0; i < m_currentTable->m_variableAttribs.size(); i++){
+      const Uint32 attrId = m_currentTable->m_variableAttribs[i]->attrId;
+      
+      AttributeData * attr_data = m_tuple.getData(attrId);
+      const AttributeDesc * attr_desc = m_tuple.getDesc(attrId);
+      
+      if(attr_desc->m_column->getNullable()){
+        const Uint32 ind = attr_desc->m_nullBitIndex;
+        if(BitmaskImpl::get(m_currentTable->m_nullBitmaskSize, 
+                            buf_ptr,ind)){
+          attr_data->null = true;
+          attr_data->void_value = NULL;
+          continue;
+        }
       }
+      
+      assert(ptr < buf_ptr + dataLength);
+      
+      typedef BackupFormat::DataFile::VariableData VarData;
+      VarData * data = (VarData *)ptr;
+      Uint32 sz = ntohl(data->Sz);
+      Uint32 id = ntohl(data->Id);
+      assert(id == attrId);
+      
+      attr_data->null = false;
+      attr_data->void_value = &data->Data[0];
+      
+      /**
+       * Compute array size
+       */
+      const Uint32 arraySize = (4 * sz) / (attr_desc->size / 8);
+      assert(arraySize >= attr_desc->arraySize);
+      if(!Twiddle(attr_desc, attr_data, attr_desc->arraySize))
+      {
+	res = -1;
+	return NULL;
+      }
+      ptr += (sz + 2);
     }
-
-    if (m_currentTable->backupVersion < MAKE_VERSION(5,1,3))
-    {
-      sz *= 4;
-    }
-    
-    attr_data->null = false;
-    attr_data->void_value = &data->Data[0];
-    attr_data->size = sz;
-
-    //if (m_currentTable->getTableId() >= 2) { ndbout << "var off=" << ptr-buf_ptr << " attrId=" << attrId << endl; }
-
-    /**
-     * Compute array size
-     */
-    const Uint32 arraySize = sz / (attr_desc->size / 8);
-    assert(arraySize <= attr_desc->arraySize);
-
-    //convert the length of blob(v1) and text(v1)
-    if(!m_hostByteOrder
-        && (attr_desc->m_column->getType() == NdbDictionary::Column::Blob
-           || attr_desc->m_column->getType() == NdbDictionary::Column::Text)
-        && attr_desc->m_column->getArrayType() == NdbDictionary::Column::ArrayTypeFixed)
-    {
-      char* p = (char*)&attr_data->u_int64_value[0];
-      Uint64 x;
-      memcpy(&x, p, sizeof(Uint64));
-      x = Twiddle64(x);
-      memcpy(p, &x, sizeof(Uint64));
-    }
-
-    //convert datetime type
-    if(!m_hostByteOrder
-        && attr_desc->m_column->getType() == NdbDictionary::Column::Datetime)
-    {
-      char* p = (char*)&attr_data->u_int64_value[0];
-      Uint64 x;
-      memcpy(&x, p, sizeof(Uint64));
-      x = Twiddle64(x);
-      memcpy(p, &x, sizeof(Uint64));
-    }
-
-    if(!Twiddle(attr_desc, attr_data, attr_desc->arraySize))
+  }
+  else
+  {
+    while (ptr + 2 < buf_ptr + dataLength) {
+      typedef BackupFormat::DataFile::VariableData VarData;
+      VarData * data = (VarData *)ptr;
+      Uint32 sz = ntohl(data->Sz);
+      Uint32 attrId = ntohl(data->Id); // column_no
+      
+      AttributeData * attr_data = m_tuple.getData(attrId);
+      const AttributeDesc * attr_desc = m_tuple.getDesc(attrId);
+      
+      // just a reminder - remove when backwards compat implemented
+      if((m_currentTable->backupVersion < MAKE_VERSION(5,1,3)) && 
+         attr_desc->m_column->getNullable()){
+        const Uint32 ind = attr_desc->m_nullBitIndex;
+        if(BitmaskImpl::get(m_currentTable->m_nullBitmaskSize, 
+                            buf_ptr,ind)){
+          attr_data->null = true;
+          attr_data->void_value = NULL;
+          continue;
+        }
+      }
+      
+      if (m_currentTable->backupVersion < MAKE_VERSION(5,1,3))
+      {
+        sz *= 4;
+      }
+      
+      attr_data->null = false;
+      attr_data->void_value = &data->Data[0];
+      attr_data->size = sz;
+      
+      //if (m_currentTable->getTableId() >= 2) { ndbout << "var off=" << ptr-buf_ptr << " attrId=" << attrId << endl; }
+      
+      /**
+       * Compute array size
+       */
+      const Uint32 arraySize = sz / (attr_desc->size / 8);
+      assert(arraySize <= attr_desc->arraySize);
+      
+      //convert the length of blob(v1) and text(v1)
+      if(!m_hostByteOrder
+         && (attr_desc->m_column->getType() == NdbDictionary::Column::Blob
+             || attr_desc->m_column->getType() == NdbDictionary::Column::Text)
+         && attr_desc->m_column->getArrayType() == NdbDictionary::Column::ArrayTypeFixed)
+      {
+        char* p = (char*)&attr_data->u_int64_value[0];
+        Uint64 x;
+        memcpy(&x, p, sizeof(Uint64));
+        x = Twiddle64(x);
+        memcpy(p, &x, sizeof(Uint64));
+      }
+      
+      //convert datetime type
+      if(!m_hostByteOrder
+         && attr_desc->m_column->getType() == NdbDictionary::Column::Datetime)
+      {
+        char* p = (char*)&attr_data->u_int64_value[0];
+        Uint64 x;
+        memcpy(&x, p, sizeof(Uint64));
+        x = Twiddle64(x);
+        memcpy(p, &x, sizeof(Uint64));
+      }
+      
+      if(!Twiddle(attr_desc, attr_data, attr_desc->arraySize))
       {
 	res = -1;
 	return NULL;
       }
-    
-    ptr += ((sz + 3) >> 2) + 2;
+      
+      ptr += ((sz + 3) >> 2) + 2;
+    }
   }
-
   assert(ptr == buf_ptr + dataLength);
 
   m_count ++;  
@@ -948,7 +995,7 @@ BackupFile::readHeader(){
   
   debug << "ByteOrder is " << m_fileHeader.ByteOrder << endl;
   debug << "magicByteOrder is " << magicByteOrder << endl;
-  
+
   if (m_fileHeader.FileType != m_expectedFileHeader.FileType){
     abort();
   }
@@ -1093,7 +1140,7 @@ void TableS::createAttr(NdbDictionary::C
   }
 
   // just a reminder - does not solve backwards compat
-  if (backupVersion < MAKE_VERSION(5,1,3))
+  if (backupVersion < MAKE_VERSION(5,1,3) || backupVersion == DROP6_VERSION)
   {
     d->m_nullBitIndex = m_noOfNullable; 
     m_noOfNullable++;
@@ -1181,7 +1228,8 @@ RestoreLogIterator::getNextLogEntry(int 
       return 0;
     }
 
-    if (unlikely(m_metaData.getFileHeader().NdbVersion < NDBD_FRAGID_VERSION))
+    if (unlikely(m_metaData.getFileHeader().NdbVersion < NDBD_FRAGID_VERSION ||
+                 m_metaData.getFileHeader().NdbVersion == DROP6_VERSION))
     {
       /*
         FragId was introduced in LogEntry in version
diff -Nrup a/storage/ndb/tools/restore/Restore.hpp b/storage/ndb/tools/restore/Restore.hpp
--- a/storage/ndb/tools/restore/Restore.hpp	2007-05-19 22:35:26 +02:00
+++ b/storage/ndb/tools/restore/Restore.hpp	2007-11-01 16:05:43 +01:00
@@ -24,6 +24,7 @@
 
 #include <ndb_version.h>
 #include <version.h>
+#define DROP6_VERSION MAKE_VERSION(5,2,1)
 
 const int FileNameLenC = 256;
 const int TableNameLenC = 256;
diff -Nrup a/storage/ndb/tools/restore/restore_main.cpp b/storage/ndb/tools/restore/restore_main.cpp
--- a/storage/ndb/tools/restore/restore_main.cpp	2007-09-12 14:04:59 +02:00
+++ b/storage/ndb/tools/restore/restore_main.cpp	2007-11-01 16:05:43 +01:00
@@ -725,7 +725,9 @@ main(int argc, char** argv)
   char buf[NDB_VERSION_STRING_BUF_SZ];
   info.setLevel(254);
   info << "Ndb version in backup files: " 
-       <<  ndbGetVersionString(version, 0, 0, buf, sizeof(buf)) << endl;
+       <<  ndbGetVersionString(version, 0, 
+                               version == DROP6_VERSION ? "-drop6" : 0, 
+                               buf, sizeof(buf)) << endl;
   
   /**
    * check wheater we can restore the backup (right version).
Thread
bk commit into 5.1 tree (jonas:1.2676) BUG#31723jonas1 Nov