diff --git a/src/mnode/inc/mgmtDef.h b/src/mnode/inc/mgmtDef.h index a31500750e4a89434a48035c83c2600fead34c22..7ed4507ee2e4d0c16b118235e93f23bcddb9bf59 100644 --- a/src/mnode/inc/mgmtDef.h +++ b/src/mnode/inc/mgmtDef.h @@ -51,7 +51,6 @@ typedef struct SDnodeObj { int8_t reserved[15]; int8_t updateEnd[1]; int32_t refCount; - SVnodeLoad vload[TSDB_MAX_VNODES]; uint32_t moduleStatus; uint32_t lastReboot; // time stamp for last reboot float score; // calc in balance function @@ -72,13 +71,6 @@ typedef struct SMnodeObj { SDnodeObj *pDnode; } SMnodeObj; - -typedef struct { - int32_t dnodeId; - uint32_t privateIp; - uint32_t publicIp; -} SVnodeGid; - typedef struct { char tableId[TSDB_TABLE_ID_LEN + 1]; int8_t type; @@ -120,24 +112,34 @@ typedef struct { SSuperTableObj *superTable; } SChildTableObj; +typedef struct { + int32_t dnodeId; + int8_t role; + int8_t reserved[3]; + SDnodeObj* pDnode; +} SVnodeGid; + typedef struct SVgObj { - uint32_t vgId; - char dbName[TSDB_DB_NAME_LEN + 1]; - int64_t createdTime; - SVnodeGid vnodeGid[TSDB_VNODES_SUPPORT]; - int32_t numOfVnodes; - int32_t lbDnodeId; - int32_t lbTime; - int8_t status; - int8_t inUse; - int8_t reserved[13]; - int8_t updateEnd[1]; - int32_t refCount; + uint32_t vgId; + char dbName[TSDB_DB_NAME_LEN + 1]; + int64_t createdTime; + SVnodeGid vnodeGid[TSDB_VNODES_SUPPORT]; + int32_t numOfVnodes; + int32_t lbDnodeId; + int32_t lbTime; + int8_t status; + int8_t inUse; + int8_t reserved[13]; + int8_t updateEnd[1]; + int32_t refCount; struct SVgObj *prev, *next; struct SDbObj *pDb; - int32_t numOfTables; - void * idPool; - SChildTableObj ** tableList; + int32_t numOfTables; + int64_t totalStorage; + int64_t compStorage; + int64_t pointsWritten; + void * idPool; + SChildTableObj **tableList; } SVgObj; typedef struct SDbObj { diff --git a/src/mnode/inc/mgmtDnode.h b/src/mnode/inc/mgmtDnode.h index 48111d3110c7fc6b2f3e54c062329bdf9cfd70c2..c0e04aae059add5d627e669c443046713e51b073 100644 --- a/src/mnode/inc/mgmtDnode.h +++ b/src/mnode/inc/mgmtDnode.h @@ -35,7 +35,8 @@ void mgmtMonitorDnodeModule(); int32_t mgmtGetDnodesNum(); void * mgmtGetNextDnode(void *pNode, SDnodeObj **pDnode); -void mgmtReleaseDnode(SDnodeObj *pDnode); +void mgmtIncDnodeRef(SDnodeObj *pDnode); +void mgmtDecDnodeRef(SDnodeObj *pDnode); void * mgmtGetDnode(int32_t dnodeId); void * mgmtGetDnodeByIp(uint32_t ip); void mgmtUpdateDnode(SDnodeObj *pDnode); diff --git a/src/mnode/inc/mgmtUser.h b/src/mnode/inc/mgmtUser.h index b6a71f6efde589611b0d5ee4a6106d35861e2f4e..8f1cf5d4503db3cca8d396545c9f1aa06f810690 100644 --- a/src/mnode/inc/mgmtUser.h +++ b/src/mnode/inc/mgmtUser.h @@ -24,7 +24,8 @@ extern "C" { int32_t mgmtInitUsers(); void mgmtCleanUpUsers(); SUserObj *mgmtGetUser(char *name); -void mgmtReleaseUser(SUserObj *pUser); +void mgmtIncUserRef(SUserObj *pUser); +void mgmtDecUserRef(SUserObj *pUser); SUserObj *mgmtGetUserFromConn(void *pConn, bool *usePublicIp); int32_t mgmtCreateUser(SAcctObj *pAcct, char *name, char *pass); void mgmtDropAllUsers(SAcctObj *pAcct); diff --git a/src/mnode/inc/mgmtVgroup.h b/src/mnode/inc/mgmtVgroup.h index 3da002026ba918e10ff8fa2e47eb469d21c959b1..534e640c4d34cbac41227e2f4c7cde28ff9f7ceb 100644 --- a/src/mnode/inc/mgmtVgroup.h +++ b/src/mnode/inc/mgmtVgroup.h @@ -30,12 +30,13 @@ enum _TSDB_VG_STATUS { int32_t mgmtInitVgroups(); void mgmtCleanUpVgroups(); SVgObj *mgmtGetVgroup(int32_t vgId); -void mgmtReleaseVgroup(SVgObj *pVgroup); +void mgmtIncVgroupRef(SVgObj *pVgroup); +void mgmtDecVgroupRef(SVgObj *pVgroup); void mgmtDropAllVgroups(SDbObj *pDropDb); void * mgmtGetNextVgroup(void *pNode, SVgObj **pVgroup); void mgmtUpdateVgroup(SVgObj *pVgroup); -void mgmtUpdateVgroupStatus(SVgObj *pVgroup, int32_t dnodeId, SVnodeLoad *pVload); +void mgmtUpdateVgroupStatus(SVgObj *pVgroup, SDnodeObj *dnodeId, SVnodeLoad *pVload); void mgmtCreateVgroup(SQueuedMsg *pMsg, SDbObj *pDb); void mgmtDropVgroup(SVgObj *pVgroup, void *ahandle); diff --git a/src/mnode/src/mgmtBalance.c b/src/mnode/src/mgmtBalance.c index 8ca651be2c6bca764752fdae7f20c89037e5f292..7b85dc08e345e256acc9db19bbd721f9679861a0 100644 --- a/src/mnode/src/mgmtBalance.c +++ b/src/mnode/src/mgmtBalance.c @@ -47,7 +47,7 @@ int32_t balanceAllocVnodes(SVgObj *pVgroup) { vnodeUsage = usage; } } - mgmtReleaseDnode(pDnode); + mgmtDecDnodeRef(pDnode); } if (pSelDnode == NULL) { @@ -56,8 +56,7 @@ int32_t balanceAllocVnodes(SVgObj *pVgroup) { } pVgroup->vnodeGid[0].dnodeId = pSelDnode->dnodeId; - pVgroup->vnodeGid[0].privateIp = pSelDnode->privateIp; - pVgroup->vnodeGid[0].publicIp = pSelDnode->publicIp; + pVgroup->vnodeGid[0].pDnode = pSelDnode; mTrace("dnode:%d, alloc one vnode to vgroup, openVnodes:%d", pSelDnode->dnodeId, pSelDnode->openVnodes); return TSDB_CODE_SUCCESS; diff --git a/src/mnode/src/mgmtDb.c b/src/mnode/src/mgmtDb.c index 805546e15e42f8591b8c501e5745de6938b4361a..d66b949421f1ffec782d5c10393f6f565ba90fa9 100644 --- a/src/mnode/src/mgmtDb.c +++ b/src/mnode/src/mgmtDb.c @@ -527,7 +527,7 @@ static int32_t mgmtGetDbMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn) pShow->rowSize = pShow->offset[cols - 1] + pShow->bytes[cols - 1]; pShow->numOfRows = pUser->pAcct->acctInfo.numOfDbs; - mgmtReleaseUser(pUser); + mgmtDecUserRef(pUser); return 0; } @@ -647,7 +647,7 @@ static int32_t mgmtRetrieveDbs(SShowObj *pShow, char *data, int32_t rows, void * } pShow->numOfReads += numOfRows; - mgmtReleaseUser(pUser); + mgmtDecUserRef(pUser); return numOfRows; } diff --git a/src/mnode/src/mgmtDnode.c b/src/mnode/src/mgmtDnode.c index dd38040147b1d71c8ea792415c6cee661963b9d6..4db74156843e2612c34ffe8a42830b7beeb49652 100644 --- a/src/mnode/src/mgmtDnode.c +++ b/src/mnode/src/mgmtDnode.c @@ -23,6 +23,7 @@ #include "tutil.h" #include "tsocket.h" #include "tbalance.h" +#include "tsync.h" #include "dnode.h" #include "mgmtDef.h" #include "mgmtLog.h" @@ -139,7 +140,7 @@ static int32_t mgmtDnodeActionRestored() { mgmtCreateDnode(ip); SDnodeObj *pDnode = mgmtGetDnodeByIp(ip); mgmtAddMnode(pDnode->dnodeId); - mgmtReleaseDnode(pDnode); + mgmtDecDnodeRef(pDnode); } return TSDB_CODE_SUCCESS; @@ -215,13 +216,17 @@ void *mgmtGetDnodeByIp(uint32_t ip) { if (ip == pDnode->privateIp) { return pDnode; } - mgmtReleaseDnode(pDnode); + mgmtDecDnodeRef(pDnode); } return NULL; } -void mgmtReleaseDnode(SDnodeObj *pDnode) { +void mgmtIncDnodeRef(SDnodeObj *pDnode) { + sdbIncRef(tsDnodeSdb, pDnode); +} + +void mgmtDecDnodeRef(SDnodeObj *pDnode) { sdbDecRef(tsDnodeSdb, pDnode); } @@ -326,19 +331,21 @@ void mgmtProcessDnodeStatusMsg(SRpcMsg *rpcMsg) { int32_t openVnodes = htons(pStatus->openVnodes); for (int32_t j = 0; j < openVnodes; ++j) { SVnodeLoad *pVload = &pStatus->load[j]; - pDnode->vload[j].vgId = htonl(pVload->vgId); - pDnode->vload[j].totalStorage = htobe64(pVload->totalStorage); - pDnode->vload[j].compStorage = htobe64(pVload->compStorage); - pDnode->vload[j].pointsWritten = htobe64(pVload->pointsWritten); - - SVgObj *pVgroup = mgmtGetVgroup(pDnode->vload[j].vgId); + pVload->vgId = htonl(pVload->vgId); + + SVgObj *pVgroup = mgmtGetVgroup(pVload->vgId); if (pVgroup == NULL) { SRpcIpSet ipSet = mgmtGetIpSetFromIp(pDnode->privateIp); - mPrint("dnode:%d, vgroup:%d not exist in mnode, drop it", pDnode->dnodeId, pDnode->vload[j].vgId); - mgmtSendDropVnodeMsg(pDnode->vload[j].vgId, &ipSet, NULL); + mPrint("dnode:%d, vgroup:%d not exist in mnode, drop it", pDnode->dnodeId, pVload->vgId); + mgmtSendDropVnodeMsg(pVload->vgId, &ipSet, NULL); } else { - mgmtUpdateVgroupStatus(pVgroup, pDnode->dnodeId, pVload); - mgmtReleaseVgroup(pVgroup); + mgmtUpdateVgroupStatus(pVgroup, pDnode, pVload); + if (pVload->role == TAOS_SYNC_ROLE_MASTER) { + pVgroup->totalStorage = htobe64(pVload->totalStorage); + pVgroup->compStorage = htobe64(pVload->compStorage); + pVgroup->pointsWritten = htobe64(pVload->pointsWritten); + } + mgmtDecVgroupRef(pVgroup); } } @@ -348,7 +355,7 @@ void mgmtProcessDnodeStatusMsg(SRpcMsg *rpcMsg) { balanceNotify(); } - mgmtReleaseDnode(pDnode); + mgmtDecDnodeRef(pDnode); int32_t contLen = sizeof(SDMStatusRsp) + TSDB_MAX_VNODES * sizeof(SDMVgroupAccess); SDMStatusRsp *pRsp = rpcMallocCont(contLen); @@ -554,7 +561,7 @@ static int32_t mgmtGetDnodeMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pCo pShow->rowSize = pShow->offset[cols - 1] + pShow->bytes[cols - 1]; pShow->pNode = NULL; - mgmtReleaseUser(pUser); + mgmtDecUserRef(pUser); return 0; } @@ -604,7 +611,7 @@ static int32_t mgmtRetrieveDnodes(SShowObj *pShow, char *data, int32_t rows, voi numOfRows++; - mgmtReleaseDnode(pDnode); + mgmtDecDnodeRef(pDnode); } pShow->numOfReads += numOfRows; @@ -661,7 +668,7 @@ static int32_t mgmtGetModuleMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pC pShow->numOfRows = mgmtGetDnodesNum() * TSDB_MOD_MAX; pShow->rowSize = pShow->offset[cols - 1] + pShow->bytes[cols - 1]; pShow->pNode = NULL; - mgmtReleaseUser(pUser); + mgmtDecUserRef(pUser); return 0; } @@ -712,7 +719,7 @@ int32_t mgmtRetrieveModules(SShowObj *pShow, char *data, int32_t rows, void *pCo numOfRows++; } - mgmtReleaseDnode(pDnode); + mgmtDecDnodeRef(pDnode); } pShow->numOfReads += numOfRows; @@ -762,7 +769,7 @@ static int32_t mgmtGetConfigMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pC pShow->rowSize = pShow->offset[cols - 1] + pShow->bytes[cols - 1]; pShow->pNode = NULL; - mgmtReleaseUser(pUser); + mgmtDecUserRef(pUser); return 0; } @@ -840,35 +847,18 @@ static int32_t mgmtGetVnodeMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pCo if (pShow->payloadLen > 0 ) { uint32_t ip = ip2uint(pShow->payload); pDnode = mgmtGetDnodeByIp(ip); - if (NULL == pDnode) { - return TSDB_CODE_NODE_OFFLINE; - } - - SVnodeLoad* pVnode; - pShow->numOfRows = 0; - for (int32_t i = 0 ; i < TSDB_MAX_VNODES; i++) { - pVnode = &pDnode->vload[i]; - if (0 != pVnode->vgId) { - pShow->numOfRows++; - } - } - - pShow->pNode = pDnode; } else { - while (true) { - pShow->pNode = mgmtGetNextDnode(pShow->pNode, (SDnodeObj **)&pDnode); - if (pDnode == NULL) break; - pShow->numOfRows += pDnode->openVnodes; - - if (0 == pShow->numOfRows) return TSDB_CODE_NODE_OFFLINE; - } + mgmtGetNextDnode(NULL, (SDnodeObj **)&pDnode); + } - pShow->pNode = NULL; - } + if (pDnode != NULL) { + pShow->numOfRows += pDnode->openVnodes; + mgmtDecDnodeRef(pDnode); + } pShow->rowSize = pShow->offset[cols - 1] + pShow->bytes[cols - 1]; - mgmtReleaseDnode(pDnode); - mgmtReleaseUser(pUser); + pShow->pNode = pDnode; + mgmtDecUserRef(pUser); return 0; } @@ -881,35 +871,35 @@ static int32_t mgmtRetrieveVnodes(SShowObj *pShow, char *data, int32_t rows, voi if (0 == rows) return 0; - if (pShow->payloadLen) { - // output the vnodes info of the designated dnode. And output all vnodes of this dnode, instead of rows (max 100) - pDnode = (SDnodeObj *)(pShow->pNode); - if (pDnode != NULL) { - SVnodeLoad* pVnode; - for (int32_t i = 0 ; i < TSDB_MAX_VNODES; i++) { - pVnode = &pDnode->vload[i]; - if (0 == pVnode->vgId) { - continue; + pDnode = (SDnodeObj *)(pShow->pNode); + if (pDnode != NULL) { + void *pNode = NULL; + SVgObj *pVgroup; + while (1) { + pNode = mgmtGetNextVgroup(pNode, &pVgroup); + if (pVgroup == NULL) break; + + for (int32_t i = 0; i < pVgroup->numOfVnodes; ++i) { + SVnodeGid *pVgid = &pVgroup->vnodeGid[i]; + if (pVgid->pDnode == pDnode) { + cols = 0; + + pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; + *(uint32_t *)pWrite = pVgroup->vgId; + cols++; + + pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; + strcpy(pWrite, mgmtGetMnodeRoleStr(pVgid->role)); + cols++; } - - cols = 0; - - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - *(uint32_t *)pWrite = pVnode->vgId; - cols++; - - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - strcpy(pWrite, pVnode->status ? "ready" : "offline"); - cols++; - - numOfRows++; } + + mgmtDecVgroupRef(pVgroup); } } else { - // TODO: output all vnodes of all dnodes numOfRows = 0; } - + pShow->numOfReads += numOfRows; return numOfRows; } diff --git a/src/mnode/src/mgmtMnode.c b/src/mnode/src/mgmtMnode.c index 05de2ecfdb7452be2dc7fbc1ecb3df54aa31635f..3eae218660713bacd03086a50c064889182f3957 100644 --- a/src/mnode/src/mgmtMnode.c +++ b/src/mnode/src/mgmtMnode.c @@ -47,7 +47,7 @@ static int32_t mgmtMnodeActionInsert(SSdbOper *pOper) { pMnode->pDnode = pDnode; pDnode->isMgmt = true; - mgmtReleaseDnode(pDnode); + mgmtDecDnodeRef(pDnode); return TSDB_CODE_SUCCESS; } @@ -58,7 +58,7 @@ static int32_t mgmtMnodeActionDelete(SSdbOper *pOper) { SDnodeObj *pDnode = mgmtGetDnode(pMnode->mnodeId); if (pDnode == NULL) return TSDB_CODE_DNODE_NOT_EXIST; pDnode->isMgmt = false; - mgmtReleaseDnode(pDnode); + mgmtDecDnodeRef(pDnode); mTrace("mnode:%d, is dropped from sdb", pMnode->mnodeId); return TSDB_CODE_SUCCESS; @@ -314,7 +314,7 @@ static int32_t mgmtGetMnodeMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pCo pShow->numOfRows = mgmtGetMnodesNum(); pShow->rowSize = pShow->offset[cols - 1] + pShow->bytes[cols - 1]; pShow->pNode = NULL; - mgmtReleaseUser(pUser); + mgmtDecUserRef(pUser); return 0; } diff --git a/src/mnode/src/mgmtProfile.c b/src/mnode/src/mgmtProfile.c index 1f557681ff209de9b9032267dd552978f40e274a..47bf805138870f78be40c6499e45c5f639a51300 100644 --- a/src/mnode/src/mgmtProfile.c +++ b/src/mnode/src/mgmtProfile.c @@ -790,12 +790,12 @@ void *mgmtMallocQueuedMsg(SRpcMsg *rpcMsg) { void mgmtFreeQueuedMsg(SQueuedMsg *pMsg) { if (pMsg != NULL) { rpcFreeCont(pMsg->pCont); - if (pMsg->pUser) mgmtReleaseUser(pMsg->pUser); + if (pMsg->pUser) mgmtDecUserRef(pMsg->pUser); if (pMsg->pDb) mgmtDecDbRef(pMsg->pDb); - if (pMsg->pVgroup) mgmtReleaseVgroup(pMsg->pVgroup); + if (pMsg->pVgroup) mgmtDecVgroupRef(pMsg->pVgroup); if (pMsg->pTable) mgmtDecTableRef(pMsg->pTable); if (pMsg->pAcct) mgmtDecAcctRef(pMsg->pAcct); - if (pMsg->pDnode) mgmtReleaseDnode(pMsg->pDnode); + if (pMsg->pDnode) mgmtDecDnodeRef(pMsg->pDnode); free(pMsg); } } diff --git a/src/mnode/src/mgmtShell.c b/src/mnode/src/mgmtShell.c index e2f393e6e9a3fc9edc1471f20129c081693a8482..54c66c5ba1bd2e23c35e05fa931246d76dc3172e 100644 --- a/src/mnode/src/mgmtShell.c +++ b/src/mnode/src/mgmtShell.c @@ -371,11 +371,11 @@ static int mgmtShellRetriveAuth(char *user, char *spi, char *encrypt, char *secr SUserObj *pUser = mgmtGetUser(user); if (pUser == NULL) { *secret = 0; - mgmtReleaseUser(pUser); + mgmtDecUserRef(pUser); return TSDB_CODE_INVALID_USER; } else { memcpy(secret, pUser->pass, TSDB_KEY_LEN); - mgmtReleaseUser(pUser); + mgmtDecUserRef(pUser); return TSDB_CODE_SUCCESS; } } diff --git a/src/mnode/src/mgmtTable.c b/src/mnode/src/mgmtTable.c index 20d845994389568fe0e749c4a9e5eba00c365c9e..1209b489d6ac7ec839b6465702c5fbc1f7e745d9 100644 --- a/src/mnode/src/mgmtTable.c +++ b/src/mnode/src/mgmtTable.c @@ -97,7 +97,7 @@ static int32_t mgmtChildTableActionInsert(SSdbOper *pOper) { mError("ctable:%s, not in vgroup:%d", pTable->info.tableId, pTable->vgId); return TSDB_CODE_INVALID_VGROUP_ID; } - mgmtReleaseVgroup(pVgroup); + mgmtDecVgroupRef(pVgroup); SDbObj *pDb = mgmtGetDb(pVgroup->dbName); if (pDb == NULL) { @@ -139,7 +139,7 @@ static int32_t mgmtChildTableActionDelete(SSdbOper *pOper) { if (pVgroup == NULL) { return TSDB_CODE_INVALID_VGROUP_ID; } - mgmtReleaseVgroup(pVgroup); + mgmtDecVgroupRef(pVgroup); SDbObj *pDb = mgmtGetDb(pVgroup->dbName); if (pDb == NULL) { @@ -275,7 +275,7 @@ static int32_t mgmtChildTableActionRestored() { pNode = pLastNode; continue; } - mgmtReleaseVgroup(pVgroup); + mgmtDecVgroupRef(pVgroup); if (strcmp(pVgroup->dbName, pDb->name) != 0) { mError("ctable:%s, db:%s not match with vgroup:%d db:%s sid:%d, discard it", @@ -1194,17 +1194,15 @@ static void mgmtProcessSuperTableVgroupMsg(SQueuedMsg *pMsg) { pRsp->vgroups[vg].vgId = htonl(vgId); for (int32_t vn = 0; vn < pVgroup->numOfVnodes; ++vn) { - SDnodeObj *pDnode = mgmtGetDnode(pVgroup->vnodeGid[vn].dnodeId); + SDnodeObj *pDnode = pVgroup->vnodeGid[vn].pDnode; if (pDnode == NULL) break; pRsp->vgroups[vg].ipAddr[vn].ip = htonl(pDnode->privateIp); pRsp->vgroups[vg].ipAddr[vn].port = htons(tsDnodeShellPort); pRsp->vgroups[vg].numOfIps++; - - mgmtReleaseDnode(pDnode); } - mgmtReleaseVgroup(pVgroup); + mgmtDecVgroupRef(pVgroup); } pRsp->numOfVgroups = htonl(vg); @@ -1613,7 +1611,7 @@ static int32_t mgmtDoGetChildTableMeta(SQueuedMsg *pMsg, STableMetaMsg *pMeta) { pMeta->vgroup.ipAddr[i].port = htonl(tsDnodeShellPort); } pMeta->vgroup.numOfIps++; - mgmtReleaseDnode(pDnode); + mgmtDecDnodeRef(pDnode); } pMeta->vgroup.vgId = htonl(pVgroup->vgId); @@ -1742,7 +1740,7 @@ static SChildTableObj* mgmtGetTableByPos(uint32_t dnodeId, int32_t vnode, int32_ SChildTableObj *pTable = pVgroup->tableList[sid]; mgmtIncTableRef((STableObj *)pTable); - mgmtReleaseVgroup(pVgroup); + mgmtDecVgroupRef(pVgroup); return pTable; } diff --git a/src/mnode/src/mgmtUser.c b/src/mnode/src/mgmtUser.c index fb65d61a3505da3c03b88ddba2fd211263dc8b7b..240704f9ecc149b5df44e3a0073b9f8c6411b493 100644 --- a/src/mnode/src/mgmtUser.c +++ b/src/mnode/src/mgmtUser.c @@ -150,7 +150,11 @@ SUserObj *mgmtGetUser(char *name) { return (SUserObj *)sdbGetRow(tsUserSdb, name); } -void mgmtReleaseUser(SUserObj *pUser) { +void mgmtIncUserRef(SUserObj *pUser) { + return sdbIncRef(tsUserSdb, pUser); +} + +void mgmtDecUserRef(SUserObj *pUser) { return sdbDecRef(tsUserSdb, pUser); } @@ -183,7 +187,7 @@ int32_t mgmtCreateUser(SAcctObj *pAcct, char *name, char *pass) { SUserObj *pUser = mgmtGetUser(name); if (pUser != NULL) { mTrace("user:%s is already there", name); - mgmtReleaseUser(pUser); + mgmtDecUserRef(pUser); return TSDB_CODE_USER_ALREADY_EXIST; } @@ -273,7 +277,7 @@ static int32_t mgmtGetUserMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pCon pShow->numOfRows = pUser->pAcct->acctInfo.numOfUsers; pShow->rowSize = pShow->offset[cols - 1] + pShow->bytes[cols - 1]; - mgmtReleaseUser(pUser); + mgmtDecUserRef(pUser); return 0; } @@ -308,7 +312,7 @@ static int32_t mgmtRetrieveUsers(SShowObj *pShow, char *data, int32_t rows, void cols++; numOfRows++; - mgmtReleaseUser(pUser); + mgmtDecUserRef(pUser); } pShow->numOfReads += numOfRows; return numOfRows; @@ -356,7 +360,7 @@ static void mgmtProcessAlterUserMsg(SQueuedMsg *pMsg) { if (strcmp(pUser->user, "monitor") == 0 || (strcmp(pUser->user + 1, pUser->acct) == 0 && pUser->user[0] == '_')) { mgmtSendSimpleResp(pMsg->thandle, TSDB_CODE_NO_RIGHTS); - mgmtReleaseUser(pUser); + mgmtDecUserRef(pUser); return; } @@ -432,7 +436,7 @@ static void mgmtProcessAlterUserMsg(SQueuedMsg *pMsg) { mgmtSendSimpleResp(pMsg->thandle, TSDB_CODE_NO_RIGHTS); } - mgmtReleaseUser(pUser); + mgmtDecUserRef(pUser); } static void mgmtProcessDropUserMsg(SQueuedMsg *pMsg) { @@ -449,7 +453,7 @@ static void mgmtProcessDropUserMsg(SQueuedMsg *pMsg) { if (strcmp(pUser->user, "monitor") == 0 || strcmp(pUser->user, pUser->acct) == 0 || (strcmp(pUser->user + 1, pUser->acct) == 0 && pUser->user[0] == '_')) { mgmtSendSimpleResp(pMsg->thandle, TSDB_CODE_NO_RIGHTS); - mgmtReleaseUser(pUser); + mgmtDecUserRef(pUser); return ; } @@ -478,7 +482,7 @@ static void mgmtProcessDropUserMsg(SQueuedMsg *pMsg) { } mgmtSendSimpleResp(pMsg->thandle, code); - mgmtReleaseUser(pUser); + mgmtDecUserRef(pUser); } void mgmtDropAllUsers(SAcctObj *pAcct) { @@ -504,7 +508,7 @@ void mgmtDropAllUsers(SAcctObj *pAcct) { numOfUsers++; } - mgmtReleaseUser(pUser); + mgmtDecUserRef(pUser); } mTrace("acct:%s, all users:%d is dropped from sdb", pAcct->user, numOfUsers); diff --git a/src/mnode/src/mgmtVgroup.c b/src/mnode/src/mgmtVgroup.c index 3ce4f41a5160de500fdf0edd5464afb46f528457..3bccf385f1fe324efe21c0099552869e16db4725 100644 --- a/src/mnode/src/mgmtVgroup.c +++ b/src/mnode/src/mgmtVgroup.c @@ -68,7 +68,6 @@ static int32_t mgmtVgroupActionInsert(SSdbOper *pOper) { if (pDb == NULL) { return TSDB_CODE_INVALID_DB; } - mgmtDecDbRef(pDb); pVgroup->pDb = pDb; pVgroup->prev = NULL; @@ -91,15 +90,13 @@ static int32_t mgmtVgroupActionInsert(SSdbOper *pOper) { for (int32_t i = 0; i < pVgroup->numOfVnodes; ++i) { SDnodeObj *pDnode = mgmtGetDnode(pVgroup->vnodeGid[i].dnodeId); if (pDnode != NULL) { - pVgroup->vnodeGid[i].privateIp = pDnode->privateIp; - pVgroup->vnodeGid[i].publicIp = pDnode->publicIp; - atomic_add_fetch_32(&pDnode->openVnodes, 1); - mgmtReleaseDnode(pDnode); - } + pVgroup->vnodeGid[i].pDnode = pDnode; + atomic_add_fetch_32(&pDnode->openVnodes, 1); + mgmtDecDnodeRef(pDnode); + } } mgmtAddVgroupIntoDb(pVgroup); - mgmtIncDbRef(pVgroup->pDb); return TSDB_CODE_SUCCESS; } @@ -115,10 +112,10 @@ static int32_t mgmtVgroupActionDelete(SSdbOper *pOper) { for (int32_t i = 0; i < pVgroup->numOfVnodes; ++i) { SDnodeObj *pDnode = mgmtGetDnode(pVgroup->vnodeGid[i].dnodeId); - if (pDnode) { + if (pDnode != NULL) { atomic_sub_fetch_32(&pDnode->openVnodes, 1); } - mgmtReleaseDnode(pDnode); + mgmtDecDnodeRef(pDnode); } return TSDB_CODE_SUCCESS; @@ -150,6 +147,12 @@ static int32_t mgmtVgroupActionUpdate(SSdbOper *pOper) { static int32_t mgmtVgroupActionEncode(SSdbOper *pOper) { SVgObj *pVgroup = pOper->pObj; memcpy(pOper->rowData, pVgroup, tsVgUpdateSize); + SVgObj *pTmpVgroup = pOper->rowData; + for (int32_t i = 0; i < TSDB_VNODES_SUPPORT; ++i) { + pTmpVgroup->vnodeGid[i].pDnode = NULL; + pTmpVgroup->vnodeGid[i].role = 0; + } + pOper->rowSize = tsVgUpdateSize; return TSDB_CODE_SUCCESS; } @@ -204,7 +207,11 @@ int32_t mgmtInitVgroups() { return 0; } -void mgmtReleaseVgroup(SVgObj *pVgroup) { +void mgmtIncVgroupRef(SVgObj *pVgroup) { + return sdbIncRef(tsVgroupSdb, pVgroup); +} + +void mgmtDecVgroupRef(SVgObj *pVgroup) { return sdbDecRef(tsVgroupSdb, pVgroup); } @@ -224,14 +231,15 @@ void mgmtUpdateVgroup(SVgObj *pVgroup) { mgmtSendCreateVgroupMsg(pVgroup, NULL); } -void mgmtUpdateVgroupStatus(SVgObj *pVgroup, int32_t dnodeId, SVnodeLoad *pVload) { - if (pVload->role == TAOS_SYNC_ROLE_MASTER) { - for (int32_t i = 0; i < pVgroup->numOfVnodes; ++i) { - SVnodeGid *pVgid = &pVgroup->vnodeGid[i]; - if (pVgid->dnodeId == dnodeId) { +void mgmtUpdateVgroupStatus(SVgObj *pVgroup, SDnodeObj *pDnode, SVnodeLoad *pVload) { + for (int32_t i = 0; i < pVgroup->numOfVnodes; ++i) { + SVnodeGid *pVgid = &pVgroup->vnodeGid[i]; + if (pVgid->pDnode == pDnode) { + pVgid->role = pVload->role; + if (pVload->role == TAOS_SYNC_ROLE_MASTER) { pVgroup->inUse = i; - break; } + break; } } } @@ -340,7 +348,7 @@ int32_t mgmtGetVgroupMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn) { mgmtDecTableRef(pTable); pVgroup = mgmtGetVgroup(((SChildTableObj*)pTable)->vgId); if (NULL == pVgroup) return TSDB_CODE_INVALID_TABLE_ID; - mgmtReleaseVgroup(pVgroup); + mgmtDecVgroupRef(pVgroup); maxReplica = pVgroup->numOfVnodes > maxReplica ? pVgroup->numOfVnodes : maxReplica; } else { SVgObj *pVgroup = pDb->pHead; @@ -391,27 +399,6 @@ int32_t mgmtGetVgroupMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn) { return 0; } -char *mgmtGetVnodeStatus(SVgObj *pVgroup, SVnodeGid *pVnode) { - SDnodeObj *pDnode = mgmtGetDnode(pVnode->dnodeId); - if (pDnode == NULL) { - mError("vgroup:%d, not exist in dnode:%d", pVgroup->vgId, pDnode->dnodeId); - return "null"; - } - mgmtReleaseDnode(pDnode); - - if (pDnode->status == TAOS_DN_STATUS_OFFLINE) { - return "offline"; - } - - for (int i = 0; i < pDnode->openVnodes; ++i) { - if (pDnode->vload[i].vgId == pVgroup->vgId) { - return pDnode->vload[i].status ? "ready" : "offline"; - } - } - - return "null"; -} - int32_t mgmtRetrieveVgroups(SShowObj *pShow, char *data, int32_t rows, void *pConn) { int32_t numOfRows = 0; SVgObj *pVgroup = NULL; @@ -453,19 +440,24 @@ int32_t mgmtRetrieveVgroups(SShowObj *pShow, char *data, int32_t rows, void *pCo *(int16_t *) pWrite = pVgroup->vnodeGid[i].dnodeId; cols++; - tinet_ntoa(ipstr, pVgroup->vnodeGid[i].privateIp); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - strcpy(pWrite, ipstr); - cols++; + SDnodeObj *pDnode = pVgroup->vnodeGid[i].pDnode; - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - if (pVgroup->vnodeGid[i].dnodeId != 0) { - char *vnodeStatus = mgmtGetVnodeStatus(pVgroup, pVgroup->vnodeGid + i); - strcpy(pWrite, vnodeStatus); + if (pDnode != NULL) { + tinet_ntoa(ipstr, pDnode->privateIp); + pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; + strcpy(pWrite, ipstr); + cols++; + pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; + strcpy(pWrite, mgmtGetMnodeRoleStr(pVgroup->vnodeGid[i].role)); + cols++; } else { + pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; + strcpy(pWrite, "null"); + cols++; + pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; strcpy(pWrite, "null"); + cols++; } - cols++; } numOfRows++; @@ -526,16 +518,17 @@ SMDCreateVnodeMsg *mgmtBuildCreateVnodeMsg(SVgObj *pVgroup) { pCfg->commitLog = pDb->cfg.commitLog; pCfg->replications = (int8_t) pVgroup->numOfVnodes; pCfg->quorum = 1; - pCfg->arbitratorIp = htonl(pVgroup->vnodeGid[0].privateIp); - + SMDVnodeDesc *pNodes = pVnode->nodes; for (int32_t j = 0; j < pVgroup->numOfVnodes; ++j) { - SDnodeObj *pDnode = mgmtGetDnode(pVgroup->vnodeGid[j].dnodeId); + SDnodeObj *pDnode = pVgroup->vnodeGid[0].pDnode; if (pDnode != NULL) { pNodes[j].nodeId = htonl(pDnode->dnodeId); pNodes[j].nodeIp = htonl(pDnode->privateIp); strcpy(pNodes[j].nodeName, pDnode->dnodeName); - mgmtReleaseDnode(pDnode); + if (j == 0) { + pCfg->arbitratorIp = htonl(pDnode->privateIp); + } } } @@ -549,7 +542,7 @@ SRpcIpSet mgmtGetIpSetFromVgroup(SVgObj *pVgroup) { .port = tsDnodeMnodePort }; for (int i = 0; i < pVgroup->numOfVnodes; ++i) { - ipSet.ip[i] = pVgroup->vnodeGid[i].privateIp; + ipSet.ip[i] = pVgroup->vnodeGid[i].pDnode->privateIp; } return ipSet; } @@ -580,7 +573,7 @@ void mgmtSendCreateVnodeMsg(SVgObj *pVgroup, SRpcIpSet *ipSet, void *ahandle) { void mgmtSendCreateVgroupMsg(SVgObj *pVgroup, void *ahandle) { mTrace("vgroup:%d, send create all vnodes msg, ahandle:%p", pVgroup->vgId, ahandle); for (int32_t i = 0; i < pVgroup->numOfVnodes; ++i) { - SRpcIpSet ipSet = mgmtGetIpSetFromIp(pVgroup->vnodeGid[i].privateIp); + SRpcIpSet ipSet = mgmtGetIpSetFromIp(pVgroup->vnodeGid[i].pDnode->privateIp); mgmtSendCreateVnodeMsg(pVgroup, &ipSet, ahandle); } } @@ -646,7 +639,7 @@ void mgmtSendDropVnodeMsg(int32_t vgId, SRpcIpSet *ipSet, void *ahandle) { static void mgmtSendDropVgroupMsg(SVgObj *pVgroup, void *ahandle) { mTrace("vgroup:%d, send drop all vnodes msg, ahandle:%p", pVgroup->vgId, ahandle); for (int32_t i = 0; i < pVgroup->numOfVnodes; ++i) { - SRpcIpSet ipSet = mgmtGetIpSetFromIp(pVgroup->vnodeGid[i].privateIp); + SRpcIpSet ipSet = mgmtGetIpSetFromIp(pVgroup->vnodeGid[i].pDnode->privateIp); mgmtSendDropVnodeMsg(pVgroup->vgId, &ipSet, ahandle); } } @@ -697,7 +690,7 @@ static void mgmtProcessVnodeCfgMsg(SRpcMsg *rpcMsg) { mgmtSendSimpleResp(rpcMsg->handle, TSDB_CODE_NOT_ACTIVE_VNODE); return; } - mgmtReleaseDnode(pDnode); + mgmtDecDnodeRef(pDnode); SVgObj *pVgroup = mgmtGetVgroup(pCfg->vgId); if (pVgroup == NULL) { @@ -705,7 +698,7 @@ static void mgmtProcessVnodeCfgMsg(SRpcMsg *rpcMsg) { mgmtSendSimpleResp(rpcMsg->handle, TSDB_CODE_NOT_ACTIVE_VNODE); return; } - mgmtReleaseVgroup(pVgroup); + mgmtDecVgroupRef(pVgroup); mgmtSendSimpleResp(rpcMsg->handle, TSDB_CODE_SUCCESS); @@ -721,7 +714,7 @@ void mgmtDropAllVgroups(SDbObj *pDropDb) { SVgObj *pVgroup = NULL; while (1) { - mgmtReleaseVgroup(pVgroup); + mgmtDecVgroupRef(pVgroup); pNode = sdbFetchRow(tsVgroupSdb, pNode, (void **)&pVgroup); if (pVgroup == NULL) break; diff --git a/src/vnode/src/vnodeMain.c b/src/vnode/src/vnodeMain.c index 029d4c8c84b350dc695cd5d7abf1d46fc0ef3182..261be8e5f0ef76ee8db551a53eae6d1b20a02cf1 100644 --- a/src/vnode/src/vnodeMain.c +++ b/src/vnode/src/vnodeMain.c @@ -408,82 +408,82 @@ static int32_t vnodeReadCfg(SVnodeObj *pVnode) { if (len <= 0) { free(content); fclose(fp); - dError("pVnode:%p vgId:%d, failed to vnode cfg, content is null", pVnode, pVnode->vgId); + dError("pVnode:%p vgId:%d, failed to read vnode cfg, content is null", pVnode, pVnode->vgId); return false; } cJSON *root = cJSON_Parse(content); if (root == NULL) { - dError("pVnode:%p vgId:%d, failed to vnode cfg, invalid json format", pVnode, pVnode->vgId); + dError("pVnode:%p vgId:%d, failed to read vnode cfg, invalid json format", pVnode, pVnode->vgId); goto PARSE_OVER; } cJSON *precision = cJSON_GetObjectItem(root, "precision"); if (!precision || precision->type != cJSON_Number) { - dError("pVnode:%p vgId:%d, failed to vnode cfg, precision not found", pVnode, pVnode->vgId); + dError("pVnode:%p vgId:%d, failed to read vnode cfg, precision not found", pVnode, pVnode->vgId); goto PARSE_OVER; } pVnode->tsdbCfg.precision = (int8_t)precision->valueint; cJSON *compression = cJSON_GetObjectItem(root, "compression"); if (!compression || compression->type != cJSON_Number) { - dError("pVnode:%p vgId:%d, failed to vnode cfg, compression not found", pVnode, pVnode->vgId); + dError("pVnode:%p vgId:%d, failed to read vnode cfg, compression not found", pVnode, pVnode->vgId); goto PARSE_OVER; } pVnode->tsdbCfg.compression = (int8_t)compression->valueint; cJSON *maxTables = cJSON_GetObjectItem(root, "maxTables"); if (!maxTables || maxTables->type != cJSON_Number) { - dError("pVnode:%p vgId:%d, failed to vnode cfg, maxTables not found", pVnode, pVnode->vgId); + dError("pVnode:%p vgId:%d, failed to read vnode cfg, maxTables not found", pVnode, pVnode->vgId); goto PARSE_OVER; } pVnode->tsdbCfg.maxTables = maxTables->valueint; cJSON *daysPerFile = cJSON_GetObjectItem(root, "daysPerFile"); if (!daysPerFile || daysPerFile->type != cJSON_Number) { - dError("pVnode:%p vgId:%d, failed to vnode cfg, daysPerFile not found", pVnode, pVnode->vgId); + dError("pVnode:%p vgId:%d, failed to read vnode cfg, daysPerFile not found", pVnode, pVnode->vgId); goto PARSE_OVER; } pVnode->tsdbCfg.daysPerFile = daysPerFile->valueint; cJSON *minRowsPerFileBlock = cJSON_GetObjectItem(root, "minRowsPerFileBlock"); if (!minRowsPerFileBlock || minRowsPerFileBlock->type != cJSON_Number) { - dError("pVnode:%p vgId:%d, failed to vnode cfg, minRowsPerFileBlock not found", pVnode, pVnode->vgId); + dError("pVnode:%p vgId:%d, failed to read vnode cfg, minRowsPerFileBlock not found", pVnode, pVnode->vgId); goto PARSE_OVER; } pVnode->tsdbCfg.minRowsPerFileBlock = minRowsPerFileBlock->valueint; cJSON *maxRowsPerFileBlock = cJSON_GetObjectItem(root, "maxRowsPerFileBlock"); if (!maxRowsPerFileBlock || maxRowsPerFileBlock->type != cJSON_Number) { - dError("pVnode:%p vgId:%d, failed to vnode cfg, maxRowsPerFileBlock not found", pVnode, pVnode->vgId); + dError("pVnode:%p vgId:%d, failed to read vnode cfg, maxRowsPerFileBlock not found", pVnode, pVnode->vgId); goto PARSE_OVER; } pVnode->tsdbCfg.maxRowsPerFileBlock = maxRowsPerFileBlock->valueint; - cJSON *keep = cJSON_GetObjectItem(root, "keep"); - if (!keep || keep->type != cJSON_Number) { - dError("pVnode:%p vgId:%d, failed to vnode cfg, keep not found", pVnode, pVnode->vgId); + cJSON *daysToKeep = cJSON_GetObjectItem(root, "daysToKeep"); + if (!daysToKeep || daysToKeep->type != cJSON_Number) { + dError("pVnode:%p vgId:%d, failed to read vnode cfg, daysToKeep not found", pVnode, pVnode->vgId); goto PARSE_OVER; } - pVnode->tsdbCfg.keep = keep->valueint; + pVnode->tsdbCfg.keep = daysToKeep->valueint; cJSON *maxCacheSize = cJSON_GetObjectItem(root, "maxCacheSize"); if (!maxCacheSize || maxCacheSize->type != cJSON_Number) { - dError("pVnode:%p vgId:%d, failed to vnode cfg, maxCacheSize not found", pVnode, pVnode->vgId); + dError("pVnode:%p vgId:%d, failed to read vnode cfg, maxCacheSize not found", pVnode, pVnode->vgId); goto PARSE_OVER; } pVnode->tsdbCfg.maxCacheSize = maxCacheSize->valueint; cJSON *commitLog = cJSON_GetObjectItem(root, "commitLog"); if (!commitLog || commitLog->type != cJSON_Number) { - dError("pVnode:%p vgId:%d, failed to vnode cfg, commitLog not found", pVnode, pVnode->vgId); + dError("pVnode:%p vgId:%d, failed to read vnode cfg, commitLog not found", pVnode, pVnode->vgId); goto PARSE_OVER; } pVnode->walCfg.commitLog = (int8_t)commitLog->valueint; cJSON *wals = cJSON_GetObjectItem(root, "wals"); if (!wals || wals->type != cJSON_Number) { - dError("pVnode:%p vgId:%d, failed to vnode cfg, wals not found", pVnode, pVnode->vgId); + dError("pVnode:%p vgId:%d, failed to read vnode cfg, wals not found", pVnode, pVnode->vgId); goto PARSE_OVER; } pVnode->walCfg.wals = (int8_t)wals->valueint; @@ -491,34 +491,34 @@ static int32_t vnodeReadCfg(SVnodeObj *pVnode) { cJSON *arbitratorIp = cJSON_GetObjectItem(root, "arbitratorIp"); if (!arbitratorIp || arbitratorIp->type != cJSON_String || arbitratorIp->valuestring == NULL) { - dError("pVnode:%p vgId:%d, failed to vnode cfg, arbitratorIp not found", pVnode, pVnode->vgId); + dError("pVnode:%p vgId:%d, failed to read vnode cfg, arbitratorIp not found", pVnode, pVnode->vgId); goto PARSE_OVER; } pVnode->syncCfg.arbitratorIp = inet_addr(arbitratorIp->valuestring); cJSON *quorum = cJSON_GetObjectItem(root, "quorum"); if (!quorum || quorum->type != cJSON_Number) { - dError("failed to vnode cfg, quorum not found", pVnode, pVnode->vgId); + dError("failed to read vnode cfg, quorum not found", pVnode, pVnode->vgId); goto PARSE_OVER; } pVnode->syncCfg.quorum = (int8_t)quorum->valueint; cJSON *replica = cJSON_GetObjectItem(root, "replica"); if (!replica || replica->type != cJSON_Number) { - dError("pVnode:%p vgId:%d, failed to vnode cfg, replica not found", pVnode, pVnode->vgId); + dError("pVnode:%p vgId:%d, failed to read vnode cfg, replica not found", pVnode, pVnode->vgId); goto PARSE_OVER; } pVnode->syncCfg.replica = (int8_t)replica->valueint; cJSON *nodeInfos = cJSON_GetObjectItem(root, "nodeInfos"); if (!nodeInfos || nodeInfos->type != cJSON_Array) { - dError("pVnode:%p vgId:%d, failed to vnode cfg, nodeInfos not found", pVnode, pVnode->vgId); + dError("pVnode:%p vgId:%d, failed to read vnode cfg, nodeInfos not found", pVnode, pVnode->vgId); goto PARSE_OVER; } int size = cJSON_GetArraySize(nodeInfos); if (size != pVnode->syncCfg.replica) { - dError("pVnode:%p vgId:%d, failed to vnode cfg, nodeInfos size not matched", pVnode, pVnode->vgId); + dError("pVnode:%p vgId:%d, failed to read vnode cfg, nodeInfos size not matched", pVnode, pVnode->vgId); goto PARSE_OVER; } @@ -528,21 +528,21 @@ static int32_t vnodeReadCfg(SVnodeObj *pVnode) { cJSON *nodeId = cJSON_GetObjectItem(nodeInfo, "nodeId"); if (!nodeId || nodeId->type != cJSON_Number) { - dError("pVnode:%p vgId:%d, failed to vnode cfg, nodeId not found", pVnode, pVnode->vgId); + dError("pVnode:%p vgId:%d, failed to read vnode cfg, nodeId not found", pVnode, pVnode->vgId); goto PARSE_OVER; } pVnode->syncCfg.nodeInfo[i].nodeId = nodeId->valueint; cJSON *nodeIp = cJSON_GetObjectItem(nodeInfo, "nodeIp"); if (!nodeIp || nodeIp->type != cJSON_String || nodeIp->valuestring == NULL) { - dError("pVnode:%p vgId:%d, failed to vnode cfg, nodeIp not found", pVnode, pVnode->vgId); + dError("pVnode:%p vgId:%d, failed to read vnode cfg, nodeIp not found", pVnode, pVnode->vgId); goto PARSE_OVER; } pVnode->syncCfg.nodeInfo[i].nodeIp = inet_addr(nodeIp->valuestring); cJSON *nodeName = cJSON_GetObjectItem(nodeInfo, "nodeName"); if (!nodeName || nodeName->type != cJSON_String || nodeName->valuestring == NULL) { - dError("pVnode:%p vgId:%d, failed to vnode cfg, nodeName not found", pVnode, pVnode->vgId); + dError("pVnode:%p vgId:%d, failed to read vnode cfg, nodeName not found", pVnode, pVnode->vgId); goto PARSE_OVER; } strncpy(pVnode->syncCfg.nodeInfo[i].name, nodeName->valuestring, TSDB_NODE_NAME_LEN);