Commit cb2d1c06 authored by unknown's avatar unknown

Merge joreland@bk-internal.mysql.com:/home/bk/mysql-5.1-new-ndb

into  perch.ndb.mysql.com:/home/jonas/src/mysql-5.1-new-ndb

parents ec325167 a3fafb90
......@@ -181,8 +181,6 @@ private:
const class NdbTableImpl* aTable,
NdbTransaction*);
int prepareSend(Uint32 TC_ConnectPtr, Uint64 TransactionId);
// Private attributes
const NdbIndexImpl* m_theIndex;
friend struct Ndb_free_list_t<NdbIndexOperation>;
......
......@@ -2522,7 +2522,7 @@ void Dbtc::execTCKEYREQ(Signal* signal)
ApiConnectRecord * const regApiPtr = &localApiConnectRecord[TapiIndex];
apiConnectptr.p = regApiPtr;
Uint32 TstartFlag = tcKeyReq->getStartFlag(Treqinfo);
Uint32 TstartFlag = TcKeyReq::getStartFlag(Treqinfo);
Uint32 TexecFlag = TcKeyReq::getExecuteFlag(Treqinfo);
Uint8 isIndexOp = regApiPtr->isIndexOp;
......@@ -2692,14 +2692,14 @@ void Dbtc::execTCKEYREQ(Signal* signal)
/* */
/* ---------------------------------------------------------------------- */
UintR TapiVersionNo = tcKeyReq->getAPIVersion(tcKeyReq->attrLen);
UintR TapiVersionNo = TcKeyReq::getAPIVersion(tcKeyReq->attrLen);
UintR Tlqhkeyreqrec = regApiPtr->lqhkeyreqrec;
regApiPtr->lqhkeyreqrec = Tlqhkeyreqrec + 1;
regCachePtr->apiVersionNo = TapiVersionNo;
UintR TapiConnectptrIndex = apiConnectptr.i;
UintR TsenderData = tcKeyReq->senderData;
UintR TattrLen = tcKeyReq->getAttrinfoLen(tcKeyReq->attrLen);
UintR TattrLen = TcKeyReq::getAttrinfoLen(tcKeyReq->attrLen);
UintR TattrinfoCount = c_counters.cattrinfoCount;
regTcPtr->apiConnect = TapiConnectptrIndex;
......@@ -2725,15 +2725,15 @@ void Dbtc::execTCKEYREQ(Signal* signal)
UintR TtabptrIndex = localTabptr.i;
UintR TtableSchemaVersion = tcKeyReq->tableSchemaVersion;
Uint8 TOperationType = tcKeyReq->getOperationType(Treqinfo);
Uint8 TOperationType = TcKeyReq::getOperationType(Treqinfo);
regCachePtr->tableref = TtabptrIndex;
regCachePtr->schemaVersion = TtableSchemaVersion;
regTcPtr->operation = TOperationType;
Uint8 TSimpleFlag = tcKeyReq->getSimpleFlag(Treqinfo);
Uint8 TDirtyFlag = tcKeyReq->getDirtyFlag(Treqinfo);
Uint8 TInterpretedFlag = tcKeyReq->getInterpretedFlag(Treqinfo);
Uint8 TDistrKeyFlag = tcKeyReq->getDistributionKeyFlag(Treqinfo);
Uint8 TSimpleFlag = TcKeyReq::getSimpleFlag(Treqinfo);
Uint8 TDirtyFlag = TcKeyReq::getDirtyFlag(Treqinfo);
Uint8 TInterpretedFlag = TcKeyReq::getInterpretedFlag(Treqinfo);
Uint8 TDistrKeyFlag = TcKeyReq::getDistributionKeyFlag(Treqinfo);
Uint8 TNoDiskFlag = TcKeyReq::getNoDiskFlag(Treqinfo);
Uint8 TexecuteFlag = TexecFlag;
......@@ -2749,10 +2749,10 @@ void Dbtc::execTCKEYREQ(Signal* signal)
Uint32 TkeyIndex;
Uint32* TOptionalDataPtr = (Uint32*)&tcKeyReq->scanInfo;
{
Uint32 TDistrGHIndex = tcKeyReq->getScanIndFlag(Treqinfo);
Uint32 TDistrGHIndex = TcKeyReq::getScanIndFlag(Treqinfo);
Uint32 TDistrKeyIndex = TDistrGHIndex;
Uint32 TscanInfo = tcKeyReq->getTakeOverScanInfo(TOptionalDataPtr[0]);
Uint32 TscanInfo = TcKeyReq::getTakeOverScanInfo(TOptionalDataPtr[0]);
regCachePtr->scanTakeOverInd = TDistrGHIndex;
regCachePtr->scanInfo = TscanInfo;
......@@ -2774,7 +2774,7 @@ void Dbtc::execTCKEYREQ(Signal* signal)
regCachePtr->keydata[2] = Tdata3;
regCachePtr->keydata[3] = Tdata4;
TkeyLength = tcKeyReq->getKeyLength(Treqinfo);
TkeyLength = TcKeyReq::getKeyLength(Treqinfo);
Uint32 TAIDataIndex;
if (TkeyLength > 8) {
TAIDataIndex = TkeyIndex + 8;
......@@ -2787,7 +2787,7 @@ void Dbtc::execTCKEYREQ(Signal* signal)
}//if
Uint32* TAIDataPtr = &TOptionalDataPtr[TAIDataIndex];
titcLenAiInTckeyreq = tcKeyReq->getAIInTcKeyReq(Treqinfo);
titcLenAiInTckeyreq = TcKeyReq::getAIInTcKeyReq(Treqinfo);
regCachePtr->keylen = TkeyLength;
regCachePtr->lenAiInTckeyreq = titcLenAiInTckeyreq;
regCachePtr->currReclenAi = titcLenAiInTckeyreq;
......@@ -2858,14 +2858,14 @@ void Dbtc::execTCKEYREQ(Signal* signal)
}//switch
}//if
Uint32 TabortOption = tcKeyReq->getAbortOption(Treqinfo);
Uint32 TabortOption = TcKeyReq::getAbortOption(Treqinfo);
regTcPtr->m_execAbortOption = TabortOption;
/*-------------------------------------------------------------------------
* Check error handling per operation
* If CommitFlag is set state accordingly and check for early abort
*------------------------------------------------------------------------*/
if (tcKeyReq->getCommitFlag(Treqinfo) == 1) {
if (TcKeyReq::getCommitFlag(Treqinfo) == 1) {
ndbrequire(TexecuteFlag);
regApiPtr->apiConnectstate = CS_REC_COMMITTING;
} else {
......@@ -11491,7 +11491,7 @@ void Dbtc::execTCINDXREQ(Signal* signal)
// If operation is readTupleExclusive or updateTuple then read index
// table with exclusive lock
Uint32 indexLength = TcKeyReq::getKeyLength(tcIndxRequestInfo);
Uint32 attrLength = tcIndxReq->attrLen;
Uint32 attrLength = TcKeyReq::getAttrinfoLen(tcIndxReq->attrLen);
indexOp->expectedKeyInfo = indexLength;
Uint32 includedIndexLength = MIN(indexLength, indexBufSize);
indexOp->expectedAttrInfo = attrLength;
......
......@@ -1077,7 +1077,7 @@ Ndb::opTupleIdOnNdb(const NdbTableImpl* table,
tOperation->incValue("NEXTID", opValue);
tRecAttrResult = tOperation->getValue("NEXTID");
if (tConnection->execute( Commit ) == -1 )
if (tConnection->execute( NdbTransaction::Commit ) == -1 )
goto error_handler;
tValue = tRecAttrResult->u_64_value();
......@@ -1092,7 +1092,7 @@ Ndb::opTupleIdOnNdb(const NdbTableImpl* table,
tOperation->equal("SYSKEY_0", aTableId );
tOperation->setValue("NEXTID", opValue);
if (tConnection->execute( Commit ) == -1 )
if (tConnection->execute( NdbTransaction::Commit ) == -1 )
goto error_handler;
range.reset();
......@@ -1109,7 +1109,7 @@ Ndb::opTupleIdOnNdb(const NdbTableImpl* table,
tOperation->def_label(0);
tOperation->interpret_exit_nok(9999);
if (tConnection->execute( Commit ) == -1)
if (tConnection->execute( NdbTransaction::Commit ) == -1)
{
if (tConnection->theError.code != 9999)
goto error_handler;
......@@ -1126,7 +1126,7 @@ Ndb::opTupleIdOnNdb(const NdbTableImpl* table,
tOperation->readTuple();
tOperation->equal("SYSKEY_0", aTableId );
tRecAttrResult = tOperation->getValue("NEXTID");
if (tConnection->execute( Commit ) == -1 )
if (tConnection->execute( NdbTransaction::Commit ) == -1 )
goto error_handler;
opValue = tRecAttrResult->u_64_value(); // out
break;
......
......@@ -172,239 +172,6 @@ NdbIndexOperation::getIndex() const
return m_theIndex;
}
int
NdbIndexOperation::prepareSend(Uint32 aTC_ConnectPtr, Uint64 aTransactionId)
{
Uint32 tTransId1, tTransId2;
Uint32 tReqInfo;
Uint32 tSignalCount = 0;
Uint32 tInterpretInd = theInterpretIndicator;
theErrorLine = 0;
if (tInterpretInd != 1) {
OperationType tOpType = theOperationType;
OperationStatus tStatus = theStatus;
if ((tOpType == UpdateRequest) ||
(tOpType == InsertRequest) ||
(tOpType == WriteRequest)) {
if (tStatus != SetValue) {
setErrorCodeAbort(4506);
return -1;
}//if
} else if ((tOpType == ReadRequest) || (tOpType == ReadExclusive) ||
(tOpType == DeleteRequest)) {
if (tStatus != GetValue) {
setErrorCodeAbort(4506);
return -1;
}//if
} else {
setErrorCodeAbort(4507);
return -1;
}//if
} else {
if (prepareSendInterpreted() == -1) {
return -1;
}//if
}//if
//-------------------------------------------------------------
// We start by filling in the first 8 unconditional words of the
// TCINDXREQ signal.
//-------------------------------------------------------------
TcKeyReq * tcKeyReq =
CAST_PTR(TcKeyReq, theTCREQ->getDataPtrSend());
Uint32 tTotalCurrAI_Len = theTotalCurrAI_Len;
Uint32 tIndexId = m_theIndex->m_id;
Uint32 tSchemaVersion = m_theIndex->m_version;
tcKeyReq->apiConnectPtr = aTC_ConnectPtr;
tcKeyReq->senderData = ptr2int();
tcKeyReq->attrLen = tTotalCurrAI_Len;
tcKeyReq->tableId = tIndexId;
tcKeyReq->tableSchemaVersion = tSchemaVersion;
tTransId1 = (Uint32) aTransactionId;
tTransId2 = (Uint32) (aTransactionId >> 32);
//-------------------------------------------------------------
// Simple is simple if simple or both start and commit is set.
//-------------------------------------------------------------
// Temporarily disable simple stuff
Uint8 tSimpleIndicator = 0;
// Uint8 tSimpleIndicator = theSimpleIndicator;
Uint8 tCommitIndicator = theCommitIndicator;
Uint8 tStartIndicator = theStartIndicator;
// if ((theNdbCon->theLastOpInList == this) && (theCommitIndicator == 0))
// abort();
// Temporarily disable simple stuff
Uint8 tSimpleAlt = 0;
// Uint8 tSimpleAlt = tStartIndicator & tCommitIndicator;
tSimpleIndicator = tSimpleIndicator | tSimpleAlt;
//-------------------------------------------------------------
// Simple state is set if start and commit is set and it is
// a read request. Otherwise it is set to zero.
//-------------------------------------------------------------
Uint8 tReadInd = (theOperationType == ReadRequest);
Uint8 tSimpleState = tReadInd & tSimpleAlt;
//theNdbCon->theSimpleState = tSimpleState;
tcKeyReq->transId1 = tTransId1;
tcKeyReq->transId2 = tTransId2;
tReqInfo = 0;
if (tTotalCurrAI_Len <= TcKeyReq::MaxAttrInfo) {
tcKeyReq->setAIInTcKeyReq(tReqInfo, tTotalCurrAI_Len);
} else {
tcKeyReq->setAIInTcKeyReq(tReqInfo, TcKeyReq::MaxAttrInfo);
}//if
tcKeyReq->setSimpleFlag(tReqInfo, tSimpleIndicator);
tcKeyReq->setCommitFlag(tReqInfo, tCommitIndicator);
tcKeyReq->setStartFlag(tReqInfo, tStartIndicator);
const Uint8 tInterpretIndicator = theInterpretIndicator;
tcKeyReq->setInterpretedFlag(tReqInfo, tInterpretIndicator);
Uint8 tDirtyIndicator = theDirtyIndicator;
OperationType tOperationType = theOperationType;
Uint32 tIndexLen = theTupKeyLen;
Uint8 abortOption = theNdbCon->m_abortOption;
tcKeyReq->setDirtyFlag(tReqInfo, tDirtyIndicator);
tcKeyReq->setOperationType(tReqInfo, tOperationType);
tcKeyReq->setKeyLength(tReqInfo, tIndexLen);
tcKeyReq->setAbortOption(tReqInfo, abortOption);
Uint8 tDistrKeyIndicator = theDistrKeyIndicator_;
Uint8 tScanIndicator = theScanInfo & 1;
tcKeyReq->setDistributionKeyFlag(tReqInfo, tDistrKeyIndicator);
tcKeyReq->setScanIndFlag(tReqInfo, tScanIndicator);
tcKeyReq->requestInfo = tReqInfo;
//-------------------------------------------------------------
// The next step is to fill in the upto three conditional words.
//-------------------------------------------------------------
Uint32* tOptionalDataPtr = &tcKeyReq->scanInfo;
Uint32 tDistrGHIndex = tScanIndicator;
Uint32 tDistrKeyIndex = tDistrGHIndex;
Uint32 tScanInfo = theScanInfo;
Uint32 tDistrKey = theDistributionKey;
tOptionalDataPtr[0] = tScanInfo;
tOptionalDataPtr[tDistrKeyIndex] = tDistrKey;
//-------------------------------------------------------------
// The next is step is to compress the key data part of the
// TCKEYREQ signal.
//-------------------------------------------------------------
Uint32 tKeyIndex = tDistrKeyIndex + tDistrKeyIndicator;
Uint32* tKeyDataPtr = &tOptionalDataPtr[tKeyIndex];
Uint32 Tdata1 = tcKeyReq->keyInfo[0];
Uint32 Tdata2 = tcKeyReq->keyInfo[1];
Uint32 Tdata3 = tcKeyReq->keyInfo[2];
Uint32 Tdata4 = tcKeyReq->keyInfo[3];
Uint32 Tdata5;
tKeyDataPtr[0] = Tdata1;
tKeyDataPtr[1] = Tdata2;
tKeyDataPtr[2] = Tdata3;
tKeyDataPtr[3] = Tdata4;
if (tIndexLen > 4) {
Tdata1 = tcKeyReq->keyInfo[4];
Tdata2 = tcKeyReq->keyInfo[5];
Tdata3 = tcKeyReq->keyInfo[6];
Tdata4 = tcKeyReq->keyInfo[7];
tKeyDataPtr[4] = Tdata1;
tKeyDataPtr[5] = Tdata2;
tKeyDataPtr[6] = Tdata3;
tKeyDataPtr[7] = Tdata4;
}//if
//-------------------------------------------------------------
// Finally we also compress the INDXATTRINFO part of the signal.
// We optimise by using the if-statement for sending INDXKEYINFO
// signals to calculating the new Attrinfo Index.
//-------------------------------------------------------------
Uint32 tAttrInfoIndex;
if (tIndexLen > TcKeyReq::MaxKeyInfo) {
/**
* Set transid and TC connect ptr in the INDXKEYINFO signals
*/
NdbApiSignal* tSignal = theTCREQ->next();
Uint32 remainingKey = tIndexLen - TcKeyReq::MaxKeyInfo;
do {
Uint32* tSigDataPtr = tSignal->getDataPtrSend();
NdbApiSignal* tnextSignal = tSignal->next();
tSignalCount++;
tSigDataPtr[0] = aTC_ConnectPtr;
tSigDataPtr[1] = tTransId1;
tSigDataPtr[2] = tTransId2;
if (remainingKey > IndxKeyInfo::DataLength) {
// The signal is full
tSignal->setLength(IndxKeyInfo::MaxSignalLength);
remainingKey -= IndxKeyInfo::DataLength;
}
else {
// Last signal
tSignal->setLength(IndxKeyInfo::HeaderLength + remainingKey);
remainingKey = 0;
}
tSignal = tnextSignal;
} while (tSignal != NULL);
tAttrInfoIndex = tKeyIndex + TcKeyReq::MaxKeyInfo;
} else {
tAttrInfoIndex = tKeyIndex + tIndexLen;
}//if
//-------------------------------------------------------------
// Perform the Attrinfo packing in the TCKEYREQ signal started
// above.
//-------------------------------------------------------------
Uint32* tAIDataPtr = &tOptionalDataPtr[tAttrInfoIndex];
Tdata1 = tcKeyReq->attrInfo[0];
Tdata2 = tcKeyReq->attrInfo[1];
Tdata3 = tcKeyReq->attrInfo[2];
Tdata4 = tcKeyReq->attrInfo[3];
Tdata5 = tcKeyReq->attrInfo[4];
theTCREQ->setLength(tcKeyReq->getAIInTcKeyReq(tReqInfo) +
tAttrInfoIndex + TcKeyReq::StaticLength);
tAIDataPtr[0] = Tdata1;
tAIDataPtr[1] = Tdata2;
tAIDataPtr[2] = Tdata3;
tAIDataPtr[3] = Tdata4;
tAIDataPtr[4] = Tdata5;
/***************************************************
* Send the INDXATTRINFO signals.
***************************************************/
if (tTotalCurrAI_Len > 5) {
// Set the last signal's length.
NdbApiSignal* tSignal = theFirstATTRINFO;
theCurrentATTRINFO->setLength(theAI_LenInCurrAI);
do {
Uint32* tSigDataPtr = tSignal->getDataPtrSend();
NdbApiSignal* tnextSignal = tSignal->next();
tSignalCount++;
tSigDataPtr[0] = aTC_ConnectPtr;
tSigDataPtr[1] = tTransId1;
tSigDataPtr[2] = tTransId2;
tSignal = tnextSignal;
} while (tSignal != NULL);
}//if
theStatus = WaitResponse;
theReceiver.prepareSend();
return 0;
}
/***************************************************************************
int receiveTCINDXREF( NdbApiSignal* aSignal)
......
......@@ -734,7 +734,7 @@ verifyHeadInline(const Tup& tup)
if (! g_opt.m_oneblob)
CHK((ra2 = g_opr->getValue("BL2")) != 0);
if (tup.m_exists) {
CHK(g_con->execute(Commit) == 0);
CHK(g_con->execute(Commit, AbortOnError) == 0);
DBG("verifyHeadInline BL1");
CHK(verifyHeadInline(g_opt.m_blob1, tup.m_blob1, ra1) == 0);
if (! g_opt.m_oneblob) {
......@@ -742,7 +742,8 @@ verifyHeadInline(const Tup& tup)
CHK(verifyHeadInline(g_opt.m_blob2, tup.m_blob2, ra2) == 0);
}
} else {
CHK(g_con->execute(Commit) == -1 && g_con->getNdbError().code == 626);
CHK(g_con->execute(Commit, AbortOnError) == -1 &&
g_con->getNdbError().code == 626);
}
g_ndb->closeTransaction(g_con);
g_opr = 0;
......@@ -1534,7 +1535,7 @@ testperf()
g_dic = g_ndb->getDictionary();
NdbDictionary::Table tab(g_opt.m_tnameperf);
if (g_dic->getTable(tab.getName()) != 0)
CHK(g_dic->dropTable(tab) == 0);
CHK(g_dic->dropTable(tab.getName()) == 0);
// col A - pk
{ NdbDictionary::Column col("A");
col.setType(NdbDictionary::Column::Unsigned);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment