diff --git a/cmake/platform.inc b/cmake/platform.inc index ac8c5ab920142a58303b88930cbf521ca6c0c240..0d53f0cc43750dea1091875551163119e807616b 100755 --- a/cmake/platform.inc +++ b/cmake/platform.inc @@ -107,9 +107,9 @@ IF (TD_LINUX_64) SET(RELEASE_FLAGS "-O0") IF (NOT TD_ARM) IF (${CMAKE_CXX_COMPILER_ID} MATCHES "Clang") - SET(COMMON_FLAGS "-std=gnu99 -Wall -fPIC -malign-double -g -msse4.2 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE") + SET(COMMON_FLAGS "-std=gnu99 -Wall -fPIC -malign-double -g3 -gdwarf-2 -msse4.2 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE") ELSE () - SET(COMMON_FLAGS "-std=gnu99 -Wall -fPIC -malign-double -g -malign-stringops -msse4.2 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE") + SET(COMMON_FLAGS "-std=gnu99 -Wall -fPIC -malign-double -g3 -gdwarf-2 -malign-stringops -msse4.2 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE") ENDIF () ELSE () SET(COMMON_FLAGS "-std=gnu99 -Wall -fPIC -g -fsigned-char -fpack-struct=8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE") diff --git a/src/util/src/tskiplist.c b/src/util/src/tskiplist.c index 11e1e740e04669f4f486c4e21e61ac174f57cdbd..3af7bfd2f2ae3623bce8bedcf5add573639f88f9 100644 --- a/src/util/src/tskiplist.c +++ b/src/util/src/tskiplist.c @@ -597,11 +597,16 @@ bool tSkipListIterNext(SSkipListIterator *iter) { pthread_rwlock_unlock(pSkipList->lock); } - return iter->cur != NULL; + return iter->cur != pSkipList->pTail; } -SSkipListNode *tSkipListIterGet(SSkipListIterator *iter) { return (iter == NULL)? NULL:iter->cur; } - +SSkipListNode *tSkipListIterGet(SSkipListIterator *iter) { + if (iter == NULL || iter->cur == iter->pSkipList->pTail) { + return NULL; + } else { + return iter->cur; + } +} void* tSkipListDestroyIter(SSkipListIterator* iter) { if (iter == NULL) { return NULL; diff --git a/src/vnode/tsdb/tests/tsdbTests.cpp b/src/vnode/tsdb/tests/tsdbTests.cpp index 1df023d07eb59f1e7e08015256c1ef0961d7ff50..bce3339b27727f5c572e3d3b66b267ea8af0b9f8 100644 --- a/src/vnode/tsdb/tests/tsdbTests.cpp +++ b/src/vnode/tsdb/tests/tsdbTests.cpp @@ -2,7 +2,6 @@ #include #include -#include "tsdb.h" #include "dataformat.h" #include "tsdbMain.h" @@ -78,8 +77,8 @@ TEST(TsdbTest, createRepo) { tsdbCreateTable(pRepo, &tCfg); // // 3. Loop to write some simple data - int nRows = 10000000; - int rowsPerSubmit = 100; + int nRows = 1; + int rowsPerSubmit = 1; int64_t start_time = 1584081000000; SSubmitMsg *pMsg = (SSubmitMsg *)malloc(sizeof(SSubmitMsg) + sizeof(SSubmitBlk) + tdMaxRowBytesFromSchema(schema) * rowsPerSubmit); @@ -140,8 +139,26 @@ TEST(TsdbTest, createRepo) { // TEST(TsdbTest, DISABLED_openRepo) { TEST(TsdbTest, openRepo) { - tsdb_repo_t *pRepo = tsdbOpenRepo("/home/ubuntu/work/ttest/vnode0"); - ASSERT_NE(pRepo, nullptr); + tsdb_repo_t *repo = tsdbOpenRepo("/home/ubuntu/work/ttest/vnode0"); + ASSERT_NE(repo, nullptr); + + STsdbRepo *pRepo = (STsdbRepo *)repo; + + SFileGroup *pGroup = tsdbSearchFGroup(pRepo->tsdbFileH, 1833); + + for (int type = TSDB_FILE_TYPE_HEAD; type < TSDB_FILE_TYPE_MAX; type++) { + tsdbOpenFile(&pGroup->files[type], O_RDONLY); + } + + SCompIdx *pIdx = (SCompIdx *)calloc(pRepo->config.maxTables, sizeof(SCompIdx)); + tsdbLoadCompIdx(pGroup, (void *)pIdx, pRepo->config.maxTables); + + SCompInfo *pCompInfo = (SCompInfo *)malloc(sizeof(SCompInfo) + pIdx[0].len); + + tsdbLoadCompBlocks(pGroup, pIdx, (void *)pCompInfo); + + int k = 0; + } TEST(TsdbTest, DISABLED_createFileGroup) {