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

more code

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