From: jonas Date: December 14 2005 1:03pm Subject: bk commit into 5.1 tree (jonas:1.1968) List-Archive: http://lists.mysql.com/commits/155 Message-Id: <20051214130355.64C54230DE3@perch.ndb.mysql.com> 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.1968 05/12/14 14:03:50 jonas@stripped +5 -0 Merge perch.ndb.mysql.com:/home/jonas/src/mysql-5.0-push into perch.ndb.mysql.com:/home/jonas/src/mysql-5.1-new storage/ndb/src/kernel/vm/SimulatedBlock.cpp 1.27 05/12/14 14:03:48 jonas@stripped +4 -6 merge storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp 1.99 05/12/14 14:00:05 jonas@stripped +0 -0 Auto merged storage/ndb/src/kernel/vm/SimulatedBlock.cpp 1.17.6.2 05/12/14 14:00:05 jonas@stripped +0 -0 Merge rename: ndb/src/kernel/vm/SimulatedBlock.cpp -> storage/ndb/src/kernel/vm/SimulatedBlock.cpp storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp 1.73.17.2 05/12/14 14:00:05 jonas@stripped +0 -0 Merge rename: ndb/src/kernel/blocks/dbtc/DbtcMain.cpp -> storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp sql/ha_ndbcluster.cc 1.222 05/12/14 14:00:05 jonas@stripped +0 -0 Auto merged mysql-test/t/ndb_basic.test 1.34 05/12/14 14:00:05 jonas@stripped +0 -0 Auto merged mysql-test/r/ndb_basic.result 1.33 05/12/14 14:00:05 jonas@stripped +0 -0 Auto merged # 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/mysql-5.1-new/RESYNC --- 1.73.17.1/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp 2005-12-14 11:30:21 +01:00 +++ 1.99/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp 2005-12-14 14:00:05 +01:00 @@ -340,7 +340,7 @@ tabptr.p->noOfKeyAttr = desc->noOfKeyAttr; tabptr.p->hasCharAttr = desc->hasCharAttr; tabptr.p->noOfDistrKeys = desc->noOfDistrKeys; - + tabptr.p->hasVarKeys = desc->noOfVarKeys > 0; signal->theData[0] = tabptr.i; signal->theData[1] = retPtr; sendSignal(retRef, GSN_TC_SCHVERCONF, signal, 2, JBB); @@ -2302,14 +2302,15 @@ { Uint64 Tmp[MAX_KEY_SIZE_IN_WORDS * MAX_XFRM_MULTIPLY]; const TableRecord* tabPtrP = &tableRecord[tabPtrI]; + const bool hasVarKeys = tabPtrP->hasVarKeys; const bool hasCharAttr = tabPtrP->hasCharAttr; - const bool hasDistKeys = tabPtrP->noOfDistrKeys > 0; + const bool compute_distkey = distr && (tabPtrP->noOfDistrKeys > 0); Uint32 *dst = (Uint32*)Tmp; Uint32 dstPos = 0; Uint32 keyPartLen[MAX_ATTRIBUTES_IN_INDEX]; Uint32 * keyPartLenPtr; - if(hasCharAttr) + if(hasCharAttr || (compute_distkey && hasVarKeys)) { keyPartLenPtr = keyPartLen; dstPos = xfrm_key(tabPtrI, src, dst, sizeof(Tmp) >> 2, keyPartLenPtr); @@ -2327,7 +2328,7 @@ md5_hash(dstHash, (Uint64*)dst, dstPos); - if(distr && hasDistKeys) + if(compute_distkey) { jam(); @@ -2735,12 +2736,14 @@ Uint8 TDirtyFlag = tcKeyReq->getDirtyFlag(Treqinfo); Uint8 TInterpretedFlag = tcKeyReq->getInterpretedFlag(Treqinfo); Uint8 TDistrKeyFlag = tcKeyReq->getDistributionKeyFlag(Treqinfo); + Uint8 TNoDiskFlag = TcKeyReq::getNoDiskFlag(Treqinfo); Uint8 TexecuteFlag = TexecFlag; regCachePtr->opSimple = TSimpleFlag; regCachePtr->opExec = TInterpretedFlag; regTcPtr->dirtyOp = TDirtyFlag; regCachePtr->distributionKeyIndicator = TDistrKeyFlag; + regCachePtr->m_no_disk_flag = TNoDiskFlag; //------------------------------------------------------------- // The next step is to read the upto three conditional words. @@ -3213,6 +3216,8 @@ LqhKeyReq::setInterpretedFlag(Tdata10, regCachePtr->opExec); LqhKeyReq::setSimpleFlag(Tdata10, regCachePtr->opSimple); LqhKeyReq::setOperation(Tdata10, regTcPtr->operation); + LqhKeyReq::setNoDiskFlag(Tdata10, regCachePtr->m_no_disk_flag); + /* ----------------------------------------------------------------------- * Sequential Number of first LQH = 0, bit 22-23 * IF ATTRIBUTE INFORMATION IS SENT IN TCKEYREQ, @@ -3925,7 +3930,7 @@ const UintR TopWords = (UintR)regApiPtr->tckeyrec; localHostptr.i = refToNode(regApiPtr->ndbapiBlockref); const Uint32 type = getNodeInfo(localHostptr.i).m_type; - const bool is_api = (type >= NodeInfo::API && type <= NodeInfo::REP); + const bool is_api = (type >= NodeInfo::API && type <= NodeInfo::MGM); const BlockNumber TblockNum = refToBlock(regApiPtr->ndbapiBlockref); const Uint32 Tmarker = (regApiPtr->commitAckMarker == RNIL) ? 0 : 1; ptrAss(localHostptr, hostRecord); @@ -4607,7 +4612,8 @@ commitConf->transId1 = regApiPtr->transid[0]; commitConf->transId2 = regApiPtr->transid[1]; commitConf->gci = regApiPtr->globalcheckpointid; - sendSignal(regApiPtr->ndbapiBlockref, GSN_TC_COMMITCONF, signal, + + sendSignal(regApiPtr->ndbapiBlockref, GSN_TC_COMMITCONF, signal, TcCommitConf::SignalLength, JBB); } else if (regApiPtr->returnsignal == RS_NO_RETURN) { jam(); @@ -5145,6 +5151,19 @@ return; } + /* Only ref in certain situations */ + { + const Uint32 opType = regTcPtr->operation; + if ( (opType == ZDELETE && errCode != ZNOT_FOUND) + || (opType == ZINSERT && errCode != ZALREADYEXIST) + || (opType == ZUPDATE && errCode != ZNOT_FOUND) + || (opType == ZWRITE && errCode != 839 && errCode != 840)) + { + TCKEY_abort(signal, 49); + return; + } + } + /* *************** */ /* TCKEYREF < */ /* *************** */ @@ -8763,6 +8782,7 @@ ScanFragReq::setDescendingFlag(tmp, ScanTabReq::getDescendingFlag(ri)); ScanFragReq::setTupScanFlag(tmp, ScanTabReq::getTupScanFlag(ri)); ScanFragReq::setAttrLen(tmp, scanTabReq->attrLenKeyLen & 0xFFFF); + ScanFragReq::setNoDiskFlag(tmp, ScanTabReq::getNoDiskFlag(ri)); scanptr.p->scanRequestInfo = tmp; scanptr.p->scanStoredProcId = scanTabReq->storedProcId; @@ -10120,6 +10140,7 @@ tabptr.p->noOfKeyAttr = 0; tabptr.p->hasCharAttr = 0; tabptr.p->noOfDistrKeys = 0; + tabptr.p->hasVarKeys = 0; }//for }//Dbtc::initTable() @@ -11154,7 +11175,6 @@ ApiConnectRecordPtr transPtr; TcConnectRecord *localTcConnectRecord = tcConnectRecord; TcConnectRecordPtr opPtr; - /** * TODO * Check transid, @@ -11168,6 +11188,7 @@ c_firedTriggerHash.remove(trigPtr); + trigPtr.p->fragId= fireOrd->fragId; bool ok = trigPtr.p->keyValues.getSize() == fireOrd->m_noPrimKeyWords; ok &= trigPtr.p->afterValues.getSize() == fireOrd->m_noAfterValueWords; ok &= trigPtr.p->beforeValues.getSize() == fireOrd->m_noBeforeValueWords; @@ -11379,7 +11400,7 @@ const UintR TopWords = (UintR)regApiPtr->tcindxrec; localHostptr.i = refToNode(regApiPtr->ndbapiBlockref); const Uint32 type = getNodeInfo(localHostptr.i).m_type; - const bool is_api = (type >= NodeInfo::API && type <= NodeInfo::REP); + const bool is_api = (type >= NodeInfo::API && type <= NodeInfo::MGM); const BlockNumber TblockNum = refToBlock(regApiPtr->ndbapiBlockref); const Uint32 Tmarker = (regApiPtr->commitAckMarker == RNIL ? 0 : 1); ptrAss(localHostptr, hostRecord); @@ -12067,7 +12088,11 @@ Uint32 dataPos = 0; TcKeyReq * const tcIndxReq = &indexOp->tcIndxReq; TcKeyReq * const tcKeyReq = (TcKeyReq *)signal->getDataPtrSend(); - Uint32 * dataPtr = &tcKeyReq->scanInfo; + /* + Data points to distrGroupHashValue since scanInfo is used to send + fragment id of receiving fragment + */ + Uint32 * dataPtr = &tcKeyReq->distrGroupHashValue; Uint32 tcKeyLength = TcKeyReq::StaticLength; Uint32 tcKeyRequestInfo = tcIndxReq->requestInfo; TcIndexData* indexData; @@ -12106,11 +12131,16 @@ regApiPtr->executingIndexOp = indexOp->indexOpId;; regApiPtr->noIndexOp++; // Increase count - // Filter out AttributeHeader:s since this should not be in key + /* + Filter out AttributeHeader:s since this should not be in key. + Also filter out fragment id from primary key and handle that + separately by setting it as Distribution Key and set indicator. + */ + AttributeHeader* attrHeader = (AttributeHeader *) aiIter.data; Uint32 headerSize = attrHeader->getHeaderSize(); - Uint32 keySize = attrHeader->getDataSize(); + Uint32 keySize = attrHeader->getDataSize() - 1; TcKeyReq::setKeyLength(tcKeyRequestInfo, keySize); // Skip header if (headerSize == 1) { @@ -12120,6 +12150,9 @@ jam(); moreKeyData = indexOp->transIdAI.next(aiIter, headerSize - 1); }//if + tcKeyReq->scanInfo = *aiIter.data; //Fragment Id + moreKeyData = indexOp->transIdAI.next(aiIter); + TcKeyReq::setDistributionKeyFlag(tcKeyRequestInfo, 1U); while(// If we have not read complete key (keySize != 0) && (dataPos < keyBufSize)) { @@ -12475,7 +12508,7 @@ AttributeBuffer::DataBufferIterator iter; Uint32 attrId = 0; Uint32 keyLength = 0; - Uint32 totalPrimaryKeyLength = 0; + Uint32 totalPrimaryKeyLength = 1; // fragment length Uint32 hops; indexTabPtr.i = indexData->indexId; @@ -12528,11 +12561,12 @@ hops = attrHeader->getHeaderSize() + attrHeader->getDataSize(); moreAttrData = keyValues.next(iter, hops); } - AttributeHeader pkAttrHeader(attrId, totalPrimaryKeyLength); + AttributeHeader pkAttrHeader(attrId, totalPrimaryKeyLength << 2); + Uint32 attributesLength = afterValues.getSize() + + pkAttrHeader.getHeaderSize() + pkAttrHeader.getDataSize(); TcKeyReq::setKeyLength(tcKeyRequestInfo, keyLength); - tcKeyReq->attrLen = afterValues.getSize() + - pkAttrHeader.getHeaderSize() + pkAttrHeader.getDataSize(); + tcKeyReq->attrLen = attributesLength; tcKeyReq->tableId = indexData->indexId; TcKeyReq::setOperationType(tcKeyRequestInfo, ZINSERT); TcKeyReq::setExecutingTrigger(tcKeyRequestInfo, true); @@ -12582,8 +12616,11 @@ } tcKeyLength += dataPos; - Uint32 attributesLength = afterValues.getSize() + - pkAttrHeader.getHeaderSize() + pkAttrHeader.getDataSize(); + /* + Size of attrinfo is unique index attributes one by one, header for each + of them (all contained in the afterValues data structure), plus a header, + the primary key (compacted) and the fragment id before the primary key + */ if (attributesLength <= attrBufSize) { jam(); // ATTRINFO fits in TCKEYREQ @@ -12600,6 +12637,10 @@ // as one attribute pkAttrHeader.insertHeader(dataPtr); dataPtr += pkAttrHeader.getHeaderSize(); + /* + Insert fragment id before primary key as part of reference to tuple + */ + *dataPtr++ = firedTriggerData->fragId; moreAttrData = keyValues.first(iter); while(moreAttrData) { jam(); @@ -12764,6 +12805,29 @@ pkAttrHeader.insertHeader(dataPtr); dataPtr += pkAttrHeader.getHeaderSize(); attrInfoPos += pkAttrHeader.getHeaderSize(); + /* + Add fragment id before primary key + TODO: This code really needs to be made into a long signal + to remove this messy code. + */ + if (attrInfoPos == AttrInfo::DataLength) + { + jam(); + // Flush ATTRINFO +#if INTERNAL_TRIGGER_TCKEYREQ_JBA + sendSignal(reference(), GSN_ATTRINFO, signal, + AttrInfo::HeaderLength + AttrInfo::DataLength, JBA); +#else + EXECUTE_DIRECT(DBTC, GSN_ATTRINFO, signal, + AttrInfo::HeaderLength + AttrInfo::DataLength); + jamEntry(); +#endif + dataPtr = (Uint32 *) &attrInfo->attrData; + attrInfoPos = 0; + } + attrInfoPos++; + *dataPtr++ = firedTriggerData->fragId; + moreAttrData = keyValues.first(iter); while(moreAttrData) { jam(); --- 1.17.6.1/ndb/src/kernel/vm/SimulatedBlock.cpp 2005-12-14 11:34:05 +01:00 +++ 1.27/storage/ndb/src/kernel/vm/SimulatedBlock.cpp 2005-12-14 14:03:48 +01:00 @@ -36,6 +36,8 @@ #include #include "Configuration.hpp" +#include +#include #define ljamEntry() jamEntryLine(30000 + __LINE__) #define ljam() jamLine(30000 + __LINE__) @@ -49,12 +51,12 @@ theNumber(blockNumber), theReference(numberToRef(blockNumber, globalData.ownId)), theConfiguration(conf), + m_global_page_pool(globalData.m_global_page_pool), c_fragmentInfoHash(c_fragmentInfoPool), c_linearFragmentSendList(c_fragmentSendPool), c_segmentedFragmentSendList(c_fragmentSendPool), c_mutexMgr(* this), - c_counterMgr(* this), - c_ptrMetaDataCommon(0) + c_counterMgr(* this) { NewVarRef = 0; @@ -148,6 +150,8 @@ a[GSN_FSREMOVEREF] = &SimulatedBlock::execFSREMOVEREF; a[GSN_FSSYNCREF] = &SimulatedBlock::execFSSYNCREF; a[GSN_FSAPPENDREF] = &SimulatedBlock::execFSAPPENDREF; + a[GSN_NODE_START_REP] = &SimulatedBlock::execNODE_START_REP; + a[GSN_API_START_REP] = &SimulatedBlock::execAPI_START_REP; } void @@ -913,6 +917,16 @@ sendSignal(reference(), GSN_CONTINUE_FRAGMENTED, signal, 1, JBB); } +void +SimulatedBlock::execNODE_START_REP(Signal* signal) +{ +} + +void +SimulatedBlock::execAPI_START_REP(Signal* signal) +{ +} + #ifdef VM_TRACE_TIME void SimulatedBlock::clearTimes() { @@ -1876,6 +1890,14 @@ return 0; } + if (0) + { + for(Uint32 i = 0; i> 2; dstWords = srcWords; + memcpy(dstPtr, srcPtr, dstWords << 2); + + if (0) + { + ndbout_c("srcPos: %d dstPos: %d len: %d srcWords: %d dstWords: %d", + srcPos, dstPos, len, srcWords, dstWords); + + for(Uint32 i = 0; i> 2); + srcWords = (lb + len + 3) >> 2; } + dstPos += dstWords; srcPos += srcWords; return dstWords; @@ -1964,6 +2018,7 @@ { Uint32 attr = desc->keyAttr[i].attributeDescriptor; Uint32 len = AttributeDescriptor::getSizeInWords(attr); + ndbrequire(AttributeDescriptor::getArrayType(attr) == NDB_ARRAYTYPE_FIXED); if(AttributeDescriptor::getDKey(attr)) { noOfDistrKeys--;