From 1ff40068e704f2443c3ec4fe9c8be86cdb5a8aad Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Thu, 2 Jun 2022 11:57:06 +0800 Subject: [PATCH] fix: send snapshot --- source/libs/sync/src/syncReplication.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/source/libs/sync/src/syncReplication.c b/source/libs/sync/src/syncReplication.c index 83fbb0aa97..bdb55f3a7c 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); -- GitLab