remove memory leak and syncNodeInRaftGroup
This commit is contained in:
parent
39283d22fb
commit
39f6ce1694
|
@ -2287,6 +2287,12 @@ int32_t syncNodeOnHeartbeat(SSyncNode* ths, const SRpcMsg* pRpcMsg) {
|
|||
int64_t timeDiff = tsMs - pMsg->timeStamp;
|
||||
syncLogRecvHeartbeat(ths, pMsg, timeDiff, tbuf);
|
||||
|
||||
if(!syncNodeInRaftGroup(ths, &pMsg->srcId))
|
||||
{
|
||||
sWarn("vgId:%d, drop heartbeat msg from dnode:%d, because it come from another cluster:%d, differ from current cluster:%d", ths->vgId, DID(&(pMsg->srcId)), CID(&(pMsg->srcId)) , CID(&(ths->myRaftId)));
|
||||
return 0;
|
||||
}
|
||||
|
||||
SRpcMsg rpcMsg = {0};
|
||||
(void)syncBuildHeartbeatReply(&rpcMsg, ths->vgId);
|
||||
SyncTerm currentTerm = raftStoreGetTerm(ths);
|
||||
|
@ -2299,12 +2305,6 @@ int32_t syncNodeOnHeartbeat(SSyncNode* ths, const SRpcMsg* pRpcMsg) {
|
|||
pMsgReply->startTime = ths->startTime;
|
||||
pMsgReply->timeStamp = tsMs;
|
||||
|
||||
if(CID(&(pMsg->srcId)) != CID(&(ths->myRaftId)))
|
||||
{
|
||||
sWarn("vgId:%d, drop heartbeat msg from dnode:%d, because it come from another cluster:%d, differ from current cluster:%d", ths->vgId, DID(&(pMsg->srcId)), CID(&(pMsg->srcId)) , CID(&(ths->myRaftId)));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (pMsg->term == currentTerm && ths->state != TAOS_SYNC_STATE_LEADER) {
|
||||
syncIndexMgrSetRecvTime(ths->pNextIndex, &(pMsg->srcId), tsMs);
|
||||
|
||||
|
|
|
@ -91,12 +91,6 @@ int32_t syncNodeOnRequestVote(SSyncNode* ths, const SRpcMsg* pRpcMsg) {
|
|||
int32_t ret = 0;
|
||||
SyncRequestVote* pMsg = pRpcMsg->pCont;
|
||||
|
||||
if(CID(&(pMsg->srcId)) != CID(&(ths->myRaftId)))
|
||||
{
|
||||
sWarn("vgId:%d, drop RequestVote msg from dnode:%d, because it come from another cluster:%d, differ from current cluster:%d", ths->vgId, DID(&(pMsg->srcId)), CID(&(pMsg->srcId)) , CID(&(ths->myRaftId)));
|
||||
return -1;
|
||||
}
|
||||
|
||||
// if already drop replica, do not process
|
||||
if (!syncNodeInRaftGroup(ths, &pMsg->srcId)) {
|
||||
syncLogRecvRequestVote(ths, pMsg, -1, "not in my config");
|
||||
|
|
Loading…
Reference in New Issue