diff --git a/CMakeLists.txt b/CMakeLists.txt index 90e841d5e0..566d4ad29d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,11 +17,12 @@ include(${TD_SUPPORT_DIR}/cmake.platform) include(${TD_SUPPORT_DIR}/cmake.define) include(${TD_SUPPORT_DIR}/cmake.options) include(${TD_SUPPORT_DIR}/cmake.version) -include(${TD_SUPPORT_DIR}/cmake.install) # contrib add_subdirectory(contrib) +set_property(GLOBAL PROPERTY GLOBAL_DEPENDS_NO_CYCLES OFF) + # api add_library(api INTERFACE) target_include_directories(api INTERFACE "include/client") @@ -36,8 +37,7 @@ add_subdirectory(source) add_subdirectory(tools) add_subdirectory(utils) add_subdirectory(examples/c) +include(${TD_SUPPORT_DIR}/cmake.install) # docs -add_subdirectory(docs/doxgen) - -# tests (TODO) +add_subdirectory(docs/doxgen) \ No newline at end of file diff --git a/source/dnode/vnode/src/meta/metaOpen.c b/source/dnode/vnode/src/meta/metaOpen.c index fb450f3594..515fd31e9d 100644 --- a/source/dnode/vnode/src/meta/metaOpen.c +++ b/source/dnode/vnode/src/meta/metaOpen.c @@ -35,7 +35,11 @@ int metaOpen(SVnode *pVnode, SMeta **ppMeta) { *ppMeta = NULL; // create handle - slen = strlen(tfsGetPrimaryPath(pVnode->pTfs)) + strlen(pVnode->path) + strlen(VNODE_META_DIR) + 3; + if (pVnode->pTfs) { + slen = strlen(tfsGetPrimaryPath(pVnode->pTfs)) + strlen(pVnode->path) + strlen(VNODE_META_DIR) + 3; + } else { + slen = strlen(pVnode->path) + strlen(VNODE_META_DIR) + 2; + } if ((pMeta = taosMemoryCalloc(1, sizeof(*pMeta) + slen)) == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; return -1; @@ -43,8 +47,12 @@ int metaOpen(SVnode *pVnode, SMeta **ppMeta) { metaInitLock(pMeta); pMeta->path = (char *)&pMeta[1]; - sprintf(pMeta->path, "%s%s%s%s%s", tfsGetPrimaryPath(pVnode->pTfs), TD_DIRSEP, pVnode->path, TD_DIRSEP, - VNODE_META_DIR); + if (pVnode->pTfs) { + sprintf(pMeta->path, "%s%s%s%s%s", tfsGetPrimaryPath(pVnode->pTfs), TD_DIRSEP, pVnode->path, TD_DIRSEP, + VNODE_META_DIR); + } else { + sprintf(pMeta->path, "%s%s%s", pVnode->path, TD_DIRSEP, VNODE_META_DIR); + } taosRealPath(pMeta->path, NULL, slen); pMeta->pVnode = pVnode; diff --git a/source/dnode/vnode/src/tsdb/tsdbFS.c b/source/dnode/vnode/src/tsdb/tsdbFS.c index 10926ae6ad..85514ed5b6 100644 --- a/source/dnode/vnode/src/tsdb/tsdbFS.c +++ b/source/dnode/vnode/src/tsdb/tsdbFS.c @@ -417,6 +417,7 @@ _err: // EXPOSED APIS ==================================================================================== int32_t tsdbFSOpen(STsdb *pTsdb) { int32_t code = 0; + SVnode *pVnode = pTsdb->pVnode; // open handle pTsdb->fs.pDelFile = NULL; @@ -429,8 +430,12 @@ int32_t tsdbFSOpen(STsdb *pTsdb) { // load fs or keep empty char fname[TSDB_FILENAME_LEN]; - snprintf(fname, TSDB_FILENAME_LEN - 1, "%s%s%s%sCURRENT", tfsGetPrimaryPath(pTsdb->pVnode->pTfs), TD_DIRSEP, - pTsdb->path, TD_DIRSEP); + if (pVnode->pTfs) { + snprintf(fname, TSDB_FILENAME_LEN - 1, "%s%s%s%sCURRENT", tfsGetPrimaryPath(pTsdb->pVnode->pTfs), TD_DIRSEP, + pTsdb->path, TD_DIRSEP); + } else { + snprintf(fname, TSDB_FILENAME_LEN - 1, "%s%sCURRENT", pTsdb->path, TD_DIRSEP); + } if (!taosCheckExistFile(fname)) { // empty one diff --git a/source/dnode/vnode/src/tsdb/tsdbOpen.c b/source/dnode/vnode/src/tsdb/tsdbOpen.c index fcbcff9248..e4080ccf1e 100644 --- a/source/dnode/vnode/src/tsdb/tsdbOpen.c +++ b/source/dnode/vnode/src/tsdb/tsdbOpen.c @@ -57,10 +57,13 @@ int tsdbOpen(SVnode *pVnode, STsdb **ppTsdb, const char *dir, STsdbKeepCfg *pKee } else { memcpy(&pTsdb->keepCfg, pKeepCfg, sizeof(STsdbKeepCfg)); } - // pTsdb->fs = tsdbNewFS(REPO_KEEP_CFG(pTsdb)); // create dir - tfsMkdir(pVnode->pTfs, pTsdb->path); + if (pVnode->pTfs) { + tfsMkdir(pVnode->pTfs, pTsdb->path); + } else { + taosMkDir(pTsdb->path); + } // open tsdb if (tsdbFSOpen(pTsdb) < 0) { diff --git a/source/dnode/vnode/src/vnd/vnodeCommit.c b/source/dnode/vnode/src/vnd/vnodeCommit.c index 6dc3ef86a7..07d9b96261 100644 --- a/source/dnode/vnode/src/vnd/vnodeCommit.c +++ b/source/dnode/vnode/src/vnd/vnodeCommit.c @@ -227,7 +227,11 @@ int vnodeCommit(SVnode *pVnode) { info.state.committed = pVnode->state.applied; info.state.commitTerm = pVnode->state.applyTerm; info.state.commitID = pVnode->state.commitID; - snprintf(dir, TSDB_FILENAME_LEN, "%s%s%s", tfsGetPrimaryPath(pVnode->pTfs), TD_DIRSEP, pVnode->path); + if (pVnode->pTfs) { + snprintf(dir, TSDB_FILENAME_LEN, "%s%s%s", tfsGetPrimaryPath(pVnode->pTfs), TD_DIRSEP, pVnode->path); + } else { + snprintf(dir, TSDB_FILENAME_LEN, "%s", pVnode->path); + } if (vnodeSaveInfo(dir, &info) < 0) { ASSERT(0); return -1; diff --git a/source/dnode/vnode/src/vnd/vnodeOpen.c b/source/dnode/vnode/src/vnd/vnodeOpen.c index 414834e2eb..de3af7cde6 100644 --- a/source/dnode/vnode/src/vnd/vnodeOpen.c +++ b/source/dnode/vnode/src/vnd/vnodeOpen.c @@ -138,12 +138,6 @@ SVnode *vnodeOpen(const char *path, STfs *pTfs, SMsgCb msgCb) { sprintf(tdir, "%s%s%s", dir, TD_DIRSEP, VNODE_WAL_DIR); taosRealPath(tdir, NULL, sizeof(tdir)); -// for test tsdb snapshot -#if 0 - pVnode->config.walCfg.segSize = 200; - pVnode->config.walCfg.retentionSize = 2000; -#endif - pVnode->pWal = walOpen(tdir, &(pVnode->config.walCfg)); if (pVnode->pWal == NULL) { vError("vgId:%d, failed to open vnode wal since %s", TD_VID(pVnode), tstrerror(terrno)); @@ -159,12 +153,14 @@ SVnode *vnodeOpen(const char *path, STfs *pTfs, SMsgCb msgCb) { goto _err; } +#if !VNODE_AS_LIB // open query if (vnodeQueryOpen(pVnode)) { vError("vgId:%d, failed to open vnode query since %s", TD_VID(pVnode), tstrerror(terrno)); terrno = TSDB_CODE_OUT_OF_MEMORY; goto _err; } +#endif // vnode begin if (vnodeBegin(pVnode) < 0) { @@ -173,11 +169,13 @@ SVnode *vnodeOpen(const char *path, STfs *pTfs, SMsgCb msgCb) { goto _err; } +#if !VNODE_AS_LIB // open sync if (vnodeSyncOpen(pVnode, dir)) { vError("vgId:%d, failed to open sync since %s", TD_VID(pVnode), tstrerror(terrno)); goto _err; } +#endif return pVnode; diff --git a/source/libs/CMakeLists.txt b/source/libs/CMakeLists.txt index ade2487239..72459f4d35 100644 --- a/source/libs/CMakeLists.txt +++ b/source/libs/CMakeLists.txt @@ -1,20 +1,21 @@ -add_subdirectory(transport) -add_subdirectory(sync) add_subdirectory(tdb) -add_subdirectory(index) +add_subdirectory(cache) +add_subdirectory(transport) add_subdirectory(wal) +add_subdirectory(monitor) +add_subdirectory(tfs) +add_subdirectory(sync) +add_subdirectory(qcom) +add_subdirectory(nodes) +add_subdirectory(catalog) + +add_subdirectory(scalar) +add_subdirectory(function) +add_subdirectory(index) add_subdirectory(parser) add_subdirectory(scheduler) -add_subdirectory(cache) -add_subdirectory(catalog) add_subdirectory(executor) add_subdirectory(stream) add_subdirectory(planner) -add_subdirectory(function) -add_subdirectory(qcom) add_subdirectory(qworker) -add_subdirectory(tfs) -add_subdirectory(monitor) -add_subdirectory(nodes) -add_subdirectory(scalar) add_subdirectory(command) \ No newline at end of file diff --git a/source/libs/function/CMakeLists.txt b/source/libs/function/CMakeLists.txt index dd048a047a..913dd24a49 100644 --- a/source/libs/function/CMakeLists.txt +++ b/source/libs/function/CMakeLists.txt @@ -14,7 +14,14 @@ target_include_directories( target_link_libraries( function - PRIVATE os util common nodes scalar qcom transport stream + PRIVATE os + PRIVATE util + PRIVATE common + PRIVATE nodes + PRIVATE qcom + PRIVATE scalar + PRIVATE transport + PRIVATE stream PUBLIC uv_a ) diff --git a/source/libs/qcom/CMakeLists.txt b/source/libs/qcom/CMakeLists.txt index 6e7b5cb610..715c3b8ef2 100644 --- a/source/libs/qcom/CMakeLists.txt +++ b/source/libs/qcom/CMakeLists.txt @@ -8,7 +8,7 @@ target_include_directories( target_link_libraries( qcom - PRIVATE os util transport nodes + PRIVATE os util transport ) if(${BUILD_TEST}) diff --git a/source/libs/scalar/CMakeLists.txt b/source/libs/scalar/CMakeLists.txt index 776abd93e8..c34c5e2877 100644 --- a/source/libs/scalar/CMakeLists.txt +++ b/source/libs/scalar/CMakeLists.txt @@ -8,8 +8,14 @@ target_include_directories( ) target_link_libraries(scalar - PRIVATE os util common nodes function qcom vnode - ) + PRIVATE os + PRIVATE util + PRIVATE common + PRIVATE nodes + PRIVATE function + PRIVATE qcom + PRIVATE vnode +) if(${BUILD_TEST}) ADD_SUBDIRECTORY(test) diff --git a/source/libs/transport/CMakeLists.txt b/source/libs/transport/CMakeLists.txt index 62eb1a985b..a48926d2d4 100644 --- a/source/libs/transport/CMakeLists.txt +++ b/source/libs/transport/CMakeLists.txt @@ -16,11 +16,6 @@ target_link_libraries( ) if (${BUILD_WITH_UV_TRANS}) if (${BUILD_WITH_UV}) - target_include_directories( - transport - PUBLIC "${TD_SOURCE_DIR}/contrib/libuv/include" - ) - target_link_libraries( transport PUBLIC uv_a