diff --git a/source/libs/sync/src/syncReplication.c b/source/libs/sync/src/syncReplication.c index 83fbb0aa97d65f81ba1a9eb36ea8fdcbf3f8dc06..bdb55f3a7c1064d0c015797f658dd8a90cae7ef9 100644 --- a/source/libs/sync/src/syncReplication.c +++ b/source/libs/sync/src/syncReplication.c @@ -178,15 +178,17 @@ int32_t syncNodeAppendEntriesPeersSnapshot(SSyncNode* pSyncNode) { syncNodeAppendEntries(pSyncNode, pDestId, pMsg); syncAppendEntriesDestroy(pMsg); - SSyncSnapshotSender* pSender = NULL; - for (int i = 0; i < pSyncNode->replicaNum; ++i) { - if (syncUtilSameId(&((pSyncNode->replicasId)[i]), pDestId)) { - pSender = (pSyncNode->senders)[i]; - break; + if (!snapshotSendingFinish) { + SSyncSnapshotSender* pSender = NULL; + for (int i = 0; i < pSyncNode->replicaNum; ++i) { + if (syncUtilSameId(&((pSyncNode->replicasId)[i]), pDestId)) { + pSender = (pSyncNode->senders)[i]; + break; + } } + ASSERT(pSender != NULL); + snapshotSenderStart(pSender); } - ASSERT(pSender != NULL); - snapshotSenderStart(pSender); } else { ret = syncNodeGetPreIndexTerm(pSyncNode, nextIndex, &preLogIndex, &preLogTerm);