16 #ifndef NDB_LOCAL_PROXY_HPP
17 #define NDB_LOCAL_PROXY_HPP
20 #include <SimulatedBlock.hpp>
21 #include <Bitmask.hpp>
22 #include <DLFifoList.hpp>
23 #include <signaldata/ReadConfig.hpp>
24 #include <signaldata/NdbSttor.hpp>
25 #include <signaldata/ReadNodesConf.hpp>
26 #include <signaldata/NodeFailRep.hpp>
27 #include <signaldata/NodeStateSignalData.hpp>
28 #include <signaldata/NFCompleteRep.hpp>
29 #include <signaldata/CreateTrigImpl.hpp>
30 #include <signaldata/DropTrigImpl.hpp>
31 #include <signaldata/DbinfoScan.hpp>
32 #include <signaldata/Sync.hpp>
59 enum { MaxLqhWorkers = MAX_NDBMT_LQH_WORKERS };
60 enum { MaxExtraWorkers = 1 };
61 enum { MaxWorkers = MaxLqhWorkers + MaxExtraWorkers };
64 Uint32 c_extraWorkers;
70 virtual void loadWorkers();
75 ndbrequire(i < c_workers);
76 ndbrequire(c_worker[i] != 0);
81 return workerBlock(c_lqhWorkers);
86 BlockReference workerRef(Uint32 i) {
87 return numberToRef(number(), workerInstance(i), getOwnNodeId());
90 BlockReference extraWorkerRef() {
91 ndbrequire(c_workers == c_lqhWorkers + 1);
92 Uint32 i = c_lqhWorkers;
98 Uint32 workerInstance(Uint32 i)
const {
99 ndbrequire(i < c_workers);
101 if (i < c_lqhWorkers)
104 ino = 1 + MaxLqhWorkers;
108 Uint32 workerIndex(Uint32 ino)
const {
109 ndbrequire(ino != 0);
111 if (ino != 1 + MaxLqhWorkers)
115 ndbrequire(i < c_workers);
127 SsFUNCREP m_sendCONF;
132 static const char* name() {
return "UNDEF"; }
196 Ss m_pool[Ss::poolSize];
206 enum { SsIdBase = (1u << 31) };
209 Ss* ssSearch(Uint32 ssId)
213 for (Uint32 i = 0; i < Ss::poolSize; i++) {
214 if (sp.m_pool[i].m_ssId == ssId) {
215 ssptr = &sp.m_pool[
i];
224 const Uint32 base = SsIdBase;
225 const Uint32 mask = ~base;
226 const Uint32 ssId = base | c_ssIdSeq;
227 c_ssIdSeq = (c_ssIdSeq + 1) & mask;
228 return ssSeize<Ss>(ssId);
232 Ss& ssSeize(Uint32 ssId) {
233 SsPool<Ss>& sp = Ss::pool(
this);
234 ndbrequire(sp.m_usage < Ss::poolSize);
235 ndbrequire(ssId != 0);
238 ssptr = ssSearch<Ss>(ssId);
239 ndbrequire(ssptr == 0);
241 ssptr = ssSearch<Ss>(0);
242 ndbrequire(ssptr != 0);
245 ssptr->m_ssId = ssId;
247 D(
"ssSeize" << V(sp.m_usage) << hex << V(ssId) <<
" " <<
Ss::name());
252 Ss& ssFind(Uint32 ssId) {
253 ndbrequire(ssId != 0);
254 Ss* ssptr = ssSearch<Ss>(ssId);
255 ndbrequire(ssptr != 0);
265 Ss& ssFindSeize(Uint32 ssId,
bool* found) {
266 ndbrequire(ssId != 0);
267 Ss* ssptr = ssSearch<Ss>(ssId);
275 return ssSeize<Ss>(ssId);
279 void ssRelease(Uint32 ssId) {
280 SsPool<Ss>& sp = Ss::pool(
this);
281 ndbrequire(sp.m_usage != 0);
282 ndbrequire(ssId != 0);
283 D(
"ssRelease" << V(sp.m_usage) << hex << V(ssId) <<
" " <<
Ss::name());
284 Ss* ssptr = ssSearch<Ss>(ssId);
285 ndbrequire(ssptr != 0);
287 ndbrequire(sp.m_usage > 0);
292 void ssRelease(Ss& ss) {
293 ssRelease<Ss>(ss.m_ssId);
301 bool ssQueue(
Signal* signal) {
302 SsPool<Ss>& sp = Ss::pool(
this);
303 if (sp.m_usage < Ss::poolSize)
307 GlobalSignalNumber gsn = signal->header.theVerId_signalNumber & 0xFFFF;
308 sendSignalWithDelay(reference(), gsn,
309 signal, 10, signal->
length(), &handle);
315 Uint32 c_typeOfStart;
316 Uint32 c_masterNodeId;
322 m_sendREQ = &LocalProxy::sendREAD_CONFIG_REQ;
323 m_sendCONF = &LocalProxy::sendREAD_CONFIG_CONF;
325 enum { poolSize = 1 };
327 return proxy->c_ss_READ_CONFIG_REQ;
331 void execREAD_CONFIG_REQ(
Signal*);
332 virtual void callREAD_CONFIG_REQ(
Signal*);
333 void backREAD_CONFIG_REQ(
Signal*);
335 void execREAD_CONFIG_CONF(
Signal*);
336 void sendREAD_CONFIG_CONF(
Signal*, Uint32 ssId);
341 Uint32 m_reqdata[25];
343 Uint32 m_confdata[25];
345 m_sendREQ = &LocalProxy::sendSTTOR;
346 m_sendCONF = &LocalProxy::sendSTTORRY;
348 enum { poolSize = 1 };
350 return proxy->c_ss_STTOR;
355 virtual void callSTTOR(
Signal*);
358 void execSTTORRY(
Signal*);
359 void sendSTTORRY(
Signal*, Uint32 ssId);
364 enum { m_reqlength =
sizeof(
NdbSttor) >> 2 };
366 m_sendREQ = &LocalProxy::sendNDB_STTOR;
367 m_sendCONF = &LocalProxy::sendNDB_STTORRY;
369 enum { poolSize = 1 };
371 return proxy->c_ss_NDB_STTOR;
375 void execNDB_STTOR(
Signal*);
376 virtual void callNDB_STTOR(
Signal*);
377 void backNDB_STTOR(
Signal*);
379 void execNDB_STTORRY(
Signal*);
380 void sendNDB_STTORRY(
Signal*, Uint32 ssId);
384 GlobalSignalNumber m_gsn;
390 void sendREAD_NODESREQ(
Signal*);
391 void execREAD_NODESCONF(
Signal*);
392 void execREAD_NODESREF(
Signal*);
400 m_sendREQ = &LocalProxy::sendNODE_FAILREP;
404 static bool noReply(BlockNumber blockNo) {
408 enum { poolSize = 1 };
410 return proxy->c_ss_NODE_FAILREP;
414 void execNODE_FAILREP(
Signal*);
416 void execNF_COMPLETEREP(
Signal*);
434 m_sendREQ = &LocalProxy::sendINCL_NODEREQ;
435 m_sendCONF = &LocalProxy::sendINCL_NODECONF;
437 enum { poolSize = 1 };
438 static SsPool<Ss_INCL_NODEREQ>& pool(
LocalProxy* proxy) {
439 return proxy->c_ss_INCL_NODEREQ;
442 SsPool<Ss_INCL_NODEREQ> c_ss_INCL_NODEREQ;
443 void execINCL_NODEREQ(
Signal*);
445 void execINCL_NODECONF(
Signal*);
446 void sendINCL_NODECONF(
Signal*, Uint32 ssId);
451 m_sendREQ = &LocalProxy::sendNODE_STATE_REP;
454 enum { poolSize = 1 };
456 return proxy->c_ss_NODE_STATE_REP;
460 void execNODE_STATE_REP(
Signal*);
467 m_sendREQ = &LocalProxy::sendCHANGE_NODE_STATE_REQ;
470 enum { poolSize = 1 };
472 return proxy->c_ss_CHANGE_NODE_STATE_REQ;
476 void execCHANGE_NODE_STATE_REQ(
Signal*);
478 void execCHANGE_NODE_STATE_CONF(
Signal*);
484 Uint32 m_reqdata[25];
486 m_sendREQ = &LocalProxy::sendDUMP_STATE_ORD;
489 enum { poolSize = 1 };
491 return proxy->c_ss_DUMP_STATE_ORD;
495 void execDUMP_STATE_ORD(
Signal*);
500 Uint32 m_errorInsert;
502 m_sendREQ = &LocalProxy::sendNDB_TAMPER;
505 enum { poolSize = 1 };
507 return proxy->c_ss_NDB_TAMPER;
511 void execNDB_TAMPER(
Signal*);
517 m_sendREQ = &LocalProxy::sendTIME_SIGNAL;
520 enum { poolSize = 1 };
522 return proxy->c_ss_TIME_SIGNAL;
526 void execTIME_SIGNAL(
Signal*);
533 m_sendREQ = &LocalProxy::sendCREATE_TRIG_IMPL_REQ;
534 m_sendCONF = &LocalProxy::sendCREATE_TRIG_IMPL_CONF;
536 enum { poolSize = 3 };
538 return proxy->c_ss_CREATE_TRIG_IMPL_REQ;
542 void execCREATE_TRIG_IMPL_REQ(
Signal*);
544 void execCREATE_TRIG_IMPL_CONF(
Signal*);
545 void execCREATE_TRIG_IMPL_REF(
Signal*);
546 void sendCREATE_TRIG_IMPL_CONF(
Signal*, Uint32 ssId);
552 m_sendREQ = &LocalProxy::sendDROP_TRIG_IMPL_REQ;
553 m_sendCONF = &LocalProxy::sendDROP_TRIG_IMPL_CONF;
555 enum { poolSize = 21 };
557 return proxy->c_ss_DROP_TRIG_IMPL_REQ;
561 void execDROP_TRIG_IMPL_REQ(
Signal*);
563 void execDROP_TRIG_IMPL_CONF(
Signal*);
564 void execDROP_TRIG_IMPL_REF(
Signal*);
565 void sendDROP_TRIG_IMPL_CONF(
Signal*, Uint32 ssId);
569 void execDBINFO_SCANREQ(
Signal*);
570 void execDBINFO_SCANCONF(
Signal*);
573 void execSYNC_REQ(
Signal*);
574 void execSYNC_REF(
Signal*);
575 void execSYNC_CONF(
Signal*);
581 m_sendREQ = &LocalProxy::sendSYNC_REQ;
584 enum { poolSize = 4 };
586 return proxy->c_ss_SYNC_REQ;
591 void execSYNC_PATH_REQ(
Signal*);