Commit 6bed3ee9 authored by unknown's avatar unknown

ndb - csc#4847 - manual merge 4.1->5.0


ndb/include/ndbapi/NdbScanOperation.hpp:
  release scan op early to save memory
ndb/src/ndbapi/NdbScanOperation.cpp:
  release scan op early to save memory
ndb/src/ndbapi/NdbTransaction.cpp:
  release scan op early to save memory
ndb/src/ndbapi/Ndblist.cpp:
  release scan op early to save memory
sql/ha_ndbcluster.cc:
  release scan op early to save memory
parent 3a1cf286
......@@ -115,7 +115,7 @@ public:
/**
* Close scan
*/
void close(bool forceSend = false);
void close(bool forceSend = false, bool releaseOp = false);
/**
* Update current tuple
......
......@@ -633,8 +633,14 @@ NdbScanOperation::doSend(int ProcessorId)
return 0;
}
void NdbScanOperation::close(bool forceSend)
void NdbScanOperation::close(bool forceSend, bool releaseOp)
{
DBUG_ENTER("NdbScanOperation::close");
DBUG_PRINT("enter", ("this=%x tcon=%x con=%x force=%d release=%d",
(UintPtr)this,
(UintPtr)m_transConnection, (UintPtr)theNdbCon,
forceSend, releaseOp));
if(m_transConnection){
if(DEBUG_NEXT_RESULT)
ndbout_c("close() theError.code = %d "
......@@ -650,13 +656,21 @@ void NdbScanOperation::close(bool forceSend)
Guard guard(tp->theMutexPtr);
close_impl(tp, forceSend);
} while(0);
theNdbCon->theScanningOp = 0;
theNdb->closeTransaction(theNdbCon);
}
theNdbCon = 0;
NdbConnection* tCon = theNdbCon;
NdbConnection* tTransCon = m_transConnection;
theNdbCon = NULL;
m_transConnection = NULL;
if (releaseOp && tTransCon) {
NdbIndexScanOperation* tOp = (NdbIndexScanOperation*)this;
tTransCon->releaseExecutedScanOperation(tOp);
}
tCon->theScanningOp = 0;
theNdb->closeTransaction(tCon);
DBUG_VOID_RETURN;
}
void
......
......@@ -954,9 +954,9 @@ void releaseExecutedScanOperation();
Remark: Release scan op when hupp'ed trans closed (save memory)
******************************************************************************/
void
NdbConnection::releaseExecutedScanOperation(NdbIndexScanOperation* cursorOp)
NdbTransaction::releaseExecutedScanOperation(NdbIndexScanOperation* cursorOp)
{
DBUG_ENTER("NdbConnection::releaseExecutedScanOperation");
DBUG_ENTER("NdbTransaction::releaseExecutedScanOperation");
DBUG_PRINT("enter", ("this=0x%x op=0x%x", (UintPtr)this, (UintPtr)cursorOp))
// here is one reason to make op lists doubly linked
......@@ -977,7 +977,7 @@ NdbConnection::releaseExecutedScanOperation(NdbIndexScanOperation* cursorOp)
}
}
DBUG_VOID_RETURN;
}//NdbConnection::releaseExecutedScanOperation()
}//NdbTransaction::releaseExecutedScanOperation()
/*****************************************************************************
NdbOperation* getNdbOperation(const char* aTableName);
......
......@@ -550,10 +550,21 @@ Remark: Add a NdbScanOperation object into the signal idlelist.
void
Ndb::releaseScanOperation(NdbIndexScanOperation* aScanOperation)
{
DBUG_ENTER("Ndb::releaseScanOperation");
DBUG_PRINT("enter", ("op=%x", (UintPtr)aScanOperation));
#ifdef ndb_release_check_dup
{ NdbIndexScanOperation* tOp = theScanOpIdleList;
while (tOp != NULL) {
assert(tOp != aScanOperation);
tOp = (NdbIndexScanOperation*)tOp->theNext;
}
}
#endif
aScanOperation->next(theScanOpIdleList);
aScanOperation->theNdbCon = NULL;
aScanOperation->theMagicNumber = 0xFE11D2;
theScanOpIdleList = aScanOperation;
DBUG_VOID_RETURN;
}
/***************************************************************************
......
......@@ -2685,7 +2685,7 @@ int ha_ndbcluster::close_scan()
m_ops_pending= 0;
}
cursor->close(m_force_send);
cursor->close(m_force_send, true);
m_active_cursor= m_multi_cursor= NULL;
DBUG_RETURN(0);
}
......@@ -5694,7 +5694,7 @@ ha_ndbcluster::read_multi_range_next(KEY_MULTI_RANGE ** multi_range_found_p)
close_scan:
if (res == 1)
{
m_multi_cursor->close();
m_multi_cursor->close(false, true);
m_active_cursor= m_multi_cursor= 0;
DBUG_MULTI_RANGE(8);
continue;
......
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