📄 dbdih.hpp
字号:
/*STOP FOR SOME REASON. */ /*------------------------------------------------------------------------*/ enum GcpStatus { GCP_READY = 0, GCP_PREPARE_SENT = 1, GCP_COMMIT_SENT = 2, GCP_NODE_FINISHED = 3, GCP_SAVE_LQH_FINISHED = 4 }; GcpStatus cgcpStatus; Uint32 cgcpStartCounter; Uint32 coldGcpStatus; Uint32 coldGcpId; /*------------------------------------------------------------------------*/ /* THIS VARIABLE KEEPS TRACK OF THE STATE OF THIS NODE AS MASTER. */ /*------------------------------------------------------------------------*/ enum MasterState { MASTER_IDLE = 0, MASTER_ACTIVE = 1, MASTER_TAKE_OVER_GCP = 2 }; MasterState cmasterState; Uint16 cmasterTakeOverNode; /* NODE IS NOT MASTER */ /* NODE IS ACTIVE AS MASTER */ /* NODE IS TAKING OVER AS MASTER */ struct CopyGCIMaster { CopyGCIMaster(){ m_copyReason = m_waiting = CopyGCIReq::IDLE;} /*------------------------------------------------------------------------*/ /* THIS STATE VARIABLE IS USED TO INDICATE IF COPYING OF RESTART */ /* INFO WAS STARTED BY A LOCAL CHECKPOINT OR AS PART OF A SYSTEM */ /* RESTART. */ /*------------------------------------------------------------------------*/ CopyGCIReq::CopyReason m_copyReason; /*------------------------------------------------------------------------*/ /* COPYING RESTART INFO CAN BE STARTED BY LOCAL CHECKPOINTS AND BY */ /* GLOBAL CHECKPOINTS. WE CAN HOWEVER ONLY HANDLE ONE SUCH COPY AT */ /* THE TIME. THUS WE HAVE TO KEEP WAIT INFORMATION IN THIS VARIABLE.*/ /*------------------------------------------------------------------------*/ CopyGCIReq::CopyReason m_waiting; } c_copyGCIMaster; struct CopyGCISlave { CopyGCISlave(){ m_copyReason = CopyGCIReq::IDLE; m_expectedNextWord = 0;} /*------------------------------------------------------------------------*/ /* THIS STATE VARIABLE IS USED TO INDICATE IF COPYING OF RESTART */ /* INFO WAS STARTED BY A LOCAL CHECKPOINT OR AS PART OF A SYSTEM */ /* RESTART. THIS VARIABLE IS USED BY THE NODE THAT RECEIVES */ /* COPY_GCI_REQ. */ /*------------------------------------------------------------------------*/ Uint32 m_senderData; BlockReference m_senderRef; CopyGCIReq::CopyReason m_copyReason; Uint32 m_expectedNextWord; } c_copyGCISlave; /*------------------------------------------------------------------------*/ /* THIS VARIABLE IS USED TO KEEP TRACK OF THE STATE OF LOCAL */ /* CHECKPOINTS. */ /*------------------------------------------------------------------------*/public: enum LcpStatus { LCP_STATUS_IDLE = 0, LCP_TCGET = 1, // Only master LCP_STATUS_ACTIVE = 2, LCP_CALCULATE_KEEP_GCI = 4, // Only master LCP_COPY_GCI = 5, LCP_INIT_TABLES = 6, LCP_TC_CLOPSIZE = 7, // Only master LCP_START_LCP_ROUND = 8, LCP_TAB_COMPLETED = 9, LCP_TAB_SAVED = 10 };private: struct LcpState { LcpStatus lcpStatus; Uint32 lcpStatusUpdatedPlace; void setLcpStatus(LcpStatus status, Uint32 line){ lcpStatus = status; lcpStatusUpdatedPlace = line; } Uint32 lcpStart; Uint32 lcpStopGcp; Uint32 keepGci; /* USED TO CALCULATE THE GCI TO KEEP AFTER A LCP */ Uint32 oldestRestorableGci; struct CurrentFragment { Uint32 tableId; Uint32 fragmentId; } currentFragment; Uint32 noOfLcpFragRepOutstanding; /*------------------------------------------------------------------------*/ /* USED TO ENSURE THAT LCP'S ARE EXECUTED WITH CERTAIN TIMEINTERVALS*/ /* EVEN WHEN SYSTEM IS NOT DOING ANYTHING. */ /*------------------------------------------------------------------------*/ Uint32 ctimer; Uint32 ctcCounter; Uint32 clcpDelay; /* MAX. 2^(CLCP_DELAY - 2) SEC BETWEEN LCP'S */ /*------------------------------------------------------------------------*/ /* THIS STATE IS USED TO TELL IF THE FIRST LCP AFTER START/RESTART */ /* HAS BEEN RUN. AFTER A NODE RESTART THE NODE DOES NOT ENTER */ /* STARTED STATE BEFORE THIS IS DONE. */ /*------------------------------------------------------------------------*/ bool immediateLcpStart; bool m_LCP_COMPLETE_REP_From_Master_Received; SignalCounter m_LCP_COMPLETE_REP_Counter_DIH; SignalCounter m_LCP_COMPLETE_REP_Counter_LQH; SignalCounter m_LAST_LCP_FRAG_ORD; NdbNodeBitmask m_participatingLQH; NdbNodeBitmask m_participatingDIH; Uint32 m_masterLcpDihRef; bool m_MASTER_LCPREQ_Received; Uint32 m_MASTER_LCPREQ_FailedNodeId; } c_lcpState; /*------------------------------------------------------------------------*/ /* THIS VARIABLE KEEPS TRACK OF HOW MANY TABLES ARE ACTIVATED WHEN */ /* STARTING A LOCAL CHECKPOINT WE SHOULD AVOID STARTING A CHECKPOINT*/ /* WHEN NO TABLES ARE ACTIVATED. */ /*------------------------------------------------------------------------*/ Uint32 cnoOfActiveTables; Uint32 cgcpDelay; /* Delay between global checkpoints */ BlockReference cdictblockref; /* DICTIONARY BLOCK REFERENCE */ Uint32 cfailurenr; /* EVERY TIME WHEN A NODE FAILURE IS REPORTED THIS NUMBER IS INCREMENTED. AT THE START OF THE SYSTEM THIS NUMBER MUST BE INITIATED TO ZERO */ bool cgckptflag; /* A FLAG WHICH IS SET WHILE A NEW GLOBAL CHECK POINT IS BEING CREATED. NO VERIFICATION IS ALLOWED IF THE FLAG IS SET*/ Uint32 cgcpOrderBlocked; BlockReference clocallqhblockref; BlockReference clocaltcblockref; BlockReference cmasterdihref; Uint16 cownNodeId; Uint32 cnewgcp; BlockReference cndbStartReqBlockref; BlockReference cntrlblockref; Uint32 cgcpSameCounter; Uint32 coldgcp; Uint32 con_lineNodes; Uint32 creceivedfrag; Uint32 cremainingfrags; Uint32 cstarttype; Uint32 csystemnodes; Uint32 currentgcp; Uint32 c_newest_restorable_gci; enum GcpMasterTakeOverState { GMTOS_IDLE = 0, GMTOS_INITIAL = 1, ALL_READY = 2, ALL_PREPARED = 3, COMMIT_STARTED_NOT_COMPLETED = 4, COMMIT_COMPLETED = 5, PREPARE_STARTED_NOT_COMMITTED = 6, SAVE_STARTED_NOT_COMPLETED = 7 }; GcpMasterTakeOverState cgcpMasterTakeOverState;public: enum LcpMasterTakeOverState { LMTOS_IDLE = 0, LMTOS_WAIT_EMPTY_LCP = 1, // Currently doing empty LCP LMTOS_WAIT_LCP_FRAG_REP = 2,// Currently waiting for outst. LCP_FRAG_REP LMTOS_INITIAL = 3, LMTOS_ALL_IDLE = 4, LMTOS_ALL_ACTIVE = 5, LMTOS_LCP_CONCLUDING = 6, LMTOS_COPY_ONGOING = 7 };private: class MasterTakeOverState { public: void set(LcpMasterTakeOverState s, Uint32 line) { state = s; updatePlace = line; } LcpMasterTakeOverState state; Uint32 updatePlace; Uint32 minTableId; Uint32 minFragId; Uint32 failedNodeId; } c_lcpMasterTakeOverState; Uint16 cmasterNodeId; Uint8 cnoHotSpare; struct NodeStartMasterRecord { Uint32 startNode; Uint32 wait; Uint32 failNr; bool activeState; bool blockLcp; bool blockGcp; Uint32 startInfoErrorCode; Uint32 m_outstandingGsn; }; NodeStartMasterRecord c_nodeStartMaster; struct NodeStartSlaveRecord { NodeStartSlaveRecord() { nodeId = 0;} Uint32 nodeId; }; NodeStartSlaveRecord c_nodeStartSlave; Uint32 cfirstAliveNode; Uint32 cfirstDeadNode; Uint32 cstartPhase; Uint32 cnoReplicas; Uint32 c_startToLock; Uint32 c_endToLock; Uint32 c_createFragmentLock; Uint32 c_updateToLock; bool cwaitLcpSr; Uint32 cnoOfNodeGroups; bool cstartGcpNow; Uint32 crestartGci; /* VALUE OF GCI WHEN SYSTEM RESTARTED OR STARTED */ Uint32 cminHotSpareNodes; /** * Counter variables keeping track of the number of outstanding signals * for particular signals in various protocols. */ SignalCounter c_COPY_GCIREQ_Counter; SignalCounter c_COPY_TABREQ_Counter; SignalCounter c_CREATE_FRAGREQ_Counter; SignalCounter c_DIH_SWITCH_REPLICA_REQ_Counter; SignalCounter c_EMPTY_LCP_REQ_Counter; SignalCounter c_END_TOREQ_Counter; SignalCounter c_GCP_COMMIT_Counter; SignalCounter c_GCP_PREPARE_Counter; SignalCounter c_GCP_SAVEREQ_Counter; SignalCounter c_INCL_NODEREQ_Counter; SignalCounter c_MASTER_GCPREQ_Counter; SignalCounter c_MASTER_LCPREQ_Counter; SignalCounter c_START_INFOREQ_Counter; SignalCounter c_START_RECREQ_Counter; SignalCounter c_START_TOREQ_Counter; SignalCounter c_STOP_ME_REQ_Counter; SignalCounter c_TC_CLOPSIZEREQ_Counter; SignalCounter c_TCGETOPSIZEREQ_Counter; SignalCounter c_UPDATE_TOREQ_Counter; SignalCounter c_START_LCP_REQ_Counter; bool c_blockCommit; Uint32 c_blockCommitNo; bool getBlockCommit() const { return c_blockCommit || cgckptflag; } /** * SwitchReplicaRecord - Should only be used by master */ struct SwitchReplicaRecord { void clear(){} Uint32 nodeId; Uint32 tableId; Uint32 fragNo; }; SwitchReplicaRecord c_switchReplicas; struct StopPermProxyRecord { StopPermProxyRecord() { clientRef = 0; } Uint32 clientData; BlockReference clientRef; BlockReference masterRef; }; struct StopPermMasterRecord { StopPermMasterRecord() { clientRef = 0;} Uint32 returnValue; Uint32 clientData; BlockReference clientRef; }; StopPermProxyRecord c_stopPermProxy; StopPermMasterRecord c_stopPermMaster; void checkStopPermProxy(Signal*, NodeId failedNodeId); void checkStopPermMaster(Signal*, NodeRecordPtr failedNodePtr); void switchReplica(Signal*, Uint32 nodeId, Uint32 tableId, Uint32 fragNo); void switchReplicaReply(Signal*, NodeId nodeId); /** * Wait GCP (proxy) */ struct WaitGCPProxyRecord { WaitGCPProxyRecord() { clientRef = 0;} Uint32 clientData; BlockReference clientRef; BlockReference masterRef; union { Uint32 nextPool; Uint32 nextList; }; Uint32 prevList; }; typedef Ptr<WaitGCPProxyRecord> WaitGCPProxyPtr; /** * Wait GCP (master) */ struct WaitGCPMasterRecord { WaitGCPMasterRecord() { clientRef = 0;} Uint32 clientData; BlockReference clientRef; union { Uint32 nextPool; Uint32 nextList; }; Uint32 prevList; }; typedef Ptr<WaitGCPMasterRecord> WaitGCPMasterPtr; /** * Pool/list of WaitGCPProxyRecord record */ ArrayPool<WaitGCPProxyRecord> waitGCPProxyPool; ArrayList<WaitGCPProxyRecord> c_waitGCPProxyList; /** * Pool/list of WaitGCPMasterRecord record */ ArrayPool<WaitGCPMasterRecord> waitGCPMasterPool; ArrayList<WaitGCPMasterRecord> c_waitGCPMasterList; void checkWaitGCPProxy(Signal*, NodeId failedNodeId); void checkWaitGCPMaster(Signal*, NodeId failedNodeId); void emptyWaitGCPMasterQueue(Signal*); /** * Stop me */ struct StopMeRecord { StopMeRecord() { clientRef = 0;} BlockReference clientRef; Uint32 clientData; }; StopMeRecord c_stopMe; void checkStopMe(Signal *, NodeRecordPtr failedNodePtr); #define DIH_CDATA_SIZE 128 /** * This variable must be atleast the size of Sysfile::SYSFILE_SIZE32 */ Uint32 cdata[DIH_CDATA_SIZE]; /* TEMPORARY ARRAY VARIABLE */ /** * Sys file data */ Uint32 sysfileData[DIH_CDATA_SIZE]; Uint32 sysfileDataToFile[DIH_CDATA_SIZE]; /** * When a node comes up without filesystem * we have to clear all LCP for that node */ void invalidateNodeLCP(Signal *, Uint32 nodeId, Uint32 tableId); void invalidateNodeLCP(Signal *, Uint32 nodeId, TabRecordPtr); /** * Reply from nodeId */ void startInfoReply(Signal *, Uint32 nodeId);};#if (DIH_CDATA_SIZE < _SYSFILE_SIZE32)#error "cdata is to small compared to Sysfile size"#endif#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -