diff --git a/src/dnode/CMakeLists.txt b/src/dnode/CMakeLists.txt index 5608cfd6d16826e399f9ea41dc026d2ab2459610..d0cbda48a05d1a87563bfc940865a2bf96485f3c 100644 --- a/src/dnode/CMakeLists.txt +++ b/src/dnode/CMakeLists.txt @@ -36,6 +36,10 @@ IF (TD_LINUX) TARGET_LINK_LIBRARIES(taosd balance sync) ENDIF () + IF (TD_DNODE_PLUGINS) + TARGET_LINK_LIBRARIES(taosd dnodePlugins) + ENDIF() + SET(PREPARE_ENV_CMD "prepare_env_cmd") SET(PREPARE_ENV_TARGET "prepare_env_target") ADD_CUSTOM_COMMAND(OUTPUT ${PREPARE_ENV_CMD} diff --git a/src/dnode/src/dnodeMain.c b/src/dnode/src/dnodeMain.c index d22cc93cb4716294b0c5eaca7899da289af9f171..59c19554b0625591fda882a34bd3b0ff41291ef3 100644 --- a/src/dnode/src/dnodeMain.c +++ b/src/dnode/src/dnodeMain.c @@ -170,6 +170,17 @@ static void dnodeCheckDataDirOpenned(char *dir) { } static int32_t dnodeInitStorage() { + pDnodeTier = dnodeNewTier(); + if (pDnodeTier == NULL) { + dError("failed to create new dnode tier since %s", tstrerror(terrno)); + return -1; + } + + if (dnodeAddDisks(pDnodeTier, NULL, 0) < 0) { + dError("failed to add disks to dnode tier since %s", tstrerror(terrno)); + return -1; + } + if (dnodeCreateDir(tsDataDir) < 0) { dError("failed to create dir: %s, reason: %s", tsDataDir, strerror(errno)); return -1; @@ -204,7 +215,12 @@ static int32_t dnodeInitStorage() { return 0; } -static void dnodeCleanupStorage() {} +static void dnodeCleanupStorage() { + if (pDnodeTier) { + dnodeCloseTier(pDnodeTier); + pDnodeTier = NULL; + } +} bool dnodeIsFirstDeploy() { return strcmp(tsFirst, tsLocalEp) == 0; diff --git a/src/dnode/src/dnodeTier.c b/src/dnode/src/dnodeTier.c index 310b65a17eedde7bea97e04c20e318263496596a..f7b3c1f49e7fcf2bdb1fa55b82a1006e96c73f66 100644 --- a/src/dnode/src/dnodeTier.c +++ b/src/dnode/src/dnodeTier.c @@ -20,7 +20,7 @@ SDnodeTier *dnodeNewTier() { return NULL; } void * dnodeCloseTier(SDnodeTier *pDnodeTier) { return NULL; } -int dnodeAddDisks(SDnodeTier *pDnodeTier, SDiskCfg *pDiskCfgs, int ndisks); +int dnodeAddDisks(SDnodeTier *pDnodeTier, SDiskCfg *pDiskCfgs, int ndisks) { return 0; } int dnodeUpdateTiersInfo(SDnodeTier *pDnodeTier) { return 0; } int dnodeCheckTiers(SDnodeTier *pDnodeTier) { return 0; } SDisk * dnodeAssignDisk(SDnodeTier *pDnodeTier, int level) { return NULL; } diff --git a/src/inc/taoserror.h b/src/inc/taoserror.h index e5619e92676e44fe0f843201a0248ae0e77ff1ce..baa5ef7760c2f820ab945472e006d8c58ff9a9fa 100644 --- a/src/inc/taoserror.h +++ b/src/inc/taoserror.h @@ -187,6 +187,8 @@ TAOS_DEFINE_ERROR(TSDB_CODE_DND_DISK_ALREADY_EXISTS, 0, 0x0406, "Disk alrea TAOS_DEFINE_ERROR(TSDB_CODE_DND_DISK_NOT_DIRECTORY, 0, 0x0407, "Disk is not a directory") TAOS_DEFINE_ERROR(TSDB_CODE_DND_NO_DISK_SPACE, 0, 0x0408, "Dnode no disk space") TAOS_DEFINE_ERROR(TSDB_CODE_DND_DUPLICATE_PRIMARY_DISK, 0, 0x0409, "Duplicate primary disk") +TAOS_DEFINE_ERROR(TSDB_CODE_DND_LACK_PRIMARY_DISK, 0, 0x040A, "Lack primary disk") +TAOS_DEFINE_ERROR(TSDB_CODE_DND_NO_DISK_AT_TIER, 0, 0x040B, "No disk at tier") // vnode TAOS_DEFINE_ERROR(TSDB_CODE_VND_ACTION_IN_PROGRESS, 0, 0x0500, "Action in progress")