Commit c9e34f19 authored by joreland@mysql.com's avatar joreland@mysql.com

wl1671 - bug fixes

parent 14d00843
...@@ -309,6 +309,16 @@ public: ...@@ -309,6 +309,16 @@ public:
*/ */
void close(); void close();
/**
* Restart transaction
*
* Once a transaction has been completed successfully
* it can be started again wo/ calling closeTransaction/startTransaction
*
* Note this method also releases completed operations
*/
int restart();
/** @} *********************************************************************/ /** @} *********************************************************************/
/** /**
...@@ -417,16 +427,14 @@ public: ...@@ -417,16 +427,14 @@ public:
*/ */
const NdbOperation * getNextCompletedOperation(const NdbOperation * op)const; const NdbOperation * getNextCompletedOperation(const NdbOperation * op)const;
/** @} *********************************************************************/
private:
/** /**
* Release completed operations * Release completed operations
*/ */
void releaseCompletedOperations(); void releaseCompletedOperations();
/** @} *********************************************************************/
private:
typedef Uint64 TimeMillis_t; typedef Uint64 TimeMillis_t;
/************************************************************************** /**************************************************************************
* These methods are service methods to other classes in the NDBAPI. * * These methods are service methods to other classes in the NDBAPI. *
......
...@@ -64,6 +64,8 @@ ...@@ -64,6 +64,8 @@
#define DEBUG(x) #define DEBUG(x)
#endif #endif
//#define MARKER_TRACE 1
const Uint32 NR_ScanNo = 0; const Uint32 NR_ScanNo = 0;
void Dblqh::execACC_COM_BLOCK(Signal* signal) void Dblqh::execACC_COM_BLOCK(Signal* signal)
...@@ -2404,6 +2406,9 @@ Dblqh::execREMOVE_MARKER_ORD(Signal* signal) ...@@ -2404,6 +2406,9 @@ Dblqh::execREMOVE_MARKER_ORD(Signal* signal)
CommitAckMarkerPtr removedPtr; CommitAckMarkerPtr removedPtr;
m_commitAckMarkerHash.release(removedPtr, key); m_commitAckMarkerHash.release(removedPtr, key);
ndbrequire(removedPtr.i != RNIL); ndbrequire(removedPtr.i != RNIL);
#ifdef MARKER_TRACE
ndbout_c("Rem marker[%.8x %.8x]", key.transid1, key.transid2);
#endif
} }
...@@ -3198,6 +3203,9 @@ void Dblqh::execLQHKEYREQ(Signal* signal) ...@@ -3198,6 +3203,9 @@ void Dblqh::execLQHKEYREQ(Signal* signal)
CommitAckMarkerPtr tmp; CommitAckMarkerPtr tmp;
#ifdef VM_TRACE #ifdef VM_TRACE
#ifdef MARKER_TRACE
ndbout_c("Add marker[%.8x %.8x]", markerPtr.p->transid1, markerPtr.p->transid2);
#endif
ndbrequire(!m_commitAckMarkerHash.find(tmp, * markerPtr.p)); ndbrequire(!m_commitAckMarkerHash.find(tmp, * markerPtr.p));
#endif #endif
m_commitAckMarkerHash.add(markerPtr); m_commitAckMarkerHash.add(markerPtr);
...@@ -5668,7 +5676,23 @@ void Dblqh::execABORT(Signal* signal) ...@@ -5668,7 +5676,23 @@ void Dblqh::execABORT(Signal* signal)
}//if }//if
regTcPtr->abortState = TcConnectionrec::ABORT_FROM_TC; regTcPtr->abortState = TcConnectionrec::ABORT_FROM_TC;
regTcPtr->activeCreat = ZFALSE; regTcPtr->activeCreat = ZFALSE;
const Uint32 commitAckMarker = regTcPtr->commitAckMarker;
if(commitAckMarker != RNIL){
jam();
#ifdef MARKER_TRACE
{
CommitAckMarkerPtr tmp;
m_commitAckMarkerHash.getPtr(tmp, commitAckMarker);
ndbout_c("Ab2 marker[%.8x %.8x]", tmp.p->transid1, tmp.p->transid2);
}
#endif
m_commitAckMarkerHash.release(commitAckMarker);
regTcPtr->commitAckMarker = RNIL;
}
abortStateHandlerLab(signal); abortStateHandlerLab(signal);
return; return;
}//Dblqh::execABORT() }//Dblqh::execABORT()
...@@ -6026,7 +6050,13 @@ void Dblqh::abortCommonLab(Signal* signal) ...@@ -6026,7 +6050,13 @@ void Dblqh::abortCommonLab(Signal* signal)
* There is no NR ongoing and we have a marker * There is no NR ongoing and we have a marker
*/ */
jam(); jam();
#ifdef MARKER_TRACE
{
CommitAckMarkerPtr tmp;
m_commitAckMarkerHash.getPtr(tmp, commitAckMarker);
ndbout_c("Abo marker[%.8x %.8x]", tmp.p->transid1, tmp.p->transid2);
}
#endif
m_commitAckMarkerHash.release(commitAckMarker); m_commitAckMarkerHash.release(commitAckMarker);
regTcPtr->commitAckMarker = RNIL; regTcPtr->commitAckMarker = RNIL;
} }
......
...@@ -193,6 +193,23 @@ NdbConnection::setErrorCode(int anErrorCode) ...@@ -193,6 +193,23 @@ NdbConnection::setErrorCode(int anErrorCode)
theError.code = anErrorCode; theError.code = anErrorCode;
}//NdbConnection::setErrorCode() }//NdbConnection::setErrorCode()
int
NdbConnection::restart(){
if(theCompletionStatus == CompletedSuccess){
releaseCompletedOperations();
Uint64 tTransid = theNdb->theFirstTransId;
theTransactionId = tTransid;
if((Uint32)tTransid == ((Uint32)~0)){
theNdb->theFirstTransId = (tTransid >> 32) << 32;
} else {
theNdb->theFirstTransId = tTransid + 1;
}
theCompletionStatus = NotCompleted;
return 0;
}
return -1;
}
/***************************************************************************** /*****************************************************************************
void handleExecuteCompletion(void); void handleExecuteCompletion(void);
...@@ -1307,7 +1324,6 @@ from other transactions. ...@@ -1307,7 +1324,6 @@ from other transactions.
if (tCommitFlag == 1) { if (tCommitFlag == 1) {
theCommitStatus = Committed; theCommitStatus = Committed;
theGlobalCheckpointId = tGCI; theGlobalCheckpointId = tGCI;
theTransactionId++;
} else if ((tNoComp >= tNoSent) && } else if ((tNoComp >= tNoSent) &&
(theLastExecOpInList->theCommitIndicator == 1)){ (theLastExecOpInList->theCommitIndicator == 1)){
/**********************************************************************/ /**********************************************************************/
......
...@@ -1308,8 +1308,8 @@ void ...@@ -1308,8 +1308,8 @@ void
NdbConnection::sendTC_COMMIT_ACK(NdbApiSignal * aSignal, NdbConnection::sendTC_COMMIT_ACK(NdbApiSignal * aSignal,
Uint32 transId1, Uint32 transId2, Uint32 transId1, Uint32 transId2,
Uint32 aTCRef){ Uint32 aTCRef){
#if 0 #ifdef MARKER_TRACE
ndbout_c("Sending TC_COMMIT_ACK(0x%x, 0x%x) to -> %d", ndbout_c("Sending TC_COMMIT_ACK(0x%.8x, 0x%.8x) to -> %d",
transId1, transId1,
transId2, transId2,
refToNode(aTCRef)); refToNode(aTCRef));
......
...@@ -654,7 +654,7 @@ HugoTransactions::scanUpdateRecords3(Ndb* pNdb, ...@@ -654,7 +654,7 @@ HugoTransactions::scanUpdateRecords3(Ndb* pNdb,
if(check != -1){ if(check != -1){
check = pTrans->execute(Commit); check = pTrans->execute(Commit);
pTrans->releaseCompletedOperations(); pTrans->restart();
} }
const NdbError err = pTrans->getNdbError(); const NdbError err = pTrans->getNdbError();
......
...@@ -412,7 +412,7 @@ UtilTransactions::clearTable3(Ndb* pNdb, ...@@ -412,7 +412,7 @@ UtilTransactions::clearTable3(Ndb* pNdb,
if(check != -1){ if(check != -1){
check = pTrans->execute(Commit); check = pTrans->execute(Commit);
pTrans->releaseCompletedOperations(); pTrans->restart();
} }
err = pTrans->getNdbError(); err = pTrans->getNdbError();
...@@ -536,7 +536,7 @@ UtilTransactions::copyTableData(Ndb* pNdb, ...@@ -536,7 +536,7 @@ UtilTransactions::copyTableData(Ndb* pNdb,
} while((eof = rs->nextResult(false)) == 0); } while((eof = rs->nextResult(false)) == 0);
check = pTrans->execute(Commit); check = pTrans->execute(Commit);
pTrans->releaseCompletedOperations(); pTrans->restart();
if( check == -1 ) { if( check == -1 ) {
const NdbError err = pTrans->getNdbError(); const NdbError err = pTrans->getNdbError();
ERR(err); ERR(err);
......
...@@ -143,7 +143,7 @@ int clear_table(Ndb* pNdb, const NdbDictionary::Table* pTab, int parallelism) ...@@ -143,7 +143,7 @@ int clear_table(Ndb* pNdb, const NdbDictionary::Table* pTab, int parallelism)
if(check != -1){ if(check != -1){
check = pTrans->execute(Commit); check = pTrans->execute(Commit);
pTrans->releaseCompletedOperations(); pTrans->restart();
} }
err = pTrans->getNdbError(); err = pTrans->getNdbError();
......
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