remove void in mndMnode.c
This commit is contained in:
parent
f0ee4100b8
commit
8f3f494282
|
@ -14,10 +14,10 @@
|
|||
*/
|
||||
|
||||
#define _DEFAULT_SOURCE
|
||||
#include "mndMnode.h"
|
||||
#include "audit.h"
|
||||
#include "mndCluster.h"
|
||||
#include "mndDnode.h"
|
||||
#include "mndMnode.h"
|
||||
#include "mndPrivilege.h"
|
||||
#include "mndShow.h"
|
||||
#include "mndSync.h"
|
||||
|
@ -114,7 +114,7 @@ static int32_t mndCreateDefaultMnode(SMnode *pMnode) {
|
|||
mndTransDrop(pTrans);
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
(void)sdbSetRawStatus(pRaw, SDB_STATUS_READY);
|
||||
TAOS_CHECK_RETURN(sdbSetRawStatus(pRaw, SDB_STATUS_READY));
|
||||
|
||||
if ((code = mndTransPrepare(pMnode, pTrans)) != 0) {
|
||||
mError("trans:%d, failed to prepare since %s", pTrans->id, terrstr());
|
||||
|
@ -270,7 +270,8 @@ void mndGetMnodeEpSet(SMnode *pMnode, SEpSet *pEpSet) {
|
|||
}
|
||||
}
|
||||
if (pObj->pDnode != NULL) {
|
||||
(void)addEpIntoEpSet(pEpSet, pObj->pDnode->fqdn, pObj->pDnode->port);
|
||||
if (addEpIntoEpSet(pEpSet, pObj->pDnode->fqdn, pObj->pDnode->port) != 0) {
|
||||
mError("mnode:%d, failed to add ep:%s:%d into epset", pObj->id, pObj->pDnode->fqdn, pObj->pDnode->port);
|
||||
}
|
||||
sdbRelease(pSdb, pObj);
|
||||
}
|
||||
|
@ -283,9 +284,9 @@ void mndGetMnodeEpSet(SMnode *pMnode, SEpSet *pEpSet) {
|
|||
pEpSet->inUse = 0;
|
||||
}
|
||||
epsetSort(pEpSet);
|
||||
}
|
||||
}
|
||||
|
||||
static int32_t mndSetCreateMnodeRedoLogs(SMnode *pMnode, STrans *pTrans, SMnodeObj *pObj) {
|
||||
static int32_t mndSetCreateMnodeRedoLogs(SMnode * pMnode, STrans * pTrans, SMnodeObj * pObj) {
|
||||
int32_t code = 0;
|
||||
SSdbRaw *pRedoRaw = mndMnodeActionEncode(pObj);
|
||||
if (pRedoRaw == NULL) {
|
||||
|
@ -296,9 +297,9 @@ static int32_t mndSetCreateMnodeRedoLogs(SMnode *pMnode, STrans *pTrans, SMnodeO
|
|||
TAOS_CHECK_RETURN(mndTransAppendRedolog(pTrans, pRedoRaw));
|
||||
TAOS_CHECK_RETURN(sdbSetRawStatus(pRedoRaw, SDB_STATUS_CREATING));
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
}
|
||||
|
||||
int32_t mndSetRestoreCreateMnodeRedoLogs(SMnode *pMnode, STrans *pTrans, SMnodeObj *pObj) {
|
||||
int32_t mndSetRestoreCreateMnodeRedoLogs(SMnode * pMnode, STrans * pTrans, SMnodeObj * pObj) {
|
||||
int32_t code = 0;
|
||||
SSdbRaw *pRedoRaw = mndMnodeActionEncode(pObj);
|
||||
if (pRedoRaw == NULL) {
|
||||
|
@ -309,9 +310,9 @@ int32_t mndSetRestoreCreateMnodeRedoLogs(SMnode *pMnode, STrans *pTrans, SMnodeO
|
|||
TAOS_CHECK_RETURN(mndTransAppendRedolog(pTrans, pRedoRaw));
|
||||
TAOS_CHECK_RETURN(sdbSetRawStatus(pRedoRaw, SDB_STATUS_READY));
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
}
|
||||
|
||||
static int32_t mndSetCreateMnodeUndoLogs(SMnode *pMnode, STrans *pTrans, SMnodeObj *pObj) {
|
||||
static int32_t mndSetCreateMnodeUndoLogs(SMnode * pMnode, STrans * pTrans, SMnodeObj * pObj) {
|
||||
int32_t code = 0;
|
||||
SSdbRaw *pUndoRaw = mndMnodeActionEncode(pObj);
|
||||
if (pUndoRaw == NULL) {
|
||||
|
@ -322,9 +323,9 @@ static int32_t mndSetCreateMnodeUndoLogs(SMnode *pMnode, STrans *pTrans, SMnodeO
|
|||
TAOS_CHECK_RETURN(mndTransAppendUndolog(pTrans, pUndoRaw));
|
||||
TAOS_CHECK_RETURN(sdbSetRawStatus(pUndoRaw, SDB_STATUS_DROPPED));
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
}
|
||||
|
||||
int32_t mndSetCreateMnodeCommitLogs(SMnode *pMnode, STrans *pTrans, SMnodeObj *pObj) {
|
||||
int32_t mndSetCreateMnodeCommitLogs(SMnode * pMnode, STrans * pTrans, SMnodeObj * pObj) {
|
||||
int32_t code = 0;
|
||||
SSdbRaw *pCommitRaw = mndMnodeActionEncode(pObj);
|
||||
if (pCommitRaw == NULL) {
|
||||
|
@ -335,13 +336,17 @@ int32_t mndSetCreateMnodeCommitLogs(SMnode *pMnode, STrans *pTrans, SMnodeObj *p
|
|||
TAOS_CHECK_RETURN(mndTransAppendCommitlog(pTrans, pCommitRaw));
|
||||
TAOS_CHECK_RETURN(sdbSetRawStatus(pCommitRaw, SDB_STATUS_READY));
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
}
|
||||
|
||||
static int32_t mndBuildCreateMnodeRedoAction(STrans *pTrans, SDCreateMnodeReq *pCreateReq, SEpSet *pCreateEpSet) {
|
||||
static int32_t mndBuildCreateMnodeRedoAction(STrans * pTrans, SDCreateMnodeReq * pCreateReq, SEpSet * pCreateEpSet) {
|
||||
int32_t code = 0;
|
||||
int32_t contLen = tSerializeSDCreateMnodeReq(NULL, 0, pCreateReq);
|
||||
void *pReq = taosMemoryMalloc(contLen);
|
||||
(void)tSerializeSDCreateMnodeReq(pReq, contLen, pCreateReq);
|
||||
code = tSerializeSDCreateMnodeReq(pReq, contLen, pCreateReq);
|
||||
if (code < 0) {
|
||||
taosMemoryFree(pReq);
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
|
||||
STransAction action = {
|
||||
.epSet = *pCreateEpSet,
|
||||
|
@ -356,14 +361,18 @@ static int32_t mndBuildCreateMnodeRedoAction(STrans *pTrans, SDCreateMnodeReq *p
|
|||
TAOS_RETURN(code);
|
||||
}
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
}
|
||||
|
||||
static int32_t mndBuildAlterMnodeTypeRedoAction(STrans *pTrans, SDAlterMnodeTypeReq *pAlterMnodeTypeReq,
|
||||
SEpSet *pAlterMnodeTypeEpSet) {
|
||||
static int32_t mndBuildAlterMnodeTypeRedoAction(STrans * pTrans, SDAlterMnodeTypeReq * pAlterMnodeTypeReq,
|
||||
SEpSet * pAlterMnodeTypeEpSet) {
|
||||
int32_t code = 0;
|
||||
int32_t contLen = tSerializeSDCreateMnodeReq(NULL, 0, pAlterMnodeTypeReq);
|
||||
void *pReq = taosMemoryMalloc(contLen);
|
||||
(void)tSerializeSDCreateMnodeReq(pReq, contLen, pAlterMnodeTypeReq);
|
||||
code = tSerializeSDCreateMnodeReq(pReq, contLen, pAlterMnodeTypeReq);
|
||||
if (code < 0) {
|
||||
taosMemoryFree(pReq);
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
|
||||
STransAction action = {
|
||||
.epSet = *pAlterMnodeTypeEpSet,
|
||||
|
@ -379,14 +388,17 @@ static int32_t mndBuildAlterMnodeTypeRedoAction(STrans *pTrans, SDAlterMnodeType
|
|||
TAOS_RETURN(code);
|
||||
}
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
}
|
||||
|
||||
static int32_t mndBuildAlterMnodeRedoAction(STrans *pTrans, SDCreateMnodeReq *pAlterReq, SEpSet *pAlterEpSet) {
|
||||
static int32_t mndBuildAlterMnodeRedoAction(STrans * pTrans, SDCreateMnodeReq * pAlterReq, SEpSet * pAlterEpSet) {
|
||||
int32_t code = 0;
|
||||
int32_t contLen = tSerializeSDCreateMnodeReq(NULL, 0, pAlterReq);
|
||||
void *pReq = taosMemoryMalloc(contLen);
|
||||
(void)tSerializeSDCreateMnodeReq(pReq, contLen, pAlterReq);
|
||||
|
||||
code = tSerializeSDCreateMnodeReq(pReq, contLen, pAlterReq);
|
||||
if (code < 0) {
|
||||
taosMemoryFree(pReq);
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
STransAction action = {
|
||||
.epSet = *pAlterEpSet,
|
||||
.pCont = pReq,
|
||||
|
@ -401,13 +413,17 @@ static int32_t mndBuildAlterMnodeRedoAction(STrans *pTrans, SDCreateMnodeReq *pA
|
|||
}
|
||||
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
}
|
||||
|
||||
static int32_t mndBuildDropMnodeRedoAction(STrans *pTrans, SDDropMnodeReq *pDropReq, SEpSet *pDroprEpSet) {
|
||||
static int32_t mndBuildDropMnodeRedoAction(STrans * pTrans, SDDropMnodeReq * pDropReq, SEpSet * pDroprEpSet) {
|
||||
int32_t code = 0;
|
||||
int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, pDropReq);
|
||||
void *pReq = taosMemoryMalloc(contLen);
|
||||
(void)tSerializeSCreateDropMQSNodeReq(pReq, contLen, pDropReq);
|
||||
code = tSerializeSCreateDropMQSNodeReq(pReq, contLen, pDropReq);
|
||||
if (code < 0) {
|
||||
taosMemoryFree(pReq);
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
|
||||
STransAction action = {
|
||||
.epSet = *pDroprEpSet,
|
||||
|
@ -422,9 +438,9 @@ static int32_t mndBuildDropMnodeRedoAction(STrans *pTrans, SDDropMnodeReq *pDrop
|
|||
TAOS_RETURN(code);
|
||||
}
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
}
|
||||
|
||||
static int32_t mndSetCreateMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDnodeObj *pDnode, SMnodeObj *pObj) {
|
||||
static int32_t mndSetCreateMnodeRedoActions(SMnode * pMnode, STrans * pTrans, SDnodeObj * pDnode, SMnodeObj * pObj) {
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
void *pIter = NULL;
|
||||
int32_t numOfReplicas = 0;
|
||||
|
@ -468,9 +484,9 @@ static int32_t mndSetCreateMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDno
|
|||
TAOS_CHECK_RETURN(mndBuildCreateMnodeRedoAction(pTrans, &createReq, &createEpset));
|
||||
|
||||
TAOS_RETURN(0);
|
||||
}
|
||||
}
|
||||
|
||||
int32_t mndSetRestoreCreateMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDnodeObj *pDnode, SMnodeObj *pObj) {
|
||||
int32_t mndSetRestoreCreateMnodeRedoActions(SMnode * pMnode, STrans * pTrans, SDnodeObj * pDnode, SMnodeObj * pObj) {
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
void *pIter = NULL;
|
||||
SDCreateMnodeReq createReq = {0};
|
||||
|
@ -516,9 +532,10 @@ int32_t mndSetRestoreCreateMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDno
|
|||
TAOS_CHECK_RETURN(mndBuildCreateMnodeRedoAction(pTrans, &createReq, &createEpset));
|
||||
|
||||
TAOS_RETURN(0);
|
||||
}
|
||||
}
|
||||
|
||||
static int32_t mndSetAlterMnodeTypeRedoActions(SMnode *pMnode, STrans *pTrans, SDnodeObj *pDnode, SMnodeObj *pObj) {
|
||||
static int32_t mndSetAlterMnodeTypeRedoActions(SMnode * pMnode, STrans * pTrans, SDnodeObj * pDnode,
|
||||
SMnodeObj * pObj) {
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
void *pIter = NULL;
|
||||
SDAlterMnodeTypeReq alterReq = {0};
|
||||
|
@ -559,9 +576,10 @@ static int32_t mndSetAlterMnodeTypeRedoActions(SMnode *pMnode, STrans *pTrans, S
|
|||
TAOS_CHECK_RETURN(mndBuildAlterMnodeTypeRedoAction(pTrans, &alterReq, &createEpset));
|
||||
|
||||
TAOS_RETURN(0);
|
||||
}
|
||||
}
|
||||
|
||||
int32_t mndSetRestoreAlterMnodeTypeRedoActions(SMnode *pMnode, STrans *pTrans, SDnodeObj *pDnode, SMnodeObj *pObj) {
|
||||
int32_t mndSetRestoreAlterMnodeTypeRedoActions(SMnode * pMnode, STrans * pTrans, SDnodeObj * pDnode,
|
||||
SMnodeObj * pObj) {
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
void *pIter = NULL;
|
||||
SDAlterMnodeTypeReq alterReq = {0};
|
||||
|
@ -607,9 +625,9 @@ int32_t mndSetRestoreAlterMnodeTypeRedoActions(SMnode *pMnode, STrans *pTrans, S
|
|||
TAOS_CHECK_RETURN(mndBuildAlterMnodeTypeRedoAction(pTrans, &alterReq, &createEpset));
|
||||
|
||||
TAOS_RETURN(0);
|
||||
}
|
||||
}
|
||||
|
||||
static int32_t mndCreateMnode(SMnode *pMnode, SRpcMsg *pReq, SDnodeObj *pDnode, SMCreateMnodeReq *pCreate) {
|
||||
static int32_t mndCreateMnode(SMnode * pMnode, SRpcMsg * pReq, SDnodeObj * pDnode, SMCreateMnodeReq * pCreate) {
|
||||
int32_t code = -1;
|
||||
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, pReq, "create-mnode");
|
||||
|
@ -645,12 +663,12 @@ static int32_t mndCreateMnode(SMnode *pMnode, SRpcMsg *pReq, SDnodeObj *pDnode,
|
|||
|
||||
code = 0;
|
||||
|
||||
_OVER:
|
||||
_OVER:
|
||||
mndTransDrop(pTrans);
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
}
|
||||
|
||||
static int32_t mndProcessCreateMnodeReq(SRpcMsg *pReq) {
|
||||
static int32_t mndProcessCreateMnodeReq(SRpcMsg * pReq) {
|
||||
SMnode *pMnode = pReq->info.node;
|
||||
int32_t code = -1;
|
||||
SMnodeObj *pObj = NULL;
|
||||
|
@ -694,7 +712,7 @@ static int32_t mndProcessCreateMnodeReq(SRpcMsg *pReq) {
|
|||
|
||||
auditRecord(pReq, pMnode->clusterId, "createMnode", "", obj, createReq.sql, createReq.sqlLen);
|
||||
|
||||
_OVER:
|
||||
_OVER:
|
||||
if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) {
|
||||
mError("mnode:%d, failed to create since %s", createReq.dnodeId, terrstr());
|
||||
}
|
||||
|
@ -704,9 +722,9 @@ _OVER:
|
|||
tFreeSMCreateQnodeReq(&createReq);
|
||||
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
}
|
||||
|
||||
static int32_t mndSetDropMnodeRedoLogs(SMnode *pMnode, STrans *pTrans, SMnodeObj *pObj) {
|
||||
static int32_t mndSetDropMnodeRedoLogs(SMnode * pMnode, STrans * pTrans, SMnodeObj * pObj) {
|
||||
int32_t code = 0;
|
||||
SSdbRaw *pRedoRaw = mndMnodeActionEncode(pObj);
|
||||
if (pRedoRaw == NULL) {
|
||||
|
@ -717,9 +735,9 @@ static int32_t mndSetDropMnodeRedoLogs(SMnode *pMnode, STrans *pTrans, SMnodeObj
|
|||
TAOS_CHECK_RETURN(mndTransAppendRedolog(pTrans, pRedoRaw));
|
||||
TAOS_CHECK_RETURN(sdbSetRawStatus(pRedoRaw, SDB_STATUS_DROPPING));
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
}
|
||||
|
||||
static int32_t mndSetDropMnodeCommitLogs(SMnode *pMnode, STrans *pTrans, SMnodeObj *pObj) {
|
||||
static int32_t mndSetDropMnodeCommitLogs(SMnode * pMnode, STrans * pTrans, SMnodeObj * pObj) {
|
||||
int32_t code = 0;
|
||||
SSdbRaw *pCommitRaw = mndMnodeActionEncode(pObj);
|
||||
if (pCommitRaw == NULL) {
|
||||
|
@ -730,9 +748,9 @@ static int32_t mndSetDropMnodeCommitLogs(SMnode *pMnode, STrans *pTrans, SMnodeO
|
|||
TAOS_CHECK_RETURN(mndTransAppendCommitlog(pTrans, pCommitRaw));
|
||||
TAOS_CHECK_RETURN(sdbSetRawStatus(pCommitRaw, SDB_STATUS_DROPPED));
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
}
|
||||
|
||||
static int32_t mndSetDropMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDnodeObj *pDnode, SMnodeObj *pObj,
|
||||
static int32_t mndSetDropMnodeRedoActions(SMnode * pMnode, STrans * pTrans, SDnodeObj * pDnode, SMnodeObj * pObj,
|
||||
bool force) {
|
||||
int32_t code = 0;
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
|
@ -768,17 +786,17 @@ static int32_t mndSetDropMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDnode
|
|||
}
|
||||
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
}
|
||||
|
||||
int32_t mndSetDropMnodeInfoToTrans(SMnode *pMnode, STrans *pTrans, SMnodeObj *pObj, bool force) {
|
||||
int32_t mndSetDropMnodeInfoToTrans(SMnode * pMnode, STrans * pTrans, SMnodeObj * pObj, bool force) {
|
||||
if (pObj == NULL) return 0;
|
||||
pObj->lastIndex = pMnode->applied;
|
||||
TAOS_CHECK_RETURN(mndSetDropMnodeRedoActions(pMnode, pTrans, pObj->pDnode, pObj, force));
|
||||
TAOS_CHECK_RETURN(mndSetDropMnodeCommitLogs(pMnode, pTrans, pObj));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static int32_t mndDropMnode(SMnode *pMnode, SRpcMsg *pReq, SMnodeObj *pObj) {
|
||||
static int32_t mndDropMnode(SMnode * pMnode, SRpcMsg * pReq, SMnodeObj * pObj) {
|
||||
int32_t code = -1;
|
||||
STrans *pTrans = NULL;
|
||||
|
||||
|
@ -797,12 +815,12 @@ static int32_t mndDropMnode(SMnode *pMnode, SRpcMsg *pReq, SMnodeObj *pObj) {
|
|||
|
||||
code = 0;
|
||||
|
||||
_OVER:
|
||||
_OVER:
|
||||
mndTransDrop(pTrans);
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
}
|
||||
|
||||
static int32_t mndProcessDropMnodeReq(SRpcMsg *pReq) {
|
||||
static int32_t mndProcessDropMnodeReq(SRpcMsg * pReq) {
|
||||
SMnode *pMnode = pReq->info.node;
|
||||
int32_t code = -1;
|
||||
SMnodeObj *pObj = NULL;
|
||||
|
@ -848,7 +866,7 @@ static int32_t mndProcessDropMnodeReq(SRpcMsg *pReq) {
|
|||
|
||||
auditRecord(pReq, pMnode->clusterId, "dropMnode", "", obj, dropReq.sql, dropReq.sqlLen);
|
||||
|
||||
_OVER:
|
||||
_OVER:
|
||||
if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) {
|
||||
mError("mnode:%d, failed to drop since %s", dropReq.dnodeId, terrstr());
|
||||
}
|
||||
|
@ -856,9 +874,9 @@ _OVER:
|
|||
mndReleaseMnode(pMnode, pObj);
|
||||
tFreeSMCreateQnodeReq(&dropReq);
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
}
|
||||
|
||||
static int32_t mndRetrieveMnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows) {
|
||||
static int32_t mndRetrieveMnodes(SRpcMsg * pReq, SShowObj * pShow, SSDataBlock * pBlock, int32_t rows) {
|
||||
SMnode *pMnode = pReq->info.node;
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
int32_t numOfRows = 0;
|
||||
|
@ -881,13 +899,21 @@ static int32_t mndRetrieveMnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
|
|||
|
||||
cols = 0;
|
||||
SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pObj->id, false);
|
||||
code = colDataSetVal(pColInfo, numOfRows, (const char *)&pObj->id, false);
|
||||
if (code != 0) {
|
||||
mError("mnode:%d, failed to set col data val since %s", pObj->id, terrstr());
|
||||
goto _out;
|
||||
}
|
||||
|
||||
char b1[TSDB_EP_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(b1, pObj->pDnode->ep, TSDB_EP_LEN + VARSTR_HEADER_SIZE);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, b1, false);
|
||||
code = colDataSetVal(pColInfo, numOfRows, b1, false);
|
||||
if (code != 0) {
|
||||
mError("mnode:%d, failed to set col data val since %s", pObj->id, terrstr());
|
||||
goto _out;
|
||||
}
|
||||
|
||||
char role[20] = "offline";
|
||||
if (pObj->id == pMnode->selfDnodeId) {
|
||||
|
@ -904,8 +930,11 @@ static int32_t mndRetrieveMnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
|
|||
char b2[12 + VARSTR_HEADER_SIZE] = {0};
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(b2, role, pShow->pMeta->pSchemas[cols].bytes);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)b2, false);
|
||||
|
||||
code = colDataSetVal(pColInfo, numOfRows, (const char *)b2, false);
|
||||
if (code != 0) {
|
||||
mError("mnode:%d, failed to set col data val since %s", pObj->id, terrstr());
|
||||
goto _out;
|
||||
}
|
||||
const char *status = "ready";
|
||||
if (objStatus == SDB_STATUS_CREATING) status = "creating";
|
||||
if (objStatus == SDB_STATUS_DROPPING) status = "dropping";
|
||||
|
@ -913,14 +942,26 @@ static int32_t mndRetrieveMnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
|
|||
char b3[9 + VARSTR_HEADER_SIZE] = {0};
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(b3, status, pShow->pMeta->pSchemas[cols].bytes);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)b3, false);
|
||||
code = colDataSetVal(pColInfo, numOfRows, (const char *)b3, false);
|
||||
if (code != 0) {
|
||||
mError("mnode:%d, failed to set col data val since %s", pObj->id, terrstr());
|
||||
goto _out;
|
||||
}
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pObj->createdTime, false);
|
||||
code = colDataSetVal(pColInfo, numOfRows, (const char *)&pObj->createdTime, false);
|
||||
if (code != 0) {
|
||||
mError("mnode:%d, failed to set col data val since %s", pObj->id, terrstr());
|
||||
goto _out;
|
||||
}
|
||||
|
||||
int64_t roleTimeMs = (isDnodeOnline) ? pObj->roleTimeMs : 0;
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&roleTimeMs, false);
|
||||
code = colDataSetVal(pColInfo, numOfRows, (const char *)&roleTimeMs, false);
|
||||
if (code != 0) {
|
||||
mError("mnode:%d, failed to set col data val since %s", pObj->id, terrstr());
|
||||
goto _out;
|
||||
}
|
||||
|
||||
numOfRows++;
|
||||
sdbRelease(pSdb, pObj);
|
||||
|
@ -928,17 +969,17 @@ static int32_t mndRetrieveMnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
|
|||
|
||||
pShow->numOfRows += numOfRows;
|
||||
|
||||
_out:
|
||||
_out:
|
||||
sdbRelease(pSdb, pSelfObj);
|
||||
return numOfRows;
|
||||
}
|
||||
}
|
||||
|
||||
static void mndCancelGetNextMnode(SMnode *pMnode, void *pIter) {
|
||||
static void mndCancelGetNextMnode(SMnode * pMnode, void *pIter) {
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
sdbCancelFetchByType(pSdb, pIter, SDB_MNODE);
|
||||
}
|
||||
}
|
||||
|
||||
static int32_t mndProcessAlterMnodeReq(SRpcMsg *pReq) {
|
||||
static int32_t mndProcessAlterMnodeReq(SRpcMsg * pReq) {
|
||||
#if 1
|
||||
return 0;
|
||||
#else
|
||||
|
@ -996,9 +1037,9 @@ static int32_t mndProcessAlterMnodeReq(SRpcMsg *pReq) {
|
|||
|
||||
TAOS_RETURN(code);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
static void mndReloadSyncConfig(SMnode *pMnode) {
|
||||
static void mndReloadSyncConfig(SMnode * pMnode) {
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
SMnodeObj *pObj = NULL;
|
||||
ESdbStatus objStatus = 0;
|
||||
|
@ -1030,7 +1071,10 @@ static void mndReloadSyncConfig(SMnode *pMnode) {
|
|||
pNode->nodePort = pObj->pDnode->port;
|
||||
pNode->nodeRole = pObj->role;
|
||||
tstrncpy(pNode->nodeFqdn, pObj->pDnode->fqdn, TSDB_FQDN_LEN);
|
||||
(void)tmsgUpdateDnodeInfo(&pNode->nodeId, &pNode->clusterId, pNode->nodeFqdn, &pNode->nodePort);
|
||||
code = tmsgUpdateDnodeInfo(&pNode->nodeId, &pNode->clusterId, pNode->nodeFqdn, &pNode->nodePort);
|
||||
if (code != 0) {
|
||||
mError("mnode:%d, failed to update dnode info since %s", pObj->id, terrstr());
|
||||
}
|
||||
mInfo("vgId:1, ep:%s:%u dnode:%d", pNode->nodeFqdn, pNode->nodePort, pNode->nodeId);
|
||||
if (pObj->pDnode->id == pMnode->selfDnodeId) {
|
||||
cfg.myIndex = cfg.totalReplicaNum;
|
||||
|
@ -1088,4 +1132,4 @@ static void mndReloadSyncConfig(SMnode *pMnode) {
|
|||
mInfo("vgId:1, mnode sync reconfig success");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue