From 579af54c492bfc9124a415dc8d3e2f06de635eb7 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Mon, 10 Oct 2022 17:45:10 +0800 Subject: [PATCH 1/3] more code --- include/util/taoserror.h | 4 ++++ source/util/src/terror.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/include/util/taoserror.h b/include/util/taoserror.h index f6940b2895..add8f33cc2 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -632,6 +632,10 @@ int32_t* taosGetErrno(); #define TSDB_CODE_TMQ_CONSUMER_MISMATCH TAOS_DEF_ERROR_CODE(0, 0x4001) #define TSDB_CODE_TMQ_CONSUMER_CLOSED TAOS_DEF_ERROR_CODE(0, 0x4002) +// TDLite +#define TSDB_CODE_TDLITE_IVLD_OPEN_FLAGS TAOS_DEF_ERROR_CODE(0, 0x4100) +#define TSDB_CODE_TDLITE_IVLD_OPEN_DIR TAOS_DEF_ERROR_CODE(0, 0x4101) + #ifdef __cplusplus } #endif diff --git a/source/util/src/terror.c b/source/util/src/terror.c index 1906a77127..eb13a08be4 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -633,6 +633,10 @@ TAOS_DEFINE_ERROR(TSDB_CODE_TMQ_INVALID_MSG, "Invalid message") TAOS_DEFINE_ERROR(TSDB_CODE_TMQ_CONSUMER_MISMATCH, "Consumer mismatch") TAOS_DEFINE_ERROR(TSDB_CODE_TMQ_CONSUMER_CLOSED, "Consumer closed") +// TDLite +TAOS_DEFINE_ERROR(TSDB_CODE_TDLITE_IVLD_OPEN_FLAGS, "Invalid TDLite open flags") +TAOS_DEFINE_ERROR(TSDB_CODE_TDLITE_IVLD_OPEN_DIR, "Invalid TDLite open directory") + #ifdef TAOS_ERROR_C }; #endif From 4eecd7fd4a250262ce1d696165c1749b8117fc5f Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Mon, 10 Oct 2022 18:17:58 +0800 Subject: [PATCH 2/3] more code --- source/dnode/vnode/src/vnd/vnodeOpen.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/source/dnode/vnode/src/vnd/vnodeOpen.c b/source/dnode/vnode/src/vnd/vnodeOpen.c index 616aa39bdf..ddd0f36194 100644 --- a/source/dnode/vnode/src/vnd/vnodeOpen.c +++ b/source/dnode/vnode/src/vnd/vnodeOpen.c @@ -28,13 +28,24 @@ int vnodeCreate(const char *path, SVnodeCfg *pCfg, STfs *pTfs) { } // create vnode env - if (tfsMkdirAt(pTfs, path, (SDiskID){0}) < 0) { - vError("vgId:%d, failed to create vnode since:%s", pCfg->vgId, tstrerror(terrno)); - return -1; + if (pTfs) { + if (tfsMkdirAt(pTfs, path, (SDiskID){0}) < 0) { + vError("vgId:%d, failed to create vnode since:%s", pCfg->vgId, tstrerror(terrno)); + return -1; + } + snprintf(dir, TSDB_FILENAME_LEN, "%s%s%s", tfsGetPrimaryPath(pTfs), TD_DIRSEP, path); + } else { + if (taosMkDir(path)) { + return TAOS_SYSTEM_ERROR(errno); + } + strcpy(dir, path); } - snprintf(dir, TSDB_FILENAME_LEN, "%s%s%s", tfsGetPrimaryPath(pTfs), TD_DIRSEP, path); - info.config = *pCfg; + if (pCfg) { + info.config = *pCfg; + } else { + info.config = vnodeCfgDefault; + } info.state.committed = -1; info.state.applied = -1; info.state.commitID = 0; @@ -44,7 +55,7 @@ int vnodeCreate(const char *path, SVnodeCfg *pCfg, STfs *pTfs) { return -1; } - vInfo("vgId:%d, vnode is created", pCfg->vgId); + vInfo("vgId:%d, vnode is created", info.config.vgId); return 0; } From 6c097be04ee45f1e0610c699f49e522fe19160c9 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Mon, 10 Oct 2022 18:29:14 +0800 Subject: [PATCH 3/3] more code --- source/dnode/vnode/src/vnd/vnodeOpen.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/dnode/vnode/src/vnd/vnodeOpen.c b/source/dnode/vnode/src/vnd/vnodeOpen.c index ddd0f36194..414834e2eb 100644 --- a/source/dnode/vnode/src/vnd/vnodeOpen.c +++ b/source/dnode/vnode/src/vnd/vnodeOpen.c @@ -69,7 +69,11 @@ SVnode *vnodeOpen(const char *path, STfs *pTfs, SMsgCb msgCb) { char tdir[TSDB_FILENAME_LEN * 2]; int ret; - snprintf(dir, TSDB_FILENAME_LEN, "%s%s%s", tfsGetPrimaryPath(pTfs), TD_DIRSEP, path); + if (pTfs) { + snprintf(dir, TSDB_FILENAME_LEN, "%s%s%s", tfsGetPrimaryPath(pTfs), TD_DIRSEP, path); + } else { + snprintf(dir, TSDB_FILENAME_LEN, "%s", path); + } info.config = vnodeCfgDefault;