From c2067ab4cd24da40e50a1b7056edb15665d98c76 Mon Sep 17 00:00:00 2001 From: slguan Date: Fri, 17 Apr 2020 00:31:33 +0800 Subject: [PATCH] fix status message error --- CMakeLists.txt | 9 +++++---- src/dnode/src/dnodeMClient.c | 30 +++++++++++++++--------------- src/inc/taosmsg.h | 2 +- src/mnode/src/mgmtDnode.c | 8 +++++++- 4 files changed, 28 insertions(+), 21 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5a9a42cc36..e53cca2ea8 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,15 +1,16 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8) PROJECT(TDengine) -SET(TD_CLUSTER FALSE) +SET(TD_SYNC FALSE) SET(TD_ACCOUNT FALSE) -SET(TD_VPEER FALSE) -SET(TD_MPEER FALSE) +SET(TD_ADMIN FALSE) SET(TD_GRANT FALSE) + SET(TD_COVER FALSE) +SET(TD_MEM_CHECK FALSE) + SET(TD_PAGMODE_LITE FALSE) SET(TD_GODLL FALSE) -SET(TD_MEM_CHECK FALSE) SET(TD_COMMUNITY_DIR ${PROJECT_SOURCE_DIR}) MESSAGE(STATUS "Community directory: " ${TD_COMMUNITY_DIR}) diff --git a/src/dnode/src/dnodeMClient.c b/src/dnode/src/dnodeMClient.c index 460c866ce1..42f947588b 100644 --- a/src/dnode/src/dnodeMClient.c +++ b/src/dnode/src/dnodeMClient.c @@ -142,9 +142,9 @@ static void dnodeProcessStatusRsp(SRpcMsg *pMsg) { } SDMStatusRsp *pStatusRsp = pMsg->pCont; - SDMNodeInfos *mpeers = &pStatusRsp->mpeers; - if (mpeers->nodeNum <= 0) { - dError("status msg is invalid, num of ips is %d", mpeers->nodeNum); + SDMNodeInfos *mnodes = &pStatusRsp->mnodes; + if (mnodes->nodeNum <= 0) { + dError("status msg is invalid, num of ips is %d", mnodes->nodeNum); taosTmrReset(dnodeSendStatusMsg, tsStatusInterval * 1000, NULL, tsDnodeTmr, &tsStatusTimer); return; } @@ -159,23 +159,23 @@ static void dnodeProcessStatusRsp(SRpcMsg *pMsg) { dnodeUpdateDnodeInfo(pState->dnodeId); SRpcIpSet mgmtIpSet = {0}; - mgmtIpSet.inUse = mpeers->inUse; - mgmtIpSet.numOfIps = mpeers->nodeNum; - mgmtIpSet.port = htons(mpeers->nodeInfos[0].nodePort); - for (int32_t i = 0; i < mpeers->nodeNum; i++) { - mgmtIpSet.ip[i] = htonl(mpeers->nodeInfos[i].nodeIp); + mgmtIpSet.inUse = mnodes->inUse; + mgmtIpSet.numOfIps = mnodes->nodeNum; + mgmtIpSet.port = htons(mnodes->nodeInfos[0].nodePort); + for (int32_t i = 0; i < mnodes->nodeNum; i++) { + mgmtIpSet.ip[i] = htonl(mnodes->nodeInfos[i].nodeIp); } if (memcmp(&mgmtIpSet, &tsMnodeIpList, sizeof(SRpcIpSet)) != 0 || tsMnodeInfos.nodeNum == 0) { memcpy(&tsMnodeIpList, &mgmtIpSet, sizeof(SRpcIpSet)); - tsMnodeInfos.inUse = mpeers->inUse; - tsMnodeInfos.nodeNum = mpeers->nodeNum; + tsMnodeInfos.inUse = mnodes->inUse; + tsMnodeInfos.nodeNum = mnodes->nodeNum; dPrint("mnode ip list is changed, numOfIps:%d inUse:%d", tsMnodeInfos.nodeNum, tsMnodeInfos.inUse); - for (int32_t i = 0; i < mpeers->nodeNum; i++) { - tsMnodeInfos.nodeInfos[i].nodeId = htonl(mpeers->nodeInfos[i].nodeId); - tsMnodeInfos.nodeInfos[i].nodeIp = htonl(mpeers->nodeInfos[i].nodeIp); - tsMnodeInfos.nodeInfos[i].nodePort = htons(mpeers->nodeInfos[i].nodePort); - strcpy(tsMnodeInfos.nodeInfos[i].nodeName, mpeers->nodeInfos[i].nodeName); + for (int32_t i = 0; i < mnodes->nodeNum; i++) { + tsMnodeInfos.nodeInfos[i].nodeId = htonl(mnodes->nodeInfos[i].nodeId); + tsMnodeInfos.nodeInfos[i].nodeIp = htonl(mnodes->nodeInfos[i].nodeIp); + tsMnodeInfos.nodeInfos[i].nodePort = htons(mnodes->nodeInfos[i].nodePort); + strcpy(tsMnodeInfos.nodeInfos[i].nodeName, mnodes->nodeInfos[i].nodeName); dPrint("mnode:%d, ip:%s:%u name:%s", tsMnodeInfos.nodeInfos[i].nodeId, taosIpStr(tsMnodeInfos.nodeInfos[i].nodeIp), tsMnodeInfos.nodeInfos[i].nodePort, tsMnodeInfos.nodeInfos[i].nodeName); diff --git a/src/inc/taosmsg.h b/src/inc/taosmsg.h index 3d0c72e531..79d086153a 100644 --- a/src/inc/taosmsg.h +++ b/src/inc/taosmsg.h @@ -608,7 +608,7 @@ typedef struct { } SDMNodeInfos; typedef struct { - SDMNodeInfos mpeers; + SDMNodeInfos mnodes; SDnodeState dnodeState; SVnodeAccess vnodeAccess[]; } SDMStatusRsp; diff --git a/src/mnode/src/mgmtDnode.c b/src/mnode/src/mgmtDnode.c index c3ff92ce6c..89c4796d85 100644 --- a/src/mnode/src/mgmtDnode.c +++ b/src/mnode/src/mgmtDnode.c @@ -63,6 +63,12 @@ static int32_t mgmtDnodeActionInsert(SSdbOperDesc *pOper) { 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; } @@ -344,7 +350,7 @@ void mgmtProcessDnodeStatusMsg(SRpcMsg *rpcMsg) { return; } - mgmtGetMnodeList(&pRsp->mpeers); + mgmtGetMnodeList(&pRsp->mnodes); pRsp->dnodeState.dnodeId = htonl(pDnode->dnodeId); pRsp->dnodeState.moduleStatus = htonl(pDnode->moduleStatus); -- GitLab