List:Commits« Previous MessageNext Message »
From:jonas Date:January 6 2006 5:35pm
Subject:bk commit into 5.1 tree (jonas:1.1988)
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
  1.1988 06/01/06 18:35:11 jonas@stripped +4 -0
  ndb dd - wl#3013 backup for ndb dd
    Add support for backing up dd objects (restore is still next)  

  storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
    1.68 06/01/06 18:35:08 jonas@stripped +2 -0
    Mark dd objects as online for backup

  storage/ndb/src/kernel/blocks/backup/BackupFormat.hpp
    1.4 06/01/06 18:35:08 jonas@stripped +2 -1
    Add table type to tabledescription

  storage/ndb/src/kernel/blocks/backup/Backup.hpp
    1.14 06/01/06 18:35:08 jonas@stripped +1 -1
    Add support for backing up dd objects

  storage/ndb/src/kernel/blocks/backup/Backup.cpp
    1.31 06/01/06 18:35:08 jonas@stripped +67 -39
    Add support for backing up dd objects

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

--- 1.30/storage/ndb/src/kernel/blocks/backup/Backup.cpp	2006-01-04 16:27:59 +01:00
+++ 1.31/storage/ndb/src/kernel/blocks/backup/Backup.cpp	2006-01-06 18:35:08 +01:00
@@ -2515,15 +2515,22 @@
     Uint32 tableId = ListTablesConf::getTableId(conf->tableData[i]);
     Uint32 tableType = ListTablesConf::getTableType(conf->tableData[i]);
     Uint32 state= ListTablesConf::getTableState(conf->tableData[i]);
-    if (!DictTabInfo::isTable(tableType) && !DictTabInfo::isIndex(tableType)){
+
+    if (! (DictTabInfo::isTable(tableType) ||
+	   DictTabInfo::isIndex(tableType) ||
+	   DictTabInfo::isFilegroup(tableType) ||
+	   DictTabInfo::isFile(tableType)))
+    {
       jam();
       continue;
-    }//if
+    }
+    
     if (state != DictTabInfo::StateOnline)
     {
       jam();
       continue;
-    }//if
+    }
+    
     TablePtr tabPtr;
     ptr.p->tables.seize(tabPtr);
     if(tabPtr.i == RNIL) {
@@ -2833,6 +2840,8 @@
   //const Uint32 senderRef = info->senderRef;
   const Uint32 len = conf->totalLen;
   const Uint32 senderData = conf->senderData;
+  const Uint32 tableType = conf->tableType;
+  const Uint32 tableId = conf->tableId;
 
   BackupRecordPtr ptr;
   c_backupPool.getPtr(ptr, senderData);
@@ -2861,7 +2870,7 @@
   ptr.p->files.getPtr(filePtr, ptr.p->ctlFilePtr);
   FsBuffer & buf = filePtr.p->operation.dataBuffer;
   { // Write into ctl file
-    Uint32* dst, dstLen = len + 2;
+    Uint32* dst, dstLen = len + 3;
     if(!buf.getWritePtr(&dst, dstLen)) {
       jam();
       ndbrequire(false);
@@ -2876,13 +2885,34 @@
       BackupFormat::CtlFile::TableDescription * desc = 
         (BackupFormat::CtlFile::TableDescription*)dst;
       desc->SectionType = htonl(BackupFormat::TABLE_DESCRIPTION);
-      desc->SectionLength = htonl(len + 2);
-      dst += 2;
-
+      desc->SectionLength = htonl(len + 3);
+      desc->TableType = htonl(tableType);
+      dst += 3;
+      
       copy(dst, dictTabInfoPtr);
       buf.updateWritePtr(dstLen);
     }//if
   }
+
+  if(ptr.p->checkError()) {
+    jam();
+    releaseSections(signal);
+    defineBackupRef(signal, ptr);
+    return;
+  }//if
+
+  TablePtr tabPtr ;
+  ndbrequire(findTable(ptr, tabPtr, tableId));
+
+  if (!DictTabInfo::isTable(tableType))
+  {
+    releaseSections(signal);
+
+    TablePtr tmp = tabPtr;
+    ptr.p->tables.next(tabPtr);
+    ptr.p->tables.release(tmp);
+    goto next;
+  }
   
   ndbrequire(ptr.p->pages.getSize() >= noPages);
   Page32Ptr pagePtr;
@@ -2890,35 +2920,29 @@
   copy(&pagePtr.p->data[0], dictTabInfoPtr);
   releaseSections(signal);
   
-  if(ptr.p->checkError()) {
-    jam();
-    defineBackupRef(signal, ptr);
-    return;
-  }//if
-
-  TablePtr tabPtr = parseTableDescription(signal, ptr, len);
-  if(tabPtr.i == RNIL) {
+  if (!parseTableDescription(signal, ptr, tabPtr, len))
+  {
     jam();
     defineBackupRef(signal, ptr);
     return;
-  }//if
-
-  TablePtr tmp = tabPtr;
-  ptr.p->tables.next(tabPtr);
-  if(DictTabInfo::isIndex(tmp.p->tableType))
-  {
-    jam();
-    ptr.p->tables.release(tmp);
   }
-  else if(!ptr.p->is_lcp())
+  
+  if(!ptr.p->is_lcp())
   {
     jam();
-    signal->theData[0] = tmp.p->tableId;
+    signal->theData[0] = tabPtr.p->tableId;
     signal->theData[1] = 1; // lock
     EXECUTE_DIRECT(DBDICT, GSN_BACKUP_FRAGMENT_REQ, signal, 2);
   }
   
-  if(tabPtr.i == RNIL) {
+  ptr.p->tables.next(tabPtr);
+  
+next:
+  if(tabPtr.i == RNIL) 
+  {
+    /**
+     * Done with all tables...
+     */
     jam();
     
     ptr.p->pages.release();
@@ -2937,6 +2961,9 @@
     return;
   }//if
 
+  /**
+   * Fetch next table...
+   */
   signal->theData[0] = BackupContinueB::BUFFER_FULL_META;
   signal->theData[1] = ptr.i;
   signal->theData[2] = tabPtr.i;
@@ -2944,8 +2971,11 @@
   return;
 }
 
-Backup::TablePtr
-Backup::parseTableDescription(Signal* signal, BackupRecordPtr ptr, Uint32 len)
+bool
+Backup::parseTableDescription(Signal* signal, 
+			      BackupRecordPtr ptr, 
+			      TablePtr tabPtr, 
+			      Uint32 len)
 {
 
   Page32Ptr pagePtr;
@@ -2962,18 +2992,17 @@
 				  DictTabInfo::TableMappingSize, 
 				  true, true);
   ndbrequire(stat == SimpleProperties::Break);
-  
-  TablePtr tabPtr;
-  ndbrequire(findTable(ptr, tabPtr, tmpTab.TableId));
-  if(DictTabInfo::isIndex(tabPtr.p->tableType)){
-    jam();
-    return tabPtr;
-  }
 
+  bool lcp = ptr.p->is_lcp();
+
+  ndbrequire(tabPtr.p->tableId == tmpTab.TableId);
+  ndbrequire(DictTabInfo::isTable(tabPtr.p->tableType));
+  ndbrequire(DictTabInfo::isTable(tmpTab.TableType));
+  ndbrequire(lcp || (tabPtr.p->tableType == tmpTab.TableType));
+  
   /**
    * LCP should not save disk attributes but only mem attributes
    */
-  bool lcp = ptr.p->is_lcp();
   
   /**
    * Initialize table object
@@ -3018,8 +3047,7 @@
     {
       jam();
       ptr.p->setErrorCode(DefineBackupRef::FailedToAllocateAttributeRecord);
-      tabPtr.i = RNIL;
-      return tabPtr;
+      return false;
     }
     
     attrPtr.p->data.m_flags = 0;
@@ -3097,7 +3125,7 @@
       tabPtr.p->noOfAttributes ++;
     }
   }
-  return tabPtr;
+  return true;
 }
 
 void

--- 1.13/storage/ndb/src/kernel/blocks/backup/Backup.hpp	2005-11-07 12:19:06 +01:00
+++ 1.14/storage/ndb/src/kernel/blocks/backup/Backup.hpp	2006-01-06 18:35:08 +01:00
@@ -607,7 +607,7 @@
 
   NodeId getMasterNodeId() const { return c_masterNodeId; }
   bool findTable(const BackupRecordPtr &, TablePtr &, Uint32 tableId) const;
-  TablePtr parseTableDescription(Signal*, BackupRecordPtr ptr, Uint32 len);
+  bool parseTableDescription(Signal*, BackupRecordPtr ptr, TablePtr, Uint32);
   
   bool insertFileHeader(BackupFormat::FileType, BackupRecord*, BackupFile*);
   void sendBackupRef(Signal* signal, BackupRecordPtr ptr, Uint32 errorCode);

--- 1.3/storage/ndb/src/kernel/blocks/backup/BackupFormat.hpp	2005-11-07 12:19:06 +01:00
+++ 1.4/storage/ndb/src/kernel/blocks/backup/BackupFormat.hpp	2006-01-06 18:35:08 +01:00
@@ -115,7 +115,8 @@
     struct TableDescription {
       Uint32 SectionType;
       Uint32 SectionLength;
-      Uint32 DictTabInfo[1];   // Length = SectionLength - 2
+      Uint32 TableType;
+      Uint32 DictTabInfo[1];   // Length = SectionLength - 3
     };
 
     /**

--- 1.67/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp	2006-01-04 11:45:45 +01:00
+++ 1.68/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp	2006-01-06 18:35:08 +01:00
@@ -7293,6 +7293,7 @@
       conf->tableData[pos] = 0;
       conf->setTableId(pos, iter.curr.p->m_id);
       conf->setTableType(pos, type); // type
+      conf->setTableState(pos, DictTabInfo::StateOnline);  // XXX todo
       pos++;
     }
     if (DictTabInfo::isFile(type)){
@@ -7300,6 +7301,7 @@
       conf->tableData[pos] = 0;
       conf->setTableId(pos, iter.curr.p->m_id);
       conf->setTableType(pos, type); // type
+      conf->setTableState(pos, DictTabInfo::StateOnline); // XXX todo
       pos++;
     }
     
Thread
bk commit into 5.1 tree (jonas:1.1988)jonas6 Jan