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

Better handling of transaction ids,

make *sure* that no one gets same transid twice
(wo/ restarting process)
parent 6af42cfb
...@@ -682,7 +682,7 @@ NdbDictInterface::~NdbDictInterface() ...@@ -682,7 +682,7 @@ NdbDictInterface::~NdbDictInterface()
{ {
if (m_transporter != NULL){ if (m_transporter != NULL){
if (m_blockNumber != -1) if (m_blockNumber != -1)
m_transporter->close(m_blockNumber); m_transporter->close(m_blockNumber, 0);
} }
} }
......
...@@ -97,7 +97,7 @@ Ndb::init(int aMaxNoOfTransactions) ...@@ -97,7 +97,7 @@ Ndb::init(int aMaxNoOfTransactions)
} }
theFirstTransId = ((Uint64)theNdbBlockNumber << 52)+((Uint64)theNode << 40); theFirstTransId = ((Uint64)theNdbBlockNumber << 52)+((Uint64)theNode << 40);
theFirstTransId += theFacade->m_open_count; theFirstTransId += theFacade->m_max_trans_id;
theFacade->unlock_mutex(); theFacade->unlock_mutex();
...@@ -175,7 +175,7 @@ error_handler: ...@@ -175,7 +175,7 @@ error_handler:
freeOperation(); freeOperation();
delete theDictionary; delete theDictionary;
TransporterFacade::instance()->close(theNdbBlockNumber); TransporterFacade::instance()->close(theNdbBlockNumber, 0);
return -1; return -1;
} }
......
...@@ -195,9 +195,9 @@ Ndb::~Ndb() ...@@ -195,9 +195,9 @@ Ndb::~Ndb()
NdbGlobalEventBuffer_drop(theGlobalEventBufferHandle); NdbGlobalEventBuffer_drop(theGlobalEventBufferHandle);
if (TransporterFacade::instance() != NULL && theNdbBlockNumber > 0){ if (TransporterFacade::instance() != NULL && theNdbBlockNumber > 0){
TransporterFacade::instance()->close(theNdbBlockNumber); TransporterFacade::instance()->close(theNdbBlockNumber, theFirstTransId);
} }
NdbMutex_Lock(&createNdbMutex); NdbMutex_Lock(&createNdbMutex);
theNoOfNdbObjects -= 1; theNoOfNdbObjects -= 1;
......
...@@ -548,7 +548,7 @@ TransporterFacade::TransporterFacade() : ...@@ -548,7 +548,7 @@ TransporterFacade::TransporterFacade() :
theClusterMgr = NULL; theClusterMgr = NULL;
theArbitMgr = NULL; theArbitMgr = NULL;
theStartNodeId = 1; theStartNodeId = 1;
m_open_count = 0; m_max_trans_id = 0;
} }
bool bool
...@@ -684,9 +684,11 @@ TransporterFacade::ReportNodeAlive(NodeId tNodeId) ...@@ -684,9 +684,11 @@ TransporterFacade::ReportNodeAlive(NodeId tNodeId)
} }
int int
TransporterFacade::close(BlockNumber blockNumber) TransporterFacade::close(BlockNumber blockNumber, Uint64 trans_id)
{ {
NdbMutex_Lock(theMutexPtr); NdbMutex_Lock(theMutexPtr);
Uint32 low_bits = (Uint32)trans_id;
m_max_trans_id = m_max_trans_id > low_bits ? m_max_trans_id : low_bits;
close_local(blockNumber); close_local(blockNumber);
NdbMutex_Unlock(theMutexPtr); NdbMutex_Unlock(theMutexPtr);
return 0; return 0;
...@@ -703,7 +705,6 @@ TransporterFacade::open(void* objRef, ...@@ -703,7 +705,6 @@ TransporterFacade::open(void* objRef,
ExecuteFunction fun, ExecuteFunction fun,
NodeStatusFunction statusFun) NodeStatusFunction statusFun)
{ {
m_open_count++;
return m_threads.open(objRef, fun, statusFun); return m_threads.open(objRef, fun, statusFun);
} }
......
...@@ -67,7 +67,7 @@ public: ...@@ -67,7 +67,7 @@ public:
int open(void* objRef, ExecuteFunction, NodeStatusFunction); int open(void* objRef, ExecuteFunction, NodeStatusFunction);
// Close this block number // Close this block number
int close(BlockNumber blockNumber); int close(BlockNumber blockNumber, Uint64 trans_id);
// Only sends to nodes which are alive // Only sends to nodes which are alive
int sendSignal(NdbApiSignal * signal, NodeId nodeId); int sendSignal(NdbApiSignal * signal, NodeId nodeId);
...@@ -210,9 +210,9 @@ private: ...@@ -210,9 +210,9 @@ private:
return (m_statusNext[index] & (1 << 16)) != 0; return (m_statusNext[index] & (1 << 16)) != 0;
} }
} m_threads; } m_threads;
Uint32 m_open_count; Uint32 m_max_trans_id;
/** /**
* execute function * execute function
*/ */
......
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