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

more code

上级 d4f4ac1d
......@@ -165,6 +165,7 @@ void tBlockDataDestroy(SBlockData *pBlockData);
int32_t tBlockDataInit(SBlockData *pBlockData, TABLEID *pId, STSchema *pTSchema, int16_t *aCid, int32_t nCid);
void tBlockDataReset(SBlockData *pBlockData);
int32_t tBlockDataAppendRow(SBlockData *pBlockData, TSDBROW *pRow, STSchema *pTSchema, int64_t uid);
int32_t tBlockDataUpdateRow(SBlockData *pBlockData, TSDBROW *pRow, STSchema *pTSchema);
int32_t tBlockDataTryUpsertRow(SBlockData *pBlockData, TSDBROW *pRow, int64_t uid);
int32_t tBlockDataUpsertRow(SBlockData *pBlockData, TSDBROW *pRow, STSchema *pTSchema, int64_t uid);
void tBlockDataClear(SBlockData *pBlockData);
......
......@@ -24,8 +24,8 @@ extern "C" {
#endif
typedef TARRAY2(SSttBlk) TSttBlkArray;
typedef TARRAY2(SStatisBlk) TStatisBlkArray;
typedef TARRAY2(SDelBlk) TDelBlkArray;
typedef TARRAY2(STbStatisBlk) TStatisBlkArray;
// SSttFileReader ==========================================
typedef struct SSttFileReader SSttFileReader;
......@@ -41,20 +41,20 @@ int32_t tsdbSttFileReaderGetSegReader(SSttFileReader *reader, const TSttSegReade
// SSttSegReader
int32_t tsdbSttFileReadSttBlk(SSttSegReader *reader, const TSttBlkArray **sttBlkArray);
int32_t tsdbSttFileReadDelBlk(SSttSegReader *reader, const TDelBlkArray **delBlkArray);
int32_t tsdbSttFileReadStatisBlk(SSttSegReader *reader, const TStatisBlkArray **statisBlkArray);
int32_t tsdbSttFileReadDelBlk(SSttSegReader *reader, const TDelBlkArray **delBlkArray);
int32_t tsdbSttFileReadSttBlock(SSttSegReader *reader, const SSttBlk *sttBlk, SBlockData *bData);
int32_t tsdbSttFileReadDelBlock(SSttSegReader *reader, const SDelBlk *delBlk, SDelBlock *dData);
int32_t tsdbSttFileReadStatisBlock(SSttSegReader *reader, const STbStatisBlk *statisBlk, STbStatisBlock *sData);
int32_t tsdbSttFileReadStatisBlock(SSttSegReader *reader, const SStatisBlk *statisBlk, STbStatisBlock *sData);
struct SSttFileReaderConfig {
STsdb *tsdb;
int32_t szPage;
STFile file[1];
SSkmInfo *skmTb;
SSkmInfo *skmRow;
uint8_t **aBuf;
int32_t szPage;
STFile file[1];
};
// SSttFileWriter ==========================================
......
......@@ -37,7 +37,7 @@ typedef union {
} SDelRecord;
typedef union {
TARRAY2(int64_t) aData[DEL_RECORD_NUM_ELEM];
TARRAY2(int64_t) dataArr[DEL_RECORD_NUM_ELEM];
struct {
TARRAY2(int64_t) suid[1];
TARRAY2(int64_t) uid[1];
......@@ -74,9 +74,9 @@ typedef union {
int64_t suid;
int64_t uid;
int64_t firstKey;
int64_t firstVer;
int64_t firstKeyVer;
int64_t lastKey;
int64_t lastVer;
int64_t lastKeyVer;
int64_t minVer;
int64_t maxVer;
int64_t count;
......@@ -84,29 +84,29 @@ typedef union {
} STbStatisRecord;
typedef union {
TARRAY2(int64_t) aData[STATIS_RECORD_NUM_ELEM];
TARRAY2(int64_t) dataArr[STATIS_RECORD_NUM_ELEM];
struct {
TARRAY2(int64_t) suid[1];
TARRAY2(int64_t) uid[1];
TARRAY2(int64_t) firstKey[1];
TARRAY2(int64_t) firstVer[1];
TARRAY2(int64_t) firstKeyVer[1];
TARRAY2(int64_t) lastKey[1];
TARRAY2(int64_t) lastVer[1];
TARRAY2(int64_t) lastKeyVer[1];
TARRAY2(int64_t) minVer[1];
TARRAY2(int64_t) maxVer[1];
TARRAY2(int64_t) aCount[1];
TARRAY2(int64_t) count[1];
};
} STbStatisBlock;
typedef struct STbStatisBlk {
typedef struct SStatisBlk {
int32_t numRec;
int32_t size[STATIS_RECORD_NUM_ELEM];
TABLEID minTid;
TABLEID maxTid;
TABLEID minTbid;
TABLEID maxTbid;
int64_t minVer;
int64_t maxVer;
SFDataPtr dp[1];
} STbStatisBlk;
} SStatisBlk;
#define STATIS_BLOCK_SIZE(db) TARRAY2_SIZE((db)->suid)
......
......@@ -17,29 +17,29 @@
// SDelBlock ----------
int32_t tDelBlockInit(SDelBlock *delBlock) {
for (int32_t i = 0; i < ARRAY_SIZE(delBlock->aData); ++i) {
TARRAY2_INIT(&delBlock->aData[i]);
for (int32_t i = 0; i < ARRAY_SIZE(delBlock->dataArr); ++i) {
TARRAY2_INIT(&delBlock->dataArr[i]);
}
return 0;
}
int32_t tDelBlockFree(SDelBlock *delBlock) {
for (int32_t i = 0; i < ARRAY_SIZE(delBlock->aData); ++i) {
TARRAY2_FREE(&delBlock->aData[i]);
for (int32_t i = 0; i < ARRAY_SIZE(delBlock->dataArr); ++i) {
TARRAY2_FREE(&delBlock->dataArr[i]);
}
return 0;
}
int32_t tDelBlockClear(SDelBlock *delBlock) {
for (int32_t i = 0; i < ARRAY_SIZE(delBlock->aData); ++i) {
TARRAY2_CLEAR(&delBlock->aData[i], NULL);
for (int32_t i = 0; i < ARRAY_SIZE(delBlock->dataArr); ++i) {
TARRAY2_CLEAR(&delBlock->dataArr[i], NULL);
}
return 0;
}
int32_t tDelBlockPut(SDelBlock *delBlock, const SDelRecord *delRecord) {
for (int32_t i = 0; i < ARRAY_SIZE(delBlock->aData); ++i) {
int32_t code = TARRAY2_APPEND(&delBlock->aData[i], delRecord->aData[i]);
for (int32_t i = 0; i < ARRAY_SIZE(delBlock->dataArr); ++i) {
int32_t code = TARRAY2_APPEND(&delBlock->dataArr[i], delRecord->aData[i]);
if (code) return code;
}
return 0;
......@@ -57,29 +57,29 @@ int32_t tDelBlockDecode(const void *buf, SDelBlock *delBlock) {
// STbStatisBlock ----------
int32_t tStatisBlockInit(STbStatisBlock *statisBlock) {
for (int32_t i = 0; i < ARRAY_SIZE(statisBlock->aData); ++i) {
TARRAY2_INIT(&statisBlock->aData[i]);
for (int32_t i = 0; i < ARRAY_SIZE(statisBlock->dataArr); ++i) {
TARRAY2_INIT(&statisBlock->dataArr[i]);
}
return 0;
}
int32_t tStatisBlockFree(STbStatisBlock *statisBlock) {
for (int32_t i = 0; i < ARRAY_SIZE(statisBlock->aData); ++i) {
TARRAY2_FREE(&statisBlock->aData[i]);
for (int32_t i = 0; i < ARRAY_SIZE(statisBlock->dataArr); ++i) {
TARRAY2_FREE(&statisBlock->dataArr[i]);
}
return 0;
}
int32_t tStatisBlockClear(STbStatisBlock *statisBlock) {
for (int32_t i = 0; i < ARRAY_SIZE(statisBlock->aData); ++i) {
TARRAY2_CLEAR(&statisBlock->aData[i], NULL);
for (int32_t i = 0; i < ARRAY_SIZE(statisBlock->dataArr); ++i) {
TARRAY2_CLEAR(&statisBlock->dataArr[i], NULL);
}
return 0;
}
int32_t tStatisBlockPut(STbStatisBlock *statisBlock, const STbStatisRecord *statisRecord) {
for (int32_t i = 0; i < ARRAY_SIZE(statisBlock->aData); ++i) {
int32_t code = TARRAY2_APPEND(&statisBlock->aData[i], statisRecord->aData[i]);
for (int32_t i = 0; i < ARRAY_SIZE(statisBlock->dataArr); ++i) {
int32_t code = TARRAY2_APPEND(&statisBlock->dataArr[i], statisRecord->aData[i]);
if (code) return code;
}
return 0;
......
......@@ -1237,7 +1237,7 @@ int32_t tBlockDataAppendRow(SBlockData *pBlockData, TSDBROW *pRow, STSchema *pTS
_exit:
return code;
}
static int32_t tBlockDataUpdateRow(SBlockData *pBlockData, TSDBROW *pRow, STSchema *pTSchema) {
int32_t tBlockDataUpdateRow(SBlockData *pBlockData, TSDBROW *pRow, STSchema *pTSchema) {
int32_t code = 0;
// version
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册