From 1ad2ce1abb3f99b5f1c6d409ec7a26c03afb3ccf Mon Sep 17 00:00:00 2001 From: sisong Date: Tue, 26 Dec 2023 11:08:02 +0800 Subject: [PATCH] hsynz client clear error data loaded from previous cachefile; --- file_for_patch.c | 1 + libhsync/sync_client/match_in_old.cpp | 13 ++++++++++--- libhsync/sync_client/sync_client.cpp | 2 -- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/file_for_patch.c b/file_for_patch.c index c71a6d76..1091a585 100644 --- a/file_for_patch.c +++ b/file_for_patch.c @@ -49,6 +49,7 @@ #include #include // ioctl #include //BLKGETSIZE64 +#include //close static hpatch_BOOL _get_block_dev_size(const char* blkdev,hpatch_uint64_t* bsize){ int fd; diff --git a/libhsync/sync_client/match_in_old.cpp b/libhsync/sync_client/match_in_old.cpp index cfc9edf8..b66d9a5f 100644 --- a/libhsync/sync_client/match_in_old.cpp +++ b/libhsync/sync_client/match_in_old.cpp @@ -275,7 +275,7 @@ static inline uint32_t _indexMapFrom(hpatch_StreamPos_t pos){ typedef volatile hpatch_StreamPos_t volStreamPos_t; -static bool matchRange(hpatch_StreamPos_t* out_newBlockDataInOldPoss, +static bool matchRange(hpatch_StreamPos_t* out_newBlockDataInOldPoss,hpatch_uint32_t kBlockCount, const uint32_t* range_begin,const uint32_t* range_end,TOldDataCache_base& oldData, const TByte* partChecksums,size_t outPartChecksumBits, TByte* newDataCheckChecksum,hpatch_StreamPos_t kMinRevSameIndex,void* _mt=0){ @@ -314,6 +314,7 @@ static bool matchRange(hpatch_StreamPos_t* out_newBlockDataInOldPoss, break; //next same block newBlockIndex=_indexMapFrom(newBlockOldPosBack); + assert(newBlockIndexpartChecksums,rd.newSyncInfo->savedStrongChecksumBits, rd.newSyncInfo->savedNewDataCheckChecksum,kMinRevSameIndex,_mt); if (kIsSkipMatchedBlock&&isMatched){ @@ -419,6 +420,9 @@ static void _rollMatch_mt(int threadIndex,void* workData){ } #endif + static inline void _init_newBlockDataInOldPoss(hpatch_StreamPos_t* newBlockDataInOldPoss,uint32_t kBlockCount){ + for (uint32_t i=0; isavedRollHashByteSize; const size_t savedRollHashBits=newSyncInfo->savedRollHashBits; + _init_newBlockDataInOldPoss(out_newBlockDataInOldPoss,kBlockCount); TAutoMem _mem_sorted(kMatchBlockCount*(size_t)sizeof(uint32_t)); uint32_t* sorted_newIndexs=(uint32_t*)_mem_sorted.data(); @@ -438,8 +443,10 @@ static void _matchNewDataInOld(_TMatchDatas& matchDatas,int threadNum){ for (uint32_t i=0;isamePairCount)&&(i==newSyncInfo->samePairList[curPair].curIndex)){ uint32_t sameIndex=newSyncInfo->samePairList[curPair].sameIndex; - while (out_newBlockDataInOldPoss[sameIndex]!=kBlockType_needSync) + while (out_newBlockDataInOldPoss[sameIndex]!=kBlockType_needSync){ sameIndex=_indexMapFrom(out_newBlockDataInOldPoss[sameIndex]); + assert(sameIndex