20 #include "SimulatedBlock.hpp"
21 #include "SafeCounter.hpp"
22 #include <signaldata/NodeFailRep.hpp>
26 m_activeCounters(m_counterPool)
30 SafeCounterManager::setSize(Uint32 maxNoOfActiveMutexes,
bool exit_on_error) {
31 return m_counterPool.
setSize(maxNoOfActiveMutexes,
false, exit_on_error);
35 SafeCounterManager::getSize()
const {
36 return m_counterPool.getSize();
40 SafeCounterManager::getNoOfFree()
const {
41 return m_counterPool.getNoOfFree();
45 SafeCounterManager::seize(ActiveCounterPtr& ptr){
46 return m_activeCounters.
seize(ptr);
50 SafeCounterManager::release(ActiveCounterPtr& ptr){
55 SafeCounterManager::getPtr(ActiveCounterPtr& ptr, Uint32 ptrI){
56 m_activeCounters.
getPtr(ptr, ptrI);
61 SafeCounterManager::printNODE_FAILREP(){
68 for(m_activeCounters.
first(ptr); !ptr.isNull(); m_activeCounters.
next(ptr)){
69 ActiveCounter::SignalDesc desc = ptr.p->m_signalDesc;
70 ndbout_c(
"theData[desc.m_senderDataOffset=%u] = %u",
71 desc.m_senderDataOffset, ptr.p->m_senderData);
72 ndbout_c(
"theData[desc.m_errorCodeOffset=%u] = %u",
73 desc.m_errorCodeOffset, desc.m_nodeFailErrorCode);
74 Uint32 len = MAX(MAX(desc.m_senderDataOffset, desc.m_errorCodeOffset),
75 desc.m_senderRefOffset);
79 while((i = overlapping.
find(i)) != NdbNodeBitmask::NotFound){
80 ndbout_c(
" theData[desc.m_senderRefOffset=%u] = %x",
81 desc.m_senderRefOffset, numberToRef(desc.m_block, i));
82 ndbout_c(
" sendSignal(%x,%u,signal,%u,JBB",
83 m_block.reference(), desc.m_gsn, len+1);
90 SafeCounterManager::execNODE_FAILREP(
Signal* signal){
91 Uint32 * theData = signal->getDataPtrSend();
94 nodes.
assign(NdbNodeBitmask::Size,
95 ((
const NodeFailRep*)signal->getDataPtr())->theNodes);
97 for(m_activeCounters.
first(ptr); !ptr.isNull(); m_activeCounters.
next(ptr)){
99 ActiveCounter::SignalDesc desc = ptr.p->m_signalDesc;
100 theData[desc.m_senderDataOffset] = ptr.p->m_senderData;
101 theData[desc.m_errorCodeOffset] = desc.m_nodeFailErrorCode;
102 Uint32 len = MAX(MAX(desc.m_senderDataOffset, desc.m_errorCodeOffset),
103 desc.m_senderRefOffset);
106 overlapping.
bitAND(nodes);
108 while((i = overlapping.
find(i)) != NdbNodeBitmask::NotFound){
109 theData[desc.m_senderRefOffset] = numberToRef(desc.m_block, i);
110 m_block.sendSignal(m_block.reference(), desc.m_gsn, signal, len+1,JBB);
118 SafeCounterManager::reference()
const {
119 return m_block.reference();
123 SafeCounterManager::progError(
int line,
int err_code,
const char*
extra){
124 m_block.
progError(line, err_code, extra);
131 mgr.getPtr(ptr, m_activeCounterPtrI);
132 ptr.p->m_nodes.clear(nodeId);
134 if (ptr.p->m_nodes.isclear()){
136 m_activeCounterPtrI = RNIL;
143 bool clear = m_count == 0;
144 bool isnull = m_ptr.i == RNIL;
146 m_activeCounterPtrI = m_ptr.i;
151 if(clear && !isnull){
152 m_mgr.release(m_ptr);
153 m_activeCounterPtrI = RNIL;
161 m_ptr.p->m_nodes = m_nodes;
165 ErrorReporter::handleAssert(
"~SafeCounter:: wo/ init", __FILE__, __LINE__);