未验证 提交 14acfd35 编写于 作者: S slguan 提交者: GitHub

Merge pull request #1631 from taosdata/feature/mpeer

fix status message error
CMAKE_MINIMUM_REQUIRED(VERSION 2.8) CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(TDengine) PROJECT(TDengine)
SET(TD_CLUSTER FALSE) SET(TD_SYNC FALSE)
SET(TD_ACCOUNT FALSE) SET(TD_ACCOUNT FALSE)
SET(TD_VPEER FALSE) SET(TD_ADMIN FALSE)
SET(TD_MPEER FALSE)
SET(TD_GRANT FALSE) SET(TD_GRANT FALSE)
SET(TD_COVER FALSE) SET(TD_COVER FALSE)
SET(TD_MEM_CHECK FALSE)
SET(TD_PAGMODE_LITE FALSE) SET(TD_PAGMODE_LITE FALSE)
SET(TD_GODLL FALSE) SET(TD_GODLL FALSE)
SET(TD_MEM_CHECK FALSE)
SET(TD_COMMUNITY_DIR ${PROJECT_SOURCE_DIR}) SET(TD_COMMUNITY_DIR ${PROJECT_SOURCE_DIR})
MESSAGE(STATUS "Community directory: " ${TD_COMMUNITY_DIR}) MESSAGE(STATUS "Community directory: " ${TD_COMMUNITY_DIR})
......
...@@ -142,9 +142,9 @@ static void dnodeProcessStatusRsp(SRpcMsg *pMsg) { ...@@ -142,9 +142,9 @@ static void dnodeProcessStatusRsp(SRpcMsg *pMsg) {
} }
SDMStatusRsp *pStatusRsp = pMsg->pCont; SDMStatusRsp *pStatusRsp = pMsg->pCont;
SDMNodeInfos *mpeers = &pStatusRsp->mpeers; SDMNodeInfos *mnodes = &pStatusRsp->mnodes;
if (mpeers->nodeNum <= 0) { if (mnodes->nodeNum <= 0) {
dError("status msg is invalid, num of ips is %d", mpeers->nodeNum); dError("status msg is invalid, num of ips is %d", mnodes->nodeNum);
taosTmrReset(dnodeSendStatusMsg, tsStatusInterval * 1000, NULL, tsDnodeTmr, &tsStatusTimer); taosTmrReset(dnodeSendStatusMsg, tsStatusInterval * 1000, NULL, tsDnodeTmr, &tsStatusTimer);
return; return;
} }
...@@ -159,23 +159,23 @@ static void dnodeProcessStatusRsp(SRpcMsg *pMsg) { ...@@ -159,23 +159,23 @@ static void dnodeProcessStatusRsp(SRpcMsg *pMsg) {
dnodeUpdateDnodeInfo(pState->dnodeId); dnodeUpdateDnodeInfo(pState->dnodeId);
SRpcIpSet mgmtIpSet = {0}; SRpcIpSet mgmtIpSet = {0};
mgmtIpSet.inUse = mpeers->inUse; mgmtIpSet.inUse = mnodes->inUse;
mgmtIpSet.numOfIps = mpeers->nodeNum; mgmtIpSet.numOfIps = mnodes->nodeNum;
mgmtIpSet.port = htons(mpeers->nodeInfos[0].nodePort); mgmtIpSet.port = htons(mnodes->nodeInfos[0].nodePort);
for (int32_t i = 0; i < mpeers->nodeNum; i++) { for (int32_t i = 0; i < mnodes->nodeNum; i++) {
mgmtIpSet.ip[i] = htonl(mpeers->nodeInfos[i].nodeIp); mgmtIpSet.ip[i] = htonl(mnodes->nodeInfos[i].nodeIp);
} }
if (memcmp(&mgmtIpSet, &tsMnodeIpList, sizeof(SRpcIpSet)) != 0 || tsMnodeInfos.nodeNum == 0) { if (memcmp(&mgmtIpSet, &tsMnodeIpList, sizeof(SRpcIpSet)) != 0 || tsMnodeInfos.nodeNum == 0) {
memcpy(&tsMnodeIpList, &mgmtIpSet, sizeof(SRpcIpSet)); memcpy(&tsMnodeIpList, &mgmtIpSet, sizeof(SRpcIpSet));
tsMnodeInfos.inUse = mpeers->inUse; tsMnodeInfos.inUse = mnodes->inUse;
tsMnodeInfos.nodeNum = mpeers->nodeNum; tsMnodeInfos.nodeNum = mnodes->nodeNum;
dPrint("mnode ip list is changed, numOfIps:%d inUse:%d", tsMnodeInfos.nodeNum, tsMnodeInfos.inUse); dPrint("mnode ip list is changed, numOfIps:%d inUse:%d", tsMnodeInfos.nodeNum, tsMnodeInfos.inUse);
for (int32_t i = 0; i < mpeers->nodeNum; i++) { for (int32_t i = 0; i < mnodes->nodeNum; i++) {
tsMnodeInfos.nodeInfos[i].nodeId = htonl(mpeers->nodeInfos[i].nodeId); tsMnodeInfos.nodeInfos[i].nodeId = htonl(mnodes->nodeInfos[i].nodeId);
tsMnodeInfos.nodeInfos[i].nodeIp = htonl(mpeers->nodeInfos[i].nodeIp); tsMnodeInfos.nodeInfos[i].nodeIp = htonl(mnodes->nodeInfos[i].nodeIp);
tsMnodeInfos.nodeInfos[i].nodePort = htons(mpeers->nodeInfos[i].nodePort); tsMnodeInfos.nodeInfos[i].nodePort = htons(mnodes->nodeInfos[i].nodePort);
strcpy(tsMnodeInfos.nodeInfos[i].nodeName, mpeers->nodeInfos[i].nodeName); strcpy(tsMnodeInfos.nodeInfos[i].nodeName, mnodes->nodeInfos[i].nodeName);
dPrint("mnode:%d, ip:%s:%u name:%s", tsMnodeInfos.nodeInfos[i].nodeId, dPrint("mnode:%d, ip:%s:%u name:%s", tsMnodeInfos.nodeInfos[i].nodeId,
taosIpStr(tsMnodeInfos.nodeInfos[i].nodeIp), tsMnodeInfos.nodeInfos[i].nodePort, taosIpStr(tsMnodeInfos.nodeInfos[i].nodeIp), tsMnodeInfos.nodeInfos[i].nodePort,
tsMnodeInfos.nodeInfos[i].nodeName); tsMnodeInfos.nodeInfos[i].nodeName);
......
...@@ -608,7 +608,7 @@ typedef struct { ...@@ -608,7 +608,7 @@ typedef struct {
} SDMNodeInfos; } SDMNodeInfos;
typedef struct { typedef struct {
SDMNodeInfos mpeers; SDMNodeInfos mnodes;
SDnodeState dnodeState; SDnodeState dnodeState;
SVnodeAccess vnodeAccess[]; SVnodeAccess vnodeAccess[];
} SDMStatusRsp; } SDMStatusRsp;
......
...@@ -63,6 +63,12 @@ static int32_t mgmtDnodeActionInsert(SSdbOperDesc *pOper) { ...@@ -63,6 +63,12 @@ static int32_t mgmtDnodeActionInsert(SSdbOperDesc *pOper) {
pDnode->status = TAOS_DN_STATUS_OFFLINE; pDnode->status = TAOS_DN_STATUS_OFFLINE;
} }
pDnode->mnodeShellPort = tsMnodeShellPort;
pDnode->mnodeDnodePort = tsMnodeDnodePort;
pDnode->dnodeShellPort = tsDnodeShellPort;
pDnode->dnodeMnodePort = tsDnodeMnodePort;
pDnode->syncPort = 0;
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
...@@ -344,7 +350,7 @@ void mgmtProcessDnodeStatusMsg(SRpcMsg *rpcMsg) { ...@@ -344,7 +350,7 @@ void mgmtProcessDnodeStatusMsg(SRpcMsg *rpcMsg) {
return; return;
} }
mgmtGetMnodeList(&pRsp->mpeers); mgmtGetMnodeList(&pRsp->mnodes);
pRsp->dnodeState.dnodeId = htonl(pDnode->dnodeId); pRsp->dnodeState.dnodeId = htonl(pDnode->dnodeId);
pRsp->dnodeState.moduleStatus = htonl(pDnode->moduleStatus); pRsp->dnodeState.moduleStatus = htonl(pDnode->moduleStatus);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册