提交 7014f790 编写于 作者: H Hongze Cheng

optmize table statistic info

上级 b3e7dd5a
......@@ -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;
......
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册