feat: process split vgroup msg imp
This commit is contained in:
parent
c949fee06b
commit
908fd4ff97
|
@ -2103,7 +2103,7 @@ static int32_t mndAddAdjustVnodeHashRangeAction(SMnode *pMnode, STrans *pTrans,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t mndSplitVgroup(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SVgObj *pVgroup) {
|
int32_t mndSplitVgroup(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SVgObj *pVgroup) {
|
||||||
int32_t code = -1;
|
int32_t code = -1;
|
||||||
STrans *pTrans = NULL;
|
STrans *pTrans = NULL;
|
||||||
SSdbRaw *pRaw = NULL;
|
SSdbRaw *pRaw = NULL;
|
||||||
|
@ -2229,42 +2229,13 @@ _OVER:
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t mndProcessSplitVgroupMsg(SRpcMsg *pReq) {
|
extern int32_t mndProcessSplitVgroupMsgImp(SRpcMsg *pReq);
|
||||||
SMnode *pMnode = pReq->info.node;
|
|
||||||
int32_t code = -1;
|
|
||||||
SVgObj *pVgroup = NULL;
|
|
||||||
SDbObj *pDb = NULL;
|
|
||||||
|
|
||||||
SSplitVgroupReq req = {0};
|
static int32_t mndProcessSplitVgroupMsg(SRpcMsg *pReq) { return mndProcessSplitVgroupMsgImp(pReq); }
|
||||||
if (tDeserializeSSplitVgroupReq(pReq->pCont, pReq->contLen, &req) != 0) {
|
|
||||||
terrno = TSDB_CODE_INVALID_MSG;
|
|
||||||
goto _OVER;
|
|
||||||
}
|
|
||||||
|
|
||||||
mInfo("vgId:%d, start to split", req.vgId);
|
#ifndef TD_ENTERPRISE
|
||||||
if (mndCheckOperPrivilege(pMnode, pReq->info.conn.user, MND_OPER_SPLIT_VGROUP) != 0) {
|
int32_t mndProcessSplitVgroupMsgImp(SRpcMsg *pReq) { return 0; }
|
||||||
goto _OVER;
|
#endif
|
||||||
}
|
|
||||||
|
|
||||||
pVgroup = mndAcquireVgroup(pMnode, req.vgId);
|
|
||||||
if (pVgroup == NULL) goto _OVER;
|
|
||||||
|
|
||||||
pDb = mndAcquireDb(pMnode, pVgroup->dbName);
|
|
||||||
if (pDb == NULL) goto _OVER;
|
|
||||||
|
|
||||||
code = mndSplitVgroup(pMnode, pReq, pDb, pVgroup);
|
|
||||||
if (code != 0) {
|
|
||||||
mError("vgId:%d, failed to start to split vgroup since %s, db:%s", pVgroup->vgId, terrstr(), pDb->name);
|
|
||||||
goto _OVER;
|
|
||||||
}
|
|
||||||
|
|
||||||
mInfo("vgId:%d, split vgroup started successfully. db:%s", pVgroup->vgId, pDb->name);
|
|
||||||
|
|
||||||
_OVER:
|
|
||||||
mndReleaseVgroup(pMnode, pVgroup);
|
|
||||||
mndReleaseDb(pMnode, pDb);
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int32_t mndSetBalanceVgroupInfoToTrans(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup,
|
static int32_t mndSetBalanceVgroupInfoToTrans(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup,
|
||||||
SDnodeObj *pSrc, SDnodeObj *pDst) {
|
SDnodeObj *pSrc, SDnodeObj *pDst) {
|
||||||
|
|
Loading…
Reference in New Issue