提交 83e238d0 编写于 作者: H hzcheng

TD-34

上级 85ce67bb
...@@ -183,9 +183,10 @@ int tsdbLoadDataBlock(SFile *pFile, SCompBlock *pStartBlock, int numOfBlocks, SD ...@@ -183,9 +183,10 @@ int tsdbLoadDataBlock(SFile *pFile, SCompBlock *pStartBlock, int numOfBlocks, SD
SCompBlock *pBlock = pStartBlock; SCompBlock *pBlock = pStartBlock;
for (int i = 0; i < numOfBlocks; i++) { for (int i = 0; i < numOfBlocks; i++) {
if (tsdbLoadCompCols(pFile, pBlock, (void *)pCompData) < 0) return -1; if (tsdbLoadCompCols(pFile, pBlock, (void *)pCompData) < 0) return -1;
pCols->numOfPoints += (pCompData->cols[0].len / 8);
for (int iCol = 0; iCol < pBlock->numOfCols; iCol++) { for (int iCol = 0; iCol < pBlock->numOfCols; iCol++) {
SCompCol *pCompCol = &(pCompData->cols[iCol]); SCompCol *pCompCol = &(pCompData->cols[iCol]);
pCols->numOfPoints += pBlock->numOfPoints; // pCols->numOfPoints += pBlock->numOfPoints;
int k = 0; int k = 0;
for (; k < pCols->numOfCols; k++) { for (; k < pCols->numOfCols; k++) {
if (pCompCol->colId == pCols->cols[k].colId) break; if (pCompCol->colId == pCols->cols[k].colId) break;
......
...@@ -1031,6 +1031,7 @@ static int tsdbCommitToFile(STsdbRepo *pRepo, int fid, SSkipListIterator **iters ...@@ -1031,6 +1031,7 @@ static int tsdbCommitToFile(STsdbRepo *pRepo, int fid, SSkipListIterator **iters
pTBlock->numOfPoints = pCols->numOfPoints; pTBlock->numOfPoints = pCols->numOfPoints;
pTBlock->sversion = pTable->sversion; pTBlock->sversion = pTable->sversion;
pTBlock->numOfSubBlocks = 1; pTBlock->numOfSubBlocks = 1;
pTBlock->numOfCols = pCols->numOfCols;
if (dataColsKeyLast(pCols) > pIdx->maxKey) pIdx->maxKey = dataColsKeyLast(pCols); if (dataColsKeyLast(pCols) > pIdx->maxKey) pIdx->maxKey = dataColsKeyLast(pCols);
......
...@@ -74,7 +74,7 @@ STable *tsdbDecodeTable(void *cont, int contLen) { ...@@ -74,7 +74,7 @@ STable *tsdbDecodeTable(void *cont, int contLen) {
T_READ_MEMBER(ptr, int8_t, pTable->type); T_READ_MEMBER(ptr, int8_t, pTable->type);
T_READ_MEMBER(ptr, int64_t, pTable->tableId.uid); T_READ_MEMBER(ptr, int64_t, pTable->tableId.uid);
T_READ_MEMBER(ptr, int32_t, pTable->tableId.tid); T_READ_MEMBER(ptr, int32_t, pTable->tableId.tid);
T_READ_MEMBER(ptr, int32_t, pTable->superUid); T_READ_MEMBER(ptr, int64_t, pTable->superUid);
T_READ_MEMBER(ptr, int32_t, pTable->sversion); T_READ_MEMBER(ptr, int32_t, pTable->sversion);
if (pTable->type == TSDB_SUPER_TABLE) { if (pTable->type == TSDB_SUPER_TABLE) {
......
...@@ -12,6 +12,7 @@ double getCurTime() { ...@@ -12,6 +12,7 @@ double getCurTime() {
} }
TEST(TsdbTest, DISABLED_tableEncodeDecode) { TEST(TsdbTest, DISABLED_tableEncodeDecode) {
// TEST(TsdbTest, tableEncodeDecode) {
STable *pTable = (STable *)malloc(sizeof(STable)); STable *pTable = (STable *)malloc(sizeof(STable));
pTable->type = TSDB_NORMAL_TABLE; pTable->type = TSDB_NORMAL_TABLE;
...@@ -47,8 +48,8 @@ TEST(TsdbTest, DISABLED_tableEncodeDecode) { ...@@ -47,8 +48,8 @@ TEST(TsdbTest, DISABLED_tableEncodeDecode) {
ASSERT_EQ(memcmp(pTable->schema, tTable->schema, sizeof(STSchema) + sizeof(STColumn) * nCols), 0); ASSERT_EQ(memcmp(pTable->schema, tTable->schema, sizeof(STSchema) + sizeof(STColumn) * nCols), 0);
} }
TEST(TsdbTest, DISABLED_createRepo) { // TEST(TsdbTest, DISABLED_createRepo) {
// TEST(TsdbTest, createRepo) { TEST(TsdbTest, createRepo) {
STsdbCfg config; STsdbCfg config;
// 1. Create a tsdb repository // 1. Create a tsdb repository
...@@ -139,12 +140,12 @@ TEST(TsdbTest, DISABLED_createRepo) { ...@@ -139,12 +140,12 @@ TEST(TsdbTest, DISABLED_createRepo) {
// TEST(TsdbTest, DISABLED_openRepo) { // TEST(TsdbTest, DISABLED_openRepo) {
TEST(TsdbTest, openRepo) { TEST(TsdbTest, openRepo) {
tsdb_repo_t *repo = tsdbOpenRepo("/home/ubuntu/work/build/test/data/vnode/vnode1/tsdb"); tsdb_repo_t *repo = tsdbOpenRepo("/home/ubuntu/work/ttest/vnode0");
ASSERT_NE(repo, nullptr); ASSERT_NE(repo, nullptr);
STsdbRepo *pRepo = (STsdbRepo *)repo; STsdbRepo *pRepo = (STsdbRepo *)repo;
SFileGroup *pGroup = tsdbSearchFGroup(pRepo->tsdbFileH, 1835); SFileGroup *pGroup = tsdbSearchFGroup(pRepo->tsdbFileH, 1833);
for (int type = TSDB_FILE_TYPE_HEAD; type < TSDB_FILE_TYPE_MAX; type++) { for (int type = TSDB_FILE_TYPE_HEAD; type < TSDB_FILE_TYPE_MAX; type++) {
tsdbOpenFile(&pGroup->files[type], O_RDONLY); tsdbOpenFile(&pGroup->files[type], O_RDONLY);
...@@ -155,7 +156,21 @@ TEST(TsdbTest, openRepo) { ...@@ -155,7 +156,21 @@ TEST(TsdbTest, openRepo) {
SCompInfo *pCompInfo = (SCompInfo *)malloc(sizeof(SCompInfo) + pIdx[1].len); SCompInfo *pCompInfo = (SCompInfo *)malloc(sizeof(SCompInfo) + pIdx[1].len);
tsdbLoadCompBlocks(pGroup, &pIdx[1], (void *)pCompInfo); tsdbLoadCompBlocks(pGroup, &pIdx[0], (void *)pCompInfo);
int blockIdx = 0;
SCompBlock *pBlock = &(pCompInfo->blocks[blockIdx]);
SCompData *pCompData = (SCompData *)malloc(sizeof(SCompData) + sizeof(SCompCol) * pBlock->numOfCols);
tsdbLoadCompCols(&pGroup->files[TSDB_FILE_TYPE_DATA], pBlock, (void *)pCompData);
STable *pTable = tsdbGetTableByUid(pRepo->tsdbMeta, pCompData->uid);
SDataCols *pDataCols = tdNewDataCols(tdMaxRowBytesFromSchema(pTable->schema), 5, 10);
tdInitDataCols(pDataCols, pTable->schema);
tsdbLoadDataBlock(&pGroup->files[TSDB_FILE_TYPE_DATA], pBlock, 1, pDataCols, pCompData);
int k = 0; int k = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册