提交 be7aaccb 编写于 作者: H Hongze Cheng

refactor more code

上级 0ba880d1
...@@ -237,19 +237,19 @@ typedef struct { ...@@ -237,19 +237,19 @@ typedef struct {
int32_t algorithm : 8; int32_t algorithm : 8;
int32_t numOfRows : 24; int32_t numOfRows : 24;
int32_t len; int32_t len;
int32_t keyLen; // key column length, keyOffset = offset+sizeof(SCompData)+sizeof(SCompCol)*numOfCols int32_t keyLen; // key column length, keyOffset = offset+sizeof(SBlockData)+sizeof(SBlockCol)*numOfCols
int16_t numOfSubBlocks; int16_t numOfSubBlocks;
int16_t numOfCols; // not including timestamp column int16_t numOfCols; // not including timestamp column
TSKEY keyFirst; TSKEY keyFirst;
TSKEY keyLast; TSKEY keyLast;
} SCompBlock; } SBlock;
typedef struct { typedef struct {
int32_t delimiter; // For recovery usage int32_t delimiter; // For recovery usage
int32_t tid; int32_t tid;
uint64_t uid; uint64_t uid;
SCompBlock blocks[]; SBlock blocks[];
} SCompInfo; } SBlockInfo;
typedef struct { typedef struct {
int16_t colId; int16_t colId;
...@@ -263,14 +263,14 @@ typedef struct { ...@@ -263,14 +263,14 @@ typedef struct {
int16_t minIndex; int16_t minIndex;
int16_t numOfNull; int16_t numOfNull;
char padding[2]; char padding[2];
} SCompCol; } SBlockCol;
typedef struct { typedef struct {
int32_t delimiter; // For recovery usage int32_t delimiter; // For recovery usage
int32_t numOfCols; // For recovery usage int32_t numOfCols; // For recovery usage
uint64_t uid; // For recovery usage uint64_t uid; // For recovery usage
SCompCol cols[]; SBlockCol cols[];
} SCompData; } SBlockData;
typedef enum { TSDB_WRITE_HELPER, TSDB_READ_HELPER } tsdb_rw_helper_t; typedef enum { TSDB_WRITE_HELPER, TSDB_READ_HELPER } tsdb_rw_helper_t;
...@@ -305,10 +305,10 @@ typedef struct { ...@@ -305,10 +305,10 @@ typedef struct {
void* pWIdx; void* pWIdx;
// For table set usage // For table set usage
SHelperTable tableInfo; SHelperTable tableInfo;
SCompInfo* pCompInfo; SBlockInfo* pCompInfo;
bool hasOldLastBlock; bool hasOldLastBlock;
// For block set usage // For block set usage
SCompData* pCompData; SBlockData* pCompData;
SDataCols* pDataCols[2]; SDataCols* pDataCols[2];
void* pBuffer; // Buffer to hold the whole data block void* pBuffer; // Buffer to hold the whole data block
void* compBuffer; // Buffer for temperary compress/decompress purpose void* compBuffer; // Buffer for temperary compress/decompress purpose
...@@ -319,7 +319,7 @@ typedef struct { ...@@ -319,7 +319,7 @@ typedef struct {
SFileGroup fGroup; SFileGroup fGroup;
int numOfIdx; int numOfIdx;
SCompIdx* pCompIdx; SCompIdx* pCompIdx;
SCompInfo* pCompInfo; SBlockInfo* pCompInfo;
void* pBuf; void* pBuf;
FILE* tLogStream; FILE* tLogStream;
} STsdbScanHandle; } STsdbScanHandle;
...@@ -523,13 +523,13 @@ int tsdbWriteCompIdx(SRWHelper* pHelper); ...@@ -523,13 +523,13 @@ int tsdbWriteCompIdx(SRWHelper* pHelper);
int tsdbLoadCompIdxImpl(SFile* pFile, uint32_t offset, uint32_t len, void* buffer); int tsdbLoadCompIdxImpl(SFile* pFile, uint32_t offset, uint32_t len, void* buffer);
int tsdbDecodeSCompIdxImpl(void* buffer, uint32_t len, SCompIdx** ppCompIdx, int* numOfIdx); int tsdbDecodeSCompIdxImpl(void* buffer, uint32_t len, SCompIdx** ppCompIdx, int* numOfIdx);
int tsdbLoadCompIdx(SRWHelper* pHelper, void* target); int tsdbLoadCompIdx(SRWHelper* pHelper, void* target);
int tsdbLoadCompInfoImpl(SFile* pFile, SCompIdx* pIdx, SCompInfo** ppCompInfo); int tsdbLoadCompInfoImpl(SFile* pFile, SCompIdx* pIdx, SBlockInfo** ppCompInfo);
int tsdbLoadCompInfo(SRWHelper* pHelper, void* target); int tsdbLoadCompInfo(SRWHelper* pHelper, void* target);
int tsdbLoadCompData(SRWHelper* phelper, SCompBlock* pcompblock, void* target); int tsdbLoadCompData(SRWHelper* phelper, SBlock* pcompblock, void* target);
void tsdbGetDataStatis(SRWHelper* pHelper, SDataStatis* pStatis, int numOfCols); void tsdbGetDataStatis(SRWHelper* pHelper, SDataStatis* pStatis, int numOfCols);
int tsdbLoadBlockDataCols(SRWHelper* pHelper, SCompBlock* pCompBlock, SCompInfo* pCompInfo, int16_t* colIds, int tsdbLoadBlockDataCols(SRWHelper* pHelper, SBlock* pCompBlock, SBlockInfo* pCompInfo, int16_t* colIds,
int numOfColIds); int numOfColIds);
int tsdbLoadBlockData(SRWHelper* pHelper, SCompBlock* pCompBlock, SCompInfo* pCompInfo); int tsdbLoadBlockData(SRWHelper* pHelper, SBlock* pCompBlock, SBlockInfo* pCompInfo);
static FORCE_INLINE int compTSKEY(const void* key1, const void* key2) { static FORCE_INLINE int compTSKEY(const void* key1, const void* key2) {
if (*(TSKEY*)key1 > *(TSKEY*)key2) { if (*(TSKEY*)key1 > *(TSKEY*)key2) {
......
...@@ -645,7 +645,7 @@ void tsdbGetFidKeyRange(int daysPerFile, int8_t precision, int fileId, TSKEY *mi ...@@ -645,7 +645,7 @@ void tsdbGetFidKeyRange(int daysPerFile, int8_t precision, int fileId, TSKEY *mi
// newLast = TSDB_NLAST_FILE_OPENED(pHelper); // newLast = TSDB_NLAST_FILE_OPENED(pHelper);
// if (tsdbLoadCompIdx(pHelper, NULL) < 0) { // if (tsdbLoadCompIdx(pHelper, NULL) < 0) {
// tsdbError("vgId:%d failed to load SCompIdx part since %s", REPO_ID(pRepo), tstrerror(terrno)); // tsdbError("vgId:%d failed to load SBlockIdx part since %s", REPO_ID(pRepo), tstrerror(terrno));
// goto _err; // goto _err;
// } // }
...@@ -681,7 +681,7 @@ void tsdbGetFidKeyRange(int daysPerFile, int8_t precision, int fileId, TSKEY *mi ...@@ -681,7 +681,7 @@ void tsdbGetFidKeyRange(int daysPerFile, int8_t precision, int fileId, TSKEY *mi
// goto _err; // goto _err;
// } // }
// // Write the SCompBlock part // // Write the SBlock part
// if (tsdbWriteCompInfo(pHelper) < 0) { // if (tsdbWriteCompInfo(pHelper) < 0) {
// tsdbError("vgId:%d, failed to write compInfo part since %s", REPO_ID(pRepo), tstrerror(terrno)); // tsdbError("vgId:%d, failed to write compInfo part since %s", REPO_ID(pRepo), tstrerror(terrno));
// goto _err; // goto _err;
......
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "tsdbMain.h"
typedef struct {
SFileGroup fGroup;
TSKEY minKey;
TSKEY maxKey;
} SReadHandle;
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册