From 7014f790a083e16523fa3dd654615f6b819c6831 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Mon, 10 Jul 2023 17:35:26 +0800 Subject: [PATCH] optmize table statistic info --- source/dnode/vnode/src/tsdb/tsdbSttFileRW.c | 19 ------------------- source/dnode/vnode/src/tsdb/tsdbUtil2.h | 8 +------- 2 files changed, 1 insertion(+), 26 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbSttFileRW.c b/source/dnode/vnode/src/tsdb/tsdbSttFileRW.c index 187d22f348..db8d14d228 100644 --- a/source/dnode/vnode/src/tsdb/tsdbSttFileRW.c +++ b/source/dnode/vnode/src/tsdb/tsdbSttFileRW.c @@ -488,21 +488,10 @@ static int32_t tsdbSttFileDoWriteStatisBlock(SSttFileWriter *writer) { .suid = TARRAY2_LAST(writer->staticBlock->suid), .uid = TARRAY2_LAST(writer->staticBlock->uid), }, - .minVer = TARRAY2_FIRST(writer->staticBlock->minVer), - .maxVer = TARRAY2_FIRST(writer->staticBlock->maxVer), .numRec = STATIS_BLOCK_SIZE(writer->staticBlock), .cmprAlg = writer->config->cmprAlg, }}; - for (int32_t i = 1; i < STATIS_BLOCK_SIZE(writer->staticBlock); i++) { - if (statisBlk->minVer > TARRAY2_GET(writer->staticBlock->minVer, i)) { - statisBlk->minVer = TARRAY2_GET(writer->staticBlock->minVer, i); - } - if (statisBlk->maxVer < TARRAY2_GET(writer->staticBlock->maxVer, i)) { - statisBlk->maxVer = TARRAY2_GET(writer->staticBlock->maxVer, i); - } - } - for (int32_t i = 0; i < STATIS_RECORD_NUM_ELEM; i++) { code = tsdbCmprData((uint8_t *)TARRAY2_DATA(writer->staticBlock->dataArr + i), TARRAY2_DATA_LEN(&writer->staticBlock->dataArr[i]), TSDB_DATA_TYPE_BIGINT, statisBlk->cmprAlg, @@ -889,8 +878,6 @@ int32_t tsdbSttFileWriteRow(SSttFileWriter *writer, SRowInfo *row) { .uid = row->uid, .firstKey = key->ts, .lastKey = key->ts, - .minVer = key->version, - .maxVer = key->version, .count = 1, }; code = tStatisBlockPut(writer->staticBlock, &record); @@ -898,12 +885,6 @@ int32_t tsdbSttFileWriteRow(SSttFileWriter *writer, SRowInfo *row) { } else { ASSERT(key->ts >= TARRAY2_LAST(writer->staticBlock->lastKey)); - if (TARRAY2_LAST(writer->staticBlock->minVer) > key->version) { - TARRAY2_LAST(writer->staticBlock->minVer) = key->version; - } - if (TARRAY2_LAST(writer->staticBlock->maxVer) < key->version) { - TARRAY2_LAST(writer->staticBlock->maxVer) = key->version; - } if (key->ts > TARRAY2_LAST(writer->staticBlock->lastKey)) { TARRAY2_LAST(writer->staticBlock->count)++; TARRAY2_LAST(writer->staticBlock->lastKey) = key->ts; diff --git a/source/dnode/vnode/src/tsdb/tsdbUtil2.h b/source/dnode/vnode/src/tsdb/tsdbUtil2.h index 87a98203b2..fa06368341 100644 --- a/source/dnode/vnode/src/tsdb/tsdbUtil2.h +++ b/source/dnode/vnode/src/tsdb/tsdbUtil2.h @@ -70,7 +70,7 @@ int32_t tTombBlockGet(STombBlock *tombBlock, int32_t idx, STombRecord *record); int32_t tTombRecordCompare(const STombRecord *record1, const STombRecord *record2); // STbStatisRecord ---------- -#define STATIS_RECORD_NUM_ELEM 7 +#define STATIS_RECORD_NUM_ELEM 5 typedef union { int64_t dataArr[STATIS_RECORD_NUM_ELEM]; struct { @@ -78,8 +78,6 @@ typedef union { int64_t uid; int64_t firstKey; int64_t lastKey; - int64_t minVer; - int64_t maxVer; int64_t count; }; } STbStatisRecord; @@ -91,8 +89,6 @@ typedef union { TARRAY2(int64_t) uid[1]; TARRAY2(int64_t) firstKey[1]; TARRAY2(int64_t) lastKey[1]; - TARRAY2(int64_t) minVer[1]; - TARRAY2(int64_t) maxVer[1]; TARRAY2(int64_t) count[1]; }; } STbStatisBlock; @@ -101,8 +97,6 @@ typedef struct { SFDataPtr dp[1]; TABLEID minTbid; TABLEID maxTbid; - int64_t minVer; - int64_t maxVer; int32_t numRec; int32_t size[STATIS_RECORD_NUM_ELEM]; int8_t cmprAlg; -- GitLab