List:Internals« Previous MessageNext Message »
From:jonas Date:November 30 2005 1:59pm
Subject:bk commit into 5.1 tree (jonas:1.1971)
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.1971 05/11/30 14:58:59 jonas@stripped +5 -0
  ndb - rowid
    bug fix list handling of alloc/free pages

  storage/ndb/src/kernel/blocks/dbtup/DbtupPageMap.cpp
    1.5 05/11/30 14:58:56 jonas@stripped +12 -1
    Fix list handling

  storage/ndb/src/kernel/blocks/dbtup/DbtupFixAlloc.cpp
    1.6 05/11/30 14:58:56 jonas@stripped +6 -3
    Correct list handling

  storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp
    1.31 05/11/30 14:58:56 jonas@stripped +10 -2
    Fix for rowid

  storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
    1.87 05/11/30 14:58:56 jonas@stripped +99 -19
    More prinouts

  storage/ndb/src/common/debugger/signaldata/LqhKey.cpp
    1.5 05/11/30 14:58:56 jonas@stripped +3 -2
    Fix prinout wrt rowid

# 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-ndb

--- 1.4/storage/ndb/src/common/debugger/signaldata/LqhKey.cpp	2005-11-23 07:50:50 +01:00
+++ 1.5/storage/ndb/src/common/debugger/signaldata/LqhKey.cpp	2005-11-30 14:58:56 +01:00
@@ -125,8 +125,9 @@
   if (LqhKeyReq::getRowidFlag(reqInfo))
   {
     fprintf(output, " Rowid: [ page: %d idx: %d ]\n",
-	    sig->variableData[nextPos++],
-	    sig->variableData[nextPos++]);
+	    sig->variableData[nextPos + 0],
+	    sig->variableData[nextPos + 1]);
+    nextPos += 2;
   }
   
   if(!LqhKeyReq::getInterpretedFlag(reqInfo)){

--- 1.86/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp	2005-11-28 14:11:57 +01:00
+++ 1.87/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp	2005-11-30 14:58:56 +01:00
@@ -1392,9 +1392,13 @@
       if (addfragptr.p->fragCopyCreation == 1) {
         jam();
         if (! DictTabInfo::isOrderedIndex(addfragptr.p->tableType))
+	{
           fragptr.p->fragStatus = Fragrecord::ACTIVE_CREATION;
+	}
         else
+	{
           fragptr.p->fragStatus = Fragrecord::FSACTIVE;
+	}
         fragptr.p->logFlag = Fragrecord::STATE_FALSE;
       } else {
         jam();
@@ -2534,10 +2538,20 @@
   c_fragment_pool.getPtr(regFragptr);
   fragptr = regFragptr;
   
+  TcConnectionrec* regTcPtr = tcConnectptr.p;
   switch (tcConnectptr.p->transactionState) {
   case TcConnectionrec::WAIT_TUP:
     jam();
-    abortErrorLab(signal);
+    if (regTcPtr->activeCreat == ZTRUE && 
+	regTcPtr->operation == ZINSERT &&
+	terrorCode == 899)
+    {
+      ndbrequire(false);
+    }
+    else
+    {
+      abortErrorLab(signal);
+    }
     break;
   case TcConnectionrec::COPY_TUPKEY:
     ndbrequire(false);
@@ -3360,7 +3374,7 @@
 
   if (LqhKeyReq::getRowidFlag(Treqinfo))
   {
-    ndbassert(op == ZINSERT || op == ZWRITE);
+    ndbassert(op == ZINSERT);
     ndbassert(refToBlock(senderRef) != DBTC);
   }
   else if(op == ZINSERT)
@@ -3434,6 +3448,7 @@
     LQHKEY_error(signal, 6);
     return;
   }//if
+
   Uint8 TcopyType = fragptr.p->fragCopy;
   Uint32 logPart = fragptr.p->m_log_part_ptr_i;
   tfragDistKey = fragptr.p->fragDistributionKey;
@@ -3875,7 +3890,9 @@
    * ----------------------------------------------------------------------- */
   if (regTcPtr->operation == ZWRITE) 
   {
+    ndbassert(regTcPtr->seqNoReplica == 0);
     Uint32 op= signal->theData[1];
+    Uint32 requestInfo = regTcPtr->reqinfo;
     if(likely(op == ZINSERT || op == ZUPDATE))
     {
       regTcPtr->operation = op;
@@ -3885,8 +3902,11 @@
       warningEvent("Convering %d to ZUPDATE", op);
       op = regTcPtr->operation = ZUPDATE;
     }
+    requestInfo &= ~(RI_OPERATION_MASK);
+    LqhKeyReq::setOperation(requestInfo, op);
+    regTcPtr->reqinfo = requestInfo;
   }//if
-
+  
   /* ------------------------------------------------------------------------
    * IT IS NOW TIME TO CONTACT THE TUPLE MANAGER. THE TUPLE MANAGER NEEDS THE
    * INFORMATION ON WHICH TABLE AND FRAGMENT, THE LOCAL KEY AND IT NEEDS TO
@@ -3912,6 +3932,7 @@
 			    Uint32 local_key,
 			    Uint32 disk_page)
 {
+  Uint32 op = regTcPtr->operation;
   regTcPtr->transactionState = TcConnectionrec::WAIT_TUP;
   /* ------------------------------------------------------------------------
    * IT IS NOW TIME TO CONTACT THE TUPLE MANAGER. THE TUPLE MANAGER NEEDS THE
@@ -3929,7 +3950,7 @@
 #endif
   Uint32 Ttupreq = regTcPtr->dirtyOp;
   Ttupreq = Ttupreq + (regTcPtr->opSimple << 1);
-  Ttupreq = Ttupreq + (regTcPtr->operation << 6);
+  Ttupreq = Ttupreq + (op << 6);
   Ttupreq = Ttupreq + (regTcPtr->opExec << 10);
   Ttupreq = Ttupreq + (regTcPtr->apiVersionNo << 11);
   Ttupreq = Ttupreq + (regTcPtr->m_use_rowid << 11);
@@ -3986,6 +4007,25 @@
   {
     ndbout << "INSERT " << regFragptrP->tabRef 
 	   << "(" << regFragptrP->fragId << ")";
+
+    {
+      ndbout << "key=[" << hex;
+      Uint32 i;
+      for(i = 0; i<regTcPtr->primKeyLen && i < 4; i++){
+	ndbout << hex << regTcPtr->tupkeyData[i] << " ";
+      }
+      
+      DatabufPtr regDatabufptr;
+      regDatabufptr.i = regTcPtr->firstTupkeybuf;
+      while(i < regTcPtr->primKeyLen)
+      {
+	ptrCheckGuard(regDatabufptr, cdatabufFileSize, databuf);
+	for(Uint32 j = 0; j<4 && i<regTcPtr->primKeyLen; j++, i++)
+	  ndbout << hex << regDatabufptr.p->data[j] << " ";
+      }
+      ndbout << "] ";
+    }
+
     if(regTcPtr->m_use_rowid)
       ndbout << " " << regTcPtr->m_row_id;
   }
@@ -3995,9 +4035,29 @@
     Local_key lk; lk.assref(local_key);
     
     ndbout << "DELETE " << regFragptrP->tabRef 
-	   << "(" << regFragptrP->fragId << ") " << lk << endl;
+	   << "(" << regFragptrP->fragId << ") " << lk;
+
+    {
+      ndbout << "key=[" << hex;
+      Uint32 i;
+      for(i = 0; i<regTcPtr->primKeyLen && i < 4; i++){
+	ndbout << hex << regTcPtr->tupkeyData[i] << " ";
+      }
+      
+      DatabufPtr regDatabufptr;
+      regDatabufptr.i = regTcPtr->firstTupkeybuf;
+      while(i < regTcPtr->primKeyLen)
+      {
+	ptrCheckGuard(regDatabufptr, cdatabufFileSize, databuf);
+	for(Uint32 j = 0; j<4 && i<regTcPtr->primKeyLen; j++, i++)
+	  ndbout << hex << regDatabufptr.p->data[j] << " ";
+      }
+      ndbout << "]" << endl;
+    }
+
   }
 
+  regTcPtr->m_use_rowid |= (op == ZINSERT);
   regTcPtr->m_row_id.m_page_no = page_no;
   regTcPtr->m_row_id.m_page_idx = page_idx;
   
@@ -4110,7 +4170,6 @@
   }//if
   regTcPtr->totSendlenAi = tupKeyConf->writeLength;
   ndbrequire(regTcPtr->totSendlenAi == regTcPtr->currTupAiLen);
-  regTcPtr->m_use_rowid = tupKeyConf->rowid;
   rwConcludedLab(signal);
   return;
 }//Dblqh::tupkeyConfLab()
@@ -4533,9 +4592,11 @@
 
   if (LqhKeyReq::getRowidFlag(Treqinfo))
   {
-    ndbassert(LqhKeyReq::getOperation(Treqinfo) == ZINSERT ||
-	      LqhKeyReq::getOperation(Treqinfo) == ZWRITE);
-    ndbassert(regTcPtr->nextSeqNoReplica == regTcPtr->lastReplicaNo);
+    ndbassert(LqhKeyReq::getOperation(Treqinfo) == ZINSERT);
+  }
+  else
+  {
+    ndbassert(LqhKeyReq::getOperation(Treqinfo) != ZINSERT);
   }
   
   UintR TreadLenAiInd = (regTcPtr->readlenAi == 0 ? 0 : 1);
@@ -4975,7 +5036,7 @@
   {
     jam();
     regTcPtr->m_dealloc = 0;
-    
+
     signal->theData[0] = regTcPtr->fragmentid;
     signal->theData[1] = regTcPtr->tableref;
     signal->theData[2] = regTcPtr->m_row_id.m_page_no;
@@ -6965,7 +7026,7 @@
   }
   
 #ifdef VM_TRACE
-  if (signal->getLength() >= 3 && nextScanConf->fragId != RNIL)
+  if (signal->getLength() > 2 && nextScanConf->accOperationPtr != RNIL)
   {
     Ptr<TcConnectionrec> regTcPtr;
     regTcPtr.i = scanptr.p->scanTcrec;
@@ -9419,7 +9480,7 @@
   initCopyTc(signal);
   tcConnectptr.p->m_use_rowid = true;
   tcConnectptr.p->m_row_id = scanptr.p->m_row_id;
-
+  
   Fragrecord* fragPtrP= fragptr.p;
   scanptr.p->scanState = ScanRecord::WAIT_TUPKEY_COPY;
   tcConnectptr.p->transactionState = TcConnectionrec::COPY_TUPKEY;
@@ -9934,6 +9995,7 @@
     }//if
     return;
   }//if
+  
   fragptr.p->fragStatus = Fragrecord::FSACTIVE;
   if (fragptr.p->lcpFlag == Fragrecord::LCP_STATE_TRUE) {
     jam();
@@ -10090,7 +10152,7 @@
   Uint32 reqinfo = 0;
   LqhKeyReq::setDirtyFlag(reqinfo, 1);
   LqhKeyReq::setSimpleFlag(reqinfo, 1);
-  LqhKeyReq::setOperation(reqinfo, ZWRITE);
+  LqhKeyReq::setOperation(reqinfo, ZINSERT);
                                         /* AILen in LQHKEYREQ  IS ZERO */
   tcConnectptr.p->reqinfo = reqinfo;
 /* ------------------------------------------------------------------------ */
@@ -14422,17 +14484,22 @@
   case ZUPDATE:
   case ZDELETE:
     jam();
-    ndbrequire(terrorCode == ZNO_TUPLE_FOUND);
+    if (unlikely(terrorCode != ZNO_TUPLE_FOUND))
+      goto error;
     break;
   case ZINSERT:
     jam();
-    ndbrequire(terrorCode == ZTUPLE_ALREADY_EXIST);
+    if (unlikely(terrorCode != ZTUPLE_ALREADY_EXIST && terrorCode != 899))
+      goto error;
+    
+    if (terrorCode == 899)
+      ndbout_c("899");
+    
     break;
   default:
-    ndbrequire(false);
-    return;
-    break;
-  }//switch
+    goto error;
+  }
+
   if (result == ZOK) {
     jam();
     execLogRecord(signal);
@@ -14451,6 +14518,19 @@
    *  PROCEEDING IN RARE CASES.
    * ----------------------------------------------------------------------- */
   return;
+error:
+  BaseString tmp;
+  tmp.appfmt("You have found a bug!"
+	     " Failed op (%s) during REDO table: %d fragment: %d err: %d",
+	     tcConnectptr.p->operation == ZINSERT ? "INSERT" :
+	     tcConnectptr.p->operation == ZUPDATE ? "UPDATE" :
+	     tcConnectptr.p->operation == ZDELETE ? "DELETE" :
+	     tcConnectptr.p->operation == ZWRITE ? "WRITE" : "<unknown>",
+	     tcConnectptr.p->tableref,
+	     tcConnectptr.p->fragmentid,
+	     terrorCode);
+  progError(__LINE__, NDBD_EXIT_SYSTEM_ERROR, 
+	    tmp.c_str());
 }//Dblqh::logLqhkeyrefLab()
 
 void Dblqh::closeExecSrCompletedLab(Signal* signal) 

--- 1.30/storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp	2005-11-25 20:12:39 +01:00
+++ 1.31/storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp	2005-11-30 14:58:56 +01:00
@@ -1404,8 +1404,16 @@
   }
   else
   {
-    // no mem insert, but rowid
-    ndbrequire(false);
+    if ((req_struct->m_row_id.m_page_no == frag_page_id &&
+	 req_struct->m_row_id.m_page_idx == regOperPtr.p->m_tuple_location.m_page_idx))
+    {
+      ndbout_c("no mem insert but rowid (same)");
+    }
+    else
+    {
+      // no mem insert, but rowid
+      ndbrequire(false);
+    }
   }
   
   if (disk_insert)

--- 1.5/storage/ndb/src/kernel/blocks/dbtup/DbtupFixAlloc.cpp	2005-11-23 07:50:50 +01:00
+++ 1.6/storage/ndb/src/kernel/blocks/dbtup/DbtupFixAlloc.cpp	2005-11-30 14:58:56 +01:00
@@ -86,14 +86,16 @@
 // convert it into a tuple header page and put it in thFreeFirst-list.
 /* ---------------------------------------------------------------- */
       c_page_pool.getPtr(pagePtr);
+
+      ndbassert(pagePtr.p->page_state == ZEMPTY_MM);
       
       convertThPage(regTabPtr->m_offsets[MM].m_fix_header_size, 
 		    (Fix_page*)pagePtr.p);
       
       pagePtr.p->page_state = ZTH_MM_FREE;
-      pagePtr.p->nextList = RNIL;
-      pagePtr.p->prevList = RNIL;
-      regFragPtr->thFreeFirst.firstItem = pagePtr.i;
+      
+      LocalDLList<Page> free_pages(c_page_pool, regFragPtr->thFreeFirst);    
+      free_pages.add(pagePtr);
     } else {
       ljam();
 /* ---------------------------------------------------------------- */
@@ -152,6 +154,7 @@
 Dbtup::alloc_tuple_from_page(Fragrecord* const regFragPtr,
 			     Fix_page* const regPagePtr)
 {
+  ndbassert(regPagePtr->free_space);
   Uint32 idx= regPagePtr->alloc_record();
   if(regPagePtr->free_space == 0)
   {

--- 1.4/storage/ndb/src/kernel/blocks/dbtup/DbtupPageMap.cpp	2005-11-04 10:32:07 +01:00
+++ 1.5/storage/ndb/src/kernel/blocks/dbtup/DbtupPageMap.cpp	2005-11-30 14:58:56 +01:00
@@ -392,9 +392,20 @@
       loopPagePtr.p->prevList = prev;
       prev = loopPagePtr.i;
     }//for
+    loopPagePtr.i--;
+    ndbassert(loopPagePtr.p == c_page_pool.getPtr(loopPagePtr.i));
     loopPagePtr.p->nextList = RNIL;
+    
     LocalDLList<Page> alloc(c_page_pool, regFragPtr->emptyPrimPage);
-    alloc.add(retPageRef, loopPagePtr);
+    if (noOfPagesAllocated > 1)
+    {
+      alloc.add(retPageRef, loopPagePtr);
+    }
+    else
+    {
+      alloc.add(loopPagePtr);
+    }
+
 /* ---------------------------------------------------------------- */
 /*       WAS ENOUGH PAGES ALLOCATED OR ARE MORE NEEDED.             */
 /* ---------------------------------------------------------------- */
Thread
bk commit into 5.1 tree (jonas:1.1971)jonas30 Nov