diff --git a/cmake/cmake.define b/cmake/cmake.define index 298d102b8738de5b437c5cf7adad86879c74b7a0..03feca37bd791a6c0b3aacb2c7287ab077d84900 100644 --- a/cmake/cmake.define +++ b/cmake/cmake.define @@ -36,11 +36,13 @@ IF (TD_WINDOWS) ENDIF () ELSE () - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -Werror=return-type -fPIC -gdwarf-2 -g3") - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Werror=return-type -fPIC -gdwarf-2 -g3") + #SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -Werror=return-type -fPIC -gdwarf-2 -g3") + #SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Werror=return-type -fPIC -gdwarf-2 -g3") + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -Werror=return-type -fPIC -gdwarf-2 -fsanitize=address -fsanitize=undefined -fno-sanitize-recover=all -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow -fno-sanitize=null -fno-sanitize=alignment -static-libasan -g3") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Werror=return-type -fPIC -gdwarf-2 -fsanitize=address -fsanitize=undefined -fno-sanitize-recover=all -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow -fno-sanitize=null -fno-sanitize=alignment -static-libasan -g3") MESSAGE("System processor ID: ${CMAKE_SYSTEM_PROCESSOR}") -IF (${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm64") +IF (${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm64" OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64") ADD_DEFINITIONS("-D_TD_ARM_") ELSE () ADD_DEFINITIONS("-msse4.2 -mfma") diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index caf82924f403582094e37ae9ffa80969433d84f4..372ea9a2d7d4802d5e8838649cbbab37fdd12eee 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -373,9 +373,9 @@ int32_t blockDataSplitRows(SSDataBlock* pBlock, bool hasVarCol, int32_t startInd size_t payloadSize = pageSize - (headerSize + colHeaderSize); // TODO speedup by checking if the whole page can fit in firstly. - if (!hasVarCol) { + /*if (!hasVarCol) { size_t rowSize = blockDataGetRowSize(pBlock); - int32_t capacity = (payloadSize / (rowSize * 8 + bitmapChar * numOfCols)) * 8; + int32_t capacity = (payloadSize / (rowSize * 8 + bitmapChar * numOfCols)) * 8; //if pageSize = 128, rowSize = 2, it will core in doAddToBuf:assert(size <= getBufPageSize(pHandle->pBuf)); *stopIndex = startIndex + capacity; if (*stopIndex >= numOfRows) { @@ -383,7 +383,7 @@ int32_t blockDataSplitRows(SSDataBlock* pBlock, bool hasVarCol, int32_t startInd } return TSDB_CODE_SUCCESS; - } + }*/ // iterate the rows that can be fit in this buffer page int32_t size = (headerSize + colHeaderSize); diff --git a/source/libs/executor/src/tsort.c b/source/libs/executor/src/tsort.c index 49a99ec284927ac89e8e845ace17282c689df5b2..e5312921fa4b7f3e7c44acc2bd54b3d67757cd8a 100644 --- a/source/libs/executor/src/tsort.c +++ b/source/libs/executor/src/tsort.c @@ -131,7 +131,12 @@ void tsortDestroySortHandle(SSortHandle* pSortHandle) { destroyDiskbasedBuf(pSortHandle->pBuf); taosMemoryFreeClear(pSortHandle->idStr); blockDataDestroy(pSortHandle->pDataBlock); - sortComparClearup(&pSortHandle->cmpParam); // pOrderedSource is in cmpParam + for (size_t i = 0; i < taosArrayGetSize(pSortHandle->pOrderedSource); i++){ + SExternalMemSource* pSource = taosArrayGet(pSortHandle->pOrderedSource, i); + blockDataDestroy(pSource->src.pBlock); + taosMemoryFreeClear(pSource); + } + taosArrayDestroy(pSortHandle->pOrderedSource); taosMemoryFreeClear(pSortHandle); } diff --git a/source/libs/executor/test/sortTests.cpp b/source/libs/executor/test/sortTests.cpp index 14d527f3024e08e3a70595f20fc7128cfc81d3f8..9ad16669a4e65ccb014b4965ee61db3aa7901b82 100644 --- a/source/libs/executor/test/sortTests.cpp +++ b/source/libs/executor/test/sortTests.cpp @@ -122,7 +122,8 @@ SSDataBlock* getSingleColDummyBlock(void* param) { } colDataAppend(pColInfo, i, result, false); - printf("int: %lld\n", v); + printf("int: %ld\n", v); + taosMemoryFree(result); } } @@ -238,11 +239,12 @@ TEST(testCase, inMem_sort_Test) { } taosArrayDestroy(orderInfo); tsortDestroySortHandle(phandle); + taosMemoryFree(pInfo); } TEST(testCase, external_mem_sort_Test) { - _info* pInfo = (_info*) taosMemoryCalloc(7, sizeof(_info)); + _info* pInfo = (_info*) taosMemoryCalloc(8, sizeof(_info)); pInfo[0].startVal = 0; pInfo[0].pageRows = 10; pInfo[0].count = 6; @@ -258,32 +260,32 @@ TEST(testCase, external_mem_sort_Test) { pInfo[2].count = 6; pInfo[2].type = TSDB_DATA_TYPE_USMALLINT; - pInfo[2].startVal = 0; - pInfo[2].pageRows = 100; - pInfo[2].count = 6; - pInfo[2].type = TSDB_DATA_TYPE_INT; - pInfo[3].startVal = 0; pInfo[3].pageRows = 100; pInfo[3].count = 6; - pInfo[3].type = TSDB_DATA_TYPE_UBIGINT; + pInfo[3].type = TSDB_DATA_TYPE_INT; pInfo[4].startVal = 0; pInfo[4].pageRows = 100; pInfo[4].count = 6; - pInfo[4].type = TSDB_DATA_TYPE_DOUBLE; + pInfo[4].type = TSDB_DATA_TYPE_UBIGINT; pInfo[5].startVal = 0; - pInfo[5].pageRows = 50; + pInfo[5].pageRows = 100; pInfo[5].count = 6; - pInfo[5].type = TSDB_DATA_TYPE_NCHAR; + pInfo[5].type = TSDB_DATA_TYPE_DOUBLE; pInfo[6].startVal = 0; - pInfo[6].pageRows = 100; + pInfo[6].pageRows = 50; pInfo[6].count = 6; - pInfo[6].type = TSDB_DATA_TYPE_BINARY; + pInfo[6].type = TSDB_DATA_TYPE_NCHAR; + + pInfo[7].startVal = 0; + pInfo[7].pageRows = 100; + pInfo[7].count = 6; + pInfo[7].type = TSDB_DATA_TYPE_BINARY; - for (int i = 0; i < 7; i++){ + for (int i = 0; i < 8; i++){ SBlockOrderInfo oi = {0}; oi.order = TSDB_ORDER_ASC; oi.slotId = 0; @@ -326,7 +328,7 @@ TEST(testCase, external_mem_sort_Test) { }else{ memcpy((char*)(&result) + sizeof(int64_t) - tDataTypes[pInfo[i].type].bytes, v, tDataTypes[pInfo[i].type].bytes); } - printf("%d: %lld\n", row++, result); + printf("%d: %ld\n", row++, result); } } taosArrayDestroy(orderInfo);