From 7322f68240603edbfc840ecb4e2d7f098b5f3dca Mon Sep 17 00:00:00 2001 From: dmchen Date: Mon, 26 Aug 2024 06:51:09 +0000 Subject: [PATCH] fix/TD-31542-fix-case --- source/libs/sync/src/syncMain.c | 2 +- source/libs/sync/src/syncPipeline.c | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index 2e76fcdf91..c8da543927 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -730,7 +730,7 @@ SyncIndex syncNodeGetSnapshotConfigIndex(SSyncNode* pSyncNode, SyncIndex snapsho sError("vgId:%d, failed get snapshot config index, configIndexCount:%d", pSyncNode->vgId, pSyncNode->raftCfg.configIndexCount); terrno = TSDB_CODE_SYN_INTERNAL_ERROR; - return -1; + return -2; } SyncIndex lastIndex = (pSyncNode->raftCfg.configIndexArr)[0]; diff --git a/source/libs/sync/src/syncPipeline.c b/source/libs/sync/src/syncPipeline.c index 5687321579..f3f6148ae5 100644 --- a/source/libs/sync/src/syncPipeline.c +++ b/source/libs/sync/src/syncPipeline.c @@ -611,17 +611,18 @@ int32_t syncFsmExecute(SSyncNode* pNode, SSyncFSM* pFsm, ESyncState role, SyncTe int32_t code = 0, lino = 0; bool retry = false; do { - SRpcMsg rpcMsg = {.code = applyCode}; - TAOS_CHECK_EXIT(syncEntry2OriginalRpc(pEntry, &rpcMsg)); - SFsmCbMeta cbMeta = {0}; - cbMeta.index = pEntry->index; cbMeta.lastConfigIndex = syncNodeGetSnapshotConfigIndex(pNode, pEntry->index); - if (cbMeta.lastConfigIndex < 0) { + if (cbMeta.lastConfigIndex < -1) { code = TSDB_CODE_SYN_INTERNAL_ERROR; if (terrno != 0) code = terrno; return code; } + + SRpcMsg rpcMsg = {.code = applyCode}; + TAOS_CHECK_EXIT(syncEntry2OriginalRpc(pEntry, &rpcMsg)); + + cbMeta.index = pEntry->index; cbMeta.isWeak = pEntry->isWeak; cbMeta.code = applyCode; cbMeta.state = role;