提交 24cbab3e 编写于 作者: C Cary Xu

code refactor

上级 cf50ac02
......@@ -51,8 +51,8 @@ typedef struct {
#endif
/**
* int32_t keyLen; // key column length, keyOffset = offset+sizeof(SBlockData)+sizeof(SBlockCol)*numOfCols
* int16_t numOfCols; // not including timestamp column
* keyLen; // key column length, keyOffset = offset+sizeof(SBlockData)+sizeof(SBlockCol)*numOfCols
* numOfCols; // not including timestamp column
*/
#define SBlockFieldsP0 \
int64_t last : 1; \
......@@ -66,8 +66,13 @@ typedef struct {
TSKEY keyFirst; \
TSKEY keyLast
/**
* aggrStat; // 0 - no aggr part in .data/.last/.sma, 1 - has aggr in .sma
* blkVer; // 0 - original block, 1 - block since importing .sma
* aggrOffset; // only valid when blkVer > 0 and aggrStat > 0
*/
#define SBlockFieldsP1 \
int64_t hasAggr : 3; \
int64_t aggrStat : 3; \
int64_t blkVer : 5; \
int64_t aggrOffset : 56; \
int32_t aggrLen
......
......@@ -1216,7 +1216,7 @@ int tsdbWriteBlockImpl(STsdbRepo *pRepo, STable *pTable, SDFile *pDFile, SDFile
pBlock->keyFirst = dataColsKeyFirst(pDataCols);
pBlock->keyLast = dataColsKeyLast(pDataCols);
#ifdef __TD_6117__
pBlock->hasAggr = aggrStatus;
pBlock->aggrStat = aggrStatus;
pBlock->blkVer = SBlockVerLatest;
pBlock->aggrOffset = offsetAggr;
pBlock->aggrLen = tsizeAggr;
......
......@@ -449,7 +449,7 @@ static int tsdbLoadBlockStatisFromDFile(SReadH *pReadh, SBlock *pBlock) {
}
static int tsdbLoadBlockStatisFromAggr(SReadH *pReadh, SBlock *pBlock) {
ASSERT((pBlock->blkVer > TSDB_SBLK_VER_0) && (pBlock->hasAggr)); // TODO: remove after pass all the test
ASSERT((pBlock->blkVer > TSDB_SBLK_VER_0) && (pBlock->aggrStat)); // TODO: remove after pass all the test
SDFile *pDFileAggr = TSDB_READ_AGGR_FILE(pReadh);
if (tsdbSeekDFile(pDFileAggr, pBlock->aggrOffset, SEEK_SET) < 0) {
......@@ -492,7 +492,7 @@ int tsdbLoadBlockStatis(SReadH *pReadh, SBlock *pBlock) {
ASSERT(pBlock->numOfSubBlocks <= 1);
if (pBlock->blkVer > TSDB_SBLK_VER_0) {
if (pBlock->hasAggr) {
if (pBlock->aggrStat) {
return tsdbLoadBlockStatisFromAggr(pReadh, pBlock);
}
return TSDB_STATIS_NONE;
......@@ -566,7 +566,7 @@ void tsdbGetBlockStatis(SReadH *pReadh, SDataStatis *pStatis, int numOfCols, SBl
j++;
}
}
} else if (pBlock->hasAggr) {
} else if (pBlock->aggrStat) {
SAggrBlkData *pAggrBlkData = pReadh->pAggrBlkData;
for (int i = 0, j = 0; i < numOfCols;) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册