[TD-385] fix error while vnode dir not exist
This commit is contained in:
parent
8cf9550198
commit
4bcc492bb2
|
@ -156,6 +156,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_SERV_OUT_OF_MEMORY, 0, 405, "server out of m
|
|||
TAOS_DEFINE_ERROR(TSDB_CODE_NO_DISK_PERMISSIONS, 0, 406, "no disk permissions")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_FILE_CORRUPTED, 0, 407, "file corrupted")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MEMORY_CORRUPTED, 0, 408, "memory corrupted")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_NOT_SUCH_FILE_OR_DIR, 0, 409, "no such file or directory")
|
||||
|
||||
// client
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_CLIENT_VERSION, 0, 451, "invalid client version")
|
||||
|
|
|
@ -73,13 +73,18 @@ int32_t vnodeCreate(SMDCreateVnodeMsg *pVnodeCfg) {
|
|||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
mkdir(tsVnodeDir, 0755);
|
||||
|
||||
char rootDir[TSDB_FILENAME_LEN] = {0};
|
||||
sprintf(rootDir, "%s/vnode%d", tsVnodeDir, pVnodeCfg->cfg.vgId);
|
||||
if (mkdir(rootDir, 0755) != 0) {
|
||||
vPrint("vgId:%d, failed to create vnode, reason:%s dir:%s", pVnodeCfg->cfg.vgId, strerror(errno), rootDir);
|
||||
if (errno == EACCES) {
|
||||
return TSDB_CODE_NO_DISK_PERMISSIONS;
|
||||
} else if (errno == ENOSPC) {
|
||||
return TSDB_CODE_SERV_NO_DISKSPACE;
|
||||
} else if (errno == ENOENT) {
|
||||
return TSDB_CODE_NOT_SUCH_FILE_OR_DIR;
|
||||
} else if (errno == EEXIST) {
|
||||
} else {
|
||||
return TSDB_CODE_VG_INIT_FAILED;
|
||||
|
|
Loading…
Reference in New Issue