Commit 8aa303ff authored by unknown's avatar unknown

ndb - bug#21941

  Fix so that scans closed before execute are removed from "scans to send list"


ndb/include/ndbapi/NdbTransaction.hpp:
  Fix so that scans closed before execute are removed from "scans to send list"
ndb/src/ndbapi/NdbScanOperation.cpp:
  Fix so that scans closed before execute are removed from "scans to send list"
ndb/src/ndbapi/NdbTransaction.cpp:
  Fix so that scans closed before execute are removed from "scans to send list"
parent f082fe61
...@@ -657,8 +657,11 @@ private: ...@@ -657,8 +657,11 @@ private:
// Release all cursor operations in connection // Release all cursor operations in connection
void releaseOps(NdbOperation*); void releaseOps(NdbOperation*);
void releaseScanOperations(NdbIndexScanOperation*); void releaseScanOperations(NdbIndexScanOperation*);
bool releaseScanOperation(NdbIndexScanOperation** listhead,
NdbIndexScanOperation** listtail,
NdbIndexScanOperation* op);
void releaseExecutedScanOperation(NdbIndexScanOperation*); void releaseExecutedScanOperation(NdbIndexScanOperation*);
// Set the transaction identity of the transaction // Set the transaction identity of the transaction
void setTransactionId(Uint64 aTransactionId); void setTransactionId(Uint64 aTransactionId);
......
...@@ -678,9 +678,27 @@ void NdbScanOperation::close(bool forceSend, bool releaseOp) ...@@ -678,9 +678,27 @@ void NdbScanOperation::close(bool forceSend, bool releaseOp)
theNdbCon = NULL; theNdbCon = NULL;
m_transConnection = NULL; m_transConnection = NULL;
if (releaseOp && tTransCon) { if (tTransCon)
{
NdbIndexScanOperation* tOp = (NdbIndexScanOperation*)this; NdbIndexScanOperation* tOp = (NdbIndexScanOperation*)this;
tTransCon->releaseExecutedScanOperation(tOp);
bool ret = true;
if (theStatus != WaitResponse)
{
/**
* Not executed yet
*/
ret =
tTransCon->releaseScanOperation(&tTransCon->m_theFirstScanOperation,
&tTransCon->m_theLastScanOperation,
tOp);
}
else if (releaseOp)
{
ret = tTransCon->releaseScanOperation(&tTransCon->m_firstExecutedScanOp,
0, tOp);
}
assert(ret);
} }
tCon->theScanningOp = 0; tCon->theScanningOp = 0;
......
...@@ -978,27 +978,58 @@ void ...@@ -978,27 +978,58 @@ void
NdbTransaction::releaseExecutedScanOperation(NdbIndexScanOperation* cursorOp) NdbTransaction::releaseExecutedScanOperation(NdbIndexScanOperation* cursorOp)
{ {
DBUG_ENTER("NdbTransaction::releaseExecutedScanOperation"); DBUG_ENTER("NdbTransaction::releaseExecutedScanOperation");
DBUG_PRINT("enter", ("this=0x%x op=0x%x", (UintPtr)this, (UintPtr)cursorOp)) DBUG_PRINT("enter", ("this=0x%x op=0x%x", (UintPtr)this, (UintPtr)cursorOp));
releaseScanOperation(&m_firstExecutedScanOp, 0, cursorOp);
DBUG_VOID_RETURN;
}//NdbTransaction::releaseExecutedScanOperation()
// here is one reason to make op lists doubly linked bool
if (m_firstExecutedScanOp == cursorOp) { NdbTransaction::releaseScanOperation(NdbIndexScanOperation** listhead,
m_firstExecutedScanOp = (NdbIndexScanOperation*)cursorOp->theNext; NdbIndexScanOperation** listtail,
cursorOp->release(); NdbIndexScanOperation* op)
theNdb->releaseScanOperation(cursorOp); {
} else if (m_firstExecutedScanOp != NULL) { if (* listhead == op)
NdbIndexScanOperation* tOp = m_firstExecutedScanOp; {
while (tOp->theNext != NULL) { * listhead = (NdbIndexScanOperation*)op->theNext;
if (tOp->theNext == cursorOp) { if (listtail && *listtail == op)
tOp->theNext = cursorOp->theNext; {
cursorOp->release(); assert(* listhead == 0);
theNdb->releaseScanOperation(cursorOp); * listtail = 0;
break; }
}
else
{
NdbIndexScanOperation* tmp = * listhead;
while (tmp != NULL)
{
if (tmp->theNext == op)
{
tmp->theNext = (NdbIndexScanOperation*)op->theNext;
if (listtail && *listtail == op)
{
assert(op->theNext == 0);
*listtail = tmp;
}
break;
} }
tOp = (NdbIndexScanOperation*)tOp->theNext; tmp = (NdbIndexScanOperation*)tmp->theNext;
} }
if (tmp == NULL)
op = NULL;
} }
DBUG_VOID_RETURN;
}//NdbTransaction::releaseExecutedScanOperation() if (op != NULL)
{
op->release();
theNdb->releaseScanOperation(op);
return true;
}
return false;
}
/***************************************************************************** /*****************************************************************************
NdbOperation* getNdbOperation(const char* aTableName); NdbOperation* getNdbOperation(const char* aTableName);
......
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