📄 mgmtsrvr.hpp
字号:
int abortBackup(Uint32 backupId); int performBackup(Uint32* backupId); /** * Global Replication */ int repCommand(Uint32* repReqId, Uint32 request, bool waitCompleted = false); //************************************************************************** // Description: Set event report level for a DB process // Parameters: // processId: Id of the DB process // level: Event report level // isResend: Flag to indicate for resending log levels during node restart // Returns: 0 if succeeded, otherwise: as stated above, plus: // INVALID_LEVEL //************************************************************************** int setEventReportingLevelImpl(int processId, const EventSubscribeReq& ll); int setNodeLogLevelImpl(int processId, const SetLogLevelOrd & ll); /** * Insert an error in a DB process. * @param processId: Id of the DB process * @param errorNo: The error number. > 0. * @return 0 if succeeded, otherwise: as stated above, plus: * INVALID_ERROR_NUMBER */ int insertError(int processId, int errorNo); int setTraceNo(int processId, int traceNo); //************************************************************************** // Description: Set trace number in a DB process. // Parameters: // processId: Id of the DB process // trace: Trace number // Returns: 0 if succeeded, otherwise: as stated above, plus: // INVALID_TRACE_NUMBER //************************************************************************** int setSignalLoggingMode(int processId, LogMode mode, const Vector<BaseString> &blocks); int setSignalLoggingMode(int processId, LogMode mode, BaseString &block) { Vector<BaseString> v; v.push_back(block); return setSignalLoggingMode(processId, mode, v); } //************************************************************************** // Description: Set signal logging mode for blocks in a DB process. // Parameters: // processId: Id of the DB process // mode: The log mode // blocks: Which blocks to be affected (container of strings) // Returns: 0 if succeeded, otherwise: as stated above, plus: // INVALID_BLOCK_NAME //************************************************************************** int startSignalTracing(int processId); //************************************************************************** // Description: Start signal tracing for a DB process. // Parameters: // processId: Id of the DB process // Returns: 0 if succeeded, otherwise: as stated above. //************************************************************************** int stopSignalTracing(int processId); //************************************************************************** // Description: Stop signal tracing for a DB process. // Parameters: // processId: Id of the DB process // Returns: 0 if succeeded, otherwise: as stated above. //************************************************************************** /** * Dump State */ int dumpState(int processId, const Uint32 args[], Uint32 argNo); int dumpState(int processId, const char* args); /** * Get next node id (node id gt that _nodeId) * of specified type and save it in _nodeId * * @return false if none found */ bool getNextNodeId(NodeId * _nodeId, enum ndb_mgm_node_type type) const ; bool alloc_node_id(NodeId * _nodeId, enum ndb_mgm_node_type type, struct sockaddr *client_addr, SOCKET_SIZE_TYPE *client_addr_len, BaseString &error_string); /** * */ enum ndb_mgm_node_type getNodeType(NodeId) const; /** * Get error text * * @param errorCode: Error code to get a match error text for. * @return The error text. */ const char* getErrorText(int errorCode, char *buf, int buf_sz); /** * Get configuration */ const Config * getConfig() const; /** * Returns the node count for the specified node type. * * @param type The node type. * @return The number of nodes of the specified type. */ int getNodeCount(enum ndb_mgm_node_type type) const; /** * Returns the port number. * @return port number. */ int getPort() const; int setDbParameter(int node, int parameter, const char * value, BaseString&); int setConnectionDbParameter(int node1, int node2, int param, int value, BaseString& msg); int getConnectionDbParameter(int node1, int node2, int param, int *value, BaseString& msg); int connect_to_self(void); void transporter_connect(NDB_SOCKET_TYPE sockfd); ConfigRetriever *get_config_retriever() { return m_config_retriever; }; const char *get_connect_address(Uint32 node_id); void get_connected_nodes(NodeBitmask &connected_nodes) const; SocketServer *get_socket_server() { return m_socket_server; } //**************************************************************************private: //************************************************************************** int send(SignalSender &ss, SimpleSignal &ssig, Uint32 node, Uint32 node_type); int sendStopMgmd(NodeId nodeId, bool abort, bool stop, bool restart, bool nostart, bool initialStart); int sendSTOP_REQ(const Vector<NodeId> &node_ids, NodeBitmask &stoppedNodes, Uint32 singleUserNodeId, bool abort, bool stop, bool restart, bool nostart, bool initialStart); /** * Check if it is possible to send a signal to a (DB) process * * @param processId: Id of the process to send to * @return 0 OK, 1 process dead, 2 API or MGMT process, 3 not configured */ int okToSendTo(NodeId nodeId, bool unCond = false); /** * Get block number for a block * * @param blockName: Block to get number for * @return -1 if block not found, otherwise block number */ int getBlockNumber(const BaseString &blockName); //************************************************************************** int _blockNumber; NodeId _ownNodeId; SocketServer *m_socket_server; BlockReference _ownReference; NdbMutex *m_configMutex; const Config * _config; Config * m_newConfig; BaseString m_configFilename; Uint32 m_nextConfigGenerationNumber; NodeBitmask m_reserved_nodes; struct in_addr m_connect_address[MAX_NODES]; //************************************************************************** // Specific signal handling methods //************************************************************************** static void defineSignals(int blockNumber); //************************************************************************** // Description: Define all signals to be sent or received for a block // Parameters: // blockNumber: The block number send/receive // Returns: - //************************************************************************** void handleReceivedSignal(NdbApiSignal* signal); //************************************************************************** // Description: This method is called from "another" thread when a signal // is received. If expect the received signal and succeed to handle it // we signal with a condition variable to the waiting // thread (receiveOptimisedResponse) that the signal has arrived. // Parameters: // signal: The recieved signal // Returns: - //************************************************************************** void handleStatus(NodeId nodeId, bool alive, bool nfComplete); //************************************************************************** // Description: Handle the death of a process // Parameters: // processId: Id of the dead process. // Returns: - //************************************************************************** //************************************************************************** // Specific signal handling data //************************************************************************** //************************************************************************** //************************************************************************** // General signal handling methods // This functions are more or less copied from the Ndb class. /** * WaitSignalType defines states where each state define a set of signals * we accept to receive. * The state is set after we have sent a signal. * When a signal arrives we first check current state (handleReceivedSignal) * to verify that we expect the arrived signal. * It's only then we are in state accepting the arrived signal * we handle the signal. */ enum WaitSignalType { NO_WAIT, // We don't expect to receive any signal WAIT_SET_VAR, // Accept SET_VAR_CONF and SET_VAR_REF WAIT_SUBSCRIBE_CONF // Accept event subscription confirmation }; /** * This function is called from "outside" of MgmtSrvr * when a signal is sent to MgmtSrvr. * @param mgmtSrvr: The MgmtSrvr object which shall recieve the signal. * @param signal: The received signal. */ static void signalReceivedNotification(void* mgmtSrvr, NdbApiSignal* signal, struct LinearSectionPtr ptr[3]); /** * Called from "outside" of MgmtSrvr when a DB process has died. * @param mgmtSrvr: The MgmtSrvr object wreceiveOptimisedResponsehich * shall receive the notification. * @param processId: Id of the dead process. */ static void nodeStatusNotification(void* mgmSrv, Uint32 nodeId, bool alive, bool nfCompleted); /** * An event from <i>nodeId</i> has arrived */ void eventReport(const Uint32 * theData); //************************************************************************** //************************************************************************** // General signal handling data STATIC_CONST( WAIT_FOR_RESPONSE_TIMEOUT = 300000 ); // Milliseconds // Max time to wait for a signal to arrive NdbApiSignal* theSignalIdleList; // List of unused signals Uint32 theWaitNode; WaitSignalType theWaitState; // State denoting a set of signals we accept to recieve. NdbCondition* theMgmtWaitForResponseCondPtr; // Condition variable used when we wait for a signal to arrive/a // signal arrives. // We wait in receiveOptimisedResponse and signal in handleReceivedSignal. NdbMgmHandle m_local_mgm_handle; char m_local_mgm_connect_string[20]; class TransporterFacade * theFacade; int sendVersionReq( int processId, Uint32 &version, const char **address); int translateStopRef(Uint32 errCode); bool _isStopThread; int _logLevelThreadSleep; MutexVector<NodeId> m_started_nodes; MutexVector<EventSubscribeReq> m_log_level_requests; LogLevel m_nodeLogLevel[MAX_NODES]; enum ndb_mgm_node_type nodeTypes[MAX_NODES]; friend class MgmApiSession; friend class Ndb_mgmd_event_service; Ndb_mgmd_event_service m_event_listner; NodeId m_master_node; /** * Handles the thread wich upon a 'Node is started' event will * set the node's previous loglevel settings. */ struct NdbThread* _logLevelThread; static void *logLevelThread_C(void *); void logLevelThreadRun(); Config *_props; ConfigRetriever *m_config_retriever;};inlineconst Config *MgmtSrvr::getConfig() const { return _config;}#endif // MgmtSrvr_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -