From 9a228d7416b849a1adad262d2fda8480e100f5e8 Mon Sep 17 00:00:00 2001 From: xiao-77 Date: Mon, 14 Oct 2024 14:51:33 +0800 Subject: [PATCH] delete wal while part dnodes offline --- source/libs/sync/src/syncMain.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index fbde104f4e..4862a4b963 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -422,13 +422,11 @@ int32_t syncSendTimeoutRsp(int64_t rid, int64_t seq) { SyncIndex syncMinMatchIndex(SSyncNode* pSyncNode) { SyncIndex minMatchIndex = SYNC_INDEX_INVALID; - if (pSyncNode->peersNum > 0) { - minMatchIndex = syncIndexMgrGetIndex(pSyncNode->pMatchIndex, &(pSyncNode->peersId[0])); - } - - for (int32_t i = 1; i < pSyncNode->peersNum; ++i) { + for (int32_t i = 0; i < pSyncNode->peersNum; ++i) { SyncIndex matchIndex = syncIndexMgrGetIndex(pSyncNode->pMatchIndex, &(pSyncNode->peersId[i])); - if (matchIndex < minMatchIndex) { + if (minMatchIndex == SYNC_INDEX_INVALID) { + minMatchIndex = matchIndex; + } else if (matchIndex > 0 && matchIndex < minMatchIndex) { minMatchIndex = matchIndex; } }