Merge pull request #17274 from taosdata/feat/tdlite
feat: adjust some code for tdlite
This commit is contained in:
commit
fcbff54e59
|
@ -632,6 +632,10 @@ int32_t* taosGetErrno();
|
||||||
#define TSDB_CODE_TMQ_CONSUMER_MISMATCH TAOS_DEF_ERROR_CODE(0, 0x4001)
|
#define TSDB_CODE_TMQ_CONSUMER_MISMATCH TAOS_DEF_ERROR_CODE(0, 0x4001)
|
||||||
#define TSDB_CODE_TMQ_CONSUMER_CLOSED TAOS_DEF_ERROR_CODE(0, 0x4002)
|
#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
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -28,13 +28,24 @@ int vnodeCreate(const char *path, SVnodeCfg *pCfg, STfs *pTfs) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// create vnode env
|
// create vnode env
|
||||||
if (tfsMkdirAt(pTfs, path, (SDiskID){0}) < 0) {
|
if (pTfs) {
|
||||||
vError("vgId:%d, failed to create vnode since:%s", pCfg->vgId, tstrerror(terrno));
|
if (tfsMkdirAt(pTfs, path, (SDiskID){0}) < 0) {
|
||||||
return -1;
|
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);
|
if (pCfg) {
|
||||||
info.config = *pCfg;
|
info.config = *pCfg;
|
||||||
|
} else {
|
||||||
|
info.config = vnodeCfgDefault;
|
||||||
|
}
|
||||||
info.state.committed = -1;
|
info.state.committed = -1;
|
||||||
info.state.applied = -1;
|
info.state.applied = -1;
|
||||||
info.state.commitID = 0;
|
info.state.commitID = 0;
|
||||||
|
@ -44,7 +55,7 @@ int vnodeCreate(const char *path, SVnodeCfg *pCfg, STfs *pTfs) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
vInfo("vgId:%d, vnode is created", pCfg->vgId);
|
vInfo("vgId:%d, vnode is created", info.config.vgId);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -58,7 +69,11 @@ SVnode *vnodeOpen(const char *path, STfs *pTfs, SMsgCb msgCb) {
|
||||||
char tdir[TSDB_FILENAME_LEN * 2];
|
char tdir[TSDB_FILENAME_LEN * 2];
|
||||||
int ret;
|
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;
|
info.config = vnodeCfgDefault;
|
||||||
|
|
||||||
|
|
|
@ -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_MISMATCH, "Consumer mismatch")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_TMQ_CONSUMER_CLOSED, "Consumer closed")
|
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
|
#ifdef TAOS_ERROR_C
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue