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