Commit e836054b authored by unknown's avatar unknown
Browse files

Merge dev3-240.dev.cn.tlan:/home/justin.he/mysql/mysql-5.1/mysql-5.1-new-ndb-bj

into  dev3-240.dev.cn.tlan:/home/justin.he/mysql/mysql-5.1/bug25877-5.1-new-ndb-bj

parents 6db06b61 34099021
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -1090,7 +1090,6 @@ Dbdict::updateSchemaState(Signal* signal, Uint32 tableId,
			  SchemaFile::TableEntry* te, Callback* callback,
                          bool savetodisk){
  jam();
  ndbrequire(tableId < c_tableRecordPool.getSize());
  XSchemaFile * xsf = &c_schemaFile[c_schemaRecord.schemaPage != 0];
  SchemaFile::TableEntry * tableEntry = getTableEntry(xsf, tableId);
  
+93 −16
Original line number Diff line number Diff line
@@ -32,6 +32,82 @@
#include <../pgman.hpp>
#include <../tsman.hpp>

// jams
#undef jam
#undef jamEntry
#ifdef DBTUP_BUFFER_CPP
#define jam()	 	jamLine(10000 + __LINE__)
#define jamEntry() 	jamEntryLine(10000 + __LINE__)
#endif
#ifdef DBTUP_ROUTINES_CPP
#define jam()           jamLine(15000 + __LINE__)
#define jamEntry()      jamEntryLine(15000 + __LINE__)
#endif
#ifdef DBTUP_COMMIT_CPP
#define jam()           jamLine(20000 + __LINE__)
#define jamEntry()      jamEntryLine(20000 + __LINE__)
#endif
#ifdef DBTUP_FIXALLOC_CPP
#define jam()           jamLine(25000 + __LINE__)
#define jamEntry()      jamEntryLine(25000 + __LINE__)
#endif
#ifdef DBTUP_TRIGGER_CPP
#define jam()           jamLine(30000 + __LINE__)
#define jamEntry()      jamEntryLine(30000 + __LINE__)
#endif
#ifdef DBTUP_ABORT_CPP
#define jam()           jamLine(35000 + __LINE__)
#define jamEntry()      jamEntryLine(35000 + __LINE__)
#endif
#ifdef DBTUP_PAGE_MAP_CPP
#define jam()           jamLine(40000 + __LINE__)
#define jamEntry()      jamEntryLine(40000 + __LINE__)
#endif
#ifdef DBTUP_PAG_MAN_CPP
#define jam()           jamLine(45000 + __LINE__)
#define jamEntry()      jamEntryLine(45000 + __LINE__)
#endif
#ifdef DBTUP_STORE_PROC_DEF_CPP
#define jam()           jamLine(50000 + __LINE__)
#define jamEntry()      jamEntryLine(50000 + __LINE__)
#endif
#ifdef DBTUP_META_CPP
#define jam()           jamLine(55000 + __LINE__)
#define jamEntry()      jamEntryLine(55000 + __LINE__)
#endif
#ifdef DBTUP_TAB_DES_MAN_CPP
#define jam()           jamLine(60000 + __LINE__)
#define jamEntry()      jamEntryLine(60000 + __LINE__)
#endif
#ifdef DBTUP_GEN_CPP
#define jam()           jamLine(65000 + __LINE__)
#define jamEntry()      jamEntryLine(65000 + __LINE__)
#endif
#ifdef DBTUP_INDEX_CPP
#define jam()           jamLine(70000 + __LINE__)
#define jamEntry()      jamEntryLine(70000 + __LINE__)
#endif
#ifdef DBTUP_DEBUG_CPP
#define jam()           jamLine(75000 + __LINE__)
#define jamEntry()      jamEntryLine(75000 + __LINE__)
#endif
#ifdef DBTUP_VAR_ALLOC_CPP
#define jam()           jamLine(80000 + __LINE__)
#define jamEntry()      jamEntryLine(80000 + __LINE__)
#endif
#ifdef DBTUP_SCAN_CPP
#define jam()           jamLine(85000 + __LINE__)
#define jamEntry()      jamEntryLine(85000 + __LINE__)
#endif
#ifdef DBTUP_DISK_ALLOC_CPP
#define jam()           jamLine(90000 + __LINE__)
#define jamEntry()      jamEntryLine(90000 + __LINE__)
#endif
#ifndef jam
#define jam()           jamLine(__LINE__)
#define jamEntry()      jamEntryLine(__LINE__)
#endif

#ifdef VM_TRACE
inline const char* dbgmask(const Bitmask<MAXNROFATTRIBUTESINWORDS>& bm) {
  static int i=0; static char buf[5][200];
@@ -70,22 +146,23 @@ inline const Uint32* ALIGN_WORD(const void* ptr)
// only reports the line number in the file it currently is located in.
// 
// DbtupExecQuery.cpp         0
// DbtupBuffer.cpp         2000
// DbtupRoutines.cpp       3000
// DbtupCommit.cpp         5000
// DbtupFixAlloc.cpp       6000
// DbtupTrigger.cpp        7000
// DbtupAbort.cpp          9000
// DbtupPageMap.cpp       14000
// DbtupPagMan.cpp        16000
// DbtupStoredProcDef.cpp 18000
// DbtupMeta.cpp          20000
// DbtupTabDesMan.cpp     22000
// DbtupGen.cpp           24000
// DbtupIndex.cpp         28000
// DbtupDebug.cpp         30000
// DbtupVarAlloc.cpp      32000
// DbtupScan.cpp          33000
// DbtupBuffer.cpp         10000
// DbtupRoutines.cpp       15000
// DbtupCommit.cpp         20000
// DbtupFixAlloc.cpp       25000
// DbtupTrigger.cpp        30000
// DbtupAbort.cpp          35000
// DbtupPageMap.cpp        40000
// DbtupPagMan.cpp         45000
// DbtupStoredProcDef.cpp  50000
// DbtupMeta.cpp           55000
// DbtupTabDesMan.cpp      60000
// DbtupGen.cpp            65000
// DbtupIndex.cpp          70000
// DbtupDebug.cpp          75000
// DbtupVarAlloc.cpp       80000
// DbtupScan.cpp           85000
// DbtupDiskAlloc.cpp      90000
//------------------------------------------------------------------

/*
+32 −34
Original line number Diff line number Diff line
@@ -14,21 +14,19 @@
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */

#define DBTUP_C
#define DBTUP_ABORT_CPP
#include "Dbtup.hpp"
#include <RefConvert.hpp>
#include <ndb_limits.h>
#include <pc.hpp>

#define ljam() { jamLine(9000 + __LINE__); }
#define ljamEntry() { jamEntryLine(9000 + __LINE__); }

void Dbtup::freeAllAttrBuffers(Operationrec*  const regOperPtr)
{
  if (regOperPtr->storedProcedureId == RNIL) {
    ljam();
    jam();
    freeAttrinbufrec(regOperPtr->firstAttrinbufrec);
  } else {
    ljam();
    jam();
    StoredProcPtr storedPtr;
    c_storedProcPool.getPtr(storedPtr, (Uint32)regOperPtr->storedProcedureId);
    ndbrequire(storedPtr.p->storedCode == ZSCAN_PROCEDURE);
@@ -46,7 +44,7 @@ void Dbtup::freeAttrinbufrec(Uint32 anAttrBuf)
  Uint32 RnoFree = cnoFreeAttrbufrec;
  localAttrBufPtr.i = anAttrBuf;
  while (localAttrBufPtr.i != RNIL) {
    ljam();
    jam();
    ptrCheckGuard(localAttrBufPtr, cnoOfAttrbufrec, attrbufrec);
    Ttemp = localAttrBufPtr.p->attrbuf[ZBUF_NEXT];
    localAttrBufPtr.p->attrbuf[ZBUF_NEXT] = cfirstfreeAttrbufrec;
@@ -62,7 +60,7 @@ void Dbtup::freeAttrinbufrec(Uint32 anAttrBuf)
 */
void Dbtup::execTUP_ABORTREQ(Signal* signal) 
{
  ljamEntry();
  jamEntry();
  do_tup_abortreq(signal, 0);
}

@@ -80,7 +78,7 @@ void Dbtup::do_tup_abortreq(Signal* signal, Uint32 flags)
             (trans_state == TRANS_ERROR_WAIT_TUPKEYREQ) ||
             (trans_state == TRANS_IDLE));
  if (regOperPtr.p->op_struct.op_type == ZREAD) {
    ljam();
    jam();
    freeAllAttrBuffers(regOperPtr.p);
    initOpConnection(regOperPtr.p);
    return;
@@ -94,7 +92,7 @@ void Dbtup::do_tup_abortreq(Signal* signal, Uint32 flags)

  if (get_tuple_state(regOperPtr.p) == TUPLE_PREPARED)
  {
    ljam();
    jam();
    if (!regTabPtr.p->tuxCustomTriggers.isEmpty() &&
        (flags & ZSKIP_TUX_TRIGGERS) == 0)
      executeTuxAbortTriggers(signal,
@@ -105,12 +103,12 @@ void Dbtup::do_tup_abortreq(Signal* signal, Uint32 flags)
    OperationrecPtr loopOpPtr;
    loopOpPtr.i = regOperPtr.p->nextActiveOp;
    while (loopOpPtr.i != RNIL) {
      ljam();
      jam();
      c_operation_pool.getPtr(loopOpPtr);
      if (get_tuple_state(loopOpPtr.p) != TUPLE_ALREADY_ABORTED &&
	  !regTabPtr.p->tuxCustomTriggers.isEmpty() &&
          (flags & ZSKIP_TUX_TRIGGERS) == 0) {
        ljam();
        jam();
        executeTuxAbortTriggers(signal,
                                loopOpPtr.p,
                                regFragPtr.p,
@@ -211,116 +209,116 @@ int Dbtup::TUPKEY_abort(Signal* signal, int error_type)
  case 1:
//tmupdate_alloc_error:
    terrorCode= ZMEM_NOMEM_ERROR;
    ljam();
    jam();
    break;

  case 15:
    ljam();
    jam();
    terrorCode = ZREGISTER_INIT_ERROR;
    break;

  case 16:
    ljam();
    jam();
    terrorCode = ZTRY_TO_UPDATE_ERROR;
    break;

  case 17:
    ljam();
    jam();
    terrorCode = ZNO_ILLEGAL_NULL_ATTR;
    break;

  case 19:
    ljam();
    jam();
    terrorCode = ZTRY_TO_UPDATE_ERROR;
    break;

  case 20:
    ljam();
    jam();
    terrorCode = ZREGISTER_INIT_ERROR;
    break;

  case 22:
    ljam();
    jam();
    terrorCode = ZTOTAL_LEN_ERROR;
    break;

  case 23:
    ljam();
    jam();
    terrorCode = ZREGISTER_INIT_ERROR;
    break;

  case 24:
    ljam();
    jam();
    terrorCode = ZREGISTER_INIT_ERROR;
    break;

  case 26:
    ljam();
    jam();
    terrorCode = ZREGISTER_INIT_ERROR;
    break;

  case 27:
    ljam();
    jam();
    terrorCode = ZREGISTER_INIT_ERROR;
    break;

  case 28:
    ljam();
    jam();
    terrorCode = ZREGISTER_INIT_ERROR;
    break;

  case 29:
    ljam();
    jam();
    break;

  case 30:
    ljam();
    jam();
    terrorCode = ZCALL_ERROR;
    break;

  case 31:
    ljam();
    jam();
    terrorCode = ZSTACK_OVERFLOW_ERROR;
    break;

  case 32:
    ljam();
    jam();
    terrorCode = ZSTACK_UNDERFLOW_ERROR;
    break;

  case 33:
    ljam();
    jam();
    terrorCode = ZNO_INSTRUCTION_ERROR;
    break;

  case 34:
    ljam();
    jam();
    terrorCode = ZOUTSIDE_OF_PROGRAM_ERROR;
    break;

  case 35:
    ljam();
    jam();
    terrorCode = ZTOO_MANY_INSTRUCTIONS_ERROR;
    break;

  case 38:
    ljam();
    jam();
    terrorCode = ZTEMPORARY_RESOURCE_FAILURE;
    break;

  case 39:
    if (get_trans_state(operPtr.p) == TRANS_TOO_MUCH_AI) {
      ljam();
      jam();
      terrorCode = ZTOO_MUCH_ATTRINFO_ERROR;
    } else if (get_trans_state(operPtr.p) == TRANS_ERROR_WAIT_TUPKEYREQ) {
      ljam();
      jam();
      terrorCode = ZSEIZE_ATTRINBUFREC_ERROR;
    } else {
      ndbrequire(false);
    }//if
    break;
  case 40:
    ljam();
    jam();
    terrorCode = ZUNSUPPORTED_BRANCH;
    break;
  default:
+16 −18
Original line number Diff line number Diff line
@@ -14,28 +14,26 @@
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */

#define DBTUP_C
#define DBTUP_BUFFER_CPP
#include "Dbtup.hpp"
#include <RefConvert.hpp>
#include <ndb_limits.h>
#include <pc.hpp>
#include <signaldata/TransIdAI.hpp>

#define ljam() { jamLine(2000 + __LINE__); }
#define ljamEntry() { jamEntryLine(2000 + __LINE__); }

void Dbtup::execSEND_PACKED(Signal* signal)
{
  Uint16 hostId;
  Uint32 i;
  Uint32 TpackedListIndex= cpackedListIndex;
  ljamEntry();
  jamEntry();
  for (i= 0; i < TpackedListIndex; i++) {
    ljam();
    jam();
    hostId= cpackedList[i];
    ndbrequire((hostId - 1) < (MAX_NODES - 1)); // Also check not zero
    Uint32 TpacketTA= hostBuffer[hostId].noOfPacketsTA;
    if (TpacketTA != 0) {
      ljam();
      jam();
      BlockReference TBref= numberToRef(API_PACKED, hostId);
      Uint32 TpacketLen= hostBuffer[hostId].packetLenTA;
      MEMCOPY_NO_WORDS(&signal->theData[0],
@@ -73,7 +71,7 @@ void Dbtup::bufferTRANSID_AI(Signal* signal, BlockReference aRef,
// There is still space in the buffer. We will copy it into the
// buffer.
// ----------------------------------------------------------------
    ljam();
    jam();
    updatePackedList(signal, hostId);
  } else if (false && TnoOfPackets == 1) {
// ----------------------------------------------------------------
@@ -118,7 +116,7 @@ void Dbtup::updatePackedList(Signal* signal, Uint16 hostId)
{
  if (hostBuffer[hostId].inPackedList == false) {
    Uint32 TpackedListIndex= cpackedListIndex;
    ljam();
    jam();
    hostBuffer[hostId].inPackedList= true;
    cpackedList[TpackedListIndex]= hostId;
    cpackedListIndex= TpackedListIndex + 1;
@@ -149,7 +147,7 @@ void Dbtup::sendReadAttrinfo(Signal* signal,

  if (ERROR_INSERTED(4006) && (nodeId != getOwnNodeId())){
    // Use error insert to turn routing on
    ljam();
    jam();
    connectedToNode= false;    
  }

@@ -167,18 +165,18 @@ void Dbtup::sendReadAttrinfo(Signal* signal,
     * Own node -> execute direct
     */
    if(nodeId != getOwnNodeId()){
      ljam();
      jam();
    
      /**
       * Send long sig
       */
      if (ToutBufIndex >= 22 && is_api && !old_dest) {
	ljam();
	jam();
	/**
	 * Flush buffer so that order is maintained
	 */
	if (TpacketTA != 0) {
	  ljam();
	  jam();
	  BlockReference TBref = numberToRef(API_PACKED, nodeId);
	  MEMCOPY_NO_WORDS(&signal->theData[0],
			   &hostBuffer[nodeId].packetBufferTA[0],
@@ -202,7 +200,7 @@ void Dbtup::sendReadAttrinfo(Signal* signal,
       */
#ifndef NDB_NO_DROPPED_SIGNAL
      if (ToutBufIndex < 22 && is_api){
	ljam();
	jam();
	bufferTRANSID_AI(signal, recBlockref, 3+ToutBufIndex);
	return;
      }
@@ -214,7 +212,7 @@ void Dbtup::sendReadAttrinfo(Signal* signal,
      Uint32 * src= signal->theData+25;
      if (ToutBufIndex >= 22){
	do {
	  ljam();
	  jam();
	  MEMCOPY_NO_WORDS(&signal->theData[3], src, 22);
	  sendSignal(recBlockref, GSN_TRANSID_AI, signal, 25, JBB);
	  ToutBufIndex -= 22;
@@ -223,14 +221,14 @@ void Dbtup::sendReadAttrinfo(Signal* signal,
      }
      
      if (ToutBufIndex > 0){
	ljam();
	jam();
	MEMCOPY_NO_WORDS(&signal->theData[3], src, ToutBufIndex);
	sendSignal(recBlockref, GSN_TRANSID_AI, signal, 3+ToutBufIndex, JBB);
      }
      return;
    }
    EXECUTE_DIRECT(block, GSN_TRANSID_AI, signal, 3 + ToutBufIndex);
    ljamEntry();
    jamEntry();
    return;
  }

@@ -242,7 +240,7 @@ void Dbtup::sendReadAttrinfo(Signal* signal,
  Uint32 routeBlockref= req_struct->TC_ref;
  
  if (true){ // TODO is_api && !old_dest){
    ljam();
    jam();
    transIdAI->attrData[0]= recBlockref;
    LinearSectionPtr ptr[3];
    ptr[0].p= &signal->theData[25];
@@ -260,7 +258,7 @@ void Dbtup::sendReadAttrinfo(Signal* signal,
  Uint32 sent= 0;
  Uint32 maxLen= TransIdAI::DataLength - 1;
  while (sent < tot) {
    ljam();      
    jam();      
    Uint32 dataLen= (tot - sent > maxLen) ? maxLen : tot - sent;
    Uint32 sigLen= dataLen + TransIdAI::HeaderLength + 1; 
    MEMCOPY_NO_WORDS(&transIdAI->attrData,
+20 −22
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */

#define DBTUP_C
#define DBTUP_COMMIT_CPP
#include "Dbtup.hpp"
#include <RefConvert.hpp>
#include <ndb_limits.h>
@@ -21,16 +22,13 @@
#include <signaldata/TupCommit.hpp>
#include "../dblqh/Dblqh.hpp"

#define ljam() { jamLine(5000 + __LINE__); }
#define ljamEntry() { jamEntryLine(5000 + __LINE__); }

void Dbtup::execTUP_DEALLOCREQ(Signal* signal)
{
  TablerecPtr regTabPtr;
  FragrecordPtr regFragPtr;
  Uint32 frag_page_id, frag_id;

  ljamEntry();
  jamEntry();

  frag_id= signal->theData[0];
  regTabPtr.i= signal->theData[1];
@@ -62,7 +60,7 @@ void Dbtup::execTUP_DEALLOCREQ(Signal* signal)
    
    if (regTabPtr.p->m_attributes[MM].m_no_of_varsize)
    {
      ljam();
      jam();
      free_var_rec(regFragPtr.p, regTabPtr.p, &tmp, pagePtr);
    } else {
      free_fix_rec(regFragPtr.p, regTabPtr.p, &tmp, (Fix_page*)pagePtr.p);
@@ -78,7 +76,7 @@ void Dbtup::execTUP_WRITELOG_REQ(Signal* signal)
  Uint32 gci= signal->theData[1];
  c_operation_pool.getPtr(loopOpPtr);
  while (loopOpPtr.p->prevActiveOp != RNIL) {
    ljam();
    jam();
    loopOpPtr.i= loopOpPtr.p->prevActiveOp;
    c_operation_pool.getPtr(loopOpPtr);
  }
@@ -87,11 +85,11 @@ void Dbtup::execTUP_WRITELOG_REQ(Signal* signal)
    signal->theData[0]= loopOpPtr.p->userpointer;
    signal->theData[1]= gci;
    if (loopOpPtr.p->nextActiveOp == RNIL) {
      ljam();
      jam();
      EXECUTE_DIRECT(DBLQH, GSN_LQH_WRITELOG_REQ, signal, 2);
      return;
    }
    ljam();
    jam();
    EXECUTE_DIRECT(DBLQH, GSN_LQH_WRITELOG_REQ, signal, 2);
    jamEntry();
    loopOpPtr.i= loopOpPtr.p->nextActiveOp;
@@ -114,16 +112,16 @@ void Dbtup::removeActiveOpList(Operationrec* const regOperPtr,
  if (regOperPtr->op_struct.in_active_list) {
    regOperPtr->op_struct.in_active_list= false;
    if (regOperPtr->nextActiveOp != RNIL) {
      ljam();
      jam();
      raoOperPtr.i= regOperPtr->nextActiveOp;
      c_operation_pool.getPtr(raoOperPtr);
      raoOperPtr.p->prevActiveOp= regOperPtr->prevActiveOp;
    } else {
      ljam();
      jam();
      tuple_ptr->m_operation_ptr_i = regOperPtr->prevActiveOp;
    }
    if (regOperPtr->prevActiveOp != RNIL) {
      ljam();
      jam();
      raoOperPtr.i= regOperPtr->prevActiveOp;
      c_operation_pool.getPtr(raoOperPtr);
      raoOperPtr.p->nextActiveOp= regOperPtr->nextActiveOp;
@@ -343,7 +341,7 @@ Dbtup::disk_page_commit_callback(Signal* signal,
  Uint32 gci;
  OperationrecPtr regOperPtr;

  ljamEntry();
  jamEntry();
  
  c_operation_pool.getPtr(regOperPtr, opPtrI);
  c_lqh->get_op_info(regOperPtr.p->userpointer, &hash_value, &gci);
@@ -379,7 +377,7 @@ Dbtup::disk_page_log_buffer_callback(Signal* signal,
  Uint32 gci;
  OperationrecPtr regOperPtr;

  ljamEntry();
  jamEntry();
  
  c_operation_pool.getPtr(regOperPtr, opPtrI);
  c_lqh->get_op_info(regOperPtr.p->userpointer, &hash_value, &gci);
@@ -447,7 +445,7 @@ void Dbtup::execTUP_COMMITREQ(Signal* signal)
  TupCommitReq * const tupCommitReq= (TupCommitReq *)signal->getDataPtr();

  regOperPtr.i= tupCommitReq->opPtr;
  ljamEntry();
  jamEntry();

  c_operation_pool.getPtr(regOperPtr);
  if(!regOperPtr.p->is_first_operation())
@@ -603,7 +601,7 @@ void Dbtup::execTUP_COMMITREQ(Signal* signal)
     *   why can't we instead remove "own version" (when approriate ofcourse)
     */
    if (!regTabPtr.p->tuxCustomTriggers.isEmpty()) {
      ljam();
      jam();
      OperationrecPtr loopPtr= regOperPtr;
      while(loopPtr.i != RNIL)
      {
@@ -656,18 +654,18 @@ Dbtup::set_change_mask_info(KeyReqStruct * const req_struct,
{
  ChangeMaskState state = get_change_mask_state(regOperPtr);
  if (state == USE_SAVED_CHANGE_MASK) {
    ljam();
    jam();
    req_struct->changeMask.setWord(0, regOperPtr->saved_change_mask[0]);
    req_struct->changeMask.setWord(1, regOperPtr->saved_change_mask[1]);
  } else if (state == RECALCULATE_CHANGE_MASK) {
    ljam();
    jam();
    // Recompute change mask, for now set all bits
    req_struct->changeMask.set();
  } else if (state == SET_ALL_MASK) {
    ljam();
    jam();
    req_struct->changeMask.set();
  } else {
    ljam();
    jam();
    ndbrequire(state == DELETE_CHANGES);
    req_struct->changeMask.set();
  }
@@ -687,17 +685,17 @@ Dbtup::calculateChangeMask(Page* const pagePtr,
    ndbrequire(loopOpPtr.p->op_struct.op_type == ZUPDATE);
    ChangeMaskState change_mask= get_change_mask_state(loopOpPtr.p);
    if (change_mask == USE_SAVED_CHANGE_MASK) {
      ljam();
      jam();
      saved_word1|= loopOpPtr.p->saved_change_mask[0];
      saved_word2|= loopOpPtr.p->saved_change_mask[1];
    } else if (change_mask == RECALCULATE_CHANGE_MASK) {
      ljam();
      jam();
      //Recompute change mask, for now set all bits
      req_struct->changeMask.set();
      return;
    } else {
      ndbrequire(change_mask == SET_ALL_MASK);
      ljam();
      jam();
      req_struct->changeMask.set();
      return;
    }
Loading