1
0
mirror of https://github.com/MariaDB/server.git synced 2025-09-02 09:41:40 +03:00

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"
This commit is contained in:
unknown
2006-09-15 16:28:38 +02:00
parent dc8649bada
commit a016cd9e19
3 changed files with 74 additions and 22 deletions

View File

@@ -657,6 +657,9 @@ 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

View File

@@ -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;

View File

@@ -978,28 +978,59 @@ 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);
// here is one reason to make op lists doubly linked
if (m_firstExecutedScanOp == cursorOp) {
m_firstExecutedScanOp = (NdbIndexScanOperation*)cursorOp->theNext;
cursorOp->release();
theNdb->releaseScanOperation(cursorOp);
} else if (m_firstExecutedScanOp != NULL) {
NdbIndexScanOperation* tOp = m_firstExecutedScanOp;
while (tOp->theNext != NULL) {
if (tOp->theNext == cursorOp) {
tOp->theNext = cursorOp->theNext;
cursorOp->release();
theNdb->releaseScanOperation(cursorOp);
break;
}
tOp = (NdbIndexScanOperation*)tOp->theNext;
}
}
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
}//NdbTransaction::releaseExecutedScanOperation() }//NdbTransaction::releaseExecutedScanOperation()
bool
NdbTransaction::releaseScanOperation(NdbIndexScanOperation** listhead,
NdbIndexScanOperation** listtail,
NdbIndexScanOperation* op)
{
if (* listhead == op)
{
* listhead = (NdbIndexScanOperation*)op->theNext;
if (listtail && *listtail == op)
{
assert(* listhead == 0);
* listtail = 0;
}
}
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;
}
tmp = (NdbIndexScanOperation*)tmp->theNext;
}
if (tmp == NULL)
op = NULL;
}
if (op != NULL)
{
op->release();
theNdb->releaseScanOperation(op);
return true;
}
return false;
}
/***************************************************************************** /*****************************************************************************
NdbOperation* getNdbOperation(const char* aTableName); NdbOperation* getNdbOperation(const char* aTableName);