ehn/vnode-open-log-fix-review

This commit is contained in:
dmchen 2024-11-21 18:28:37 +08:00
parent a7fdabb6d7
commit 246a375cc2
2 changed files with 8 additions and 8 deletions

View File

@ -104,10 +104,10 @@ int32_t syncNodeOnAppendEntries(SSyncNode* ths, const SRpcMsg* pRpcMsg) {
goto _IGNORE; goto _IGNORE;
} }
int32_t nRef = atomic_fetch_add_32(&ths->recvCount, 1); int32_t nRef = atomic_add_fetch_32(&ths->recvCount, 1);
if (nRef < 0) { if (nRef <= 0) {
sError("vgId:%d, recv count is %d", ths->vgId, nRef); sError("vgId:%d, recv count is %d", ths->vgId, nRef);
} }
int32_t code = syncBuildAppendEntriesReply(&rpcRsp, ths->vgId); int32_t code = syncBuildAppendEntriesReply(&rpcRsp, ths->vgId);
if (code != 0) { if (code != 0) {

View File

@ -90,16 +90,16 @@ int32_t syncNodeSendAppendEntries(SSyncNode* pSyncNode, const SRaftId* destRaftI
int32_t nRef = 0; int32_t nRef = 0;
if (pSyncNode != NULL) { if (pSyncNode != NULL) {
nRef = atomic_fetch_add_32(&pSyncNode->sendCount, 1); nRef = atomic_add_fetch_32(&pSyncNode->sendCount, 1);
if (nRef < 0) { if (nRef <= 0) {
sError("vgId:%d, send count is %d", pSyncNode->vgId, nRef); sError("vgId:%d, send count is %d", pSyncNode->vgId, nRef);
} }
} }
SSyncLogReplMgr* mgr = syncNodeGetLogReplMgr(pSyncNode, (SRaftId*)destRaftId); SSyncLogReplMgr* mgr = syncNodeGetLogReplMgr(pSyncNode, (SRaftId*)destRaftId);
if (mgr != NULL) { if (mgr != NULL) {
nRef = atomic_fetch_add_32(&mgr->sendCount, 1); nRef = atomic_add_fetch_32(&mgr->sendCount, 1);
if (nRef < 0) { if (nRef <= 0) {
sError("vgId:%d, send count is %d", pSyncNode->vgId, nRef); sError("vgId:%d, send count is %d", pSyncNode->vgId, nRef);
} }
} }