List:Commits« Previous MessageNext Message »
From:pekka Date:December 26 2006 1:02am
Subject:bk commit into 5.1 tree (pekka:1.2376)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of pekka. When pekka 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, 2006-12-26 02:02:00+02:00, pekka@stripped +2 -0
  ndb - wl#3600

  storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp@stripped, 2006-12-26 02:01:24+02:00,
pekka@stripped +43 -27
    wl#3600 move AlterTable to own op record

  storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp@stripped, 2006-12-26 02:01:24+02:00,
pekka@stripped +49 -2
    wl#3600 move AlterTable to own op record

# 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:	pekka
# Host:	clam.(none)
# Root:	/export/space/pekka/ndb/version/my52-wl3600

--- 1.118/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp	2006-12-25 23:57:53 +02:00
+++ 1.119/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp	2006-12-26 02:01:24 +02:00
@@ -1513,6 +1513,7 @@
   c_schemaOpHash(c_schemaOpPool),
   c_schemaTransHash(c_schemaTransPool),
   c_opCreateTable(c_opRecordPool),
+  c_opAlterTable(c_opRecordPool),
   c_opDropTable(c_opRecordPool),
   c_opCreateIndex(c_opRecordPool),
   c_opDropIndex(c_opRecordPool),
@@ -2097,6 +2098,7 @@
   
   c_opRecordPool.setSize(256);   // XXX need config params
   c_opCreateTable.setSize(8);
+  c_opAlterTable.setSize(8);
   c_opDropTable.setSize(8);
   c_opCreateIndex.setSize(8);
   c_opCreateEvent.setSize(2);
@@ -3328,6 +3330,20 @@
 }
 
 void
+Dbdict::releaseAlterTableOp(Signal* signal, AlterTableRecordPtr alterTabPtr)
+{
+  if (alterTabPtr.p->m_tabInfoPtrI != RNIL)
+  {
+    jam();
+    SegmentedSectionPtr tabInfoPtr;
+    getSection(tabInfoPtr, alterTabPtr.p->m_tabInfoPtrI);
+    signal->setSection(tabInfoPtr, 0);
+    releaseSections(signal);
+  }
+  c_opAlterTable.release(alterTabPtr);
+}
+
+void
 Dbdict::restartDropTab(Signal* signal, Uint32 tableId){
 
   const Uint32 key = ++c_opRecordSequence;
@@ -4015,8 +4031,8 @@
   ParseDictTabInfoRecord parseRecord;
   aParseRecord = &parseRecord;
     
-  CreateTableRecordPtr alterTabPtr; // Reuse create table records
-  c_opCreateTable.seize(alterTabPtr);
+  AlterTableRecordPtr alterTabPtr; // Reuse create table records
+  c_opAlterTable.seize(alterTabPtr);
   
   if(alterTabPtr.isNull()){
     jam();
@@ -4036,7 +4052,7 @@
   
   if(parseRecord.errorCode != 0){
     jam();
-    c_opCreateTable.release(alterTabPtr);
+    c_opAlterTable.release(alterTabPtr);
     alterTableRef(signal, req, 
 		  (AlterTableRef::ErrorCode) parseRecord.errorCode, 
 		  aParseRecord);
@@ -4045,8 +4061,8 @@
   
   releaseSections(signal);
   alterTabPtr.p->key = ++c_opRecordSequence;
-  c_opCreateTable.add(alterTabPtr);
-  ndbrequire(c_opCreateTable.find(alterTabPtr, alterTabPtr.p->key));
+  c_opAlterTable.add(alterTabPtr);
+  ndbrequire(c_opAlterTable.find(alterTabPtr, alterTabPtr.p->key));
   alterTabPtr.p->m_errorCode = 0;
   alterTabPtr.p->m_senderRef = senderRef;
   alterTabPtr.p->m_senderData = senderData;
@@ -4085,8 +4101,8 @@
   
   ndbrequire(retValue == 0);
   
-  CreateTableRecordPtr alterTabPtr;
-  ndbrequire(c_opCreateTable.find(alterTabPtr, callbackData));
+  AlterTableRecordPtr alterTabPtr;
+  ndbrequire(c_opAlterTable.find(alterTabPtr, callbackData));
 
   TableRecordPtr tablePtr;
   c_tableRecordPool.getPtr(tablePtr, alterTabPtr.p->m_alterTableId, true);
@@ -4111,7 +4127,7 @@
     c_tableRecordPool.getPtr(tablePtr, alterTabPtr.p->m_tablePtrI);  
     releaseTableObject(tablePtr.i, false);
 
-    c_opCreateTable.release(alterTabPtr);
+    c_opAlterTable.release(alterTabPtr);
     c_blockState = BS_IDLE;
     return;
   }
@@ -4187,7 +4203,7 @@
   SegmentedSectionPtr tabInfoPtr;
   signal->getSection(tabInfoPtr, AlterTabReq::DICT_TAB_INFO);
 
-  CreateTableRecordPtr alterTabPtr; // Reuse create table records
+  AlterTableRecordPtr alterTabPtr; // Reuse create table records
 
   if (senderRef != reference()) {
     jam();
@@ -4196,13 +4212,13 @@
   if ((requestType == AlterTabReq::AlterTablePrepare)
       && (senderRef != reference())) {
     jam();
-    c_opCreateTable.seize(alterTabPtr);
+    c_opAlterTable.seize(alterTabPtr);
     if(!alterTabPtr.isNull())
       alterTabPtr.p->m_changeMask = changeMask;
   }
   else {
     jam();
-    ndbrequire(c_opCreateTable.find(alterTabPtr, senderData));
+    ndbrequire(c_opAlterTable.find(alterTabPtr, senderData));
   }
   if(alterTabPtr.isNull()){
     jam();
@@ -4280,14 +4296,14 @@
       
       if(parseRecord.errorCode != 0){
 	jam();
-	c_opCreateTable.release(alterTabPtr);
+	c_opAlterTable.release(alterTabPtr);
 	alterTabRef(signal, req, 
 		    (AlterTableRef::ErrorCode) parseRecord.errorCode, 
 		    aParseRecord);
 	return;
       }
       alterTabPtr.p->key = senderData;
-      c_opCreateTable.add(alterTabPtr);
+      c_opAlterTable.add(alterTabPtr);
       alterTabPtr.p->m_errorCode = 0;
       alterTabPtr.p->m_senderRef = senderRef;
       alterTabPtr.p->m_senderData = senderData;
@@ -4304,7 +4320,7 @@
     }
     if (handleAlterTab(req, alterTabPtr.p, tablePtr, newTablePtr) == -1) {
       jam();
-      c_opCreateTable.release(alterTabPtr);
+      c_opAlterTable.release(alterTabPtr);
       alterTabRef(signal, req, AlterTableRef::UnsupportedChange);
       return;
     }
@@ -4421,8 +4437,8 @@
   Uint32 errorStatus = ref->errorStatus;
   AlterTabReq::RequestType requestType = 
     (AlterTabReq::RequestType) ref->requestType;
-  CreateTableRecordPtr alterTabPtr;  
-  ndbrequire(c_opCreateTable.find(alterTabPtr, senderData));
+  AlterTableRecordPtr alterTabPtr;  
+  ndbrequire(c_opAlterTable.find(alterTabPtr, senderData));
   Uint32 changeMask = alterTabPtr.p->m_changeMask;
   SafeCounter safeCounter(c_counterMgr, alterTabPtr.p->m_coordinatorData.m_counter);
   safeCounter.clearWaitingFor(refToNode(senderRef));
@@ -4507,8 +4523,8 @@
   Uint32 gci = conf->gci;
   AlterTabReq::RequestType requestType = 
     (AlterTabReq::RequestType) conf->requestType;
-  CreateTableRecordPtr alterTabPtr;  
-  ndbrequire(c_opCreateTable.find(alterTabPtr, senderData));
+  AlterTableRecordPtr alterTabPtr;  
+  ndbrequire(c_opAlterTable.find(alterTabPtr, senderData));
 
   switch (requestType) {
   case(AlterTabReq::AlterTablePrepare): {
@@ -4668,7 +4684,7 @@
       TableRecordPtr tabPtr;
       c_tableRecordPool.getPtr(tabPtr, alterTabPtr.p->m_tablePtrI);  
       releaseTableObject(tabPtr.i, false);
-      releaseCreateTableOp(signal,alterTabPtr);
+      releaseAlterTableOp(signal,alterTabPtr);
       c_blockState = BS_IDLE;
     }
     else {
@@ -4700,7 +4716,7 @@
 }
 
 int Dbdict::handleAlterTab(AlterTabReq * req,
-			   CreateTableRecord * alterTabPtrP,
+			   AlterTableRecord * alterTabPtrP,
 			   TableRecordPtr origTablePtr,
 			   TableRecordPtr newTablePtr)
 {
@@ -4764,7 +4780,7 @@
 void Dbdict::revertAlterTable(Signal * signal, 
 			      Uint32 changeMask, 
 			      Uint32 tableId,
-			      CreateTableRecord * alterTabPtrP)
+			      AlterTableRecord * alterTabPtrP)
 {
   bool supportedAlteration = false;
 
@@ -4821,8 +4837,8 @@
 {
   jam();
   Uint32 key = callbackData;
-  CreateTableRecordPtr alterTabPtr;  
-  ndbrequire(c_opCreateTable.find(alterTabPtr, key));
+  AlterTableRecordPtr alterTabPtr;  
+  ndbrequire(c_opAlterTable.find(alterTabPtr, key));
   Uint32 tableId = alterTabPtr.p->m_alterTableId;
 
   Callback callback;
@@ -4851,8 +4867,8 @@
 				Uint32 returnCode)
 {
   jam();
-  CreateTableRecordPtr alterTabPtr;  
-  ndbrequire(c_opCreateTable.find(alterTabPtr, callbackData));
+  AlterTableRecordPtr alterTabPtr;  
+  ndbrequire(c_opAlterTable.find(alterTabPtr, callbackData));
   Uint32 coordinatorRef = alterTabPtr.p->m_coordinatorRef;
   TableRecordPtr tabPtr;
   c_tableRecordPool.getPtr(tabPtr, alterTabPtr.p->m_alterTableId);
@@ -4913,7 +4929,7 @@
     // Release resources
     c_tableRecordPool.getPtr(tabPtr, alterTabPtr.p->m_tablePtrI);  
     releaseTableObject(tabPtr.i, false);
-    releaseCreateTableOp(signal,alterTabPtr);
+    releaseAlterTableOp(signal,alterTabPtr);
     c_blockState = BS_IDLE;
   }
 }
@@ -16429,7 +16445,7 @@
 Dbdict::addSchemaOp(SchemaTransPtr trans_ptr, SchemaOpPtr& op_ptr)
 {
   LocalDLFifoList<SchemaOp> list(c_schemaOpPool, trans_ptr.p->m_opList);
-#if VM_TRACE
+#ifdef VM_TRACE
   SchemaOpPtr loop_ptr;
   list.first(loop_ptr);
   while (loop_ptr.i != RNIL) {

--- 1.49/storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp	2006-12-25 23:57:53 +02:00
+++ 1.50/storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp	2006-12-26 02:01:24 +02:00
@@ -1513,6 +1513,49 @@
   typedef Ptr<CreateTableRecord> CreateTableRecordPtr;
 
   /**
+   * Alter table record
+   */
+  struct AlterTableRecord : OpRecordCommon {
+    Uint32 m_senderRef;
+    Uint32 m_senderData;
+    Uint32 m_coordinatorRef;
+    
+    Uint32 m_errorCode;
+    void setErrorCode(Uint32 c){ if(m_errorCode == 0) m_errorCode = c;}
+
+    // For alter table
+    Uint32 m_changeMask;
+    bool m_alterTableFailed;
+    AlterTableRef m_alterTableRef;
+    Uint32 m_alterTableId;
+
+    /* Previous table name (used for reverting failed table rename) */
+    char previousTableName[MAX_TAB_NAME_SIZE];
+
+    /* Previous table definition, frm (used for reverting) */
+    /** TODO Could preferrably be made dynamic size */
+    Uint32 previousFrmLen;
+    char previousFrmData[MAX_FRM_DATA_SIZE];
+
+    Uint32 m_tablePtrI;
+    Uint32 m_tabInfoPtrI;
+    Uint32 m_fragmentsPtrI;
+
+    Uint32 m_dihAddFragPtr; // Connect ptr towards DIH
+    Uint32 m_lqhFragPtr;    // Connect ptr towards LQH
+
+    Callback m_callback;    // Who's using local create tab
+    MutexHandle2<DIH_START_LCP_MUTEX> m_startLcpMutex;
+    
+    struct CoordinatorData {
+      Uint32 m_gsn;
+      SafeCounterHandle m_counter;
+      AlterTabReq::RequestType m_requestType;
+    } m_coordinatorData;
+  };
+  typedef Ptr<AlterTableRecord> AlterTableRecordPtr;
+
+  /**
    * Drop table record
    */
   struct DropTableRecord : OpRecordCommon {
@@ -2327,6 +2370,7 @@
   // Common operation record pool
 public:
   STATIC_CONST( opCreateTableSize = sizeof(CreateTableRecord) );
+  STATIC_CONST( opAlterTableSize = sizeof(AlterTableRecord) );
   STATIC_CONST( opDropTableSize = sizeof(DropTableRecord) );
   STATIC_CONST( opCreateIndexSize = sizeof(OpCreateIndex) );
   STATIC_CONST( opDropIndexSize = sizeof(OpDropIndex) );
@@ -2344,6 +2388,7 @@
 #define PTR_ALIGN(n) ((((n)+sizeof(void*)-1)>>2)&~((sizeof(void*)-1)>>2))
   union OpRecordUnion {
     Uint32 u_opCreateTable  [PTR_ALIGN(opCreateTableSize)];
+    Uint32 u_opAlterTable   [PTR_ALIGN(opAlterTableSize)];
     Uint32 u_opDropTable    [PTR_ALIGN(opDropTableSize)];
     Uint32 u_opCreateIndex  [PTR_ALIGN(opCreateIndexSize)];
     Uint32 u_opDropIndex    [PTR_ALIGN(opDropIndexSize)];
@@ -2363,6 +2408,7 @@
   
   // Operation records
   KeyTable2<CreateTableRecord, OpRecordUnion> c_opCreateTable;
+  KeyTable2<AlterTableRecord, OpRecordUnion> c_opAlterTable;
   KeyTable2<DropTableRecord, OpRecordUnion> c_opDropTable;
   KeyTable2<OpCreateIndex, OpRecordUnion> c_opCreateIndex;
   KeyTable2<OpDropIndex, OpRecordUnion> c_opDropIndex;
@@ -2513,6 +2559,7 @@
   // Add Table Handling
   /* ------------------------------------------------------------ */
   void releaseCreateTableOp(Signal* signal, CreateTableRecordPtr createTabPtr);
+  void releaseAlterTableOp(Signal* signal, AlterTableRecordPtr alterTabPtr);
 
   /* ------------------------------------------------------------ */
   // Add Fragment Handling
@@ -2816,13 +2863,13 @@
   void dropTableRef(Signal * signal, DropTableReq *, DropTableRef::ErrorCode);
   void printTables(); // For debugging only
   int handleAlterTab(AlterTabReq * req,
-		     CreateTableRecord * regAlterTabPtr,
+		     AlterTableRecord * regAlterTabPtr,
 		     TableRecordPtr origTablePtr,
 		     TableRecordPtr newTablePtr);
   void revertAlterTable(Signal * signal, 
 			Uint32 changeMask, 
 			Uint32 tableId,
-			CreateTableRecord * regAlterTabPtr);
+			AlterTableRecord * regAlterTabPtr);
   void alterTable_backup_mutex_locked(Signal* signal, Uint32, Uint32);
   void alterTableRef(Signal * signal, 
 		     AlterTableReq *, AlterTableRef::ErrorCode, 
Thread
bk commit into 5.1 tree (pekka:1.2376)pekka26 Dec