commit
4326d4a04e
|
@ -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,19 +270,21 @@ 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);
|
||||
}
|
||||
sdbRelease(pSdb, pObj);
|
||||
}
|
||||
|
||||
if (pEpSet->numOfEps == 0) {
|
||||
syncGetRetryEpSet(pMnode->syncMgmt.sync, pEpSet);
|
||||
}
|
||||
if (pEpSet->numOfEps == 0) {
|
||||
syncGetRetryEpSet(pMnode->syncMgmt.sync, pEpSet);
|
||||
}
|
||||
|
||||
if (pEpSet->inUse >= pEpSet->numOfEps) {
|
||||
pEpSet->inUse = 0;
|
||||
if (pEpSet->inUse >= pEpSet->numOfEps) {
|
||||
pEpSet->inUse = 0;
|
||||
}
|
||||
epsetSort(pEpSet);
|
||||
}
|
||||
epsetSort(pEpSet);
|
||||
}
|
||||
|
||||
static int32_t mndSetCreateMnodeRedoLogs(SMnode *pMnode, STrans *pTrans, SMnodeObj *pObj) {
|
||||
|
@ -341,7 +343,11 @@ static int32_t mndBuildCreateMnodeRedoAction(STrans *pTrans, SDCreateMnodeReq *p
|
|||
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,
|
||||
|
@ -363,7 +369,11 @@ static int32_t mndBuildAlterMnodeTypeRedoAction(STrans *pTrans, SDAlterMnodeType
|
|||
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,
|
||||
|
@ -385,8 +395,11 @@ static int32_t mndBuildAlterMnodeRedoAction(STrans *pTrans, SDCreateMnodeReq *pA
|
|||
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,
|
||||
|
@ -407,7 +420,11 @@ static int32_t mndBuildDropMnodeRedoAction(STrans *pTrans, SDDropMnodeReq *pDrop
|
|||
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,
|
||||
|
@ -868,6 +885,7 @@ static int32_t mndRetrieveMnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
|
|||
ESdbStatus objStatus = 0;
|
||||
char *pWrite;
|
||||
int64_t curMs = taosGetTimestampMs();
|
||||
int code = 0;
|
||||
|
||||
pSelfObj = sdbAcquire(pSdb, SDB_MNODE, &pMnode->selfDnodeId);
|
||||
if (pSelfObj == NULL) {
|
||||
|
@ -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);
|
||||
|
@ -1005,6 +1046,7 @@ static void mndReloadSyncConfig(SMnode *pMnode) {
|
|||
void *pIter = NULL;
|
||||
int32_t updatingMnodes = 0;
|
||||
int32_t readyMnodes = 0;
|
||||
int32_t code = 0;
|
||||
SSyncCfg cfg = {
|
||||
.myIndex = -1,
|
||||
.lastIndex = 0,
|
||||
|
@ -1030,7 +1072,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;
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
*/
|
||||
|
||||
#define _DEFAULT_SOURCE
|
||||
#include "mndVgroup.h"
|
||||
#include "audit.h"
|
||||
#include "mndArbGroup.h"
|
||||
#include "mndDb.h"
|
||||
|
@ -27,6 +26,7 @@
|
|||
#include "mndTopic.h"
|
||||
#include "mndTrans.h"
|
||||
#include "mndUser.h"
|
||||
#include "mndVgroup.h"
|
||||
#include "tmisce.h"
|
||||
|
||||
#define VGROUP_VER_NUMBER 1
|
||||
|
@ -320,6 +320,7 @@ void *mndBuildCreateVnodeReq(SMnode *pMnode, SDnodeObj *pDnode, SDbObj *pDb, SVg
|
|||
createReq.tsdbPageSize = pDb->cfg.tsdbPageSize;
|
||||
createReq.changeVersion = ++(pVgroup->syncConfChangeVer);
|
||||
createReq.encryptAlgorithm = pDb->cfg.encryptAlgorithm;
|
||||
int32_t code = 0;
|
||||
|
||||
for (int32_t v = 0; v < pVgroup->replica; ++v) {
|
||||
SReplica *pReplica = NULL;
|
||||
|
@ -390,7 +391,13 @@ void *mndBuildCreateVnodeReq(SMnode *pMnode, SDnodeObj *pDnode, SDbObj *pDb, SVg
|
|||
return NULL;
|
||||
}
|
||||
|
||||
(void)tSerializeSCreateVnodeReq(pReq, contLen, &createReq);
|
||||
code = tSerializeSCreateVnodeReq(pReq, contLen, &createReq);
|
||||
if (code < 0) {
|
||||
terrno = TSDB_CODE_APP_ERROR;
|
||||
taosMemoryFree(pReq);
|
||||
mError("vgId:%d, failed to serialize create vnode req,since %s", createReq.vgId, terrstr());
|
||||
return NULL;
|
||||
}
|
||||
*pContLen = contLen;
|
||||
return pReq;
|
||||
}
|
||||
|
@ -436,7 +443,12 @@ static void *mndBuildAlterVnodeConfigReq(SMnode *pMnode, SDbObj *pDb, SVgObj *pV
|
|||
pHead->contLen = htonl(contLen);
|
||||
pHead->vgId = htonl(pVgroup->vgId);
|
||||
|
||||
(void)tSerializeSAlterVnodeConfigReq((char *)pReq + sizeof(SMsgHead), contLen, &alterReq);
|
||||
if (tSerializeSAlterVnodeConfigReq((char *)pReq + sizeof(SMsgHead), contLen, &alterReq) < 0) {
|
||||
taosMemoryFree(pReq);
|
||||
mError("vgId:%d, failed to serialize alter vnode config req,since %s", pVgroup->vgId, terrstr());
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return NULL;
|
||||
}
|
||||
*pContLen = contLen;
|
||||
return pReq;
|
||||
}
|
||||
|
@ -514,7 +526,12 @@ static void *mndBuildAlterVnodeReplicaReq(SMnode *pMnode, SDbObj *pDb, SVgObj *p
|
|||
return NULL;
|
||||
}
|
||||
|
||||
(void)tSerializeSAlterVnodeReplicaReq(pReq, contLen, &alterReq);
|
||||
if (tSerializeSAlterVnodeReplicaReq(pReq, contLen, &alterReq) < 0) {
|
||||
mError("vgId:%d, failed to serialize alter vnode req,since %s", alterReq.vgId, terrstr());
|
||||
taosMemoryFree(pReq);
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return NULL;
|
||||
}
|
||||
*pContLen = contLen;
|
||||
return pReq;
|
||||
}
|
||||
|
@ -587,7 +604,12 @@ static void *mndBuildCheckLearnCatchupReq(SMnode *pMnode, SDbObj *pDb, SVgObj *p
|
|||
return NULL;
|
||||
}
|
||||
|
||||
(void)tSerializeSAlterVnodeReplicaReq(pReq, contLen, &req);
|
||||
if (tSerializeSAlterVnodeReplicaReq(pReq, contLen, &req) < 0) {
|
||||
mError("vgId:%d, failed to serialize alter vnode req,since %s", req.vgId, terrstr());
|
||||
taosMemoryFree(pReq);
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return NULL;
|
||||
}
|
||||
*pContLen = contLen;
|
||||
return pReq;
|
||||
}
|
||||
|
@ -611,7 +633,12 @@ static void *mndBuildDisableVnodeWriteReq(SMnode *pMnode, SDbObj *pDb, int32_t v
|
|||
return NULL;
|
||||
}
|
||||
|
||||
(void)tSerializeSDisableVnodeWriteReq(pReq, contLen, &disableReq);
|
||||
if (tSerializeSDisableVnodeWriteReq(pReq, contLen, &disableReq) < 0) {
|
||||
mError("vgId:%d, failed to serialize disable vnode write req,since %s", vgId, terrstr());
|
||||
taosMemoryFree(pReq);
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return NULL;
|
||||
}
|
||||
*pContLen = contLen;
|
||||
return pReq;
|
||||
}
|
||||
|
@ -639,7 +666,12 @@ static void *mndBuildAlterVnodeHashRangeReq(SMnode *pMnode, int32_t srcVgId, SVg
|
|||
return NULL;
|
||||
}
|
||||
|
||||
(void)tSerializeSAlterVnodeHashRangeReq(pReq, contLen, &alterReq);
|
||||
if (tSerializeSAlterVnodeHashRangeReq(pReq, contLen, &alterReq) < 0) {
|
||||
mError("vgId:%d, failed to serialize alter vnode hashrange req,since %s", srcVgId, terrstr());
|
||||
taosMemoryFree(pReq);
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return NULL;
|
||||
}
|
||||
*pContLen = contLen;
|
||||
return pReq;
|
||||
}
|
||||
|
@ -664,7 +696,12 @@ void *mndBuildDropVnodeReq(SMnode *pMnode, SDnodeObj *pDnode, SDbObj *pDb, SVgOb
|
|||
return NULL;
|
||||
}
|
||||
|
||||
(void)tSerializeSDropVnodeReq(pReq, contLen, &dropReq);
|
||||
if (tSerializeSDropVnodeReq(pReq, contLen, &dropReq) < 0) {
|
||||
mError("vgId:%d, failed to serialize drop vnode req,since %s", dropReq.vgId, terrstr());
|
||||
taosMemoryFree(pReq);
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return NULL;
|
||||
}
|
||||
*pContLen = contLen;
|
||||
return pReq;
|
||||
}
|
||||
|
@ -907,7 +944,9 @@ SEpSet mndGetVgroupEpset(SMnode *pMnode, const SVgObj *pVgroup) {
|
|||
epset.inUse = epset.numOfEps;
|
||||
}
|
||||
|
||||
(void)addEpIntoEpSet(&epset, pDnode->fqdn, pDnode->port);
|
||||
if (addEpIntoEpSet(&epset, pDnode->fqdn, pDnode->port) != 0) {
|
||||
mWarn("vgId:%d, failed to add ep:%s:%d into epset", pVgroup->vgId, pDnode->fqdn, pDnode->port);
|
||||
}
|
||||
mndReleaseDnode(pMnode, pDnode);
|
||||
}
|
||||
epsetSort(&epset);
|
||||
|
@ -930,7 +969,9 @@ SEpSet mndGetVgroupEpsetById(SMnode *pMnode, int32_t vgId) {
|
|||
epset.inUse = epset.numOfEps;
|
||||
}
|
||||
|
||||
(void)addEpIntoEpSet(&epset, pDnode->fqdn, pDnode->port);
|
||||
if (addEpIntoEpSet(&epset, pDnode->fqdn, pDnode->port) != 0) {
|
||||
mWarn("vgId:%d, failed to add ep:%s:%d into epset", pVgroup->vgId, pDnode->fqdn, pDnode->port);
|
||||
}
|
||||
mndReleaseDnode(pMnode, pDnode);
|
||||
}
|
||||
|
||||
|
@ -945,6 +986,7 @@ static int32_t mndRetrieveVgroups(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *p
|
|||
SVgObj *pVgroup = NULL;
|
||||
int32_t cols = 0;
|
||||
int64_t curMs = taosGetTimestampMs();
|
||||
int32_t code = 0;
|
||||
|
||||
SDbObj *pDb = NULL;
|
||||
if (strlen(pShow->db) > 0) {
|
||||
|
@ -965,26 +1007,46 @@ static int32_t mndRetrieveVgroups(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *p
|
|||
|
||||
cols = 0;
|
||||
SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pVgroup->vgId, false);
|
||||
code = colDataSetVal(pColInfo, numOfRows, (const char *)&pVgroup->vgId, false);
|
||||
if (code != 0) {
|
||||
mError("vgId:%d, failed to set vgId, since %s", pVgroup->vgId, tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
|
||||
SName name = {0};
|
||||
char db[TSDB_DB_NAME_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
(void)tNameFromString(&name, pVgroup->dbName, T_NAME_ACCT | T_NAME_DB);
|
||||
code = tNameFromString(&name, pVgroup->dbName, T_NAME_ACCT | T_NAME_DB);
|
||||
if (code != 0) {
|
||||
mError("vgId:%d, failed to set dbName, since %s", pVgroup->vgId, tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
(void)tNameGetDbName(&name, varDataVal(db));
|
||||
varDataSetLen(db, strlen(varDataVal(db)));
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)db, false);
|
||||
code = colDataSetVal(pColInfo, numOfRows, (const char *)db, false);
|
||||
if (code != 0) {
|
||||
mError("vgId:%d, failed to set dbName, since %s", pVgroup->vgId, tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pVgroup->numOfTables, false);
|
||||
code = colDataSetVal(pColInfo, numOfRows, (const char *)&pVgroup->numOfTables, false);
|
||||
if (code != 0) {
|
||||
mError("vgId:%d, failed to set numOfTables, since %s", pVgroup->vgId, tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
|
||||
// default 3 replica, add 1 replica if move vnode
|
||||
for (int32_t i = 0; i < 4; ++i) {
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
if (i < pVgroup->replica) {
|
||||
int16_t dnodeId = (int16_t)pVgroup->vnodeGid[i].dnodeId;
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&dnodeId, false);
|
||||
code = colDataSetVal(pColInfo, numOfRows, (const char *)&dnodeId, false);
|
||||
if (code != 0) {
|
||||
mError("vgId:%d, failed to set dnodeId, since %s", pVgroup->vgId, tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
|
||||
bool exist = false;
|
||||
bool online = false;
|
||||
|
@ -1038,7 +1100,11 @@ static int32_t mndRetrieveVgroups(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *p
|
|||
STR_WITH_MAXSIZE_TO_VARSTR(buf1, role, pShow->pMeta->pSchemas[cols].bytes);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)buf1, false);
|
||||
code = colDataSetVal(pColInfo, numOfRows, (const char *)buf1, false);
|
||||
if (code != 0) {
|
||||
mError("vgId:%d, failed to set role, since %s", pVgroup->vgId, tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
} else {
|
||||
colDataSetNULL(pColInfo, numOfRows);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
|
@ -1048,21 +1114,25 @@ static int32_t mndRetrieveVgroups(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *p
|
|||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
int32_t cacheUsage = (int32_t)pVgroup->cacheUsage;
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&cacheUsage, false);
|
||||
code = colDataSetVal(pColInfo, numOfRows, (const char *)&cacheUsage, false);
|
||||
if (code != 0) {
|
||||
mError("vgId:%d, failed to set cacheUsage, since %s", pVgroup->vgId, tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pVgroup->numOfCachedTables, false);
|
||||
code = colDataSetVal(pColInfo, numOfRows, (const char *)&pVgroup->numOfCachedTables, false);
|
||||
if (code != 0) {
|
||||
mError("vgId:%d, failed to set numOfCachedTables, since %s", pVgroup->vgId, tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pVgroup->isTsma, false);
|
||||
|
||||
// pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
// if (pDb == NULL || pDb->compactStartTime <= 0) {
|
||||
// colDataSetNULL(pColInfo, numOfRows);
|
||||
// } else {
|
||||
// (void)colDataSetVal(pColInfo, numOfRows, (const char *)&pDb->compactStartTime, false);
|
||||
// }
|
||||
|
||||
code = colDataSetVal(pColInfo, numOfRows, (const char *)&pVgroup->isTsma, false);
|
||||
if (code != 0) {
|
||||
mError("vgId:%d, failed to set isTsma, since %s", pVgroup->vgId, tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
numOfRows++;
|
||||
sdbRelease(pSdb, pVgroup);
|
||||
}
|
||||
|
@ -1147,6 +1217,7 @@ static int32_t mndRetrieveVnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
|
|||
SVgObj *pVgroup = NULL;
|
||||
int32_t cols = 0;
|
||||
int64_t curMs = taosGetTimestampMs();
|
||||
int32_t code = 0;
|
||||
|
||||
while (numOfRows < rows - TSDB_MAX_REPLICA) {
|
||||
pShow->pIter = sdbFetch(pSdb, SDB_VGROUP, pShow->pIter, (void **)&pVgroup);
|
||||
|
@ -1158,10 +1229,17 @@ static int32_t mndRetrieveVnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
|
|||
cols = 0;
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pGid->dnodeId, false);
|
||||
|
||||
code = colDataSetVal(pColInfo, numOfRows, (const char *)&pGid->dnodeId, false);
|
||||
if (code != 0) {
|
||||
mError("vgId:%d, failed to set dnodeId, since %s", pVgroup->vgId, tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pVgroup->vgId, false);
|
||||
code = colDataSetVal(pColInfo, numOfRows, (const char *)&pVgroup->vgId, false);
|
||||
if (code != 0) {
|
||||
mError("vgId:%d, failed to set vgId, since %s", pVgroup->vgId, tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
|
||||
// db_name
|
||||
const char *dbname = mndGetDbStr(pVgroup->dbName);
|
||||
|
@ -1172,7 +1250,11 @@ static int32_t mndRetrieveVnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
|
|||
STR_WITH_MAXSIZE_TO_VARSTR(b1, "NULL", TSDB_DB_NAME_LEN + VARSTR_HEADER_SIZE);
|
||||
}
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)b1, false);
|
||||
code = colDataSetVal(pColInfo, numOfRows, (const char *)b1, false);
|
||||
if (code != 0) {
|
||||
mError("vgId:%d, failed to set dbName, since %s", pVgroup->vgId, tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
|
||||
// dnode is online?
|
||||
SDnodeObj *pDnode = mndAcquireDnode(pMnode, pGid->dnodeId);
|
||||
|
@ -1186,18 +1268,34 @@ static int32_t mndRetrieveVnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
|
|||
ESyncState syncState = (isDnodeOnline) ? pGid->syncState : TAOS_SYNC_STATE_OFFLINE;
|
||||
STR_TO_VARSTR(buf, syncStr(syncState));
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)buf, false);
|
||||
code = colDataSetVal(pColInfo, numOfRows, (const char *)buf, false);
|
||||
if (code != 0) {
|
||||
mError("vgId:%d, failed to set syncState, since %s", pVgroup->vgId, tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
|
||||
int64_t roleTimeMs = (isDnodeOnline) ? pGid->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("vgId:%d, failed to set roleTimeMs, since %s", pVgroup->vgId, tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
|
||||
int64_t startTimeMs = (isDnodeOnline) ? pGid->startTimeMs : 0;
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&startTimeMs, false);
|
||||
code = colDataSetVal(pColInfo, numOfRows, (const char *)&startTimeMs, false);
|
||||
if (code != 0) {
|
||||
mError("vgId:%d, failed to set startTimeMs, since %s", pVgroup->vgId, tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pGid->syncRestore, false);
|
||||
code = colDataSetVal(pColInfo, numOfRows, (const char *)&pGid->syncRestore, false);
|
||||
if (code != 0) {
|
||||
mError("vgId:%d, failed to set syncRestore, since %s", pVgroup->vgId, tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
|
||||
numOfRows++;
|
||||
sdbRelease(pSdb, pDnode);
|
||||
|
@ -1270,8 +1368,10 @@ static int32_t mndAddVnodeToVgroup(SMnode *pMnode, STrans *pTrans, SVgObj *pVgro
|
|||
sdbFreeRaw(pVgRaw);
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
(void)sdbSetRawStatus(pVgRaw, SDB_STATUS_READY);
|
||||
|
||||
code = sdbSetRawStatus(pVgRaw, SDB_STATUS_READY);
|
||||
if (code != 0) {
|
||||
mError("vgId:%d, failed to set raw status since %s at line:%d", pVgroup->vgId, tstrerror(code), __LINE__);
|
||||
}
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
|
||||
|
@ -1332,7 +1432,10 @@ _OVER:
|
|||
sdbFreeRaw(pVgRaw);
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
(void)sdbSetRawStatus(pVgRaw, SDB_STATUS_READY);
|
||||
code = sdbSetRawStatus(pVgRaw, SDB_STATUS_READY);
|
||||
if (code != 0) {
|
||||
mError("vgId:%d, failed to set raw status since %s at line:%d", pVgroup->vgId, tstrerror(code), __LINE__);
|
||||
}
|
||||
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
|
@ -1568,6 +1671,10 @@ int32_t mndAddNewVgPrepareAction(SMnode *pMnode, STrans *pTrans, SVgObj *pVg) {
|
|||
|
||||
TAOS_CHECK_GOTO(mndTransAppendPrepareLog(pTrans, pRaw), NULL, _err);
|
||||
(void)sdbSetRawStatus(pRaw, SDB_STATUS_CREATING);
|
||||
if (code != 0) {
|
||||
mError("vgId:%d, failed to set raw status since %s at line:%d", pVg->vgId, tstrerror(code), __LINE__);
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
pRaw = NULL;
|
||||
TAOS_RETURN(code);
|
||||
|
||||
|
@ -1824,7 +1931,11 @@ int32_t mndSetMoveVgroupInfoToTrans(SMnode *pMnode, STrans *pTrans, SDbObj *pDb,
|
|||
sdbFreeRaw(pRaw);
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
(void)sdbSetRawStatus(pRaw, SDB_STATUS_READY);
|
||||
code = sdbSetRawStatus(pRaw, SDB_STATUS_READY);
|
||||
if (code != 0) {
|
||||
mError("vgId:%d, failed to set raw status since %s at line:%d", newVg.vgId, tstrerror(code), __LINE__);
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
||||
TAOS_CHECK_RETURN(mndAddDropVnodeAction(pMnode, pTrans, pDb, &newVg, &del, true));
|
||||
|
@ -1850,7 +1961,6 @@ int32_t mndSetMoveVgroupInfoToTrans(SMnode *pMnode, STrans *pTrans, SDbObj *pDb,
|
|||
sdbFreeRaw(pRaw);
|
||||
return -1;
|
||||
}
|
||||
(void)sdbSetRawStatus(pRaw, SDB_STATUS_READY);
|
||||
}
|
||||
|
||||
if (mndAddDropVnodeAction(pMnode, pTrans, pDb, &newVg, &del, true) != 0) return -1;
|
||||
|
@ -1880,7 +1990,11 @@ int32_t mndSetMoveVgroupInfoToTrans(SMnode *pMnode, STrans *pTrans, SDbObj *pDb,
|
|||
sdbFreeRaw(pRaw);
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
(void)sdbSetRawStatus(pRaw, SDB_STATUS_READY);
|
||||
code = sdbSetRawStatus(pRaw, SDB_STATUS_READY);
|
||||
if (code != 0) {
|
||||
mError("vgId:%d, failed to set raw status since %s at line:%d", newVg.vgId, tstrerror(code), __LINE__);
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < newVg.replica; ++i) {
|
||||
|
@ -1930,7 +2044,11 @@ int32_t mndSetMoveVgroupInfoToTrans(SMnode *pMnode, STrans *pTrans, SDbObj *pDb,
|
|||
sdbFreeRaw(pRaw);
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
(void)sdbSetRawStatus(pRaw, SDB_STATUS_READY);
|
||||
code = sdbSetRawStatus(pRaw, SDB_STATUS_READY);
|
||||
if (code != 0) {
|
||||
mError("vgId:%d, failed to set raw status since %s at line:%d", newVg.vgId, tstrerror(code), __LINE__);
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
||||
mInfo("vgId:%d, vgroup info after move, replica:%d", newVg.vgId, newVg.replica);
|
||||
|
@ -2005,7 +2123,11 @@ static int32_t mndAddIncVgroupReplicaToTrans(SMnode *pMnode, STrans *pTrans, SDb
|
|||
sdbFreeRaw(pVgRaw);
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
(void)sdbSetRawStatus(pVgRaw, SDB_STATUS_READY);
|
||||
code = sdbSetRawStatus(pVgRaw, SDB_STATUS_READY);
|
||||
if (code != 0) {
|
||||
mError("vgId:%d, failed to set raw status since %s at line:%d", pVgroup->vgId, tstrerror(code), __LINE__);
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
|
||||
// learner
|
||||
for (int32_t i = 0; i < pVgroup->replica - 1; ++i) {
|
||||
|
@ -2057,7 +2179,11 @@ static int32_t mndAddDecVgroupReplicaFromTrans(SMnode *pMnode, STrans *pTrans, S
|
|||
sdbFreeRaw(pVgRaw);
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
(void)sdbSetRawStatus(pVgRaw, SDB_STATUS_READY);
|
||||
code = sdbSetRawStatus(pVgRaw, SDB_STATUS_READY);
|
||||
if (code != 0) {
|
||||
mError("vgId:%d, failed to set raw status since %s at line:%d", pVgroup->vgId, tstrerror(code), __LINE__);
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
|
||||
TAOS_CHECK_RETURN(mndAddDropVnodeAction(pMnode, pTrans, pDb, pVgroup, &delGid, true));
|
||||
for (int32_t i = 0; i < pVgroup->replica; ++i) {
|
||||
|
@ -2171,7 +2297,11 @@ static int32_t mndRedistributeVgroup(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb,
|
|||
sdbFreeRaw(pRaw);
|
||||
goto _OVER;
|
||||
}
|
||||
(void)sdbSetRawStatus(pRaw, SDB_STATUS_READY);
|
||||
code = sdbSetRawStatus(pRaw, SDB_STATUS_READY);
|
||||
if (code != 0) {
|
||||
mError("vgId:%d, failed to set raw status since %s at line:%d", newVg.vgId, tstrerror(code), __LINE__);
|
||||
goto _OVER;
|
||||
}
|
||||
}
|
||||
|
||||
mInfo("vgId:%d, vgroup info after redistribute, replica:%d", newVg.vgId, newVg.replica);
|
||||
|
@ -2452,7 +2582,11 @@ static void *mndBuildSForceBecomeFollowerReq(SMnode *pMnode, SVgObj *pVgroup, in
|
|||
pHead->contLen = htonl(contLen);
|
||||
pHead->vgId = htonl(pVgroup->vgId);
|
||||
|
||||
(void)tSerializeSForceBecomeFollowerReq((char *)pReq + sizeof(SMsgHead), contLen, &balanceReq);
|
||||
if (tSerializeSForceBecomeFollowerReq((char *)pReq + sizeof(SMsgHead), contLen, &balanceReq) < 0) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
taosMemoryFree(pReq);
|
||||
return NULL;
|
||||
}
|
||||
*pContLen = contLen;
|
||||
return pReq;
|
||||
}
|
||||
|
@ -2693,7 +2827,11 @@ int32_t mndBuildAlterVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *pOldDb
|
|||
sdbFreeRaw(pVgRaw);
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
(void)sdbSetRawStatus(pVgRaw, SDB_STATUS_READY);
|
||||
code = sdbSetRawStatus(pVgRaw, SDB_STATUS_READY);
|
||||
if (code != 0) {
|
||||
mError("vgId:%d, failed to set raw status since %s at line:%d", pNewVgroup->vgId, tstrerror(code), __LINE__);
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
}
|
||||
|
||||
TAOS_RETURN(code);
|
||||
|
@ -2776,7 +2914,12 @@ int32_t mndBuildRaftAlterVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *pO
|
|||
sdbFreeRaw(pVgRaw);
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
(void)sdbSetRawStatus(pVgRaw, SDB_STATUS_READY);
|
||||
code = sdbSetRawStatus(pVgRaw, SDB_STATUS_READY);
|
||||
if (code != 0) {
|
||||
mError("vgId:%d, failed to set raw status to ready, error:%s, line:%d", newVgroup.vgId, tstrerror(code),
|
||||
__LINE__);
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
} else if (newVgroup.replica == 3 && pNewDb->cfg.replications == 1) {
|
||||
mInfo("db:%s, vgId:%d, will remove 2 vnodes, vn:0 dnode:%d vn:1 dnode:%d vn:2 dnode:%d", pVgroup->dbName,
|
||||
pVgroup->vgId, pVgroup->vnodeGid[0].dnodeId, pVgroup->vnodeGid[1].dnodeId, pVgroup->vnodeGid[2].dnodeId);
|
||||
|
@ -2801,7 +2944,12 @@ int32_t mndBuildRaftAlterVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *pO
|
|||
sdbFreeRaw(pVgRaw);
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
(void)sdbSetRawStatus(pVgRaw, SDB_STATUS_READY);
|
||||
code = sdbSetRawStatus(pVgRaw, SDB_STATUS_READY);
|
||||
if (code != 0) {
|
||||
mError("vgId:%d, failed to set raw status to ready, error:%s, line:%d", newVgroup.vgId, tstrerror(code),
|
||||
__LINE__);
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
|
||||
SVnodeGid del2 = {0};
|
||||
TAOS_CHECK_RETURN(mndRemoveVnodeFromVgroupWithoutSave(pMnode, pTrans, &newVgroup, pArray, &del2));
|
||||
|
@ -2823,7 +2971,12 @@ int32_t mndBuildRaftAlterVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *pO
|
|||
sdbFreeRaw(pVgRaw);
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
(void)sdbSetRawStatus(pVgRaw, SDB_STATUS_READY);
|
||||
code = sdbSetRawStatus(pVgRaw, SDB_STATUS_READY);
|
||||
if (code != 0) {
|
||||
mError("vgId:%d, failed to set raw status to ready, error:%s, line:%d", newVgroup.vgId, tstrerror(code),
|
||||
__LINE__);
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
|
@ -2841,7 +2994,12 @@ int32_t mndBuildRaftAlterVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *pO
|
|||
sdbFreeRaw(pVgRaw);
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
(void)sdbSetRawStatus(pVgRaw, SDB_STATUS_READY);
|
||||
code = sdbSetRawStatus(pVgRaw, SDB_STATUS_READY);
|
||||
if (code != 0) {
|
||||
mError("vgId:%d, failed to set raw status to ready, error:%s, line:%d", newVgroup.vgId, tstrerror(code),
|
||||
__LINE__);
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
}
|
||||
|
||||
TAOS_RETURN(code);
|
||||
|
@ -2917,7 +3075,11 @@ int32_t mndBuildRestoreAlterVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj
|
|||
sdbFreeRaw(pVgRaw);
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
(void)sdbSetRawStatus(pVgRaw, SDB_STATUS_READY);
|
||||
code = sdbSetRawStatus(pVgRaw, SDB_STATUS_READY);
|
||||
if (code != 0) {
|
||||
mError("vgId:%d, failed to set raw status to ready, error:%s, line:%d", newVgroup.vgId, tstrerror(code), __LINE__);
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
|
@ -2938,7 +3100,11 @@ static int32_t mndAddVgStatusAction(STrans *pTrans, SVgObj *pVg, ESdbStatus vgSt
|
|||
goto _err;
|
||||
}
|
||||
if ((code = appendActionCb(pTrans, pRaw)) != 0) goto _err;
|
||||
(void)sdbSetRawStatus(pRaw, vgStatus);
|
||||
code = sdbSetRawStatus(pRaw, vgStatus);
|
||||
if (code != 0) {
|
||||
mError("vgId:%d, failed to set raw status to ready, error:%s, line:%d", pVg->vgId, tstrerror(code), __LINE__);
|
||||
goto _err;
|
||||
}
|
||||
pRaw = NULL;
|
||||
TAOS_RETURN(code);
|
||||
_err:
|
||||
|
@ -2956,7 +3122,11 @@ static int32_t mndAddDbStatusAction(STrans *pTrans, SDbObj *pDb, ESdbStatus dbSt
|
|||
goto _err;
|
||||
}
|
||||
if ((code = appendActionCb(pTrans, pRaw)) != 0) goto _err;
|
||||
(void)sdbSetRawStatus(pRaw, dbStatus);
|
||||
code = sdbSetRawStatus(pRaw, dbStatus);
|
||||
if (code != 0) {
|
||||
mError("db:%s, failed to set raw status to ready, error:%s, line:%d", pDb->name, tstrerror(code), __LINE__);
|
||||
goto _err;
|
||||
}
|
||||
pRaw = NULL;
|
||||
TAOS_RETURN(code);
|
||||
_err:
|
||||
|
@ -3165,7 +3335,11 @@ static int32_t mndSetBalanceVgroupInfoToTrans(SMnode *pMnode, STrans *pTrans, SD
|
|||
sdbFreeRaw(pRaw);
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
(void)sdbSetRawStatus(pRaw, SDB_STATUS_READY);
|
||||
code = sdbSetRawStatus(pRaw, SDB_STATUS_READY);
|
||||
if (code != 0) {
|
||||
mError("vgId:%d, failed to set raw status to ready, error:%s, line:%d", newVg.vgId, tstrerror(code), __LINE__);
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
}
|
||||
|
||||
mInfo("vgId:%d, vgroup info after balance, replica:%d", newVg.vgId, newVg.replica);
|
||||
|
@ -3391,7 +3565,11 @@ static void *mndBuildCompactVnodeReq(SMnode *pMnode, SDbObj *pDb, SVgObj *pVgrou
|
|||
pHead->contLen = htonl(contLen);
|
||||
pHead->vgId = htonl(pVgroup->vgId);
|
||||
|
||||
(void)tSerializeSCompactVnodeReq((char *)pReq + sizeof(SMsgHead), contLen, &compactReq);
|
||||
if (tSerializeSCompactVnodeReq((char *)pReq + sizeof(SMsgHead), contLen, &compactReq) < 0) {
|
||||
taosMemoryFree(pReq);
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return NULL;
|
||||
}
|
||||
*pContLen = contLen;
|
||||
return pReq;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue