From bd23a36f86b0392037bcbd4207ab8501e40a6d38 Mon Sep 17 00:00:00 2001 From: Benguang Zhao Date: Sun, 29 Jan 2023 18:03:09 +0800 Subject: [PATCH] fix: round lastApplyIndex up to beginIndex -1 in syncBeginSnapshot --- source/libs/sync/src/syncMain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index b9ca6af912..ea22ac7bb5 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -306,7 +306,7 @@ int32_t syncBeginSnapshot(int64_t rid, int64_t lastApplyIndex) { if (pSyncNode->replicaNum > 1) { // multi replicas - lastApplyIndex -= SYNC_VNODE_LOG_RETENTION; + lastApplyIndex = TMAX(lastApplyIndex - SYNC_VNODE_LOG_RETENTION, beginIndex - 1); if (pSyncNode->state == TAOS_SYNC_STATE_LEADER) { pSyncNode->minMatchIndex = syncMinMatchIndex(pSyncNode);