fix(sync): add error log when pState is NULL
This commit is contained in:
parent
a228d5ecb9
commit
fddd6657bc
|
@ -337,6 +337,7 @@ char* syncNodePeerState2Str(const SSyncNode* pSyncNode) {
|
|||
for (int32_t i = 0; i < pSyncNode->replicaNum; ++i) {
|
||||
SPeerState* pState = syncNodeGetPeerState((SSyncNode*)pSyncNode, &(pSyncNode->replicasId[i]));
|
||||
if (pState == NULL) {
|
||||
sError("vgId:%d, replica maybe dropped", pSyncNode->vgId);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -3497,6 +3498,7 @@ SPeerState* syncNodeGetPeerState(SSyncNode* ths, const SRaftId* pDestId) {
|
|||
bool syncNodeNeedSendAppendEntries(SSyncNode* ths, const SRaftId* pDestId, const SyncAppendEntries* pMsg) {
|
||||
SPeerState* pState = syncNodeGetPeerState(ths, pDestId);
|
||||
if (pState == NULL) {
|
||||
sError("vgId:%d, replica maybe dropped", ths->vgId);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -163,7 +163,10 @@ int32_t syncNodeSendAppendEntries(SSyncNode* pSyncNode, const SRaftId* destRaftI
|
|||
syncNodeSendMsgById(destRaftId, pSyncNode, &rpcMsg);
|
||||
|
||||
SPeerState* pState = syncNodeGetPeerState(pSyncNode, destRaftId);
|
||||
ASSERT(pState != NULL);
|
||||
if (pState == NULL) {
|
||||
sError("vgId:%d, replica maybe dropped", pSyncNode->vgId);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (pMsg->dataLen > 0) {
|
||||
pState->lastSendIndex = pMsg->prevLogIndex + 1;
|
||||
|
|
Loading…
Reference in New Issue