16 #include "DblqhProxy.hpp"
18 #include "DblqhCommon.hpp"
20 #include <signaldata/StartFragReq.hpp>
21 #include <signaldata/ExecFragReq.hpp>
29 addRecSignal(GSN_CREATE_TAB_REQ, &DblqhProxy::execCREATE_TAB_REQ);
30 addRecSignal(GSN_CREATE_TAB_CONF, &DblqhProxy::execCREATE_TAB_CONF);
31 addRecSignal(GSN_CREATE_TAB_REF, &DblqhProxy::execCREATE_TAB_REF);
35 addRecSignal(GSN_LQHADDATTCONF, &DblqhProxy::execLQHADDATTCONF);
36 addRecSignal(GSN_LQHADDATTREF, &DblqhProxy::execLQHADDATTREF);
39 addRecSignal(GSN_LQHFRAGREQ, &DblqhProxy::execLQHFRAGREQ);
42 addRecSignal(GSN_TAB_COMMITREQ, &DblqhProxy::execTAB_COMMITREQ);
43 addRecSignal(GSN_TAB_COMMITCONF, &DblqhProxy::execTAB_COMMITCONF);
44 addRecSignal(GSN_TAB_COMMITREF, &DblqhProxy::execTAB_COMMITREF);
49 addRecSignal(GSN_END_LCP_CONF, &DblqhProxy::execEND_LCP_CONF);
50 addRecSignal(GSN_LCP_COMPLETE_REP, &DblqhProxy::execLCP_COMPLETE_REP);
52 addRecSignal(GSN_EMPTY_LCP_REQ, &DblqhProxy::execEMPTY_LCP_REQ);
55 addRecSignal(GSN_GCP_SAVEREQ, &DblqhProxy::execGCP_SAVEREQ);
56 addRecSignal(GSN_GCP_SAVECONF, &DblqhProxy::execGCP_SAVECONF);
57 addRecSignal(GSN_GCP_SAVEREF, &DblqhProxy::execGCP_SAVEREF);
60 addRecSignal(GSN_PREP_DROP_TAB_REQ, &DblqhProxy::execPREP_DROP_TAB_REQ);
61 addRecSignal(GSN_PREP_DROP_TAB_CONF, &DblqhProxy::execPREP_DROP_TAB_CONF);
62 addRecSignal(GSN_PREP_DROP_TAB_REF, &DblqhProxy::execPREP_DROP_TAB_REF);
65 addRecSignal(GSN_DROP_TAB_REQ, &DblqhProxy::execDROP_TAB_REQ);
66 addRecSignal(GSN_DROP_TAB_CONF, &DblqhProxy::execDROP_TAB_CONF);
67 addRecSignal(GSN_DROP_TAB_REF, &DblqhProxy::execDROP_TAB_REF);
70 addRecSignal(GSN_ALTER_TAB_REQ, &DblqhProxy::execALTER_TAB_REQ);
71 addRecSignal(GSN_ALTER_TAB_CONF, &DblqhProxy::execALTER_TAB_CONF);
72 addRecSignal(GSN_ALTER_TAB_REF, &DblqhProxy::execALTER_TAB_REF);
78 addRecSignal(GSN_START_RECREQ, &DblqhProxy::execSTART_RECREQ);
79 addRecSignal(GSN_START_RECCONF, &DblqhProxy::execSTART_RECCONF);
86 addRecSignal(GSN_SUB_GCP_COMPLETE_REP, &DblqhProxy::execSUB_GCP_COMPLETE_REP);
89 addRecSignal(GSN_EXEC_SRREQ, &DblqhProxy::execEXEC_SRREQ);
90 addRecSignal(GSN_EXEC_SRCONF, &DblqhProxy::execEXEC_SRCONF);
94 addRecSignal(GSN_EXEC_FRAGCONF, &DblqhProxy::execEXEC_FRAGCONF);
97 addRecSignal(GSN_DROP_FRAG_REQ, &DblqhProxy::execDROP_FRAG_REQ);
98 addRecSignal(GSN_DROP_FRAG_CONF, &DblqhProxy::execDROP_FRAG_CONF);
99 addRecSignal(GSN_DROP_FRAG_REF, &DblqhProxy::execDROP_FRAG_REF);
103 DblqhProxy::~DblqhProxy()
108 DblqhProxy::newWorker(Uint32 instanceNo)
110 return new Dblqh(m_ctx, instanceNo);
116 DblqhProxy::callNDB_STTOR(
Signal* signal)
118 Ss_READ_NODES_REQ& ss = c_ss_READ_NODESREQ;
119 ndbrequire(ss.m_gsn == 0);
121 const Uint32 startPhase = signal->theData[2];
122 switch (startPhase) {
124 ss.m_gsn = GSN_NDB_STTOR;
125 sendREAD_NODESREQ(signal);
128 backNDB_STTOR(signal);
135 DblqhProxy::callREAD_CONFIG_REQ(
Signal* signal)
138 ndbrequire(req->noOfParameters == 0);
141 m_ctx.m_config.getOwnConfigIterator();
144 ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_TUP_TABLE, &c_tableRecSize));
145 c_tableRec = (Uint8*)
allocRecord(
"TableRec",
sizeof(Uint8), c_tableRecSize);
146 D(
"proxy:" << V(c_tableRecSize));
148 for (i = 0; i < c_tableRecSize; i++)
150 backREAD_CONFIG_REQ(signal);
158 DblqhProxy::execCREATE_TAB_REQ(
Signal* signal)
160 Ss_CREATE_TAB_REQ& ss = ssSeize<Ss_CREATE_TAB_REQ>(1);
164 ndbrequire(signal->getLength() == CreateTabReq::SignalLengthLDM);
170 DblqhProxy::sendCREATE_TAB_REQ(
Signal* signal, Uint32 ssId,
173 Ss_CREATE_TAB_REQ& ss = ssFind<Ss_CREATE_TAB_REQ>(ssId);
177 req->senderRef = reference();
178 req->senderData = ssId;
180 signal, CreateTabReq::SignalLengthLDM, JBB, handle);
184 DblqhProxy::execCREATE_TAB_CONF(
Signal* signal)
187 Uint32 ssId = conf->senderData;
188 Ss_CREATE_TAB_REQ& ss = ssFind<Ss_CREATE_TAB_REQ>(ssId);
189 recvCONF(signal, ss);
193 DblqhProxy::execCREATE_TAB_REF(
Signal* signal)
196 Uint32 ssId = ref->senderData;
197 Ss_CREATE_TAB_REQ& ss = ssFind<Ss_CREATE_TAB_REQ>(ssId);
198 recvREF(signal, ss, ref->errorCode);
202 DblqhProxy::sendCREATE_TAB_CONF(
Signal* signal, Uint32 ssId)
204 Ss_CREATE_TAB_REQ& ss = ssFind<Ss_CREATE_TAB_REQ>(ssId);
205 BlockReference dictRef = ss.m_req.senderRef;
209 ss.m_lqhConnectPtr[ss.m_worker] = conf->lqhConnectPtr;
215 if (ss.m_error == 0) {
218 conf->senderRef = reference();
219 conf->senderData = ss.m_req.senderData;
220 conf->lqhConnectPtr = ssId;
221 sendSignal(dictRef, GSN_CREATE_TAB_CONF,
222 signal, CreateTabConf::SignalLength, JBB);
228 signal, CreateTabReq::SignalLength);
230 Uint32 tableId = ss.m_req.tableId;
231 ndbrequire(tableId < c_tableRecSize);
232 c_tableRec[tableId] = 1;
235 ref->senderRef = reference();
236 ref->senderData = ss.m_req.senderData;
237 ref->errorCode = ss.m_error;
240 ref->errorStatus = 0;
241 sendSignal(dictRef, GSN_CREATE_TAB_REF,
242 signal, CreateTabRef::SignalLength, JBB);
243 ssRelease<Ss_CREATE_TAB_REQ>(ssId);
253 Uint32 ssId = req->lqhFragPtr;
256 const Uint32 reqlength =
257 LqhAddAttrReq::HeaderLength +
258 req->noOfAttributes * LqhAddAttrReq::EntryLength;
259 ndbrequire(signal->getLength() == reqlength);
260 memcpy(&ss.m_req, req, reqlength << 2);
261 ss.m_reqlength = reqlength;
269 ndbrequire(ss_main.m_req.noOfAttributes >= req->noOfAttributes);
270 ss_main.m_req.noOfAttributes -= req->noOfAttributes;
276 saveSections(ss, handle);
284 Ss_LQHADDATTREQ& ss = ssFind<Ss_LQHADDATTREQ>(ssId);
285 Ss_CREATE_TAB_REQ& ss_main = ssFind<Ss_CREATE_TAB_REQ>(ssId);
288 const Uint32 reqlength = ss.m_reqlength;
289 memcpy(req, &ss.m_req, reqlength << 2);
290 req->lqhFragPtr = ss_main.m_lqhConnectPtr[ss.m_worker];
291 req->noOfAttributes = ss.m_req.noOfAttributes;
292 req->senderData = ssId;
293 req->senderAttrPtr = ss.m_req.senderAttrPtr;
295 signal, reqlength, JBB, handle);
299 DblqhProxy::execLQHADDATTCONF(
Signal* signal)
302 Uint32 ssId = conf->senderData;
303 Ss_LQHADDATTREQ& ss = ssFind<Ss_LQHADDATTREQ>(ssId);
304 recvCONF(signal, ss);
308 DblqhProxy::execLQHADDATTREF(
Signal* signal)
311 Uint32 ssId = ref->senderData;
312 Ss_LQHADDATTREQ& ss = ssFind<Ss_LQHADDATTREQ>(ssId);
313 recvREF(signal, ss, ref->errorCode);
321 BlockReference dictRef = ss_main.m_req.senderRef;
330 conf->senderData = ss.m_req.senderData;
331 conf->senderAttrPtr = ss.m_req.senderAttrPtr;
332 sendSignal(dictRef, GSN_LQHADDATTCONF,
333 signal, LqhAddAttrConf::SignalLength, JBB);
335 if (ss_main.m_req.noOfAttributes == 0)
342 ssRelease<Ss_CREATE_TAB_REQ>(ssId);
349 ref->senderData = ss.m_req.senderData;
350 ref->errorCode = ss.m_error;
351 sendSignal(dictRef, GSN_LQHADDATTREF,
352 signal, LqhAddAttrRef::SignalLength, JBB);
353 ssRelease<Ss_CREATE_TAB_REQ>(ssId);
356 ssRelease<Ss_LQHADDATTREQ>(ssId);
362 DblqhProxy::execLQHFRAGREQ(
Signal* signal)
365 Uint32 instance = getInstanceKey(req->tableId, req->fragId);
368 sendSignal(numberToRef(DBLQH, instance, getOwnNodeId()),
369 GSN_LQHFRAGREQ, signal, signal->getLength(), JBB);
375 DblqhProxy::execTAB_COMMITREQ(
Signal* signal)
377 Ss_TAB_COMMITREQ& ss = ssSeize<Ss_TAB_COMMITREQ>(1);
385 DblqhProxy::sendTAB_COMMITREQ(
Signal* signal, Uint32 ssId,
388 Ss_TAB_COMMITREQ& ss = ssFind<Ss_TAB_COMMITREQ>(ssId);
391 req->senderRef = reference();
392 req->senderData = ssId;
393 req->tableId = ss.m_req.tableId;
395 signal, TabCommitReq::SignalLength, JBB, handle);
399 DblqhProxy::execTAB_COMMITCONF(
Signal* signal)
402 Uint32 ssId = conf->senderData;
403 Ss_TAB_COMMITREQ& ss = ssFind<Ss_TAB_COMMITREQ>(ssId);
404 recvCONF(signal, ss);
408 DblqhProxy::execTAB_COMMITREF(
Signal* signal)
411 Uint32 ssId = ref->senderData;
412 Ss_TAB_COMMITREQ& ss = ssFind<Ss_TAB_COMMITREQ>(ssId);
415 recvREF(signal, ss, ref->errorCode);
419 DblqhProxy::sendTAB_COMMITCONF(
Signal* signal, Uint32 ssId)
421 Ss_TAB_COMMITREQ& ss = ssFind<Ss_TAB_COMMITREQ>(ssId);
422 BlockReference dictRef = ss.m_req.senderRef;
427 if (ss.m_error == 0) {
430 conf->senderData = ss.m_req.senderData;
431 conf->nodeId = getOwnNodeId();
432 conf->tableId = ss.m_req.tableId;
433 sendSignal(dictRef, GSN_TAB_COMMITCONF,
434 signal, TabCommitConf::SignalLength, JBB);
438 ref->senderData = ss.m_req.senderData;
439 ref->nodeId = getOwnNodeId();
440 ref->tableId = ss.m_req.tableId;
441 sendSignal(dictRef, GSN_TAB_COMMITREF,
442 signal, TabCommitRef::SignalLength, JBB);
446 ssRelease<Ss_TAB_COMMITREQ>(ssId);
452 DblqhProxy::getNoOfOutstanding(
const LcpRecord &
rec)
const
454 ndbrequire(rec.m_lcp_frag_ord_cnt >= rec.m_lcp_frag_rep_cnt);
455 return rec.m_lcp_frag_ord_cnt - rec.m_lcp_frag_rep_cnt;
461 ndbrequire(signal->getLength() == LcpFragOrd::SignalLength);
466 bool lcp_complete_ord = req->lastFragmentFlag;
468 if (c_lcpRecord.m_state == LcpRecord::L_IDLE)
471 D(
"LCP: start" << V(req->lcpId));
472 c_lcpRecord.m_state = LcpRecord::L_STARTING;
473 c_lcpRecord.m_lcpId = req->lcpId;
474 c_lcpRecord.m_lcp_frag_rep_cnt = 0;
475 c_lcpRecord.m_lcp_frag_ord_cnt = 0;
476 c_lcpRecord.m_complete_outstanding = 0;
477 c_lcpRecord.m_lastFragmentFlag =
false;
478 c_lcpRecord.m_empty_lcp_req.clear();
484 signal, LcpFragOrd::SignalLength);
487 signal, LcpFragOrd::SignalLength);
489 c_lcpRecord.m_state = LcpRecord::L_RUNNING;
493 D(
"LCP: continue" << V(req->lcpId) << V(c_lcpRecord.m_lcp_frag_ord_cnt));
494 ndbrequire(c_lcpRecord.m_state == LcpRecord::L_RUNNING);
495 ndbrequire(c_lcpRecord.m_lcpId == req->lcpId);
497 if (lcp_complete_ord)
500 c_lcpRecord.m_lastFragmentFlag =
true;
501 if (getNoOfOutstanding(c_lcpRecord) == 0)
504 completeLCP_1(signal);
516 c_lcpRecord.m_last_lcp_frag_ord = req_copy;
519 c_lcpRecord.m_lcp_frag_ord_cnt++;
522 ndbrequire(req->tableId < c_tableRecSize);
523 if (c_tableRec[req->tableId] == 0)
529 sendSignal(workerRef(0),
530 GSN_LCP_FRAG_ORD, signal, LcpFragOrd::SignalLength, JBB);
535 Uint32 instance = getInstanceKey(req->tableId, req->fragmentId);
536 sendSignal(numberToRef(DBLQH, instance, getOwnNodeId()),
537 GSN_LCP_FRAG_ORD, signal, LcpFragOrd::SignalLength, JBB);
544 ndbrequire(signal->getLength() == LcpFragRep::SignalLength);
548 ndbrequire(c_lcpRecord.m_state == LcpRecord::L_RUNNING);
549 ndbrequire(c_lcpRecord.m_lcpId == conf->lcpId);
551 c_lcpRecord.m_lcp_frag_rep_cnt++;
552 D(
"LCP: rep" << V(conf->lcpId) << V(c_lcpRecord.m_lcp_frag_rep_cnt));
558 conf->nodeId = LcpFragRep::BROADCAST_REQ;
559 sendSignal(DBDIH_REF, GSN_LCP_FRAG_REP,
560 signal, LcpFragRep::SignalLength, JBB);
562 if (c_lcpRecord.m_lastFragmentFlag)
568 if (getNoOfOutstanding(c_lcpRecord) == 0)
574 completeLCP_1(signal);
579 checkSendEMPTY_LCP_CONF(signal);
585 ndbrequire(c_lcpRecord.m_state == LcpRecord::L_RUNNING);
586 c_lcpRecord.m_state = LcpRecord::L_COMPLETING_1;
587 ndbrequire(c_lcpRecord.m_complete_outstanding == 0);
595 ord->lcpId = c_lcpRecord.m_lcpId;
596 ord->lastFragmentFlag =
true;
597 for (Uint32 i = 0; i<c_workers; i++)
600 c_lcpRecord.m_complete_outstanding++;
601 sendSignal(workerRef(i), GSN_LCP_FRAG_ORD, signal,
602 LcpFragOrd::SignalLength, JBB);
611 req->senderRef= reference();
613 req->backupId= c_lcpRecord.m_lcpId;
614 for (Uint32 i = 0; i<c_workers; i++)
617 c_lcpRecord.m_complete_outstanding++;
618 sendSignal(numberToRef(PGMAN, workerInstance(i), getOwnNodeId()),
619 GSN_END_LCP_REQ, signal, EndLcpReq::SignalLength, JBB);
624 DblqhProxy::execLCP_COMPLETE_REP(
Signal* signal)
627 ndbrequire(c_lcpRecord.m_state == LcpRecord::L_COMPLETING_1);
628 ndbrequire(c_lcpRecord.m_complete_outstanding);
629 c_lcpRecord.m_complete_outstanding--;
631 if (c_lcpRecord.m_complete_outstanding == 0)
634 completeLCP_2(signal);
640 DblqhProxy::execEND_LCP_CONF(
Signal* signal)
643 ndbrequire(c_lcpRecord.m_state == LcpRecord::L_COMPLETING_1 ||
644 c_lcpRecord.m_state == LcpRecord::L_COMPLETING_2 ||
645 c_lcpRecord.m_state == LcpRecord::L_COMPLETING_3);
647 ndbrequire(c_lcpRecord.m_complete_outstanding);
648 c_lcpRecord.m_complete_outstanding--;
650 if (c_lcpRecord.m_complete_outstanding == 0)
653 if (c_lcpRecord.m_state == LcpRecord::L_COMPLETING_1)
656 completeLCP_2(signal);
659 else if (c_lcpRecord.m_state == LcpRecord::L_COMPLETING_2)
662 completeLCP_3(signal);
668 sendLCP_COMPLETE_REP(signal);
678 ndbrequire(c_lcpRecord.m_state == LcpRecord::L_COMPLETING_1);
679 c_lcpRecord.m_state = LcpRecord::L_COMPLETING_2;
683 req->senderRef= reference();
685 req->backupId= c_lcpRecord.m_lcpId;
686 c_lcpRecord.m_complete_outstanding++;
693 Uint32 instance = MaxLqhWorkers + 1;
694 sendSignal(numberToRef(PGMAN, instance, getOwnNodeId()),
695 GSN_END_LCP_REQ, signal, EndLcpReq::SignalLength, JBB);
703 ndbrequire(c_lcpRecord.m_state == LcpRecord::L_COMPLETING_2);
704 c_lcpRecord.m_state = LcpRecord::L_COMPLETING_3;
712 req->senderRef= reference();
714 req->backupId= c_lcpRecord.m_lcpId;
717 sendSignal(TSMAN_REF, GSN_END_LCP_REQ, signal,
718 EndLcpReq::SignalLength, JBB);
720 if (c_lcpRecord.m_lcp_frag_rep_cnt)
723 c_lcpRecord.m_complete_outstanding++;
724 sendSignal(LGMAN_REF, GSN_END_LCP_REQ, signal,
725 EndLcpReq::SignalLength, JBB);
736 sendLCP_COMPLETE_REP(signal);
741 DblqhProxy::sendLCP_COMPLETE_REP(
Signal* signal)
743 ndbrequire(c_lcpRecord.m_state == LcpRecord::L_COMPLETING_3);
746 conf->nodeId = LcpFragRep::BROADCAST_REQ;
747 conf->blockNo = DBLQH;
748 conf->lcpId = c_lcpRecord.m_lcpId;
749 sendSignal(DBDIH_REF, GSN_LCP_COMPLETE_REP,
750 signal, LcpCompleteRep::SignalLength, JBB);
752 c_lcpRecord.m_state = LcpRecord::L_IDLE;
753 checkSendEMPTY_LCP_CONF(signal);
757 DblqhProxy::execEMPTY_LCP_REQ(
Signal* signal)
761 CRASH_INSERTION(5008);
764 Uint32 nodeId = refToNode(req->senderRef);
765 c_lcpRecord.m_empty_lcp_req.set(nodeId);
766 checkSendEMPTY_LCP_CONF(signal);
772 ndbrequire(!c_lcpRecord.m_empty_lcp_req.isclear());
777 switch(c_lcpRecord.m_state){
778 case LcpRecord::L_IDLE:
782 case LcpRecord::L_STARTING:
785 case LcpRecord::L_RUNNING:{
787 if (getNoOfOutstanding(c_lcpRecord) == 0)
794 conf->tableId = c_lcpRecord.m_last_lcp_frag_ord.tableId;
795 conf->fragmentId = c_lcpRecord.m_last_lcp_frag_ord.fragmentId;
796 conf->lcpId = c_lcpRecord.m_last_lcp_frag_ord.lcpId;
797 conf->lcpNo = c_lcpRecord.m_last_lcp_frag_ord.lcpNo;
802 case LcpRecord::L_COMPLETING_1:
804 case LcpRecord::L_COMPLETING_2:
806 case LcpRecord::L_COMPLETING_3:
811 conf->senderNodeId = getOwnNodeId();
813 c_lcpRecord.m_empty_lcp_req.copyto(NdbNodeBitmask::Size, rep->receiverGroup);
814 sendSignal(DBDIH_REF, GSN_EMPTY_LCP_REP, signal,
815 EmptyLcpRep::SignalLength + EmptyLcpConf::SignalLength, JBB);
817 c_lcpRecord.m_empty_lcp_req.clear();
823 DblqhProxy::execGCP_SAVEREQ(
Signal* signal)
826 Uint32 ssId = getSsId(req);
827 Ss_GCP_SAVEREQ& ss = ssSeize<Ss_GCP_SAVEREQ>(ssId);
835 Ss_GCP_SAVEREQ& ss = ssFind<Ss_GCP_SAVEREQ>(ssId);
840 req->dihBlockRef = reference();
841 req->dihPtr = ss.m_worker;
843 signal, GCPSaveReq::SignalLength, JBB, handle);
847 DblqhProxy::execGCP_SAVECONF(
Signal* signal)
850 Uint32 ssId = getSsId(conf);
851 Ss_GCP_SAVEREQ& ss = ssFind<Ss_GCP_SAVEREQ>(ssId);
852 recvCONF(signal, ss);
856 DblqhProxy::execGCP_SAVEREF(
Signal* signal)
859 Uint32 ssId = getSsId(ref);
860 Ss_GCP_SAVEREQ& ss = ssFind<Ss_GCP_SAVEREQ>(ssId);
862 if (ss.m_error != 0) {
864 ndbrequire(ss.m_error == ref->errorCode);
866 recvREF(signal, ss, ref->errorCode);
870 DblqhProxy::sendGCP_SAVECONF(
Signal* signal, Uint32 ssId)
872 Ss_GCP_SAVEREQ& ss = ssFind<Ss_GCP_SAVEREQ>(ssId);
877 if (ss.m_error == 0) {
879 conf->dihPtr = ss.m_req.dihPtr;
880 conf->nodeId = getOwnNodeId();
881 conf->gci = ss.m_req.gci;
882 sendSignal(ss.m_req.dihBlockRef, GSN_GCP_SAVECONF,
883 signal, GCPSaveConf::SignalLength, JBB);
887 ref->dihPtr = ss.m_req.dihPtr;
888 ref->nodeId = getOwnNodeId();
889 ref->gci = ss.m_req.gci;
890 ref->errorCode = ss.m_error;
891 sendSignal(ss.m_req.dihBlockRef, GSN_GCP_SAVEREF,
892 signal, GCPSaveRef::SignalLength, JBB);
895 ssRelease<Ss_GCP_SAVEREQ>(ssId);
900 DblqhProxy::execSUB_GCP_COMPLETE_REP(
Signal* signal)
903 for (Uint32 i = 0; i<c_workers; i++)
906 sendSignal(workerRef(i), GSN_SUB_GCP_COMPLETE_REP, signal,
907 signal->getLength(), JBB);
914 DblqhProxy::execPREP_DROP_TAB_REQ(
Signal* signal)
917 Uint32 ssId = getSsId(req);
918 Ss_PREP_DROP_TAB_REQ& ss = ssSeize<Ss_PREP_DROP_TAB_REQ>(ssId);
920 ndbrequire(signal->getLength() == PrepDropTabReq::SignalLength);
925 DblqhProxy::sendPREP_DROP_TAB_REQ(
Signal* signal, Uint32 ssId,
928 Ss_PREP_DROP_TAB_REQ& ss = ssFind<Ss_PREP_DROP_TAB_REQ>(ssId);
932 req->senderRef = reference();
933 req->senderData = ssId;
935 signal, PrepDropTabReq::SignalLength, JBB, handle);
939 DblqhProxy::execPREP_DROP_TAB_CONF(
Signal* signal)
942 Uint32 ssId = getSsId(conf);
943 Ss_PREP_DROP_TAB_REQ& ss = ssFind<Ss_PREP_DROP_TAB_REQ>(ssId);
944 recvCONF(signal, ss);
948 DblqhProxy::execPREP_DROP_TAB_REF(
Signal* signal)
951 Uint32 ssId = getSsId(ref);
952 Ss_PREP_DROP_TAB_REQ& ss = ssFind<Ss_PREP_DROP_TAB_REQ>(ssId);
953 recvREF(signal, ss, ref->errorCode);
957 DblqhProxy::sendPREP_DROP_TAB_CONF(
Signal* signal, Uint32 ssId)
959 Ss_PREP_DROP_TAB_REQ& ss = ssFind<Ss_PREP_DROP_TAB_REQ>(ssId);
960 BlockReference dictRef = ss.m_req.senderRef;
965 if (ss.m_error == 0) {
968 conf->senderRef = reference();
969 conf->senderData = ss.m_req.senderData;
970 conf->tableId = ss.m_req.tableId;
971 sendSignal(dictRef, GSN_PREP_DROP_TAB_CONF,
972 signal, PrepDropTabConf::SignalLength, JBB);
976 ref->senderRef = reference();
977 ref->senderData = ss.m_req.senderData;
978 ref->tableId = ss.m_req.tableId;
979 ref->errorCode = ss.m_error;
980 sendSignal(dictRef, GSN_PREP_DROP_TAB_REF,
981 signal, PrepDropTabRef::SignalLength, JBB);
984 ssRelease<Ss_PREP_DROP_TAB_REQ>(ssId);
990 DblqhProxy::execDROP_TAB_REQ(
Signal* signal)
993 Uint32 ssId = getSsId(req);
994 Ss_DROP_TAB_REQ& ss = ssSeize<Ss_DROP_TAB_REQ>(ssId);
996 ndbrequire(signal->getLength() == DropTabReq::SignalLength);
999 Uint32 tableId = ss.m_req.tableId;
1000 ndbrequire(tableId < c_tableRecSize);
1001 c_tableRec[tableId] = 0;
1007 Ss_DROP_TAB_REQ& ss = ssFind<Ss_DROP_TAB_REQ>(ssId);
1011 req->senderRef = reference();
1012 req->senderData = ssId;
1014 signal, DropTabReq::SignalLength, JBB, handle);
1018 DblqhProxy::execDROP_TAB_CONF(
Signal* signal)
1021 Uint32 ssId = getSsId(conf);
1022 Ss_DROP_TAB_REQ& ss = ssFind<Ss_DROP_TAB_REQ>(ssId);
1023 recvCONF(signal, ss);
1027 DblqhProxy::execDROP_TAB_REF(
Signal* signal)
1030 Uint32 ssId = getSsId(ref);
1031 Ss_DROP_TAB_REQ& ss = ssFind<Ss_DROP_TAB_REQ>(ssId);
1032 recvREF(signal, ss, ref->errorCode);
1036 DblqhProxy::sendDROP_TAB_CONF(
Signal* signal, Uint32 ssId)
1038 Ss_DROP_TAB_REQ& ss = ssFind<Ss_DROP_TAB_REQ>(ssId);
1039 BlockReference dictRef = ss.m_req.senderRef;
1044 if (ss.m_error == 0) {
1047 conf->senderRef = reference();
1048 conf->senderData = ss.m_req.senderData;
1049 conf->tableId = ss.m_req.tableId;
1050 sendSignal(dictRef, GSN_DROP_TAB_CONF,
1051 signal, DropTabConf::SignalLength, JBB);
1057 signal, DropTabReq::SignalLength);
1061 ref->senderRef = reference();
1062 ref->senderData = ss.m_req.senderData;
1063 ref->tableId = ss.m_req.tableId;
1064 ref->errorCode = ss.m_error;
1065 sendSignal(dictRef, GSN_DROP_TAB_REF,
1066 signal, DropTabConf::SignalLength, JBB);
1069 ssRelease<Ss_DROP_TAB_REQ>(ssId);
1075 DblqhProxy::execALTER_TAB_REQ(
Signal* signal)
1084 Uint32 ssId = getSsId(req);
1085 Ss_ALTER_TAB_REQ& ss = ssSeize<Ss_ALTER_TAB_REQ>(ssId);
1087 ndbrequire(signal->getLength() == AlterTabReq::SignalLength);
1090 saveSections(ss, handle);
1092 sendREQ(signal, ss);
1096 DblqhProxy::sendALTER_TAB_REQ(
Signal* signal, Uint32 ssId,
1099 Ss_ALTER_TAB_REQ& ss = ssFind<Ss_ALTER_TAB_REQ>(ssId);
1103 req->senderRef = reference();
1104 req->senderData = ssId;
1106 signal, AlterTabReq::SignalLength, JBB, handle);
1110 DblqhProxy::execALTER_TAB_CONF(
Signal* signal)
1113 Uint32 ssId = getSsId(conf);
1114 Ss_ALTER_TAB_REQ& ss = ssFind<Ss_ALTER_TAB_REQ>(ssId);
1115 recvCONF(signal, ss);
1119 DblqhProxy::execALTER_TAB_REF(
Signal* signal)
1122 Uint32 ssId = getSsId(ref);
1123 Ss_ALTER_TAB_REQ& ss = ssFind<Ss_ALTER_TAB_REQ>(ssId);
1124 recvREF(signal, ss, ref->errorCode);
1128 DblqhProxy::sendALTER_TAB_CONF(
Signal* signal, Uint32 ssId)
1130 Ss_ALTER_TAB_REQ& ss = ssFind<Ss_ALTER_TAB_REQ>(ssId);
1131 BlockReference dictRef = ss.m_req.senderRef;
1136 if (ss.m_error == 0) {
1139 conf->senderRef = reference();
1140 conf->senderData = ss.m_req.senderData;
1141 sendSignal(dictRef, GSN_ALTER_TAB_CONF,
1142 signal, AlterTabConf::SignalLength, JBB);
1146 ref->senderRef = reference();
1147 ref->senderData = ss.m_req.senderData;
1148 ref->errorCode = ss.m_error;
1149 sendSignal(dictRef, GSN_ALTER_TAB_REF,
1150 signal, AlterTabConf::SignalLength, JBB);
1153 ssRelease<Ss_ALTER_TAB_REQ>(ssId);
1162 Uint32 instance = getInstanceKey(req->tableId, req->fragId);
1165 sendSignal(numberToRef(DBLQH, instance, getOwnNodeId()),
1166 GSN_START_FRAGREQ, signal, signal->getLength(), JBB);
1172 DblqhProxy::execSTART_RECREQ(
Signal* signal)
1174 if (refToMain(signal->getSendersBlockRef()) == DBLQH) {
1176 execSTART_RECREQ_2(signal);
1181 Ss_START_RECREQ& ss = ssSeize<Ss_START_RECREQ>();
1186 for (i = 0; i < ss.m_req2cnt; i++) {
1187 Ss_START_RECREQ_2::Req tmp;
1188 tmp.proxyBlockNo = ss.m_req2[
i].m_blockNo;
1189 Uint32 ssId2 = getSsId(&tmp);
1190 Ss_START_RECREQ_2& ss2 = ssSeize<Ss_START_RECREQ_2>(ssId2);
1191 ss.m_req2[
i].m_ssId = ssId2;
1197 ndbrequire(signal->getLength() == StartRecReq::SignalLength);
1198 sendREQ(signal, ss);
1204 Ss_START_RECREQ& ss = ssFind<Ss_START_RECREQ>(ssId);
1209 req->senderRef = reference();
1210 req->senderData = ssId;
1212 signal, StartRecReq::SignalLength, JBB, handle);
1216 DblqhProxy::execSTART_RECCONF(
Signal* signal)
1220 if (refToMain(signal->getSendersBlockRef()) != DBLQH) {
1222 execSTART_RECCONF_2(signal);
1226 Uint32 ssId = conf->senderData;
1227 Ss_START_RECREQ& ss = ssFind<Ss_START_RECREQ>(ssId);
1228 recvCONF(signal, ss);
1239 if (ss.m_error == 0) {
1245 signal->theData[0] = 12003;
1246 sendSignal(LGMAN_REF, GSN_DUMP_STATE_ORD, signal, 1, JBB);
1249 conf->startingNodeId = getOwnNodeId();
1250 conf->senderData = ss.m_req.senderData;
1251 sendSignal(ss.m_req.senderRef, GSN_START_RECCONF,
1252 signal, StartRecConf::SignalLength, JBB);
1259 for (i = 0; i < ss.m_req2cnt; i++) {
1261 Uint32 ssId2 = ss.m_req2[
i].m_ssId;
1262 ssRelease<Ss_START_RECREQ_2>(ssId2);
1265 ssRelease<Ss_START_RECREQ>(ssId);
1271 DblqhProxy::execSTART_RECREQ_2(
Signal* signal)
1273 ndbrequire(signal->getLength() == Ss_START_RECREQ_2::Req::SignalLength);
1275 const Ss_START_RECREQ_2::Req* req =
1276 (
const Ss_START_RECREQ_2::Req*)signal->getDataPtr();
1277 Uint32 ssId = getSsId(req);
1278 Ss_START_RECREQ_2& ss = ssFind<Ss_START_RECREQ_2>(ssId);
1281 recvCONF(signal, ss);
1285 DblqhProxy::sendSTART_RECREQ_2(
Signal* signal, Uint32 ssId)
1287 Ss_START_RECREQ_2& ss = ssFind<Ss_START_RECREQ_2>(ssId);
1289 const Ss_START_RECREQ_2::Req* req =
1290 (
const Ss_START_RECREQ_2::Req*)signal->getDataPtr();
1292 if (firstReply(ss)) {
1302 if (req->lcpId < ss.m_req.lcpId)
1305 ss.m_req.lcpId = req->lcpId;
1307 ndbrequire(ss.m_req.proxyBlockNo == req->proxyBlockNo);
1314 Ss_START_RECREQ_2::Req* req =
1315 (Ss_START_RECREQ_2::Req*)signal->getDataPtrSend();
1317 BlockReference ref = numberToRef(req->proxyBlockNo, getOwnNodeId());
1318 sendSignal(ref, GSN_START_RECREQ, signal,
1319 Ss_START_RECREQ_2::Req::SignalLength, JBB);
1324 DblqhProxy::execSTART_RECCONF_2(
Signal* signal)
1326 ndbrequire(signal->getLength() == Ss_START_RECREQ_2::Conf::SignalLength);
1328 const Ss_START_RECREQ_2::Conf* conf =
1329 (
const Ss_START_RECREQ_2::Conf*)signal->getDataPtr();
1330 Uint32 ssId = getSsId(conf);
1331 Ss_START_RECREQ_2& ss = ssFind<Ss_START_RECREQ_2>(ssId);
1335 sendREQ(signal, ss);
1339 DblqhProxy::sendSTART_RECCONF_2(
Signal* signal, Uint32 ssId,
1342 Ss_START_RECREQ_2& ss = ssFind<Ss_START_RECREQ_2>(ssId);
1344 Ss_START_RECREQ_2::Conf* conf =
1345 (Ss_START_RECREQ_2::Conf*)signal->getDataPtrSend();
1348 Ss_START_RECREQ_2::Conf::SignalLength, JBB, handle);
1366 ndbrequire(signal->getLength() == LqhTransReq::SignalLength);
1367 sendREQ(signal, ss);
1373 Uint32 nodeId = ss.m_req.failedNodeId;
1374 for (Uint32 i = 0; i<NDB_ARRAY_SIZE(c_ss_LQH_TRANSREQ.m_pool); i++)
1376 if (c_ss_LQH_TRANSREQ.m_pool[i].m_ssId != 0 &&
1377 c_ss_LQH_TRANSREQ.m_pool[i].m_ssId != ss.m_ssId &&
1378 c_ss_LQH_TRANSREQ.m_pool[i].m_req.failedNodeId == nodeId)
1381 c_ss_LQH_TRANSREQ.m_pool[
i].m_valid =
false;
1389 Ss_LQH_TRANSREQ& ss = ssFind<Ss_LQH_TRANSREQ>(ssId);
1394 req->senderData = ssId;
1395 req->senderRef = reference();
1397 signal, LqhTransReq::SignalLength, JBB, handle);
1404 Uint32 ssId = conf->tcRef;
1408 BlockReference ref = signal->getSendersBlockRef();
1409 ndbrequire(refToMain(ref) == number());
1410 const Uint32 ino = refToInstance(ref);
1411 const Uint32 worker = workerIndex(ino);
1413 ndbrequire(ref == workerRef(worker));
1414 ndbrequire(worker < c_workers);
1422 if (ss.m_conf.operationStatus == LqhTransConf::LastTransConf)
1425 ndbrequire(ss.m_workerMask.get(worker));
1426 ss.m_workerMask.clear(worker);
1427 if (ss.m_workerMask.isclear())
1430 ssRelease<Ss_LQH_TRANSREQ>(ssId);
1435 else if (ss.m_conf.operationStatus == LqhTransConf::LastTransConf)
1445 Uint32 nodeId = ss.m_req.failedNodeId;
1446 for (Uint32 i = 0; i<NDB_ARRAY_SIZE(c_ss_LQH_TRANSREQ.m_pool); i++)
1448 if (c_ss_LQH_TRANSREQ.m_pool[i].m_ssId != 0 &&
1449 c_ss_LQH_TRANSREQ.m_pool[i].m_ssId != ssId &&
1450 c_ss_LQH_TRANSREQ.m_pool[i].m_req.failedNodeId == nodeId &&
1451 c_ss_LQH_TRANSREQ.m_pool[i].m_valid ==
false)
1454 if (c_ss_LQH_TRANSREQ.m_pool[i].m_workerMask.get(worker))
1457 c_ss_LQH_TRANSREQ.m_pool[
i].m_workerMask.clear(worker);
1458 if (c_ss_LQH_TRANSREQ.m_pool[i].m_workerMask.isclear())
1461 ssRelease<Ss_LQH_TRANSREQ>(c_ss_LQH_TRANSREQ.m_pool[
i].m_ssId);
1468 recvCONF(signal, ss);
1472 DblqhProxy::sendLQH_TRANSCONF(
Signal* signal, Uint32 ssId)
1474 Ss_LQH_TRANSREQ& ss = ssFind<Ss_LQH_TRANSREQ>(ssId);
1476 if (ss.m_conf.operationStatus != LqhTransConf::LastTransConf) {
1480 conf->tcRef = ss.m_req.senderData;
1481 sendSignal(ss.m_req.senderRef, GSN_LQH_TRANSCONF,
1482 signal, LqhTransConf::SignalLength, JBB);
1491 if (ss.m_error == 0) {
1494 conf->tcRef = ss.m_req.senderData;
1495 conf->lqhNodeId = getOwnNodeId();
1496 conf->operationStatus = LqhTransConf::LastTransConf;
1497 sendSignal(ss.m_req.senderRef, GSN_LQH_TRANSCONF,
1498 signal, LqhTransConf::SignalLength, JBB);
1503 ssRelease<Ss_LQH_TRANSREQ>(ssId);
1509 DblqhProxy::execEXEC_SRREQ(
Signal* signal)
1511 const BlockReference senderRef = signal->getSendersBlockRef();
1513 if (refToInstance(senderRef) != 0) {
1515 execEXEC_SR_2(signal, GSN_EXEC_SRREQ);
1519 execEXEC_SR_1(signal, GSN_EXEC_SRREQ);
1523 DblqhProxy::execEXEC_SRCONF(
Signal* signal)
1525 const BlockReference senderRef = signal->getSendersBlockRef();
1527 if (refToInstance(senderRef) != 0) {
1529 execEXEC_SR_2(signal, GSN_EXEC_SRCONF);
1533 execEXEC_SR_1(signal, GSN_EXEC_SRCONF);
1537 DblqhProxy::execEXEC_SR_1(
Signal* signal, GlobalSignalNumber gsn)
1539 ndbrequire(signal->getLength() == Ss_EXEC_SR_1::Sig::SignalLength);
1541 const Ss_EXEC_SR_1::Sig* sig =
1542 (
const Ss_EXEC_SR_1::Sig*)signal->getDataPtr();
1543 Uint32 ssId = getSsId(sig);
1544 Ss_EXEC_SR_1& ss = ssSeize<Ss_EXEC_SR_1>(ssId);
1548 sendREQ(signal, ss);
1549 ssRelease<Ss_EXEC_SR_1>(ss);
1555 Ss_EXEC_SR_1& ss = ssFind<Ss_EXEC_SR_1>(ssId);
1556 signal->theData[0] = ss.m_sig.nodeId;
1563 DblqhProxy::execEXEC_SR_2(
Signal* signal, GlobalSignalNumber gsn)
1565 ndbrequire(signal->getLength() == Ss_EXEC_SR_2::Sig::SignalLength);
1567 const Ss_EXEC_SR_2::Sig* sig =
1568 (
const Ss_EXEC_SR_2::Sig*)signal->getDataPtr();
1569 Uint32 ssId = getSsId(sig);
1572 Ss_EXEC_SR_2& ss = ssFindSeize<Ss_EXEC_SR_2>(ssId, &found);
1578 ndbrequire(sig->nodeId == getOwnNodeId());
1579 if (ss.m_sigcount == 0) {
1585 ndbrequire(ss.m_gsn == gsn);
1586 ndbrequire(memcmp(&ss.m_sig, sig,
sizeof(*sig)) == 0);
1591 recvCONF(signal, ss);
1595 DblqhProxy::sendEXEC_SR_2(
Signal* signal, Uint32 ssId)
1597 Ss_EXEC_SR_2& ss = ssFind<Ss_EXEC_SR_2>(ssId);
1599 if (!lastReply(ss)) {
1605 nodes.
assign(NdbNodeBitmask::Size, ss.m_sig.sr_nodes);
1608 signal->theData[0] = ss.m_sig.nodeId;
1609 sendSignal(rg, ss.m_gsn, signal, 1, JBB);
1611 ssRelease<Ss_EXEC_SR_2>(ssId);
1618 Uint32 ref = ((
ExecFragReq*)signal->getDataPtr())->dst;
1620 if (refToNode(ref) == getOwnNodeId())
1623 sendSignal(ref, GSN_EXEC_FRAGREQ, signal, signal->getLength(), JBB);
1625 else if (ndb_route_exec_frag(
getNodeInfo(refToNode(ref)).m_version))
1628 sendSignal(numberToRef(DBLQH, refToNode(ref)), GSN_EXEC_FRAGREQ, signal,
1629 signal->getLength(), JBB);
1634 sendSignal(ref, GSN_EXEC_FRAGREQ, signal,
1635 signal->getLength(), JBB);
1641 DblqhProxy::execEXEC_FRAGCONF(
Signal* signal)
1643 Uint32 ref = signal->theData[1];
1645 if (refToNode(ref) == getOwnNodeId())
1648 sendSignal(ref, GSN_EXEC_FRAGCONF, signal, 1, JBB);
1650 else if (ndb_route_exec_frag(
getNodeInfo(refToNode(ref)).m_version))
1653 sendSignal(numberToRef(DBLQH, refToNode(ref)), GSN_EXEC_FRAGCONF,
1659 sendSignal(ref, GSN_EXEC_FRAGCONF, signal, 2, JBB);
1666 DblqhProxy::execDROP_FRAG_REQ(
Signal* signal)
1669 Uint32 ssId = getSsId(req);
1670 Ss_DROP_FRAG_REQ& ss = ssSeize<Ss_DROP_FRAG_REQ>(ssId);
1672 ndbrequire(signal->getLength() == DropFragReq::SignalLength);
1673 sendREQ(signal, ss);
1677 DblqhProxy::sendDROP_FRAG_REQ(
Signal* signal, Uint32 ssId,
1680 Ss_DROP_FRAG_REQ& ss = ssFind<Ss_DROP_FRAG_REQ>(ssId);
1684 req->senderRef = reference();
1685 req->senderData = ssId;
1687 signal, DropFragReq::SignalLength, JBB, handle);
1691 DblqhProxy::execDROP_FRAG_CONF(
Signal* signal)
1694 Uint32 ssId = getSsId(conf);
1695 Ss_DROP_FRAG_REQ& ss = ssFind<Ss_DROP_FRAG_REQ>(ssId);
1696 recvCONF(signal, ss);
1700 DblqhProxy::execDROP_FRAG_REF(
Signal* signal)
1703 Uint32 ssId = getSsId(ref);
1704 Ss_DROP_FRAG_REQ& ss = ssFind<Ss_DROP_FRAG_REQ>(ssId);
1705 recvREF(signal, ss, ref->errCode);
1709 DblqhProxy::sendDROP_FRAG_CONF(
Signal* signal, Uint32 ssId)
1711 Ss_DROP_FRAG_REQ& ss = ssFind<Ss_DROP_FRAG_REQ>(ssId);
1712 BlockReference dictRef = ss.m_req.senderRef;
1717 if (ss.m_error == 0) {
1720 conf->senderRef = reference();
1721 conf->senderData = ss.m_req.senderData;
1722 conf->tableId = ss.m_req.tableId;
1723 conf->fragId = ss.m_req.fragId;
1724 sendSignal(dictRef, GSN_DROP_FRAG_CONF,
1725 signal, DropFragConf::SignalLength, JBB);
1729 ref->senderRef = reference();
1730 ref->senderData = ss.m_req.senderData;
1731 ref->tableId = ss.m_req.tableId;
1732 ref->fragId = ss.m_req.fragId;
1733 ref->errCode = ss.m_error;
1734 sendSignal(dictRef, GSN_DROP_FRAG_REF,
1735 signal, DropFragConf::SignalLength, JBB);
1738 ssRelease<Ss_DROP_FRAG_REQ>(ssId);