remove void at mnode 4
This commit is contained in:
parent
8f3f494282
commit
faa1816245
|
@ -285,6 +285,7 @@ void mndGetMnodeEpSet(SMnode *pMnode, SEpSet *pEpSet) {
|
||||||
}
|
}
|
||||||
epsetSort(pEpSet);
|
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;
|
int32_t code = 0;
|
||||||
|
@ -534,8 +535,7 @@ void mndGetMnodeEpSet(SMnode *pMnode, SEpSet *pEpSet) {
|
||||||
TAOS_RETURN(0);
|
TAOS_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t mndSetAlterMnodeTypeRedoActions(SMnode * pMnode, STrans * pTrans, SDnodeObj * pDnode,
|
static int32_t mndSetAlterMnodeTypeRedoActions(SMnode *pMnode, STrans *pTrans, SDnodeObj *pDnode, SMnodeObj *pObj) {
|
||||||
SMnodeObj * pObj) {
|
|
||||||
SSdb *pSdb = pMnode->pSdb;
|
SSdb *pSdb = pMnode->pSdb;
|
||||||
void *pIter = NULL;
|
void *pIter = NULL;
|
||||||
SDAlterMnodeTypeReq alterReq = {0};
|
SDAlterMnodeTypeReq alterReq = {0};
|
||||||
|
@ -578,8 +578,7 @@ void mndGetMnodeEpSet(SMnode *pMnode, SEpSet *pEpSet) {
|
||||||
TAOS_RETURN(0);
|
TAOS_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t mndSetRestoreAlterMnodeTypeRedoActions(SMnode * pMnode, STrans * pTrans, SDnodeObj * pDnode,
|
int32_t mndSetRestoreAlterMnodeTypeRedoActions(SMnode *pMnode, STrans *pTrans, SDnodeObj *pDnode, SMnodeObj *pObj) {
|
||||||
SMnodeObj * pObj) {
|
|
||||||
SSdb *pSdb = pMnode->pSdb;
|
SSdb *pSdb = pMnode->pSdb;
|
||||||
void *pIter = NULL;
|
void *pIter = NULL;
|
||||||
SDAlterMnodeTypeReq alterReq = {0};
|
SDAlterMnodeTypeReq alterReq = {0};
|
||||||
|
@ -886,6 +885,7 @@ void mndGetMnodeEpSet(SMnode *pMnode, SEpSet *pEpSet) {
|
||||||
ESdbStatus objStatus = 0;
|
ESdbStatus objStatus = 0;
|
||||||
char *pWrite;
|
char *pWrite;
|
||||||
int64_t curMs = taosGetTimestampMs();
|
int64_t curMs = taosGetTimestampMs();
|
||||||
|
int code = 0;
|
||||||
|
|
||||||
pSelfObj = sdbAcquire(pSdb, SDB_MNODE, &pMnode->selfDnodeId);
|
pSelfObj = sdbAcquire(pSdb, SDB_MNODE, &pMnode->selfDnodeId);
|
||||||
if (pSelfObj == NULL) {
|
if (pSelfObj == NULL) {
|
||||||
|
@ -1046,6 +1046,7 @@ void mndGetMnodeEpSet(SMnode *pMnode, SEpSet *pEpSet) {
|
||||||
void *pIter = NULL;
|
void *pIter = NULL;
|
||||||
int32_t updatingMnodes = 0;
|
int32_t updatingMnodes = 0;
|
||||||
int32_t readyMnodes = 0;
|
int32_t readyMnodes = 0;
|
||||||
|
int32_t code = 0;
|
||||||
SSyncCfg cfg = {
|
SSyncCfg cfg = {
|
||||||
.myIndex = -1,
|
.myIndex = -1,
|
||||||
.lastIndex = 0,
|
.lastIndex = 0,
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define _DEFAULT_SOURCE
|
#define _DEFAULT_SOURCE
|
||||||
#include "mndVgroup.h"
|
|
||||||
#include "audit.h"
|
#include "audit.h"
|
||||||
#include "mndArbGroup.h"
|
#include "mndArbGroup.h"
|
||||||
#include "mndDb.h"
|
#include "mndDb.h"
|
||||||
|
@ -27,6 +26,7 @@
|
||||||
#include "mndTopic.h"
|
#include "mndTopic.h"
|
||||||
#include "mndTrans.h"
|
#include "mndTrans.h"
|
||||||
#include "mndUser.h"
|
#include "mndUser.h"
|
||||||
|
#include "mndVgroup.h"
|
||||||
#include "tmisce.h"
|
#include "tmisce.h"
|
||||||
|
|
||||||
#define VGROUP_VER_NUMBER 1
|
#define VGROUP_VER_NUMBER 1
|
||||||
|
@ -320,6 +320,7 @@ void *mndBuildCreateVnodeReq(SMnode *pMnode, SDnodeObj *pDnode, SDbObj *pDb, SVg
|
||||||
createReq.tsdbPageSize = pDb->cfg.tsdbPageSize;
|
createReq.tsdbPageSize = pDb->cfg.tsdbPageSize;
|
||||||
createReq.changeVersion = ++(pVgroup->syncConfChangeVer);
|
createReq.changeVersion = ++(pVgroup->syncConfChangeVer);
|
||||||
createReq.encryptAlgorithm = pDb->cfg.encryptAlgorithm;
|
createReq.encryptAlgorithm = pDb->cfg.encryptAlgorithm;
|
||||||
|
int32_t code = 0;
|
||||||
|
|
||||||
for (int32_t v = 0; v < pVgroup->replica; ++v) {
|
for (int32_t v = 0; v < pVgroup->replica; ++v) {
|
||||||
SReplica *pReplica = NULL;
|
SReplica *pReplica = NULL;
|
||||||
|
@ -390,7 +391,13 @@ void *mndBuildCreateVnodeReq(SMnode *pMnode, SDnodeObj *pDnode, SDbObj *pDb, SVg
|
||||||
return NULL;
|
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;
|
*pContLen = contLen;
|
||||||
return pReq;
|
return pReq;
|
||||||
}
|
}
|
||||||
|
@ -436,7 +443,12 @@ static void *mndBuildAlterVnodeConfigReq(SMnode *pMnode, SDbObj *pDb, SVgObj *pV
|
||||||
pHead->contLen = htonl(contLen);
|
pHead->contLen = htonl(contLen);
|
||||||
pHead->vgId = htonl(pVgroup->vgId);
|
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;
|
*pContLen = contLen;
|
||||||
return pReq;
|
return pReq;
|
||||||
}
|
}
|
||||||
|
@ -514,7 +526,12 @@ static void *mndBuildAlterVnodeReplicaReq(SMnode *pMnode, SDbObj *pDb, SVgObj *p
|
||||||
return NULL;
|
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;
|
*pContLen = contLen;
|
||||||
return pReq;
|
return pReq;
|
||||||
}
|
}
|
||||||
|
@ -587,7 +604,12 @@ static void *mndBuildCheckLearnCatchupReq(SMnode *pMnode, SDbObj *pDb, SVgObj *p
|
||||||
return NULL;
|
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;
|
*pContLen = contLen;
|
||||||
return pReq;
|
return pReq;
|
||||||
}
|
}
|
||||||
|
@ -611,7 +633,12 @@ static void *mndBuildDisableVnodeWriteReq(SMnode *pMnode, SDbObj *pDb, int32_t v
|
||||||
return NULL;
|
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;
|
*pContLen = contLen;
|
||||||
return pReq;
|
return pReq;
|
||||||
}
|
}
|
||||||
|
@ -639,7 +666,12 @@ static void *mndBuildAlterVnodeHashRangeReq(SMnode *pMnode, int32_t srcVgId, SVg
|
||||||
return NULL;
|
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;
|
*pContLen = contLen;
|
||||||
return pReq;
|
return pReq;
|
||||||
}
|
}
|
||||||
|
@ -664,7 +696,12 @@ void *mndBuildDropVnodeReq(SMnode *pMnode, SDnodeObj *pDnode, SDbObj *pDb, SVgOb
|
||||||
return NULL;
|
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;
|
*pContLen = contLen;
|
||||||
return pReq;
|
return pReq;
|
||||||
}
|
}
|
||||||
|
@ -907,7 +944,9 @@ SEpSet mndGetVgroupEpset(SMnode *pMnode, const SVgObj *pVgroup) {
|
||||||
epset.inUse = epset.numOfEps;
|
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);
|
mndReleaseDnode(pMnode, pDnode);
|
||||||
}
|
}
|
||||||
epsetSort(&epset);
|
epsetSort(&epset);
|
||||||
|
@ -930,7 +969,9 @@ SEpSet mndGetVgroupEpsetById(SMnode *pMnode, int32_t vgId) {
|
||||||
epset.inUse = epset.numOfEps;
|
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);
|
mndReleaseDnode(pMnode, pDnode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -945,6 +986,7 @@ static int32_t mndRetrieveVgroups(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *p
|
||||||
SVgObj *pVgroup = NULL;
|
SVgObj *pVgroup = NULL;
|
||||||
int32_t cols = 0;
|
int32_t cols = 0;
|
||||||
int64_t curMs = taosGetTimestampMs();
|
int64_t curMs = taosGetTimestampMs();
|
||||||
|
int32_t code = 0;
|
||||||
|
|
||||||
SDbObj *pDb = NULL;
|
SDbObj *pDb = NULL;
|
||||||
if (strlen(pShow->db) > 0) {
|
if (strlen(pShow->db) > 0) {
|
||||||
|
@ -965,26 +1007,46 @@ static int32_t mndRetrieveVgroups(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *p
|
||||||
|
|
||||||
cols = 0;
|
cols = 0;
|
||||||
SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
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};
|
SName name = {0};
|
||||||
char db[TSDB_DB_NAME_LEN + VARSTR_HEADER_SIZE] = {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));
|
(void)tNameGetDbName(&name, varDataVal(db));
|
||||||
varDataSetLen(db, strlen(varDataVal(db)));
|
varDataSetLen(db, strlen(varDataVal(db)));
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
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++);
|
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
|
// default 3 replica, add 1 replica if move vnode
|
||||||
for (int32_t i = 0; i < 4; ++i) {
|
for (int32_t i = 0; i < 4; ++i) {
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
if (i < pVgroup->replica) {
|
if (i < pVgroup->replica) {
|
||||||
int16_t dnodeId = (int16_t)pVgroup->vnodeGid[i].dnodeId;
|
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 exist = false;
|
||||||
bool online = 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);
|
STR_WITH_MAXSIZE_TO_VARSTR(buf1, role, pShow->pMeta->pSchemas[cols].bytes);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
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 {
|
} else {
|
||||||
colDataSetNULL(pColInfo, numOfRows);
|
colDataSetNULL(pColInfo, numOfRows);
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
|
@ -1048,21 +1114,25 @@ static int32_t mndRetrieveVgroups(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *p
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
int32_t cacheUsage = (int32_t)pVgroup->cacheUsage;
|
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++);
|
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++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pVgroup->isTsma, false);
|
code = colDataSetVal(pColInfo, numOfRows, (const char *)&pVgroup->isTsma, false);
|
||||||
|
if (code != 0) {
|
||||||
// pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
mError("vgId:%d, failed to set isTsma, since %s", pVgroup->vgId, tstrerror(code));
|
||||||
// if (pDb == NULL || pDb->compactStartTime <= 0) {
|
return code;
|
||||||
// colDataSetNULL(pColInfo, numOfRows);
|
}
|
||||||
// } else {
|
|
||||||
// (void)colDataSetVal(pColInfo, numOfRows, (const char *)&pDb->compactStartTime, false);
|
|
||||||
// }
|
|
||||||
|
|
||||||
numOfRows++;
|
numOfRows++;
|
||||||
sdbRelease(pSdb, pVgroup);
|
sdbRelease(pSdb, pVgroup);
|
||||||
}
|
}
|
||||||
|
@ -1147,6 +1217,7 @@ static int32_t mndRetrieveVnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
|
||||||
SVgObj *pVgroup = NULL;
|
SVgObj *pVgroup = NULL;
|
||||||
int32_t cols = 0;
|
int32_t cols = 0;
|
||||||
int64_t curMs = taosGetTimestampMs();
|
int64_t curMs = taosGetTimestampMs();
|
||||||
|
int32_t code = 0;
|
||||||
|
|
||||||
while (numOfRows < rows - TSDB_MAX_REPLICA) {
|
while (numOfRows < rows - TSDB_MAX_REPLICA) {
|
||||||
pShow->pIter = sdbFetch(pSdb, SDB_VGROUP, pShow->pIter, (void **)&pVgroup);
|
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;
|
cols = 0;
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
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++);
|
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
|
// db_name
|
||||||
const char *dbname = mndGetDbStr(pVgroup->dbName);
|
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);
|
STR_WITH_MAXSIZE_TO_VARSTR(b1, "NULL", TSDB_DB_NAME_LEN + VARSTR_HEADER_SIZE);
|
||||||
}
|
}
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
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?
|
// dnode is online?
|
||||||
SDnodeObj *pDnode = mndAcquireDnode(pMnode, pGid->dnodeId);
|
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;
|
ESyncState syncState = (isDnodeOnline) ? pGid->syncState : TAOS_SYNC_STATE_OFFLINE;
|
||||||
STR_TO_VARSTR(buf, syncStr(syncState));
|
STR_TO_VARSTR(buf, syncStr(syncState));
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
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;
|
int64_t roleTimeMs = (isDnodeOnline) ? pGid->roleTimeMs : 0;
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
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;
|
int64_t startTimeMs = (isDnodeOnline) ? pGid->startTimeMs : 0;
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
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++);
|
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++;
|
numOfRows++;
|
||||||
sdbRelease(pSdb, pDnode);
|
sdbRelease(pSdb, pDnode);
|
||||||
|
@ -1270,8 +1368,10 @@ static int32_t mndAddVnodeToVgroup(SMnode *pMnode, STrans *pTrans, SVgObj *pVgro
|
||||||
sdbFreeRaw(pVgRaw);
|
sdbFreeRaw(pVgRaw);
|
||||||
TAOS_RETURN(code);
|
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_RETURN(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1332,7 +1432,10 @@ _OVER:
|
||||||
sdbFreeRaw(pVgRaw);
|
sdbFreeRaw(pVgRaw);
|
||||||
TAOS_RETURN(code);
|
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_RETURN(code);
|
||||||
}
|
}
|
||||||
|
@ -1568,6 +1671,10 @@ int32_t mndAddNewVgPrepareAction(SMnode *pMnode, STrans *pTrans, SVgObj *pVg) {
|
||||||
|
|
||||||
TAOS_CHECK_GOTO(mndTransAppendPrepareLog(pTrans, pRaw), NULL, _err);
|
TAOS_CHECK_GOTO(mndTransAppendPrepareLog(pTrans, pRaw), NULL, _err);
|
||||||
(void)sdbSetRawStatus(pRaw, SDB_STATUS_CREATING);
|
(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;
|
pRaw = NULL;
|
||||||
TAOS_RETURN(code);
|
TAOS_RETURN(code);
|
||||||
|
|
||||||
|
@ -1824,7 +1931,11 @@ int32_t mndSetMoveVgroupInfoToTrans(SMnode *pMnode, STrans *pTrans, SDbObj *pDb,
|
||||||
sdbFreeRaw(pRaw);
|
sdbFreeRaw(pRaw);
|
||||||
TAOS_RETURN(code);
|
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));
|
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);
|
sdbFreeRaw(pRaw);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
(void)sdbSetRawStatus(pRaw, SDB_STATUS_READY);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mndAddDropVnodeAction(pMnode, pTrans, pDb, &newVg, &del, true) != 0) return -1;
|
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);
|
sdbFreeRaw(pRaw);
|
||||||
TAOS_RETURN(code);
|
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) {
|
for (int32_t i = 0; i < newVg.replica; ++i) {
|
||||||
|
@ -1930,7 +2044,11 @@ int32_t mndSetMoveVgroupInfoToTrans(SMnode *pMnode, STrans *pTrans, SDbObj *pDb,
|
||||||
sdbFreeRaw(pRaw);
|
sdbFreeRaw(pRaw);
|
||||||
TAOS_RETURN(code);
|
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);
|
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);
|
sdbFreeRaw(pVgRaw);
|
||||||
TAOS_RETURN(code);
|
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
|
// learner
|
||||||
for (int32_t i = 0; i < pVgroup->replica - 1; ++i) {
|
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);
|
sdbFreeRaw(pVgRaw);
|
||||||
TAOS_RETURN(code);
|
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));
|
TAOS_CHECK_RETURN(mndAddDropVnodeAction(pMnode, pTrans, pDb, pVgroup, &delGid, true));
|
||||||
for (int32_t i = 0; i < pVgroup->replica; ++i) {
|
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);
|
sdbFreeRaw(pRaw);
|
||||||
goto _OVER;
|
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);
|
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->contLen = htonl(contLen);
|
||||||
pHead->vgId = htonl(pVgroup->vgId);
|
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;
|
*pContLen = contLen;
|
||||||
return pReq;
|
return pReq;
|
||||||
}
|
}
|
||||||
|
@ -2693,7 +2827,11 @@ int32_t mndBuildAlterVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *pOldDb
|
||||||
sdbFreeRaw(pVgRaw);
|
sdbFreeRaw(pVgRaw);
|
||||||
TAOS_RETURN(code);
|
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);
|
TAOS_RETURN(code);
|
||||||
|
@ -2776,7 +2914,12 @@ int32_t mndBuildRaftAlterVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *pO
|
||||||
sdbFreeRaw(pVgRaw);
|
sdbFreeRaw(pVgRaw);
|
||||||
TAOS_RETURN(code);
|
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) {
|
} 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,
|
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);
|
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);
|
sdbFreeRaw(pVgRaw);
|
||||||
TAOS_RETURN(code);
|
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};
|
SVnodeGid del2 = {0};
|
||||||
TAOS_CHECK_RETURN(mndRemoveVnodeFromVgroupWithoutSave(pMnode, pTrans, &newVgroup, pArray, &del2));
|
TAOS_CHECK_RETURN(mndRemoveVnodeFromVgroupWithoutSave(pMnode, pTrans, &newVgroup, pArray, &del2));
|
||||||
|
@ -2823,7 +2971,12 @@ int32_t mndBuildRaftAlterVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *pO
|
||||||
sdbFreeRaw(pVgRaw);
|
sdbFreeRaw(pVgRaw);
|
||||||
TAOS_RETURN(code);
|
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 {
|
} else {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -2841,7 +2994,12 @@ int32_t mndBuildRaftAlterVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *pO
|
||||||
sdbFreeRaw(pVgRaw);
|
sdbFreeRaw(pVgRaw);
|
||||||
TAOS_RETURN(code);
|
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);
|
TAOS_RETURN(code);
|
||||||
|
@ -2917,7 +3075,11 @@ int32_t mndBuildRestoreAlterVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj
|
||||||
sdbFreeRaw(pVgRaw);
|
sdbFreeRaw(pVgRaw);
|
||||||
TAOS_RETURN(code);
|
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);
|
TAOS_RETURN(code);
|
||||||
}
|
}
|
||||||
|
@ -2938,7 +3100,11 @@ static int32_t mndAddVgStatusAction(STrans *pTrans, SVgObj *pVg, ESdbStatus vgSt
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
if ((code = appendActionCb(pTrans, pRaw)) != 0) 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;
|
pRaw = NULL;
|
||||||
TAOS_RETURN(code);
|
TAOS_RETURN(code);
|
||||||
_err:
|
_err:
|
||||||
|
@ -2956,7 +3122,11 @@ static int32_t mndAddDbStatusAction(STrans *pTrans, SDbObj *pDb, ESdbStatus dbSt
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
if ((code = appendActionCb(pTrans, pRaw)) != 0) 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;
|
pRaw = NULL;
|
||||||
TAOS_RETURN(code);
|
TAOS_RETURN(code);
|
||||||
_err:
|
_err:
|
||||||
|
@ -3165,7 +3335,11 @@ static int32_t mndSetBalanceVgroupInfoToTrans(SMnode *pMnode, STrans *pTrans, SD
|
||||||
sdbFreeRaw(pRaw);
|
sdbFreeRaw(pRaw);
|
||||||
TAOS_RETURN(code);
|
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);
|
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->contLen = htonl(contLen);
|
||||||
pHead->vgId = htonl(pVgroup->vgId);
|
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;
|
*pContLen = contLen;
|
||||||
return pReq;
|
return pReq;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue