fix: change orReplace logic in mnode
This commit is contained in:
parent
65f117822c
commit
b2de711a84
|
@ -231,12 +231,11 @@ static int32_t mndCreateFunc(SMnode *pMnode, SRpcMsg *pReq, SCreateFuncReq *pCre
|
||||||
|
|
||||||
if(pCreate->orReplace == 1){
|
if(pCreate->orReplace == 1){
|
||||||
SFuncObj *oldFunc = mndAcquireFunc(pMnode, pCreate->name);
|
SFuncObj *oldFunc = mndAcquireFunc(pMnode, pCreate->name);
|
||||||
if(oldFunc == NULL){
|
if(oldFunc != NULL){
|
||||||
goto _OVER;
|
|
||||||
}
|
|
||||||
func.funcVersion = oldFunc->funcVersion + 1;
|
func.funcVersion = oldFunc->funcVersion + 1;
|
||||||
mndReleaseFunc(pMnode, oldFunc);
|
mndReleaseFunc(pMnode, oldFunc);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq, "create-func");
|
pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq, "create-func");
|
||||||
if (pTrans == NULL) goto _OVER;
|
if (pTrans == NULL) goto _OVER;
|
||||||
|
@ -319,6 +318,9 @@ static int32_t mndProcessCreateFuncReq(SRpcMsg *pReq) {
|
||||||
mInfo("func:%s, already exist, ignore exist is set", createReq.name);
|
mInfo("func:%s, already exist, ignore exist is set", createReq.name);
|
||||||
code = 0;
|
code = 0;
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
|
} else if (createReq.orReplace) {
|
||||||
|
mInfo("func:%s, replace function is set", createReq.name);
|
||||||
|
code = 0;
|
||||||
} else {
|
} else {
|
||||||
terrno = TSDB_CODE_MND_FUNC_ALREADY_EXIST;
|
terrno = TSDB_CODE_MND_FUNC_ALREADY_EXIST;
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
|
|
Loading…
Reference in New Issue