From d0e0034a0f6c0a624782bac23c965e6112ff7f82 Mon Sep 17 00:00:00 2001 From: Cary Xu Date: Wed, 20 Oct 2021 20:09:05 +0800 Subject: [PATCH] code optimization --- src/tsdb/inc/tsdbReadImpl.h | 7 ++++--- src/tsdb/src/tsdbCommit.c | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/tsdb/inc/tsdbReadImpl.h b/src/tsdb/inc/tsdbReadImpl.h index f067905f5c..088fc5e580 100644 --- a/src/tsdb/inc/tsdbReadImpl.h +++ b/src/tsdb/inc/tsdbReadImpl.h @@ -75,7 +75,8 @@ typedef struct { uint64_t aggrStat : 3; \ uint64_t blkVer : 5; \ uint64_t aggrOffset : 56; \ - uint32_t aggrLen + uint32_t aggrLen; \ + uint32_t reserved typedef struct { SBlockFieldsP0; @@ -118,6 +119,7 @@ typedef struct { char padding[1]; } SBlockColV0; + typedef struct { int16_t colId; uint8_t offsetH; @@ -125,8 +127,7 @@ typedef struct { int32_t len; uint32_t type : 8; uint32_t offset : 24; - // char padding[]; -} SBlockColV1; +} SBlockColV1; // size #define SBlockCol SBlockColV1 // latest SBlockCol definition diff --git a/src/tsdb/src/tsdbCommit.c b/src/tsdb/src/tsdbCommit.c index be59a2e1d7..53ca51004f 100644 --- a/src/tsdb/src/tsdbCommit.c +++ b/src/tsdb/src/tsdbCommit.c @@ -1263,7 +1263,7 @@ static int tsdbCommitMemData(SCommitH *pCommith, SCommitIter *pIter, TSKEY keyLi int32_t defaultRows = TSDB_COMMIT_DEFAULT_ROWS(pCommith); SDFile * pDFile; bool isLast; - SBlock block = {0}; + SBlock block; while (true) { tsdbLoadDataFromCache(pIter->pTable, pIter->pIter, keyLimit, defaultRows, pCommith->pDataCols, NULL, 0, @@ -1363,7 +1363,7 @@ static int tsdbMergeMemData(SCommitH *pCommith, SCommitIter *pIter, int bidx) { static int tsdbMoveBlock(SCommitH *pCommith, int bidx) { SBlock *pBlock = pCommith->readh.pBlkInfo->blocks + bidx; SDFile *pDFile; - SBlock block = {0}; + SBlock block; bool isSameFile; ASSERT(pBlock->numOfSubBlocks > 0); @@ -1416,7 +1416,7 @@ static int tsdbCommitAddBlock(SCommitH *pCommith, const SBlock *pSupBlock, const static int tsdbMergeBlockData(SCommitH *pCommith, SCommitIter *pIter, SDataCols *pDataCols, TSKEY keyLimit, bool isLastOneBlock) { STsdbRepo *pRepo = TSDB_COMMIT_REPO(pCommith); STsdbCfg * pCfg = REPO_CFG(pRepo); - SBlock block = {0}; + SBlock block; SDFile * pDFile; bool isLast; int32_t defaultRows = TSDB_COMMIT_DEFAULT_ROWS(pCommith); -- GitLab