diff --git a/src/common/inc/tdataformat.h b/src/common/inc/tdataformat.h index ddacc1ed01a92ac12cb365263c2b453d72909e99..f77d3c6dc7e3d77bd7e175672fde774831907ecc 100644 --- a/src/common/inc/tdataformat.h +++ b/src/common/inc/tdataformat.h @@ -161,7 +161,6 @@ typedef struct { int maxRowSize; int maxCols; // max number of columns int maxPoints; // max number of points - int exColBytes; // extra column bytes to allocate for each column int numOfPoints; int numOfCols; // Total number of cols @@ -175,7 +174,7 @@ typedef struct { #define dataColsKeyFirst(pCols) dataColsKeyAt(pCols, 0) #define dataColsKeyLast(pCols) dataColsKeyAt(pCols, (pCols)->numOfPoints - 1) -SDataCols *tdNewDataCols(int maxRowSize, int maxCols, int maxRows, int exColBytes); +SDataCols *tdNewDataCols(int maxRowSize, int maxCols, int maxRows); void tdResetDataCols(SDataCols *pCols); void tdInitDataCols(SDataCols *pCols, STSchema *pSchema); SDataCols *tdDupDataCols(SDataCols *pCols, bool keepData); diff --git a/src/common/src/tdataformat.c b/src/common/src/tdataformat.c index 54402528ba219166b9769a2e60cbaef5912cfdb8..b0281cbd00c3fd5cef07593515e9622af302e5d2 100644 --- a/src/common/src/tdataformat.c +++ b/src/common/src/tdataformat.c @@ -287,16 +287,15 @@ void dataColSetOffset(SDataCol *pCol, int nEle, int maxPoints) { } } -SDataCols *tdNewDataCols(int maxRowSize, int maxCols, int maxRows, int exColBytes) { +SDataCols *tdNewDataCols(int maxRowSize, int maxCols, int maxRows) { SDataCols *pCols = (SDataCols *)calloc(1, sizeof(SDataCols) + sizeof(SDataCol) * maxCols); if (pCols == NULL) return NULL; pCols->maxRowSize = maxRowSize; pCols->maxCols = maxCols; pCols->maxPoints = maxRows; - pCols->exColBytes = exColBytes; - pCols->buf = malloc(maxRowSize * maxRows + exColBytes * maxCols); + pCols->buf = malloc(maxRowSize * maxRows); if (pCols->buf == NULL) { free(pCols); return NULL; @@ -312,16 +311,13 @@ void tdInitDataCols(SDataCols *pCols, STSchema *pSchema) { void *ptr = pCols->buf; for (int i = 0; i < schemaNCols(pSchema); i++) { - if (i > 0) { - pCols->cols[i].pData = (char *)(pCols->cols[i - 1].pData) + schemaColAt(pSchema, i - 1)->bytes * pCols->maxPoints; - } pCols->cols[i].type = colType(schemaColAt(pSchema, i)); pCols->cols[i].bytes = colBytes(schemaColAt(pSchema, i)); pCols->cols[i].offset = colOffset(schemaColAt(pSchema, i)) + TD_DATA_ROW_HEAD_SIZE; pCols->cols[i].colId = colColId(schemaColAt(pSchema, i)); pCols->cols[i].pData = ptr; - ptr = ptr + pCols->exColBytes + colBytes(schemaColAt(pSchema, i)) * pCols->maxPoints; + ptr = ptr + colBytes(schemaColAt(pSchema, i)) * pCols->maxPoints; if (colType(schemaColAt(pSchema, i)) == TSDB_DATA_TYPE_BINARY || colType(schemaColAt(pSchema, i)) == TSDB_DATA_TYPE_NCHAR) ptr = ptr + (sizeof(int32_t) + sizeof(int16_t)) * pCols->maxPoints; @@ -337,7 +333,7 @@ void tdFreeDataCols(SDataCols *pCols) { SDataCols *tdDupDataCols(SDataCols *pDataCols, bool keepData) { SDataCols *pRet = - tdNewDataCols(pDataCols->maxRowSize, pDataCols->maxCols, pDataCols->maxPoints, pDataCols->exColBytes); + tdNewDataCols(pDataCols->maxRowSize, pDataCols->maxCols, pDataCols->maxPoints); if (pRet == NULL) return NULL; pRet->numOfCols = pDataCols->numOfCols; diff --git a/src/query/tests/astTest.cpp b/src/query/tests/astTest.cpp index dee85ef63002b91e08cf32d7f1eb6417c1afac7c..d767e7ad7b427dd99c841c622a26ccda1a8141e9 100644 --- a/src/query/tests/astTest.cpp +++ b/src/query/tests/astTest.cpp @@ -582,7 +582,7 @@ void exprSerializeTest1() { tExprTreeDestroy(&p1, nullptr); tExprTreeDestroy(&p2, nullptr); - tbufClose(&bw); + // tbufClose(&bw); } void exprSerializeTest2() { @@ -627,7 +627,7 @@ void exprSerializeTest2() { tExprTreeDestroy(&p1, nullptr); tExprTreeDestroy(&p2, nullptr); - tbufClose(&bw); + // tbufClose(&bw); } } // namespace TEST(testCase, astTest) { diff --git a/src/tsdb/src/tsdbMain.c b/src/tsdb/src/tsdbMain.c index 299084e2ec66b6959e0ef59c4a21913e78d110e4..095e84491733d57bff878ce7bbdc86dc6a4d76b2 100644 --- a/src/tsdb/src/tsdbMain.c +++ b/src/tsdb/src/tsdbMain.c @@ -879,9 +879,7 @@ static void *tsdbCommitData(void *arg) { } if (tsdbInitWriteHelper(&whelper, pRepo) < 0) goto _exit; - if ((pDataCols = tdNewDataCols(pMeta->maxRowBytes, pMeta->maxCols, pCfg->maxRowsPerFileBlock, - sizeof(TSCKSUM) + COMP_OVERFLOW_BYTES)) == NULL) - goto _exit; + if ((pDataCols = tdNewDataCols(pMeta->maxRowBytes, pMeta->maxCols, pCfg->maxRowsPerFileBlock)) == NULL) goto _exit; int sfid = tsdbGetKeyFileId(pCache->imem->keyFirst, pCfg->daysPerFile, pCfg->precision); int efid = tsdbGetKeyFileId(pCache->imem->keyLast, pCfg->daysPerFile, pCfg->precision); diff --git a/src/tsdb/src/tsdbRWHelper.c b/src/tsdb/src/tsdbRWHelper.c index a5cf75ae3b09d8f33239d38bbfb405002be4926e..888ee069ae40a0e98e4dbe0990aef359fc2a515c 100644 --- a/src/tsdb/src/tsdbRWHelper.c +++ b/src/tsdb/src/tsdbRWHelper.c @@ -90,8 +90,8 @@ static void tsdbResetHelperBlock(SRWHelper *pHelper) { } static int tsdbInitHelperBlock(SRWHelper *pHelper) { - pHelper->pDataCols[0] = tdNewDataCols(pHelper->config.maxRowSize, pHelper->config.maxCols, pHelper->config.maxRows, sizeof(TSCKSUM) + COMP_OVERFLOW_BYTES); - pHelper->pDataCols[1] = tdNewDataCols(pHelper->config.maxRowSize, pHelper->config.maxCols, pHelper->config.maxRows, sizeof(TSCKSUM) + COMP_OVERFLOW_BYTES); + pHelper->pDataCols[0] = tdNewDataCols(pHelper->config.maxRowSize, pHelper->config.maxCols, pHelper->config.maxRows); + pHelper->pDataCols[1] = tdNewDataCols(pHelper->config.maxRowSize, pHelper->config.maxCols, pHelper->config.maxRows); if (pHelper->pDataCols[0] == NULL || pHelper->pDataCols[1] == NULL) return -1; tsdbResetHelperBlockImpl(pHelper); diff --git a/src/tsdb/src/tsdbRead.c b/src/tsdb/src/tsdbRead.c index dea1eadc005e3394bf6f9345195d9d4e8743e559..bc9220dbc72b197785b5fa227340def9e1839dbb 100644 --- a/src/tsdb/src/tsdbRead.c +++ b/src/tsdb/src/tsdbRead.c @@ -407,7 +407,7 @@ static bool doLoadFileDataBlock(STsdbQueryHandle* pQueryHandle, SCompBlock* pBlo SArray* sa = getDefaultLoadColumns(pQueryHandle, true); if (pCheckInfo->pDataCols == NULL) { - pCheckInfo->pDataCols = tdNewDataCols(1000, 2, 4096, 0); + pCheckInfo->pDataCols = tdNewDataCols(1000, 2, 4096); } tdInitDataCols(pCheckInfo->pDataCols, tsdbGetTableSchema(tsdbGetMeta(pQueryHandle->pTsdb), pCheckInfo->pTableObj)); diff --git a/src/tsdb/tests/tsdbTests.cpp b/src/tsdb/tests/tsdbTests.cpp index 0e5d59b4feb01d35473243cb66e2064de8530a08..c7ed6fcae11eb3c86c4728c4fd980a10638c16f7 100644 --- a/src/tsdb/tests/tsdbTests.cpp +++ b/src/tsdb/tests/tsdbTests.cpp @@ -245,7 +245,7 @@ TEST(TsdbTest, DISABLED_openRepo) { // tsdbLoadCompCols(&pGroup->files[TSDB_FILE_TYPE_DATA], pBlock, (void *)pCompData); // STable *pTable = tsdbGetTableByUid(pRepo->tsdbMeta, pCompData->uid); - // SDataCols *pDataCols = tdNewDataCols(tdMaxRowBytesFromSchema(tsdbGetTableSchema(pRepo->tsdbMeta, pTable)), 5, 10); + // SDataCols *pDataCols = tdNewDataCols(tdMaxRowBytesFromSchema(tsdbGetTableSchema(pRepo->tsdbMeta, pTable)), 5); // tdInitDataCols(pDataCols, tsdbGetTableSchema(pRepo->tsdbMeta, pTable)); // tsdbLoadDataBlock(&pGroup->files[TSDB_FILE_TYPE_DATA], pBlock, 1, pDataCols, pCompData);