From f2fd847414f7841eec4e792fe61ee3063265f8d2 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 9 Nov 2022 17:35:22 +0800 Subject: [PATCH] refact: move sync test code to single lib --- source/libs/sync/src/syncMain.c | 8 +------- source/libs/sync/src/syncReplication.c | 2 +- tests/script/tsim/vnode/replica3_repeat.sim | 2 +- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index d05e1608e2..b4ca3f5b01 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -2223,10 +2223,6 @@ int32_t syncNodeOnClientRequest(SSyncNode* ths, SRpcMsg* pMsg, SyncIndex* pRetIn } else { // del resp mgr, call FpCommitCb - - SRpcMsg rpcMsg = {0}; - syncClientRequest2RpcMsg(pMsg, &rpcMsg); - SFsmCbMeta cbMeta = { .index = pEntry->index, .lastConfigIndex = SYNC_INDEX_INVALID, @@ -2238,9 +2234,7 @@ int32_t syncNodeOnClientRequest(SSyncNode* ths, SRpcMsg* pMsg, SyncIndex* pRetIn .currentTerm = ths->pRaftStore->currentTerm, .flag = 0, }; - - syncRespMgrGetAndDel(ths->pSyncRespMgr, cbMeta.seqNum, &rpcMsg.info); - ths->pFsm->FpCommitCb(ths->pFsm, &rpcMsg, &cbMeta); + ths->pFsm->FpCommitCb(ths->pFsm, pMsg, &cbMeta); if (h) { taosLRUCacheRelease(ths->pLogStore->pCache, h, false); diff --git a/source/libs/sync/src/syncReplication.c b/source/libs/sync/src/syncReplication.c index 8c3f7e5384..3f22a1f2cd 100644 --- a/source/libs/sync/src/syncReplication.c +++ b/source/libs/sync/src/syncReplication.c @@ -78,7 +78,7 @@ int32_t syncNodeReplicateOne(SSyncNode* pSyncNode, SRaftId* pDestId) { pMsg = syncAppendEntriesBuild(pEntry->bytes, pSyncNode->vgId); ASSERT(pMsg != NULL); - memcpy(pMsg->data, pEntry->data, pEntry->bytes); + memcpy(pMsg->data, pEntry, pEntry->bytes); syncEntryDestory(pEntry); } else { diff --git a/tests/script/tsim/vnode/replica3_repeat.sim b/tests/script/tsim/vnode/replica3_repeat.sim index ccff06819b..8efba515ae 100644 --- a/tests/script/tsim/vnode/replica3_repeat.sim +++ b/tests/script/tsim/vnode/replica3_repeat.sim @@ -118,7 +118,7 @@ step7: sql select count(*) from db.tb -x step7 print select count(*) from db.tb ==> $data00 $lastRows -if $data00 <= $lastRows then +if $data00 < $lastRows then return -1 endi