19 #include "Ndbcntr.hpp"
21 #include <ndb_limits.h>
22 #include <ndb_version.h>
23 #include <SimpleProperties.hpp>
24 #include <signaldata/DictTabInfo.hpp>
25 #include <signaldata/SchemaTrans.hpp>
26 #include <signaldata/CreateTable.hpp>
27 #include <signaldata/CreateHashMap.hpp>
28 #include <signaldata/ReadNodesConf.hpp>
29 #include <signaldata/NodeFailRep.hpp>
30 #include <signaldata/TcKeyReq.hpp>
31 #include <signaldata/TcKeyConf.hpp>
32 #include <signaldata/EventReport.hpp>
33 #include <signaldata/NodeStateSignalData.hpp>
34 #include <signaldata/StopPerm.hpp>
35 #include <signaldata/StopMe.hpp>
36 #include <signaldata/WaitGCP.hpp>
37 #include <signaldata/CheckNodeGroups.hpp>
38 #include <signaldata/StartOrd.hpp>
39 #include <signaldata/AbortAll.hpp>
40 #include <signaldata/SystemError.hpp>
41 #include <signaldata/NdbSttor.hpp>
42 #include <signaldata/CntrStart.hpp>
43 #include <signaldata/DumpStateOrd.hpp>
45 #include <signaldata/FsRemoveReq.hpp>
46 #include <signaldata/ReadConfig.hpp>
48 #include <signaldata/FailRep.hpp>
50 #include <AttributeHeader.hpp>
51 #include <Configuration.hpp>
52 #include <DebuggerNames.hpp>
53 #include <signaldata/DihRestart.hpp>
58 #include <signaldata/TakeOver.hpp>
59 #include <signaldata/CreateNodegroupImpl.hpp>
60 #include <signaldata/DropNodegroupImpl.hpp>
61 #include <signaldata/CreateFilegroup.hpp>
63 #include <EventLogger.hpp>
69 Uint32 g_currentStartPhase;
79 Uint32 ErrorInsertStart;
80 Uint32 ErrorInsertStop;
84 { NDBFS_REF, 0 , 2000, 2999 },
85 { DBTC_REF, 1 , 8000, 8035 },
86 { DBDIH_REF, 1 , 7000, 7173 },
87 { DBLQH_REF, 1 , 5000, 5030 },
88 { DBACC_REF, 1 , 3000, 3999 },
89 { DBTUP_REF, 1 , 4000, 4007 },
90 { DBDICT_REF, 1 , 6000, 6003 },
91 { NDBCNTR_REF, 0 , 1000, 1999 },
92 { CMVMI_REF, 1 , 9000, 9999 },
93 { QMGR_REF, 1 , 1, 999 },
94 { TRIX_REF, 1 , 0, 0 },
95 { BACKUP_REF, 1 , 10000, 10999 },
96 { DBUTIL_REF, 1 , 11000, 11999 },
97 { SUMA_REF, 1 , 13000, 13999 },
98 { DBTUX_REF, 1 , 12000, 12999 }
99 ,{ TSMAN_REF, 1 , 0, 0 }
100 ,{ LGMAN_REF, 1 , 0, 0 }
101 ,{ PGMAN_REF, 1 , 0, 0 }
102 ,{ RESTORE_REF,1 , 0, 0 }
103 ,{ DBINFO_REF,1 , 0, 0 }
104 ,{ DBSPJ_REF,1 , 0, 0 }
107 static const Uint32 ALL_BLOCKS_SZ =
sizeof(ALL_BLOCKS)/
sizeof(
BlockInfo);
109 static BlockReference readConfigOrder[ALL_BLOCKS_SZ] = {
136 void Ndbcntr::execCONTINUEB(
Signal* signal)
139 UintR Ttemp1 = signal->theData[0];
147 if(cmasterNodeId == getOwnNodeId() && c_start.m_starting.
isclear()){
149 trySystemRestart(signal);
153 Uint64 now = NdbTick_CurrentMillisecond();
154 if(now > c_start.m_startFailureTimeout)
159 m_ctx.m_config.getOwnConfigIterator();
160 ndb_mgm_get_int_parameter(p, CFG_DB_START_FAILURE_TIMEOUT, &to_3);
162 tmp.
append(
"Shutting down node as total restart time exceeds "
163 " StartFailureTimeout as set in config file ");
165 tmp.
append(
" 0 (inifinite)");
172 signal->theData[0] = ZSTARTUP;
173 sendSignalWithDelay(reference(), GSN_CONTINUEB, signal, 1000, 1);
178 c_stopRec.checkTimeout(signal);
181 if (ERROR_INSERTED(1002))
183 signal->theData[0] = ZBLOCK_STTOR;
184 sendSignalWithDelay(reference(), GSN_CONTINUEB, signal, 100, 1);
189 c_missra.sendNextSTTOR(signal);
194 systemErrorLab(signal, __LINE__);
201 Ndbcntr::execAPI_START_REP(
Signal* signal)
203 if(refToBlock(signal->getSendersBlockRef()) == QMGR)
205 for(Uint32
i = 0;
i<ALL_BLOCKS_SZ;
i++){
206 sendSignal(ALL_BLOCKS[
i].Ref, GSN_API_START_REP, signal, 1, JBB);
213 void Ndbcntr::execSYSTEM_ERROR(
Signal* signal)
217 int killingNode = refToNode(sysErr->errorRef);
218 Uint32 data1 = sysErr->data[0];
221 switch (sysErr->errorCode){
222 case SystemError::GCPStopDetected:
225 "Node %d killed this node because "
226 "GCP stop was detected",
228 signal->theData[0] = 7025;
233 signal->theData[0] = 12002;
240 case SystemError::CopyFragRefError:
241 CRASH_INSERTION(1000);
243 "Killed by node %d as "
244 "copyfrag failed, error: %u",
248 case SystemError::StartFragRefError:
250 "Node %d killed this node because "
251 "it replied StartFragRef error code: %u.",
255 case SystemError::CopySubscriptionRef:
257 "Node %d killed this node because "
258 "it could not copy a subscription during node restart. "
259 "Copy subscription error code: %u.",
262 case SystemError::CopySubscriberRef:
264 "Node %d killed this node because "
265 "it could not start a subscriber during node restart. "
266 "Copy subscription error code: %u.",
271 " this node was killed by node %d",
272 sysErr->errorCode, killingNode);
276 progError(__LINE__, NDBD_EXIT_SYSTEM_ERROR, buf);
300 parse_size(
const char * src)
304 num = strtoll(src, &endptr, 10);
341 key =
"undo_buffer_size=";
342 group.size = 64*1024*1024;
343 group.name =
"DEFAULT-LG";
349 key =
"extent_size=";
350 group.size = 1024*1024;
351 group.name =
"DEFAULT-TS";
355 size_t keylen = strlen(key);
359 arg.split(list,
";");
362 for (Uint32
i = 0;
i<list.size();
i++)
365 if (strncasecmp(list[
i].c_str(),
"name=",
sizeof(
"name=")-1) == 0)
367 group.name= strdup(list[
i].c_str() +
sizeof(
"name=")-1);
369 else if (strncasecmp(list[
i].c_str(), key, keylen) == 0)
371 group.size = parse_size(list[
i].c_str() + keylen);
373 else if (strlen(list[
i].c_str()) == 0 && (
i + 1) == list.size())
385 const char * path = list[
i].c_str();
386 char * sizeptr =
const_cast<char*
>(strchr(path,
':'));
393 entry.name = strdup(path);
394 entry.size = parse_size(sizeptr + 1);
395 entry.type = filetype;
403 dst.push_back(
group);
405 dst.push_back(
entry);
412 Ndbcntr::execREAD_CONFIG_REQ(
Signal* signal)
418 Uint32 ref = req->senderRef;
419 Uint32 senderData = req->senderData;
422 m_ctx.m_config.getOwnConfigIterator();
426 ndb_mgm_get_int_parameter(p, CFG_DB_DISCLESS, &dl);
429 const char * lgspec = 0;
431 if (!ndb_mgm_get_string_parameter(p, CFG_DB_DD_LOGFILEGROUP_SPEC, &lgspec))
438 "Unable to parse InitialLogfileGroup: %s", lgspec);
439 progError(__LINE__, NDBD_EXIT_INVALID_CONFIG, buf);
443 const char * tsspec = 0;
444 if (!ndb_mgm_get_string_parameter(p, CFG_DB_DD_TABLEPACE_SPEC, &tsspec))
446 if (f_dd.size() == 0)
449 "but InitialLogfileGroup is not!");
458 "Unable to parse InitialTablespace: %s", tsspec);
459 progError(__LINE__, NDBD_EXIT_INVALID_CONFIG, buf);
467 f_dd.push_back(empty);
473 g_sysTable_NDBEVENTS_0.columnCount--;
477 conf->senderRef = reference();
478 conf->senderData = senderData;
479 sendSignal(ref, GSN_READ_CONFIG_CONF, signal,
480 ReadConfigConf::SignalLength, JBB);
483 void Ndbcntr::execSTTOR(
Signal* signal)
486 cstartPhase = signal->theData[1];
489 cinternalStartphase = cstartPhase - 1;
491 switch (cstartPhase) {
493 if(m_ctx.m_config.getInitialStart()){
496 clearFilesystem(signal);
503 startPhase1Lab(signal);
507 startPhase2Lab(signal);
511 startPhase3Lab(signal);
515 startPhase4Lab(signal);
519 startPhase5Lab(signal);
523 getNodeGroup(signal);
528 startPhase8Lab(signal);
532 startPhase9Lab(signal);
542 Ndbcntr::getNodeGroup(
Signal* signal){
545 sd->requestType = CheckNodeGroups::Direct | CheckNodeGroups::GetNodeGroup;
547 CheckNodeGroups::SignalLength);
549 c_nodeGroup = sd->output;
555 void Ndbcntr::execNDB_STTORRY(
Signal* signal)
558 switch (cstartPhase) {
601 systemErrorLab(signal, __LINE__);
607 void Ndbcntr::startPhase1Lab(
Signal* signal)
615 NdbBlocksRecPtr ndbBlocksPtr;
617 ptrAss(ndbBlocksPtr, ndbBlocksRec);
618 ndbBlocksPtr.p->blockref = DBLQH_REF;
620 ptrAss(ndbBlocksPtr, ndbBlocksRec);
621 ndbBlocksPtr.p->blockref = DBDICT_REF;
623 ptrAss(ndbBlocksPtr, ndbBlocksRec);
624 ndbBlocksPtr.p->blockref = DBTUP_REF;
626 ptrAss(ndbBlocksPtr, ndbBlocksRec);
627 ndbBlocksPtr.p->blockref = DBACC_REF;
629 ptrAss(ndbBlocksPtr, ndbBlocksRec);
630 ndbBlocksPtr.p->blockref = DBTC_REF;
632 ptrAss(ndbBlocksPtr, ndbBlocksRec);
633 ndbBlocksPtr.p->blockref = DBDIH_REF;
638 void Ndbcntr::execREAD_NODESREF(
Signal* signal)
641 systemErrorLab(signal, __LINE__);
649 void Ndbcntr::execNDB_STARTREF(
Signal* signal)
652 systemErrorLab(signal, __LINE__);
659 void Ndbcntr::startPhase2Lab(
Signal* signal)
661 c_start.m_lastGci = 0;
662 c_start.m_lastGciNodeId = getOwnNodeId();
665 req->senderRef = reference();
666 sendSignal(DBDIH_REF, GSN_DIH_RESTARTREQ, signal,
667 DihRestartReq::SignalLength, JBB);
674 void Ndbcntr::execDIH_RESTARTCONF(
Signal* signal)
679 signal->getDataPtrSend());
680 c_start.m_lastGci = conf->latest_gci;
681 ctypeOfStart = NodeState::ST_SYSTEM_RESTART;
682 cdihStartType = ctypeOfStart;
690 void Ndbcntr::execDIH_RESTARTREF(
Signal* signal)
693 ctypeOfStart = NodeState::ST_INITIAL_START;
694 cdihStartType = ctypeOfStart;
699 void Ndbcntr::ph2ALab(
Signal* signal)
706 signal->theData[0] = reference();
707 sendSignal(QMGR_REF, GSN_READ_NODESREQ, signal, 1, JBB);
713 setTimeout(Uint64 time, Uint32 timeoutValue){
714 if(timeoutValue == 0)
716 return time + timeoutValue;
722 void Ndbcntr::execREAD_NODESCONF(
Signal* signal)
727 cmasterNodeId = readNodes->masterNodeId;
728 cdynamicNodeId = readNodes->ndynamicId;
733 c_allDefinedNodes.
assign(NdbNodeBitmask::Size, readNodes->allNodes);
734 c_clusterNodes.
assign(NdbNodeBitmask::Size, readNodes->clusterNodes);
741 m_ctx.m_config.getOwnConfigIterator();
744 ndb_mgm_get_int_parameter(p, CFG_DB_START_PARTIAL_TIMEOUT, &to_1);
745 ndb_mgm_get_int_parameter(p, CFG_DB_START_PARTITION_TIMEOUT, &to_2);
746 ndb_mgm_get_int_parameter(p, CFG_DB_START_FAILURE_TIMEOUT, &to_3);
748 c_start.m_startTime = NdbTick_CurrentMillisecond();
749 c_start.m_startPartialTimeout = setTimeout(c_start.m_startTime, to_1);
750 c_start.m_startPartitionedTimeout = setTimeout(c_start.m_startTime, to_2);
751 c_start.m_startFailureTimeout = setTimeout(c_start.m_startTime, to_3);
753 sendCntrStartReq(signal);
755 signal->theData[0] = ZSTARTUP;
756 sendSignalWithDelay(reference(), GSN_CONTINUEB, signal, 1000, 1);
762 Ndbcntr::execCM_ADD_REP(
Signal* signal){
764 c_clusterNodes.
set(signal->theData[0]);
768 Ndbcntr::sendCntrStartReq(
Signal * signal){
772 req->startType = ctypeOfStart;
773 req->lastGci = c_start.m_lastGci;
774 req->nodeId = getOwnNodeId();
775 sendSignal(calcNdbCntrBlockRef(cmasterNodeId), GSN_CNTR_START_REQ,
776 signal, CntrStartReq::SignalLength, JBB);
780 Ndbcntr::execCNTR_START_REF(
Signal * signal){
784 switch(ref->errorCode){
785 case CntrStartRef::NotMaster:
787 cmasterNodeId = ref->masterNodeId;
788 sendCntrStartReq(signal);
790 case CntrStartRef::StopInProgress:
792 progError(__LINE__, NDBD_EXIT_RESTART_DURING_SHUTDOWN);
798 Ndbcntr::StartRecord::reset(){
802 m_withoutLog.
clear();
804 m_lastGci = m_lastGciNodeId = 0;
805 m_startPartialTimeout = ~0;
806 m_startPartitionedTimeout = ~0;
807 m_startFailureTimeout = ~0;
810 bzero(m_wait_sp,
sizeof(m_wait_sp));
814 Ndbcntr::execCNTR_START_CONF(
Signal * signal){
818 cnoStartNodes = conf->noStartNodes;
819 ctypeOfStart = (NodeState::StartType)conf->startType;
820 cdihStartType = ctypeOfStart;
821 c_start.m_lastGci = conf->startGci;
822 cmasterNodeId = conf->masterNodeId;
824 tmp.
assign(NdbNodeBitmask::Size, conf->startedNodes);
825 c_startedNodes.
bitOR(tmp);
826 c_start.m_starting.
assign(NdbNodeBitmask::Size, conf->startingNodes);
827 m_cntr_start_conf =
true;
842 #define PARALLELL_NR 0
845 const bool parallellNR =
true;
847 const bool parallellNR =
false;
851 Ndbcntr::execCNTR_START_REP(
Signal* signal){
853 Uint32 nodeId = signal->theData[0];
855 c_startedNodes.
set(nodeId);
856 c_start.m_starting.
clear(nodeId);
861 for(Uint32
i = 0;
i<ALL_BLOCKS_SZ;
i++){
862 sendSignal(ALL_BLOCKS[
i].Ref, GSN_NODE_START_REP, signal, 1, JBB);
865 signal->theData[0] = nodeId;
866 execSTART_PERMREP(signal);
870 Ndbcntr::execSTART_PERMREP(
Signal* signal)
872 Uint32 nodeId = signal->theData[0];
873 c_startedNodes.
set(nodeId);
874 c_start.m_starting.
clear(nodeId);
876 if(!c_start.m_starting.
isclear()){
881 if(cmasterNodeId != getOwnNodeId()){
887 if(c_start.m_waiting.
isclear()){
893 startWaitingNodes(signal);
897 Ndbcntr::execCNTR_START_REQ(
Signal * signal){
901 const Uint32 nodeId = req->nodeId;
902 const Uint32 lastGci = req->lastGci;
903 const NodeState::StartType st = (NodeState::StartType)req->startType;
905 if(cmasterNodeId == 0){
908 sendSignalWithDelay(reference(), GSN_CNTR_START_REQ, signal, 100,
909 signal->getLength());
913 if(cmasterNodeId != getOwnNodeId()){
915 sendCntrStartRef(signal, nodeId, CntrStartRef::NotMaster);
935 sendCntrStartRef(signal, nodeId, CntrStartRef::StopInProgress);
944 c_start.m_waiting.
set(nodeId);
946 case NodeState::ST_INITIAL_START:
948 c_start.m_withoutLog.
set(nodeId);
950 case NodeState::ST_SYSTEM_RESTART:
952 c_start.m_withLog.
set(nodeId);
953 if(starting && lastGci > c_start.m_lastGci){
956 ref->errorCode = CntrStartRef::NotMaster;
957 ref->masterNodeId = nodeId;
959 sendSignal(rg, GSN_CNTR_START_REF, signal,
960 CntrStartRef::SignalLength, JBB);
965 Uint32
i = c_start.m_logNodesCount++;
966 c_start.m_logNodes[
i].m_nodeId = nodeId;
967 c_start.m_logNodes[
i].m_lastGci = req->lastGci;
970 case NodeState::ST_NODE_RESTART:
971 case NodeState::ST_INITIAL_NODE_RESTART:
972 case NodeState::ST_ILLEGAL_TYPE:
976 const bool startInProgress = !c_start.m_starting.
isclear();
978 if((starting && startInProgress) || (startInProgress && !parallellNR)){
987 trySystemRestart(signal);
990 startWaitingNodes(signal);
996 Ndbcntr::startWaitingNodes(
Signal * signal){
999 if (!c_start.m_waitTO.
isclear())
1005 ndbout_c(
"starting (TO) %s", c_start.m_waitTO.
getText(buf));
1013 c_start.m_starting.
bitOR(c_start.m_waitTO);
1014 c_start.m_waiting.
bitANDC(c_start.m_waitTO);
1015 c_start.m_waitTO.
clear();
1022 rep->nodeId = getOwnNodeId();
1023 rep->waitPoint = CntrWaitRep::ZWAITPOINT_4_2_TO;
1024 sendSignal(rg, GSN_CNTR_WAITREP, signal, 2, JBB);
1028 const Uint32 nodeId = c_start.m_waiting.
find(0);
1029 const Uint32 Tref = calcNdbCntrBlockRef(nodeId);
1030 ndbrequire(nodeId != c_start.m_waiting.NotFound);
1032 NodeState::StartType nrType = NodeState::ST_NODE_RESTART;
1033 if(c_start.m_withoutLog.
get(nodeId))
1036 nrType = NodeState::ST_INITIAL_NODE_RESTART;
1043 conf->noStartNodes = 1;
1044 conf->startType = nrType;
1045 conf->startGci = ~0;
1046 conf->masterNodeId = getOwnNodeId();
1049 c_startedNodes.
copyto(NdbNodeBitmask::Size, conf->startedNodes);
1050 sendSignal(Tref, GSN_CNTR_START_CONF, signal,
1051 CntrStartConf::SignalLength, JBB);
1053 c_start.m_waiting.
clear(nodeId);
1054 c_start.m_withLog.
clear(nodeId);
1055 c_start.m_withoutLog.
clear(nodeId);
1056 c_start.m_starting.
set(nodeId);
1060 c_start.m_starting = c_start.m_waiting;
1061 c_start.m_waiting.
clear();
1064 conf->noStartNodes = 1;
1065 conf->startGci = ~0;
1066 conf->masterNodeId = getOwnNodeId();
1067 c_start.m_starting.
copyto(NdbNodeBitmask::Size, conf->startingNodes);
1068 c_startedNodes.
copyto(NdbNodeBitmask::Size, conf->startedNodes);
1071 if(!c_start.m_withLog.
isclear()){
1073 ndbout_c(
"Starting nodes w/ log: %s", c_start.m_withLog.
getText(buf));
1076 conf->startType = NodeState::ST_NODE_RESTART;
1078 sendSignal(rg, GSN_CNTR_START_CONF, signal,
1079 CntrStartConf::SignalLength, JBB);
1082 if(!c_start.m_withoutLog.
isclear()){
1084 ndbout_c(
"Starting nodes wo/ log: %s", c_start.m_withoutLog.
getText(buf));
1086 conf->startType = NodeState::ST_INITIAL_NODE_RESTART;
1088 sendSignal(rg, GSN_CNTR_START_CONF, signal,
1089 CntrStartConf::SignalLength, JBB);
1092 c_start.m_waiting.
clear();
1093 c_start.m_withLog.
clear();
1094 c_start.m_withoutLog.
clear();
1099 Ndbcntr::sendCntrStartRef(
Signal * signal,
1100 Uint32 nodeId, CntrStartRef::ErrorCode
code){
1102 ref->errorCode = code;
1103 ref->masterNodeId = cmasterNodeId;
1104 sendSignal(calcNdbCntrBlockRef(nodeId), GSN_CNTR_START_REF, signal,
1105 CntrStartRef::SignalLength, JBB);
1108 CheckNodeGroups::Output
1111 sd->blockRef = reference();
1112 sd->requestType = CheckNodeGroups::Direct | CheckNodeGroups::ArbitCheck;
1115 CheckNodeGroups::SignalLength);
1117 return (CheckNodeGroups::Output)sd->output;
1121 Ndbcntr::trySystemRestart(
Signal* signal){
1125 const bool allNodes = c_start.m_waiting.
equal(c_allDefinedNodes);
1126 const bool allClusterNodes = c_start.m_waiting.
equal(c_clusterNodes);
1128 if(!allClusterNodes){
1133 NodeState::StartType srType = NodeState::ST_SYSTEM_RESTART;
1134 if(c_start.m_waiting.
equal(c_start.m_withoutLog))
1137 srType = NodeState::ST_INITIAL_START;
1138 c_start.m_starting = c_start.m_withoutLog;
1139 c_start.m_withoutLog.
clear();
1142 CheckNodeGroups::Output wLog = checkNodeGroups(signal, c_start.m_withLog);
1145 case CheckNodeGroups::Win:
1148 case CheckNodeGroups::Lose:
1151 ndbrequire(!allNodes);
1153 case CheckNodeGroups::Partitioning:
1155 bool allowPartition = (c_start.m_startPartitionedTimeout != (Uint64)~0);
1170 c_start.m_starting = c_start.m_withLog;
1171 c_start.m_withLog.
clear();
1178 conf->noStartNodes = c_start.m_starting.
count();
1179 conf->startType = srType;
1180 conf->startGci = c_start.m_lastGci;
1181 conf->masterNodeId = c_start.m_lastGciNodeId;
1182 c_start.m_starting.
copyto(NdbNodeBitmask::Size, conf->startingNodes);
1183 c_startedNodes.
copyto(NdbNodeBitmask::Size, conf->startedNodes);
1185 ndbrequire(c_start.m_lastGciNodeId == getOwnNodeId());
1188 sendSignal(rg, GSN_CNTR_START_CONF, signal, CntrStartConf::SignalLength,JBB);
1190 c_start.m_waiting.
bitANDC(c_start.m_starting);
1195 void Ndbcntr::ph2GLab(
Signal* signal)
1197 if (cndbBlocksCount < ZNO_NDB_BLOCKS) {
1199 sendNdbSttor(signal);
1202 sendSttorry(signal);
1220 void Ndbcntr::startPhase3Lab(
Signal* signal)
1229 void Ndbcntr::ph3ALab(
Signal* signal)
1231 if (cndbBlocksCount < ZNO_NDB_BLOCKS) {
1233 sendNdbSttor(signal);
1237 sendSttorry(signal);
1252 void Ndbcntr::startPhase4Lab(
Signal* signal)
1258 void Ndbcntr::ph4ALab(
Signal* signal)
1267 void Ndbcntr::ph4BLab(
Signal* signal)
1272 if (cndbBlocksCount < ZNO_NDB_BLOCKS) {
1274 sendNdbSttor(signal);
1277 if ((ctypeOfStart == NodeState::ST_NODE_RESTART) ||
1278 (ctypeOfStart == NodeState::ST_INITIAL_NODE_RESTART)) {
1280 sendSttorry(signal);
1283 waitpoint41Lab(signal);
1287 void Ndbcntr::waitpoint41Lab(
Signal* signal)
1289 if (getOwnNodeId() == cmasterNodeId) {
1296 if (cnoWaitrep == cnoStartNodes) {
1310 signal->theData[0] = reference();
1311 signal->theData[1] = ctypeOfStart;
1312 sendSignal(DBDIH_REF, GSN_NDB_STARTREQ, signal, 2, JBB);
1322 signal->theData[0] = getOwnNodeId();
1323 signal->theData[1] = CntrWaitRep::ZWAITPOINT_4_1;
1324 sendSignal(calcNdbCntrBlockRef(cmasterNodeId),
1325 GSN_CNTR_WAITREP, signal, 2, JBB);
1331 Ndbcntr::waitpoint42To(
Signal* signal)
1341 cdihStartType = NodeState::ST_SYSTEM_RESTART;
1342 ctypeOfStart = NodeState::ST_NODE_RESTART;
1350 rep->nodeState.masterNodeId = cmasterNodeId;
1351 rep->nodeState.setNodeGroup(c_nodeGroup);
1352 rep->nodeState.starting.restartType = NodeState::ST_NODE_RESTART;
1354 sendSignal(DBTUX_REF, GSN_NODE_STATE_REP, signal,
1355 NodeStateRep::SignalLength, JBB);
1362 req->senderRef = reference();
1363 req->senderData = RNIL;
1364 req->flags = StartCopyReq::WAIT_LCP;
1365 req->startingNodeId = getOwnNodeId();
1366 sendSignal(DBDIH_REF, GSN_START_COPYREQ, signal,
1367 StartCopyReq::SignalLength, JBB);
1371 Ndbcntr::execSTART_COPYREF(
Signal* signal)
1377 Ndbcntr::execSTART_COPYCONF(
Signal* signal)
1379 sendSttorry(signal);
1386 void Ndbcntr::execNDB_STARTCONF(
Signal* signal)
1391 if (signal->getLength() >= 1 + NdbNodeBitmask::Size)
1394 tmp.
assign(NdbNodeBitmask::Size, signal->theData+1);
1395 if (!c_start.m_starting.
equal(tmp))
1400 char buf0[100], buf1[100];
1401 ndbout_c(
"execNDB_STARTCONF: changing from %s to %s",
1402 c_start.m_starting.
getText(buf0),
1408 c_start.m_waiting.
bitOR(waiting);
1409 c_start.m_waitTO.
bitOR(waiting);
1411 c_start.m_starting.
assign(tmp);
1412 cnoStartNodes = c_start.m_starting.
count();
1417 signal->theData[0] = getOwnNodeId();
1418 signal->theData[1] = CntrWaitRep::ZWAITPOINT_4_2;
1419 c_start.m_starting.
copyto(NdbNodeBitmask::Size, signal->theData+2);
1420 sendSignal(rg, GSN_CNTR_WAITREP, signal, 2 + NdbNodeBitmask::Size,
1435 void Ndbcntr::startPhase5Lab(
Signal* signal)
1452 void Ndbcntr::ph5ALab(
Signal* signal)
1454 if (cndbBlocksCount < ZNO_NDB_BLOCKS) {
1456 sendNdbSttor(signal);
1460 cstartPhase = cstartPhase + 1;
1461 cinternalStartphase = cstartPhase - 1;
1462 if (getOwnNodeId() == cmasterNodeId) {
1463 switch(ctypeOfStart){
1464 case NodeState::ST_INITIAL_START:
1470 beginSchemaTransLab(signal);
1472 case NodeState::ST_SYSTEM_RESTART:
1474 waitpoint52Lab(signal);
1476 case NodeState::ST_NODE_RESTART:
1477 case NodeState::ST_INITIAL_NODE_RESTART:
1480 case NodeState::ST_ILLEGAL_TYPE:
1491 switch(ctypeOfStart){
1492 case NodeState::ST_NODE_RESTART:
1493 case NodeState::ST_INITIAL_NODE_RESTART:
1499 req->senderRef = reference();
1500 req->nodeId = getOwnNodeId();
1501 req->internalStartPhase = cinternalStartphase;
1502 req->typeOfStart = cdihStartType;
1503 req->masterNodeId = cmasterNodeId;
1507 ndbout_c(
"sending NDB_STTOR(%d) to DIH", cinternalStartphase);
1509 sendSignal(DBDIH_REF, GSN_NDB_STTOR, signal,
1510 NdbSttor::SignalLength, JBB);
1512 case NodeState::ST_INITIAL_START:
1513 case NodeState::ST_SYSTEM_RESTART:
1523 signal->theData[0] = getOwnNodeId();
1524 signal->theData[1] = CntrWaitRep::ZWAITPOINT_5_2;
1525 sendSignal(calcNdbCntrBlockRef(cmasterNodeId),
1526 GSN_CNTR_WAITREP, signal, 2, JBB);
1533 void Ndbcntr::waitpoint52Lab(
Signal* signal)
1535 cnoWaitrep = cnoWaitrep + 1;
1548 if (cnoWaitrep == cnoStartNodes) {
1553 req->senderRef = reference();
1554 req->nodeId = getOwnNodeId();
1555 req->internalStartPhase = cinternalStartphase;
1556 req->typeOfStart = cdihStartType;
1557 req->masterNodeId = cmasterNodeId;
1559 ndbout_c(
"sending NDB_STTOR(%d) to DIH", cinternalStartphase);
1561 sendSignal(DBDIH_REF, GSN_NDB_STTOR, signal,
1562 NdbSttor::SignalLength, JBB);
1570 void Ndbcntr::ph6ALab(
Signal* signal)
1572 if ((ctypeOfStart == NodeState::ST_NODE_RESTART) ||
1573 (ctypeOfStart == NodeState::ST_INITIAL_NODE_RESTART)) {
1575 waitpoint51Lab(signal);
1580 rg.m_nodes.clear(getOwnNodeId());
1581 signal->theData[0] = getOwnNodeId();
1582 signal->theData[1] = CntrWaitRep::ZWAITPOINT_5_1;
1583 sendSignal(rg, GSN_CNTR_WAITREP, signal, 2, JBB);
1585 waitpoint51Lab(signal);
1589 void Ndbcntr::waitpoint51Lab(
Signal* signal)
1591 cstartPhase = cstartPhase + 1;
1597 cinternalStartphase = cstartPhase - 1;
1598 cndbBlocksCount = 0;
1603 void Ndbcntr::ph6BLab(
Signal* signal)
1607 if (cndbBlocksCount < ZNO_NDB_BLOCKS) {
1609 sendNdbSttor(signal);
1612 if ((ctypeOfStart == NodeState::ST_NODE_RESTART) ||
1613 (ctypeOfStart == NodeState::ST_INITIAL_NODE_RESTART)) {
1615 sendSttorry(signal);
1618 waitpoint61Lab(signal);
1621 void Ndbcntr::waitpoint61Lab(
Signal* signal)
1623 if (getOwnNodeId() == cmasterNodeId) {
1626 if (cnoWaitrep6 == cnoStartNodes) {
1629 rg.m_nodes.clear(getOwnNodeId());
1630 signal->theData[0] = getOwnNodeId();
1631 signal->theData[1] = CntrWaitRep::ZWAITPOINT_6_2;
1632 sendSignal(rg, GSN_CNTR_WAITREP, signal, 2, JBB);
1633 sendSttorry(signal);
1637 signal->theData[0] = getOwnNodeId();
1638 signal->theData[1] = CntrWaitRep::ZWAITPOINT_6_1;
1639 sendSignal(calcNdbCntrBlockRef(cmasterNodeId), GSN_CNTR_WAITREP, signal, 2, JBB);
1644 void Ndbcntr::startPhase8Lab(
Signal* signal)
1646 cinternalStartphase = cstartPhase - 1;
1647 cndbBlocksCount = 0;
1651 void Ndbcntr::ph7ALab(
Signal* signal)
1653 while (cndbBlocksCount < ZNO_NDB_BLOCKS) {
1655 sendNdbSttor(signal);
1658 if ((ctypeOfStart == NodeState::ST_NODE_RESTART) ||
1659 (ctypeOfStart == NodeState::ST_INITIAL_NODE_RESTART)) {
1661 sendSttorry(signal);
1664 waitpoint71Lab(signal);
1667 void Ndbcntr::waitpoint71Lab(
Signal* signal)
1669 if (getOwnNodeId() == cmasterNodeId) {
1672 if (cnoWaitrep7 == cnoStartNodes) {
1675 rg.m_nodes.clear(getOwnNodeId());
1676 signal->theData[0] = getOwnNodeId();
1677 signal->theData[1] = CntrWaitRep::ZWAITPOINT_7_2;
1678 sendSignal(rg, GSN_CNTR_WAITREP, signal, 2, JBB);
1679 sendSttorry(signal);
1683 signal->theData[0] = getOwnNodeId();
1684 signal->theData[1] = CntrWaitRep::ZWAITPOINT_7_1;
1685 sendSignal(calcNdbCntrBlockRef(cmasterNodeId), GSN_CNTR_WAITREP, signal, 2, JBB);
1690 void Ndbcntr::startPhase9Lab(
Signal* signal)
1692 cinternalStartphase = cstartPhase - 1;
1693 cndbBlocksCount = 0;
1697 void Ndbcntr::ph8ALab(
Signal* signal)
1703 sendSttorry(signal);
1704 resetStartVariables(signal);
1709 Ndbcntr::wait_sp(
Signal* signal, Uint32 sp)
1714 switch(ctypeOfStart){
1715 case NodeState::ST_SYSTEM_RESTART:
1716 case NodeState::ST_INITIAL_START:
1725 if (!ndb_wait_sp(
getNodeInfo(cmasterNodeId).m_version))
1729 rep->nodeId = getOwnNodeId();
1730 rep->waitPoint = RNIL;
1731 rep->request = CntrWaitRep::WaitFor;
1734 sendSignal(calcNdbCntrBlockRef(cmasterNodeId),
1735 GSN_CNTR_WAITREP, signal, CntrWaitRep::SignalLength, JBB);
1741 Ndbcntr::wait_sp_rep(
Signal* signal)
1744 switch(rep.request){
1745 case CntrWaitRep::WaitFor:
1747 ndbrequire(cmasterNodeId == getOwnNodeId());
1749 case CntrWaitRep::Grant:
1754 c_missra.sendNextSTTOR(signal);
1758 c_start.m_wait_sp[rep.nodeId] = rep.sp;
1763 Uint32 node = c_start.m_starting.
find(0);
1764 ndbrequire(node < NDB_ARRAY_SIZE(c_start.m_wait_sp));
1765 Uint32 min = c_start.m_wait_sp[node];
1766 for (; node != NdbNodeBitmask::NotFound;
1767 node = c_start.m_starting.
find(node + 1))
1772 if (c_start.m_wait_sp[node] < min)
1774 min = c_start.m_wait_sp[node];
1787 node = c_start.m_starting.
find(0);
1788 for (; node != NdbNodeBitmask::NotFound;
1789 node = c_start.m_starting.
find(node + 1))
1794 if (c_start.m_wait_sp[node] == min)
1796 grantnodes.
set(node);
1797 c_start.m_wait_sp[node] = 0;
1803 conf->nodeId = getOwnNodeId();
1804 conf->waitPoint = RNIL;
1805 conf->request = CntrWaitRep::Grant;
1807 sendSignal(rg, GSN_CNTR_WAITREP, signal, CntrWaitRep::SignalLength, JBB);
1813 void Ndbcntr::execCNTR_WAITREP(
Signal* signal)
1818 Uint32 twaitPoint = rep->waitPoint;
1819 switch (twaitPoint) {
1820 case CntrWaitRep::ZWAITPOINT_4_1:
1822 waitpoint41Lab(signal);
1824 case CntrWaitRep::ZWAITPOINT_4_2:
1826 c_start.m_starting.
assign(NdbNodeBitmask::Size, signal->theData + 2);
1827 sendSttorry(signal);
1829 case CntrWaitRep::ZWAITPOINT_5_1:
1831 waitpoint51Lab(signal);
1833 case CntrWaitRep::ZWAITPOINT_5_2:
1835 waitpoint52Lab(signal);
1837 case CntrWaitRep::ZWAITPOINT_6_1:
1839 waitpoint61Lab(signal);
1841 case CntrWaitRep::ZWAITPOINT_6_2:
1843 sendSttorry(signal);
1845 case CntrWaitRep::ZWAITPOINT_7_1:
1847 waitpoint71Lab(signal);
1849 case CntrWaitRep::ZWAITPOINT_7_2:
1851 sendSttorry(signal);
1853 case CntrWaitRep::ZWAITPOINT_4_2_TO:
1855 waitpoint42To(signal);
1858 ndbrequire(signal->getLength() >= CntrWaitRep::SignalLength);
1859 wait_sp_rep(signal);
1863 systemErrorLab(signal, __LINE__);
1871 void Ndbcntr::execNODE_FAILREP(
Signal* signal)
1875 if (ERROR_INSERTED(1001))
1877 sendSignalWithDelay(reference(), GSN_NODE_FAILREP, signal, 100,
1878 signal->getLength());
1884 allFailed.
assign(NdbNodeBitmask::Size, nodeFail->theNodes);
1890 failedStarted.
bitAND(allFailed);
1891 failedStarting.
bitAND(allFailed);
1892 failedWaiting.
bitAND(allFailed);
1894 const bool tMasterFailed = allFailed.get(cmasterNodeId);
1895 const bool tStarted = !failedStarted.
isclear();
1896 const bool tStarting = !failedStarting.
isclear();
1909 c_start.m_starting.
bitANDC(allFailed);
1910 c_start.m_waiting.
bitANDC(allFailed);
1911 c_start.m_withLog.
bitANDC(allFailed);
1912 c_start.m_withoutLog.
bitANDC(allFailed);
1913 c_start.m_waitTO.
bitANDC(allFailed);
1914 c_clusterNodes.
bitANDC(allFailed);
1915 c_startedNodes.
bitANDC(allFailed);
1921 const Uint32 phase = st.starting.startPhase;
1923 const bool tStartConf = (phase > 2) || (phase == 2 && cndbBlocksCount > 0);
1926 progError(__LINE__, NDBD_EXIT_SR_OTHERNODEFAILED,
1927 "Unhandled node failure during restart");
1930 if(tStartConf && tStarting){
1932 progError(__LINE__, NDBD_EXIT_SR_OTHERNODEFAILED,
1933 "Unhandled node failure of starting node during restart");
1936 if(tStartConf && tStarted){
1938 progError(__LINE__, NDBD_EXIT_SR_OTHERNODEFAILED,
1939 "Unhandled node failure of started node during restart");
1943 while(!allFailed.isclear()){
1944 nodeId = allFailed.find(nodeId + 1);
1945 allFailed.clear(nodeId);
1946 signal->theData[0] = nodeId;
1947 sendSignal(QMGR_REF, GSN_NDB_FAILCONF, signal, 1, JBB);
1953 ndbrequire(!allFailed.get(getOwnNodeId()));
1956 rep->masterNodeId = cmasterNodeId;
1958 sendSignal(DBTC_REF, GSN_NODE_FAILREP, signal,
1959 NodeFailRep::SignalLength, JBB);
1961 sendSignal(DBLQH_REF, GSN_NODE_FAILREP, signal,
1962 NodeFailRep::SignalLength, JBB);
1964 sendSignal(DBDIH_REF, GSN_NODE_FAILREP, signal,
1965 NodeFailRep::SignalLength, JBB);
1967 sendSignal(DBDICT_REF, GSN_NODE_FAILREP, signal,
1968 NodeFailRep::SignalLength, JBB);
1970 sendSignal(BACKUP_REF, GSN_NODE_FAILREP, signal,
1971 NodeFailRep::SignalLength, JBB);
1973 sendSignal(SUMA_REF, GSN_NODE_FAILREP, signal,
1974 NodeFailRep::SignalLength, JBB);
1976 sendSignal(QMGR_REF, GSN_NODE_FAILREP, signal,
1977 NodeFailRep::SignalLength, JBB);
1979 sendSignal(DBUTIL_REF, GSN_NODE_FAILREP, signal,
1980 NodeFailRep::SignalLength, JBB);
1982 sendSignal(DBTUP_REF, GSN_NODE_FAILREP, signal,
1983 NodeFailRep::SignalLength, JBB);
1985 sendSignal(TSMAN_REF, GSN_NODE_FAILREP, signal,
1986 NodeFailRep::SignalLength, JBB);
1988 sendSignal(LGMAN_REF, GSN_NODE_FAILREP, signal,
1989 NodeFailRep::SignalLength, JBB);
1991 sendSignal(DBSPJ_REF, GSN_NODE_FAILREP, signal,
1992 NodeFailRep::SignalLength, JBB);
1994 if (c_stopRec.stopReq.senderRef)
1997 switch(c_stopRec.m_state){
1998 case StopRecord::SR_WAIT_NODE_FAILURES:
2002 tmp.
assign(NdbNodeBitmask::Size, c_stopRec.stopReq.nodes);
2004 tmp.
copyto(NdbNodeBitmask::Size, c_stopRec.stopReq.nodes);
2009 if (c_stopRec.stopReq.senderRef != RNIL)
2013 stopConf->senderData = c_stopRec.stopReq.senderData;
2014 stopConf->nodeState = (Uint32) NodeState::SL_SINGLEUSER;
2015 sendSignal(c_stopRec.stopReq.senderRef, GSN_STOP_CONF, signal,
2016 StopConf::SignalLength, JBB);
2019 c_stopRec.stopReq.senderRef = 0;
2021 req->senderRef = reference();
2022 req->senderData = StopRecord::SR_UNBLOCK_GCP_START_GCP;
2023 req->requestType = WaitGCPReq::UnblockStartGcp;
2024 sendSignal(DBDIH_REF, GSN_WAIT_GCP_REQ, signal,
2025 WaitGCPReq::SignalLength, JBA);
2029 case StopRecord::SR_QMGR_STOP_REQ:
2032 tmp.
assign(NdbNodeBitmask::Size, c_stopRec.stopReq.nodes);
2037 Uint32 nodeId = allFailed.find(0);
2041 conf->senderData = c_stopRec.stopReq.senderData;
2042 conf->nodeId = nodeId;
2043 sendSignal(reference(),
2044 GSN_STOP_CONF, signal, StopConf::SignalLength, JBB);
2047 tmp.
copyto(NdbNodeBitmask::Size, c_stopRec.stopReq.nodes);
2051 case StopRecord::SR_BLOCK_GCP_START_GCP:
2052 case StopRecord::SR_WAIT_COMPLETE_GCP:
2053 case StopRecord::SR_UNBLOCK_GCP_START_GCP:
2054 case StopRecord::SR_CLUSTER_SHUTDOWN:
2060 signal->theData[2] = 0;
2063 while(!allFailed.isclear()){
2064 nodeId = allFailed.find(nodeId + 1);
2065 allFailed.clear(nodeId);
2066 signal->theData[1] = nodeId;
2067 sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 3, JBB);
2076 void Ndbcntr::execREAD_NODESREQ(
Signal* signal)
2085 BlockReference TuserBlockref = signal->theData[0];
2094 tmp1.
bitOR(c_startedNodes);
2096 tmp1.bitOR(c_start.m_starting);
2098 tmp1.set(getOwnNodeId());
2102 tmp2.
bitOR(c_allDefinedNodes);
2107 tmp2.
copyto(NdbNodeBitmask::Size, readNodes->inactiveNodes);
2108 c_allDefinedNodes.
copyto(NdbNodeBitmask::Size, readNodes->allNodes);
2109 c_clusterNodes.
copyto(NdbNodeBitmask::Size, readNodes->clusterNodes);
2110 c_startedNodes.
copyto(NdbNodeBitmask::Size, readNodes->startedNodes);
2111 c_start.m_starting.
copyto(NdbNodeBitmask::Size, readNodes->startingNodes);
2113 readNodes->noOfNodes = c_allDefinedNodes.
count();
2114 readNodes->masterNodeId = cmasterNodeId;
2115 readNodes->ndynamicId = cdynamicNodeId;
2116 if (m_cntr_start_conf)
2119 sendSignal(TuserBlockref, GSN_READ_NODESCONF, signal,
2120 ReadNodesConf::SignalLength, JBB);
2124 signal->theData[0] = ZNOT_AVAILABLE;
2125 sendSignal(TuserBlockref, GSN_READ_NODESREF, signal, 1, JBB);
2132 void Ndbcntr::systemErrorLab(
Signal* signal,
int line)
2147 void Ndbcntr::beginSchemaTransLab(
Signal* signal)
2149 c_schemaTransId = reference();
2153 req->clientRef = reference();
2154 req->transId = c_schemaTransId;
2155 req->requestInfo = 0;
2156 sendSignal(DBDICT_REF, GSN_SCHEMA_TRANS_BEGIN_REQ, signal,
2157 SchemaTransBeginReq::SignalLength, JBB);
2160 void Ndbcntr::execSCHEMA_TRANS_BEGIN_CONF(
Signal* signal)
2164 ndbrequire(conf->transId == c_schemaTransId);
2165 c_schemaTransKey = conf->transKey;
2167 createHashMap(signal, 0);
2170 void Ndbcntr::execSCHEMA_TRANS_BEGIN_REF(
Signal* signal)
2176 Ndbcntr::createHashMap(
Signal* signal, Uint32 idx)
2179 req->clientRef = reference();
2180 req->clientData = idx;
2181 req->requestInfo = 0;
2182 req->transId = c_schemaTransId;
2183 req->transKey = c_schemaTransKey;
2186 sendSignal(DBDICT_REF, GSN_CREATE_HASH_MAP_REQ, signal,
2187 CreateHashMapReq::SignalLength, JBB);
2191 Ndbcntr::execCREATE_HASH_MAP_REF(
Signal* signal)
2199 Ndbcntr::execCREATE_HASH_MAP_CONF(
Signal* signal)
2204 if (conf->senderData == 0)
2207 c_hashMapId = conf->objectId;
2208 c_hashMapVersion = conf->objectVersion;
2211 createSystableLab(signal, 0);
2214 void Ndbcntr::endSchemaTransLab(
Signal* signal)
2218 req->clientRef = reference();
2219 req->transId = c_schemaTransId;
2220 req->requestInfo = 0;
2221 req->transKey = c_schemaTransKey;
2223 sendSignal(DBDICT_REF, GSN_SCHEMA_TRANS_END_REQ, signal,
2224 SchemaTransEndReq::SignalLength, JBB);
2227 void Ndbcntr::execSCHEMA_TRANS_END_CONF(
Signal* signal)
2229 c_schemaTransId = 0;
2230 c_schemaTransKey = RNIL;
2231 startInsertTransactions(signal);
2234 void Ndbcntr::execSCHEMA_TRANS_END_REF(
Signal* signal)
2240 "Failed to commit schema trans, err: %u",
2242 progError(__LINE__, NDBD_EXIT_INVALID_CONFIG, buf);
2247 Ndbcntr::createDDObjects(
Signal * signal,
unsigned index)
2250 m_ctx.m_config.getOwnConfigIterator();
2253 Uint32 propPage[256];
2258 switch(entry->type){
2267 fg.FilegroupType = entry->type;
2271 fg.LF_UndoBufferSize = Uint32(entry->size);
2276 fg.TS_ExtentSize = Uint32(entry->size);
2277 fg.TS_LogfileGroupId = RNIL;
2278 fg.TS_LogfileGroupVersion = RNIL;
2282 s = SimpleProperties::pack(w,
2284 DictFilegroupInfo::Mapping,
2285 DictFilegroupInfo::MappingSize,
true);
2288 Uint32 length = w.getWordsUsed();
2290 ptr[0].p = &propPage[0];
2294 req->senderRef = reference();
2295 req->senderData =
index;
2296 req->objType = entry->type;
2297 req->transId = c_schemaTransId;
2298 req->transKey = c_schemaTransKey;
2299 req->requestInfo = 0;
2300 sendSignal(DBDICT_REF, GSN_CREATE_FILEGROUP_REQ, signal,
2301 CreateFilegroupReq::SignalLength, JBB, ptr, 1);
2308 Uint32 propPage[256];
2312 f.FileType = entry->type;
2313 f.FilegroupId = RNIL;
2314 f.FilegroupVersion = RNIL;
2315 f.FileSizeHi = Uint32(entry->size >> 32);
2316 f.FileSizeLo = Uint32(entry->size);
2319 s = SimpleProperties::pack(w,
2321 DictFilegroupInfo::FileMapping,
2322 DictFilegroupInfo::FileMappingSize,
true);
2324 Uint32 length = w.getWordsUsed();
2326 ptr[0].p = &propPage[0];
2330 req->senderRef = reference();
2331 req->senderData =
index;
2332 req->objType = entry->type;
2333 req->transId = c_schemaTransId;
2334 req->transKey = c_schemaTransKey;
2335 req->requestInfo = CreateFileReq::ForceCreateFile;
2336 sendSignal(DBDICT_REF, GSN_CREATE_FILE_REQ, signal,
2337 CreateFileReq::SignalLength, JBB, ptr, 1);
2344 endSchemaTransLab(signal);
2348 Ndbcntr::execCREATE_FILEGROUP_REF(
Signal* signal)
2354 const ddentry* entry = &f_dd[ref->senderData];
2366 progError(__LINE__, NDBD_EXIT_INVALID_CONFIG, buf);
2370 Ndbcntr::execCREATE_FILEGROUP_CONF(
Signal* signal)
2374 createDDObjects(signal, conf->senderData + 1);
2378 Ndbcntr::execCREATE_FILE_REF(
Signal* signal)
2384 const ddentry* entry = &f_dd[ref->senderData];
2398 progError(__LINE__, NDBD_EXIT_INVALID_CONFIG, buf);
2402 Ndbcntr::execCREATE_FILE_CONF(
Signal* signal)
2406 createDDObjects(signal, conf->senderData + 1);
2409 void Ndbcntr::createSystableLab(
Signal* signal,
unsigned index)
2411 if (index >= g_sysTableCount) {
2412 ndbassert(index == g_sysTableCount);
2413 createDDObjects(signal, 0);
2416 const SysTable&
table = *g_sysTableList[
index];
2417 Uint32 propPage[256];
2423 w.add(DictTabInfo::TableName, table.name);
2424 w.add(DictTabInfo::TableLoggedFlag, table.tableLoggedFlag);
2428 w.add(DictTabInfo::FragmentTypeVal, (Uint32)table.fragmentType);
2430 w.add(DictTabInfo::NoOfAttributes, (Uint32)table.columnCount);
2434 w.add(DictTabInfo::TableTypeVal, (Uint32)table.tableType);
2435 w.add(DictTabInfo::SingleUserMode, (Uint32)NDB_SUM_READ_WRITE);
2436 w.add(DictTabInfo::HashMapObjectId, c_hashMapId);
2437 w.add(DictTabInfo::HashMapVersion, c_hashMapVersion);
2439 for (
unsigned i = 0;
i < table.columnCount;
i++) {
2440 const SysColumn& column = table.columnList[
i];
2441 ndbassert(column.pos ==
i);
2442 w.add(DictTabInfo::AttributeName, column.name);
2443 w.add(DictTabInfo::AttributeId, (Uint32)
i);
2444 w.add(DictTabInfo::AttributeKeyFlag, (Uint32)column.keyFlag);
2445 w.add(DictTabInfo::AttributeStorageType,
2446 (Uint32)NDB_STORAGETYPE_MEMORY);
2447 switch(column.type){
2448 case DictTabInfo::ExtVarbinary:
2450 w.add(DictTabInfo::AttributeArrayType,
2451 (Uint32)NDB_ARRAYTYPE_SHORT_VAR);
2453 case DictTabInfo::ExtLongvarbinary:
2455 w.add(DictTabInfo::AttributeArrayType,
2456 (Uint32)NDB_ARRAYTYPE_MEDIUM_VAR);
2460 w.add(DictTabInfo::AttributeArrayType,
2461 (Uint32)NDB_ARRAYTYPE_FIXED);
2464 w.add(DictTabInfo::AttributeNullableFlag, (Uint32)column.nullable);
2465 w.add(DictTabInfo::AttributeExtType, (Uint32)column.type);
2466 w.add(DictTabInfo::AttributeExtLength, (Uint32)column.length);
2467 w.add(DictTabInfo::AttributeEnd, (Uint32)
true);
2469 w.add(DictTabInfo::TableEnd, (Uint32)
true);
2471 Uint32 length = w.getWordsUsed();
2473 ptr[0].p = &propPage[0];
2477 req->clientRef = reference();
2478 req->clientData =
index;
2479 req->requestInfo = 0;
2480 req->transId = c_schemaTransId;
2481 req->transKey = c_schemaTransKey;
2482 sendSignal(DBDICT_REF, GSN_CREATE_TABLE_REQ, signal,
2483 CreateTableReq::SignalLength, JBB, ptr, 1);
2487 void Ndbcntr::execCREATE_TABLE_REF(
Signal* signal)
2490 progError(__LINE__,NDBD_EXIT_NDBREQUIRE,
"CREATE_TABLE_REF");
2494 void Ndbcntr::execCREATE_TABLE_CONF(
Signal* signal)
2499 ndbrequire(conf->transId == c_schemaTransId);
2500 ndbrequire(conf->senderData < g_sysTableCount);
2501 const SysTable& table = *g_sysTableList[conf->senderData];
2502 table.tableId = conf->tableId;
2503 table.tableVersion = conf->tableVersion;
2504 createSystableLab(signal, conf->senderData + 1);
2512 void Ndbcntr::startInsertTransactions(
Signal* signal)
2517 ctransidPhase = ZTRUE;
2518 signal->theData[0] = 0;
2519 signal->theData[1] = reference();
2520 sendSignal(DBTC_REF, GSN_TCSEIZEREQ, signal, 2, JBB);
2527 void Ndbcntr::execTCSEIZECONF(
Signal* signal)
2530 ctcConnectionP = signal->theData[1];
2531 ctcReference = signal->theData[2];
2532 crSystab7Lab(signal);
2536 const unsigned int RowsPerCommit = 16;
2537 void Ndbcntr::crSystab7Lab(
Signal* signal)
2544 UintR reqInfo_Start = 0;
2545 tcKeyReq->setOperationType(reqInfo_Start, ZINSERT);
2546 tcKeyReq->setKeyLength (reqInfo_Start, 1);
2547 tcKeyReq->setAIInTcKeyReq (reqInfo_Start, 5);
2548 tcKeyReq->setAbortOption (reqInfo_Start, TcKeyReq::AbortOnError);
2552 const UintR guard0 = ckey + (RowsPerCommit - 1);
2553 for (Tmp = ckey; Tmp <= guard0; Tmp++) {
2554 UintR reqInfo = reqInfo_Start;
2557 tcKeyReq->setStartFlag(reqInfo, 1);
2559 if (Tmp == guard0) {
2561 tcKeyReq->setCommitFlag(reqInfo, 1);
2562 tcKeyReq->setExecuteFlag(reqInfo, 1);
2564 if (ctransidPhase == ZTRUE) {
2573 tcKeyReq->apiConnectPtr = ctcConnectionP;
2574 tcKeyReq->attrLen = 5;
2575 tcKeyReq->tableId = g_sysTable_SYSTAB_0.tableId;
2576 tcKeyReq->requestInfo = reqInfo;
2577 tcKeyReq->tableSchemaVersion = g_sysTable_SYSTAB_0.tableVersion;
2578 tcKeyReq->transId1 = 0;
2579 tcKeyReq->transId2 = ckey;
2585 Uint32* tKeyDataPtr = &tcKeyReq->scanInfo;
2586 Uint32* tAIDataPtr = &tKeyDataPtr[1];
2588 tKeyDataPtr[0] = tkey;
2591 tAIDataPtr[1] = tkey;
2593 tAIDataPtr[3] = (tkey << 16);
2595 sendSignal(ctcReference, GSN_TCKEYREQ, signal,
2596 TcKeyReq::StaticLength + 6, JBB);
2598 ckey = ckey + RowsPerCommit;
2605 void Ndbcntr::execTCKEYCONF(
Signal* signal)
2610 cgciSystab = keyConf->gci_hi;
2611 UintR confInfo = keyConf->confInfo;
2613 if (TcKeyConf::getMarkerFlag(confInfo)){
2614 Uint32 transId1 = keyConf->transId1;
2615 Uint32 transId2 = keyConf->transId2;
2616 signal->theData[0] = transId1;
2617 signal->theData[1] = transId2;
2618 sendSignal(ctcReference, GSN_TC_COMMIT_ACK, signal, 2, JBB);
2621 cresponses = cresponses + TcKeyConf::getNoOfOperations(confInfo);
2622 if (TcKeyConf::getCommitFlag(confInfo)){
2624 ndbrequire(cresponses == RowsPerCommit);
2626 crSystab8Lab(signal);
2632 void Ndbcntr::crSystab8Lab(
Signal* signal)
2634 if (ckey < ZSIZE_SYSTAB) {
2636 crSystab7Lab(signal);
2638 }
else if (ctransidPhase == ZTRUE) {
2641 ctransidPhase = ZFALSE;
2644 signal->theData[0] = ctcConnectionP;
2645 signal->theData[1] = reference();
2646 signal->theData[2] = 0;
2647 sendSignal(ctcReference, GSN_TCRELEASEREQ, signal, 2, JBB);
2654 void Ndbcntr::execTCRELEASECONF(
Signal* signal)
2657 waitpoint52Lab(signal);
2661 void Ndbcntr::crSystab9Lab(
Signal* signal)
2663 signal->theData[0] = 0;
2664 signal->theData[1] = reference();
2665 signal->theData[2] = 0;
2666 sendSignalWithDelay(DBDIH_REF, GSN_GETGCIREQ, signal, 100, 3);
2673 void Ndbcntr::execGETGCICONF(
Signal* signal)
2678 if (signal->theData[1] < cgciSystab) {
2684 crSystab9Lab(signal);
2688 waitpoint52Lab(signal);
2692 void Ndbcntr::execTCKEYREF(
Signal* signal)
2695 systemErrorLab(signal, __LINE__);
2699 void Ndbcntr::execTCROLLBACKREP(
Signal* signal)
2702 systemErrorLab(signal, __LINE__);
2706 void Ndbcntr::execTCRELEASEREF(
Signal* signal)
2709 systemErrorLab(signal, __LINE__);
2713 void Ndbcntr::execTCSEIZEREF(
Signal* signal)
2716 systemErrorLab(signal, __LINE__);
2724 void Ndbcntr::initData(
Signal* signal)
2736 void Ndbcntr::resetStartVariables(
Signal* signal)
2739 cnoWaitrep6 = cnoWaitrep7 = 0;
2747 void Ndbcntr::sendNdbSttor(
Signal* signal)
2749 NdbBlocksRecPtr ndbBlocksPtr;
2751 ndbBlocksPtr.i = cndbBlocksCount;
2752 ptrCheckGuard(ndbBlocksPtr, ZSIZE_NDB_BLOCKS_REC, ndbBlocksRec);
2755 req->senderRef = reference();
2756 req->nodeId = getOwnNodeId();
2757 req->internalStartPhase = cinternalStartphase;
2758 req->typeOfStart = ctypeOfStart;
2759 req->masterNodeId = cmasterNodeId;
2761 for (
int i = 0; i < 16; i++) {
2763 req->config[
i] = 0x88776655;
2769 ndbout_c(
"sending NDB_STTOR(%d) to %s",
2770 cinternalStartphase,
2771 getBlockName( refToBlock(ndbBlocksPtr.p->blockref)));
2773 if (refToBlock(ndbBlocksPtr.p->blockref) == DBDIH)
2774 req->typeOfStart = cdihStartType;
2775 sendSignal(ndbBlocksPtr.p->blockref, GSN_NDB_STTOR, signal, 22, JBB);
2782 void Ndbcntr::sendSttorry(
Signal* signal)
2784 signal->theData[3] = ZSTART_PHASE_1;
2785 signal->theData[4] = ZSTART_PHASE_2;
2786 signal->theData[5] = ZSTART_PHASE_3;
2787 signal->theData[6] = ZSTART_PHASE_4;
2788 signal->theData[7] = ZSTART_PHASE_5;
2789 signal->theData[8] = ZSTART_PHASE_6;
2791 signal->theData[9] = ZSTART_PHASE_8;
2792 signal->theData[10] = ZSTART_PHASE_9;
2793 signal->theData[11] = ZSTART_PHASE_END;
2794 sendSignal(NDBCNTR_REF, GSN_STTORRY, signal, 12, JBB);
2798 Ndbcntr::execDUMP_STATE_ORD(
Signal* signal)
2801 Uint32 arg = dumpState->args[0];
2804 infoEvent(
"Cntr: cstartPhase = %d, cinternalStartphase = %d, block = %d",
2805 cstartPhase, cinternalStartphase, cndbBlocksCount);
2806 infoEvent(
"Cntr: cmasterNodeId = %d", cmasterNodeId);
2809 if (arg == DumpStateOrd::NdbcntrTestStopOnError){
2810 if (m_ctx.m_config.stopOnError() ==
true)
2813 const BlockReference tblockref = calcNdbCntrBlockRef(getOwnNodeId());
2816 sysErr->errorCode = SystemError::TestStopOnError;
2817 sysErr->errorRef = reference();
2818 sendSignal(tblockref, GSN_SYSTEM_ERROR, signal,
2819 SystemError::SignalLength, JBA);
2822 if (arg == DumpStateOrd::NdbcntrStopNodes)
2825 for(Uint32 i = 1; i<signal->getLength(); i++)
2826 mask.
set(signal->theData[i]);
2829 req->senderRef = RNIL;
2830 req->senderData = 123;
2831 req->requestInfo = 0;
2832 req->singleuser = 0;
2833 req->singleUserApi = 0;
2834 mask.
copyto(NdbNodeBitmask::Size, req->nodes);
2835 StopReq::setPerformRestart(req->requestInfo, 1);
2836 StopReq::setNoStart(req->requestInfo, 1);
2837 StopReq::setStopNodes(req->requestInfo, 1);
2840 sendSignal(reference(), GSN_STOP_REQ, signal,
2841 StopReq::SignalLength, JBB);
2848 if (signal->getLength() == 2)
2850 c_error_insert_extra = signal->theData[1];
2851 SET_ERROR_INSERT_VALUE(1002);
2853 else if (ERROR_INSERTED(1002))
2855 CLEAR_ERROR_INSERT_VALUE;
2862 void Ndbcntr::updateNodeState(
Signal* signal,
const NodeState& newState)
const{
2867 CRASH_INSERTION(1000);
2870 stateRep->nodeState = newState;
2871 stateRep->nodeState.masterNodeId = cmasterNodeId;
2872 stateRep->nodeState.setNodeGroup(c_nodeGroup);
2874 for(Uint32 i = 0; i<ALL_BLOCKS_SZ; i++){
2875 sendSignal(ALL_BLOCKS[i].Ref, GSN_NODE_STATE_REP, signal,
2876 NodeStateRep::SignalLength, JBB);
2881 Ndbcntr::execRESUME_REQ(
Signal* signal){
2887 signal->theData[0] = NDB_LE_SingleUser;
2888 signal->theData[1] = 2;
2889 sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 2, JBB);
2894 updateNodeState(signal, newState);
2895 c_stopRec.stopReq.senderRef=0;
2899 Ndbcntr::execSTOP_REQ(
Signal* signal){
2902 Uint32 singleuser = req->singleuser;
2904 Uint32 senderData = req->senderData;
2905 BlockReference senderRef = req->senderRef;
2906 bool abort = StopReq::getStopAbort(req->requestInfo);
2907 bool stopnodes = StopReq::getStopNodes(req->requestInfo);
2911 (abort && !stopnodes)))
2919 const Uint32 reqInfo = req->requestInfo;
2920 if(StopReq::getPerformRestart(reqInfo)){
2924 sendSignal(CMVMI_REF, GSN_START_ORD, signal, 1, JBA);
2927 sendSignal(CMVMI_REF, GSN_STOP_ORD, signal, 1, JBA);
2932 if(c_stopRec.stopReq.senderRef != 0 ||
2933 (cmasterNodeId == getOwnNodeId() && !c_start.m_starting.
isclear()))
2938 if(!singleuser && StopReq::getSystemStop(req->requestInfo)){
2940 sendSignalWithDelay(reference(), GSN_STOP_REQ, signal, 100,
2941 StopReq::SignalLength);
2948 if(c_stopRec.stopReq.senderRef &&
2949 StopReq::getSystemStop(c_stopRec.stopReq.requestInfo))
2950 ref->errorCode = StopRef::SystemShutdownInProgress;
2952 ref->errorCode = StopRef::NodeShutdownInProgress;
2953 ref->senderData = senderData;
2954 ref->masterNodeId = cmasterNodeId;
2956 if (senderRef != RNIL)
2957 sendSignal(senderRef, GSN_STOP_REF, signal, StopRef::SignalLength, JBB);
2961 if (stopnodes && !abort)
2964 ref->errorCode = StopRef::UnsupportedNodeShutdown;
2965 ref->senderData = senderData;
2966 ref->masterNodeId = cmasterNodeId;
2967 if (senderRef != RNIL)
2968 sendSignal(senderRef, GSN_STOP_REF, signal, StopRef::SignalLength, JBB);
2972 if (stopnodes && cmasterNodeId != getOwnNodeId())
2975 ref->errorCode = StopRef::MultiNodeShutdownNotMaster;
2976 ref->senderData = senderData;
2977 ref->masterNodeId = cmasterNodeId;
2978 if (senderRef != RNIL)
2979 sendSignal(senderRef, GSN_STOP_REF, signal, StopRef::SignalLength, JBB);
2983 c_stopRec.stopReq = * req;
2984 c_stopRec.stopInitiatedTime = NdbTick_CurrentMillisecond();
2998 mask.
assign(NdbNodeBitmask::Size, c_stopRec.stopReq.nodes);
3000 ndbout_c(
"Initiating shutdown abort of %s", mask.
getText(buf));
3003 req->senderRef = reference();
3004 req->senderData = StopRecord::SR_BLOCK_GCP_START_GCP;
3005 req->requestType = WaitGCPReq::BlockStartGcp;
3006 sendSignal(DBDIH_REF, GSN_WAIT_GCP_REQ, signal,
3007 WaitGCPReq::SignalLength, JBB);
3010 else if(!singleuser)
3012 if(StopReq::getSystemStop(c_stopRec.stopReq.requestInfo))
3015 if(StopReq::getPerformRestart(c_stopRec.stopReq.requestInfo))
3026 signal->theData[1] = StopReq::getSystemStop(c_stopRec.stopReq.requestInfo) ? 1 : 0;
3027 sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 2, JBB);
3031 signal->theData[0] = NDB_LE_SingleUser;
3032 signal->theData[1] = 0;
3033 sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 2, JBB);
3037 StopReq::getSystemStop(c_stopRec.stopReq.requestInfo));
3040 newState.setSingleUser(
true);
3041 newState.setSingleUserApi(c_stopRec.stopReq.singleUserApi);
3043 updateNodeState(signal, newState);
3044 signal->theData[0] = ZSHUTDOWN;
3045 sendSignalWithDelay(reference(), GSN_CONTINUEB, signal, 100, 1);
3049 Ndbcntr::StopRecord::checkTimeout(
Signal* signal){
3052 if(!cntr.getNodeState().getSingleUserMode())
3053 if(!checkNodeFail(signal)){
3058 switch(cntr.getNodeState().startLevel){
3060 checkApiTimeout(signal);
3063 checkTcTimeout(signal);
3066 checkLqhTimeout_1(signal);
3069 checkLqhTimeout_2(signal);
3071 case NodeState::SL_SINGLEUSER:
3081 if(StopReq::getSystemStop(stopReq.requestInfo)){
3090 ndbMask.
assign(cntr.c_startedNodes);
3092 if (StopReq::getStopNodes(stopReq.requestInfo))
3095 tmp.
assign(NdbNodeBitmask::Size, stopReq.nodes);
3098 ndbStopNodes.
assign(NdbNodeBitmask::Size, stopReq.nodes);
3099 ndbStopNodes.
bitAND(ndbMask);
3100 ndbStopNodes.
copyto(NdbNodeBitmask::Size, stopReq.nodes);
3104 bool allNodesStopped =
true;
3106 for( i = 0; i < (int) NdbNodeBitmask::Size; i++ ){
3107 if ( stopReq.nodes[i] != 0 ){
3108 allNodesStopped =
false;
3113 if ( allNodesStopped ) {
3115 stopConf->senderData = stopReq.senderData;
3117 cntr.sendSignal(stopReq.senderRef, GSN_STOP_CONF, signal,
3118 StopConf::SignalLength, JBB);
3119 stopReq.senderRef = 0;
3126 ndbMask.
clear(cntr.getOwnNodeId());
3130 sd->blockRef = cntr.reference();
3131 sd->requestType = CheckNodeGroups::Direct | CheckNodeGroups::ArbitCheck;
3133 cntr.EXECUTE_DIRECT(DBDIH, GSN_CHECKNODEGROUPSREQ, signal,
3134 CheckNodeGroups::SignalLength);
3136 switch (sd->output) {
3137 case CheckNodeGroups::Win:
3138 case CheckNodeGroups::Partitioning:
3145 ref->senderData = stopReq.senderData;
3146 ref->errorCode = StopRef::NodeShutdownWouldCauseSystemCrash;
3147 ref->masterNodeId = cntr.cmasterNodeId;
3149 const BlockReference bref = stopReq.senderRef;
3151 cntr.sendSignal(bref, GSN_STOP_REF, signal, StopRef::SignalLength, JBB);
3153 stopReq.senderRef = 0;
3155 if (cntr.getNodeState().startLevel != NodeState::SL_SINGLEUSER)
3158 cntr.updateNodeState(signal, newState);
3162 cntr.sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 1, JBB);
3168 Ndbcntr::StopRecord::checkApiTimeout(
Signal* signal){
3169 const Int32 timeout = stopReq.apiTimeout;
3170 const NDB_TICKS alarm = stopInitiatedTime + (NDB_TICKS)timeout;
3171 const NDB_TICKS now = NdbTick_CurrentMillisecond();
3172 if((timeout >= 0 && now >= alarm)){
3176 StopReq::getSystemStop(stopReq.requestInfo));
3177 if(stopReq.singleuser) {
3178 newState.setSingleUser(
true);
3179 newState.setSingleUserApi(stopReq.singleUserApi);
3181 cntr.updateNodeState(signal, newState);
3183 stopInitiatedTime = now;
3186 signal->theData[0] = ZSHUTDOWN;
3187 cntr.sendSignalWithDelay(cntr.reference(), GSN_CONTINUEB, signal, 100, 1);
3191 Ndbcntr::StopRecord::checkTcTimeout(
Signal* signal){
3192 const Int32 timeout = stopReq.transactionTimeout;
3193 const NDB_TICKS alarm = stopInitiatedTime + (NDB_TICKS)timeout;
3194 const NDB_TICKS now = NdbTick_CurrentMillisecond();
3195 if((timeout >= 0 && now >= alarm)){
3198 if(stopReq.getSystemStop(stopReq.requestInfo) || stopReq.singleuser){
3200 if(stopReq.singleuser)
3204 req->senderRef = cntr.reference();
3205 req->senderData = 12;
3206 cntr.sendSignal(DBTC_REF, GSN_ABORT_ALL_REQ, signal,
3207 AbortAllReq::SignalLength, JBB);
3212 req->senderRef = cntr.reference();
3213 req->senderData = StopRecord::SR_CLUSTER_SHUTDOWN;
3215 cntr.sendSignal(DBDIH_REF, GSN_WAIT_GCP_REQ, signal,
3216 WaitGCPReq::SignalLength, JBB);
3221 req->senderRef = cntr.reference();
3222 req->senderData = 12;
3223 cntr.sendSignal(DBDIH_REF, GSN_STOP_PERM_REQ, signal,
3224 StopPermReq::SignalLength, JBB);
3228 signal->theData[0] = ZSHUTDOWN;
3229 cntr.sendSignalWithDelay(cntr.reference(), GSN_CONTINUEB, signal, 100, 1);
3232 void Ndbcntr::execSTOP_PERM_REF(
Signal* signal){
3237 signal->theData[0] = ZSHUTDOWN;
3238 sendSignalWithDelay(reference(), GSN_CONTINUEB, signal, 100, 1);
3241 void Ndbcntr::execSTOP_PERM_CONF(
Signal* signal){
3245 req->senderRef = reference();
3246 req->senderData = 12;
3247 sendSignal(DBTC_REF, GSN_ABORT_ALL_REQ, signal,
3248 AbortAllReq::SignalLength, JBB);
3251 void Ndbcntr::execABORT_ALL_CONF(
Signal* signal){
3253 if(c_stopRec.stopReq.singleuser) {
3256 NodeState newState(NodeState::SL_SINGLEUSER);
3257 newState.setSingleUser(
true);
3258 newState.setSingleUserApi(c_stopRec.stopReq.singleUserApi);
3259 updateNodeState(signal, newState);
3260 c_stopRec.stopInitiatedTime = NdbTick_CurrentMillisecond();
3263 stopConf->senderData = c_stopRec.stopReq.senderData;
3264 stopConf->nodeState = (Uint32) NodeState::SL_SINGLEUSER;
3265 sendSignal(c_stopRec.stopReq.senderRef, GSN_STOP_CONF, signal, StopConf::SignalLength, JBB);
3267 c_stopRec.stopReq.senderRef = 0;
3269 signal->theData[0] = NDB_LE_SingleUser;
3270 signal->theData[1] = 1;
3271 signal->theData[2] = c_stopRec.stopReq.singleUserApi;
3272 sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 3, JBB);
3278 StopReq::getSystemStop(c_stopRec.stopReq.requestInfo));
3279 updateNodeState(signal, newState);
3281 c_stopRec.stopInitiatedTime = NdbTick_CurrentMillisecond();
3283 signal->theData[0] = ZSHUTDOWN;
3284 sendSignalWithDelay(reference(), GSN_CONTINUEB, signal, 100, 1);
3288 void Ndbcntr::execABORT_ALL_REF(
Signal* signal){
3292 stopRef->senderData = c_stopRec.stopReq.senderData;
3293 stopRef->errorCode = StopRef::TransactionAbortFailed;
3294 stopRef->masterNodeId = cmasterNodeId;
3295 sendSignal(c_stopRec.stopReq.senderRef, GSN_STOP_REF, signal, StopRef::SignalLength, JBB);
3299 Ndbcntr::StopRecord::checkLqhTimeout_1(
Signal* signal){
3300 const Int32 timeout = stopReq.readOperationTimeout;
3301 const NDB_TICKS alarm = stopInitiatedTime + (NDB_TICKS)timeout;
3302 const NDB_TICKS now = NdbTick_CurrentMillisecond();
3304 if((timeout >= 0 && now >= alarm)){
3311 StopReq::getSystemStop(stopReq.requestInfo));
3312 req->nodeState = newState;
3313 req->senderRef = cntr.reference();
3314 req->senderData = 12;
3315 cntr.sendSignal(DBLQH_REF, GSN_CHANGE_NODE_STATE_REQ, signal,
3316 ChangeNodeStateReq::SignalLength, JBB);
3319 signal->theData[0] = ZSHUTDOWN;
3320 cntr.sendSignalWithDelay(cntr.reference(), GSN_CONTINUEB, signal, 100, 1);
3324 Ndbcntr::execCHANGE_NODE_STATE_CONF(
Signal* signal)
3331 signal->theData[0] = reference();
3332 signal->theData[1] = 12;
3333 sendSignal(SUMA_REF, GSN_STOP_ME_REQ, signal, 2, JBB);
3336 void Ndbcntr::execSTOP_ME_REF(
Signal* signal){
3342 void Ndbcntr::execSTOP_ME_CONF(
Signal* signal){
3346 if (conf->senderData == 12)
3351 signal->theData[0] = reference();
3352 signal->theData[1] = 13;
3353 sendSignal(DBDIH_REF, GSN_STOP_ME_REQ, signal, 2, JBB);
3358 StopReq::getSystemStop(c_stopRec.stopReq.requestInfo));
3359 updateNodeState(signal, newState);
3361 c_stopRec.stopInitiatedTime = NdbTick_CurrentMillisecond();
3362 signal->theData[0] = ZSHUTDOWN;
3363 sendSignalWithDelay(reference(), GSN_CONTINUEB, signal, 100, 1);
3367 Ndbcntr::StopRecord::checkLqhTimeout_2(
Signal* signal){
3368 const Int32 timeout = stopReq.operationTimeout;
3369 const NDB_TICKS alarm = stopInitiatedTime + (NDB_TICKS)timeout;
3370 const NDB_TICKS now = NdbTick_CurrentMillisecond();
3372 if((timeout >= 0 && now >= alarm)){
3375 if(StopReq::getPerformRestart(stopReq.requestInfo)){
3379 cntr.sendSignal(CMVMI_REF, GSN_START_ORD, signal, 2, JBA);
3382 cntr.sendSignal(CMVMI_REF, GSN_STOP_ORD, signal, 1, JBA);
3386 signal->theData[0] = ZSHUTDOWN;
3387 cntr.sendSignalWithDelay(cntr.reference(), GSN_CONTINUEB, signal, 100, 1);
3390 void Ndbcntr::execWAIT_GCP_REF(
Signal* signal){
3396 req->senderRef = reference();
3397 req->senderData = StopRecord::SR_CLUSTER_SHUTDOWN;
3399 sendSignal(DBDIH_REF, GSN_WAIT_GCP_REQ, signal,
3400 WaitGCPReq::SignalLength, JBB);
3403 void Ndbcntr::execWAIT_GCP_CONF(
Signal* signal){
3408 switch(conf->senderData){
3409 case StopRecord::SR_BLOCK_GCP_START_GCP:
3422 req->senderRef = reference();
3423 req->senderData = StopRecord::SR_WAIT_COMPLETE_GCP;
3426 sendSignal(DBDIH_REF, GSN_WAIT_GCP_REQ, signal,
3427 WaitGCPReq::SignalLength, JBB);
3430 case StopRecord::SR_UNBLOCK_GCP_START_GCP:
3435 case StopRecord::SR_WAIT_COMPLETE_GCP:
3445 tmp.
assign(NdbNodeBitmask::Size, c_stopRec.stopReq.nodes);
3446 c_stopRec.m_stop_req_counter = tmp;
3449 * stopReq = c_stopRec.stopReq;
3450 stopReq->senderRef = reference();
3451 sendSignal(rg, GSN_STOP_REQ, signal, StopReq::SignalLength, JBA);
3452 c_stopRec.m_state = StopRecord::SR_QMGR_STOP_REQ;
3455 case StopRecord::SR_CLUSTER_SHUTDOWN:
3463 ndbrequire(StopReq::getSystemStop(c_stopRec.stopReq.requestInfo));
3470 rep->nodeState = newState;
3471 rep->nodeState.masterNodeId = cmasterNodeId;
3472 rep->nodeState.setNodeGroup(c_nodeGroup);
3474 NodeStateRep::SignalLength);
3476 if(StopReq::getPerformRestart(c_stopRec.stopReq.requestInfo)){
3479 startOrd->
restartInfo = c_stopRec.stopReq.requestInfo;
3480 sendSignalWithDelay(CMVMI_REF, GSN_START_ORD, signal, 500,
3481 StartOrd::SignalLength);
3484 sendSignalWithDelay(CMVMI_REF, GSN_STOP_ORD, signal, 500, 1);
3491 req->senderRef = reference();
3492 req->senderData = StopRecord::SR_UNBLOCK_GCP_START_GCP;
3493 req->requestType = WaitGCPReq::UnblockStartGcp;
3494 sendSignal(DBDIH_REF, GSN_WAIT_GCP_REQ, signal,
3495 WaitGCPReq::SignalLength, JBB);
3499 Ndbcntr::execSTOP_CONF(
Signal* signal)
3503 ndbrequire(c_stopRec.m_state == StopRecord::SR_QMGR_STOP_REQ);
3504 c_stopRec.m_stop_req_counter.clearWaitingFor(conf->nodeId);
3505 if (c_stopRec.m_stop_req_counter.done())
3509 mask.
assign(NdbNodeBitmask::Size, c_stopRec.stopReq.nodes);
3511 ndbout_c(
"Stopping of %s", mask.
getText(buf));
3517 failRep->failCause = FailRep::ZMULTI_NODE_SHUTDOWN;
3518 failRep->failSourceNodeId = getOwnNodeId();
3522 != NdbNodeBitmask::NotFound)
3524 failRep->failNodeId = nodeId;
3525 sendSignal(rg, GSN_FAIL_REP, signal, FailRep::SignalLength, JBA);
3527 c_stopRec.m_state = StopRecord::SR_WAIT_NODE_FAILURES;
3532 void Ndbcntr::execSTTORRY(
Signal* signal){
3534 c_missra.execSTTORRY(signal);
3537 void Ndbcntr::execREAD_CONFIG_CONF(
Signal* signal){
3539 c_missra.execREAD_CONFIG_CONF(signal);
3542 void Ndbcntr::execSTART_ORD(
Signal* signal){
3544 c_missra.execSTART_ORD(signal);
3553 Ndbcntr::clearFilesystem(
Signal* signal)
3557 req->userReference = reference();
3558 req->userPointer = 0;
3560 req->ownDirectory = 1;
3562 const Uint32 DX = CLEAR_DX;
3563 const Uint32 LCP = CLEAR_DX + CLEAR_LCP;
3564 const Uint32 DD = CLEAR_DX + CLEAR_LCP + CLEAR_DD;
3566 if (c_fsRemoveCount < DX)
3568 FsOpenReq::setVersion(req->fileNumber, 3);
3569 FsOpenReq::setSuffix(req->fileNumber, FsOpenReq::S_CTL);
3570 FsOpenReq::v1_setDisk(req->fileNumber, c_fsRemoveCount);
3572 else if (c_fsRemoveCount < LCP)
3574 FsOpenReq::setVersion(req->fileNumber, 5);
3575 FsOpenReq::setSuffix(req->fileNumber, FsOpenReq::S_DATA);
3576 FsOpenReq::v5_setLcpNo(req->fileNumber, c_fsRemoveCount - CLEAR_DX);
3577 FsOpenReq::v5_setTableId(req->fileNumber, 0);
3578 FsOpenReq::v5_setFragmentId(req->fileNumber, 0);
3580 else if (c_fsRemoveCount < DD)
3582 req->ownDirectory = 0;
3583 FsOpenReq::setVersion(req->fileNumber, 6);
3584 FsOpenReq::setSuffix(req->fileNumber, FsOpenReq::S_DATA);
3585 FsOpenReq::v5_setLcpNo(req->fileNumber,
3586 FsOpenReq::BP_DD_DF + c_fsRemoveCount - LCP);
3593 sendSignal(NDBFS_REF, GSN_FSREMOVEREQ, signal,
3594 FsRemoveReq::SignalLength, JBA);
3599 Ndbcntr::execFSREMOVECONF(
Signal* signal){
3601 if(c_fsRemoveCount == CLEAR_DX + CLEAR_LCP + CLEAR_DD){
3603 sendSttorry(signal);
3606 ndbrequire(c_fsRemoveCount < CLEAR_DX + CLEAR_LCP + CLEAR_DD);
3607 clearFilesystem(signal);
3611 void Ndbcntr::Missra::execSTART_ORD(
Signal* signal){
3613 signal->theData[1] = NDB_VERSION;
3614 signal->theData[2] = NDB_MYSQL_VERSION_D;
3615 cntr.sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 3, JBB);
3617 currentBlockIndex = 0;
3618 sendNextREAD_CONFIG_REQ(signal);
3621 void Ndbcntr::Missra::sendNextREAD_CONFIG_REQ(
Signal* signal){
3623 if(currentBlockIndex < ALL_BLOCKS_SZ){
3627 req->senderData = 0;
3628 req->senderRef = cntr.reference();
3629 req->noOfParameters = 0;
3631 const BlockReference ref = readConfigOrder[currentBlockIndex];
3634 ndbout_c(
"sending READ_CONFIG_REQ to %s(ref=%x index=%d)",
3635 getBlockName( refToBlock(ref)),
3643 cntr.sendSignalWithDelay(ref, GSN_READ_CONFIG_REQ, signal,
3644 1, ReadConfigReq::SignalLength);
3651 currentStartPhase = 0;
3652 for(Uint32 i = 0; i<ALL_BLOCKS_SZ; i++){
3653 if(ALL_BLOCKS[i].NextSP < currentStartPhase)
3654 currentStartPhase = ALL_BLOCKS[
i].NextSP;
3657 currentBlockIndex = 0;
3658 sendNextSTTOR(signal);
3661 void Ndbcntr::Missra::execREAD_CONFIG_CONF(
Signal* signal){
3664 const Uint32 ref = conf->senderRef;
3665 ndbrequire(refToBlock(readConfigOrder[currentBlockIndex])
3666 == refToBlock(ref));
3668 currentBlockIndex++;
3669 sendNextREAD_CONFIG_REQ(signal);
3672 void Ndbcntr::Missra::execSTTORRY(
Signal* signal){
3673 const BlockReference ref = signal->senderBlockRef();
3674 ndbrequire(refToBlock(ref) == refToBlock(ALL_BLOCKS[currentBlockIndex].Ref));
3679 for (Uint32 i = 3; i < 25; i++){
3681 if (signal->theData[i] > currentStartPhase){
3683 ALL_BLOCKS[currentBlockIndex].NextSP = signal->theData[
i];
3688 currentBlockIndex++;
3689 sendNextSTTOR(signal);
3692 void Ndbcntr::Missra::sendNextSTTOR(
Signal* signal){
3694 for(; currentStartPhase < 255 ;
3695 currentStartPhase++, g_currentStartPhase = currentStartPhase){
3699 if (cntr.cerrorInsert == 1002 &&
3700 cntr.c_error_insert_extra == currentStartPhase)
3702 signal->theData[0] = ZBLOCK_STTOR;
3703 cntr.sendSignalWithDelay(cntr.reference(), GSN_CONTINUEB, signal, 100, 1);
3708 const Uint32 start = currentBlockIndex;
3709 for(; currentBlockIndex < ALL_BLOCKS_SZ; currentBlockIndex++){
3711 if(ALL_BLOCKS[currentBlockIndex].NextSP == currentStartPhase){
3713 signal->theData[0] = 0;
3714 signal->theData[1] = currentStartPhase;
3715 signal->theData[2] = 0;
3716 signal->theData[3] = 0;
3717 signal->theData[4] = 0;
3718 signal->theData[5] = 0;
3719 signal->theData[6] = 0;
3720 signal->theData[7] = cntr.ctypeOfStart;
3722 const BlockReference ref = ALL_BLOCKS[currentBlockIndex].Ref;
3724 #ifdef MAX_STARTPHASE
3725 ndbrequire(currentStartPhase <= MAX_STARTPHASE);
3729 ndbout_c(
"sending STTOR(%d) to %s(ref=%x index=%d)",
3731 getBlockName( refToBlock(ref)),
3735 if (refToBlock(ref) == DBDIH)
3736 signal->theData[7] = cntr.cdihStartType;
3738 cntr.sendSignal(ref, GSN_STTOR, signal, 8, JBB);
3744 currentBlockIndex = 0;
3747 (NodeState::StartType)cntr.ctypeOfStart);
3748 cntr.updateNodeState(signal, newState);
3756 g_eventLogger->
info(
"Start phase %u completed", currentStartPhase);
3759 signal->theData[1] = currentStartPhase;
3760 signal->theData[2] = cntr.ctypeOfStart;
3761 cntr.sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 3, JBB);
3771 if (cntr.wait_sp(signal, currentStartPhase + 1))
3774 currentStartPhase++;
3775 g_currentStartPhase = currentStartPhase;
3781 g_eventLogger->
info(
"Node started");
3784 signal->theData[1] = NDB_VERSION;
3785 signal->theData[2] = NDB_MYSQL_VERSION_D;
3786 cntr.sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 3, JBB);
3789 cntr.updateNodeState(signal, newState);
3792 signal->theData[0] = cntr.getOwnNodeId();
3793 cntr.sendSignal(rg, GSN_CNTR_START_REP, signal, 1, JBB);
3797 Ndbcntr::execCREATE_NODEGROUP_IMPL_REQ(
Signal* signal)
3804 if (req->requestType == CreateNodegroupImplReq::RT_COMMIT)
3807 Uint32 save = c_nodeGroup;
3808 getNodeGroup(signal);
3809 if (save != c_nodeGroup)
3818 conf->senderRef = reference();
3819 conf->senderData = req->senderData;
3820 sendSignal(req->senderRef, GSN_CREATE_NODEGROUP_IMPL_CONF, signal,
3821 CreateNodegroupImplConf::SignalLength, JBB);
3826 Ndbcntr::execDROP_NODEGROUP_IMPL_REQ(
Signal* signal)
3833 if (req->requestType == DropNodegroupImplReq::RT_COMPLETE)
3836 Uint32 save = c_nodeGroup;
3837 getNodeGroup(signal);
3839 if (save != c_nodeGroup)
3848 conf->senderRef = reference();
3849 conf->senderData = req->senderData;
3850 sendSignal(req->senderRef, GSN_DROP_NODEGROUP_IMPL_CONF, signal,
3851 DropNodegroupImplConf::SignalLength, JBB);