fix: avoid memory leak in mnode sync
This commit is contained in:
parent
07fee01d1c
commit
077ea4a14f
|
@ -141,6 +141,7 @@ int32_t mndSyncPropose(SMnode *pMnode, SSdbRaw *pRaw) {
|
||||||
terrno = TSDB_CODE_APP_ERROR;
|
terrno = TSDB_CODE_APP_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rpcFreeCont(rsp.pCont);
|
||||||
if (code != 0) return code;
|
if (code != 0) return code;
|
||||||
return pMgmt->errCode;
|
return pMgmt->errCode;
|
||||||
}
|
}
|
||||||
|
|
|
@ -681,6 +681,7 @@ static int32_t mndTransSync(SMnode *pMnode, STrans *pTrans) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sdbFreeRaw(pRaw);
|
||||||
mDebug("trans:%d, sync finished", pTrans->id);
|
mDebug("trans:%d, sync finished", pTrans->id);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -318,11 +318,8 @@ int32_t syncPropose(int64_t rid, const SRpcMsg* pMsg, bool isWeak) {
|
||||||
sTrace("syncPropose msgType:%d ", pMsg->msgType);
|
sTrace("syncPropose msgType:%d ", pMsg->msgType);
|
||||||
|
|
||||||
int32_t ret = TAOS_SYNC_PROPOSE_SUCCESS;
|
int32_t ret = TAOS_SYNC_PROPOSE_SUCCESS;
|
||||||
SSyncNode* pSyncNode = (SSyncNode*)taosAcquireRef(tsNodeRefId, rid);
|
SSyncNode* pSyncNode = taosAcquireRef(tsNodeRefId, rid);
|
||||||
if (pSyncNode == NULL) {
|
if (pSyncNode == NULL) return TAOS_SYNC_PROPOSE_OTHER_ERROR;
|
||||||
rpcFreeCont(pMsg->pCont);
|
|
||||||
return TAOS_SYNC_PROPOSE_OTHER_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
assert(rid == pSyncNode->rid);
|
assert(rid == pSyncNode->rid);
|
||||||
|
|
||||||
|
@ -335,14 +332,13 @@ int32_t syncPropose(int64_t rid, const SRpcMsg* pMsg, bool isWeak) {
|
||||||
SyncClientRequest* pSyncMsg = syncClientRequestBuild2(pMsg, seqNum, isWeak, pSyncNode->vgId);
|
SyncClientRequest* pSyncMsg = syncClientRequestBuild2(pMsg, seqNum, isWeak, pSyncNode->vgId);
|
||||||
SRpcMsg rpcMsg;
|
SRpcMsg rpcMsg;
|
||||||
syncClientRequest2RpcMsg(pSyncMsg, &rpcMsg);
|
syncClientRequest2RpcMsg(pSyncMsg, &rpcMsg);
|
||||||
if (pSyncNode->FpEqMsg != NULL) {
|
|
||||||
pSyncNode->FpEqMsg(pSyncNode->msgcb, &rpcMsg);
|
if (pSyncNode->FpEqMsg != NULL && (*pSyncNode->FpEqMsg)(pSyncNode->msgcb, &rpcMsg) == 0) {
|
||||||
|
ret = TAOS_SYNC_PROPOSE_SUCCESS;
|
||||||
} else {
|
} else {
|
||||||
sTrace("syncPropose pSyncNode->FpEqMsg is NULL");
|
sTrace("syncPropose pSyncNode->FpEqMsg is NULL");
|
||||||
}
|
}
|
||||||
syncClientRequestDestroy(pSyncMsg);
|
syncClientRequestDestroy(pSyncMsg);
|
||||||
ret = TAOS_SYNC_PROPOSE_SUCCESS;
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
sTrace("syncPropose not leader, %s", syncUtilState2String(pSyncNode->state));
|
sTrace("syncPropose not leader, %s", syncUtilState2String(pSyncNode->state));
|
||||||
ret = TAOS_SYNC_PROPOSE_NOT_LEADER;
|
ret = TAOS_SYNC_PROPOSE_NOT_LEADER;
|
||||||
|
|
Loading…
Reference in New Issue