Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
94eac805
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22017
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
94eac805
编写于
11月 23, 2021
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-10430 refact osDir.h and daemon module
上级
6c626909
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
125 addition
and
51 deletion
+125
-51
include/dnode/mgmt/dnode.h
include/dnode/mgmt/dnode.h
+92
-18
include/os/osDir.h
include/os/osDir.h
+6
-6
source/common/src/tglobal.c
source/common/src/tglobal.c
+1
-1
source/dnode/mgmt/daemon/src/daemon.c
source/dnode/mgmt/daemon/src/daemon.c
+6
-6
source/dnode/mgmt/impl/src/dndInt.c
source/dnode/mgmt/impl/src/dndInt.c
+3
-3
source/dnode/mnode/sdb/src/sdbFile.c
source/dnode/mnode/sdb/src/sdbFile.c
+3
-3
source/dnode/vnode/tq/src/tqMetaStore.c
source/dnode/vnode/tq/src/tqMetaStore.c
+1
-1
source/libs/wal/src/walMgmt.c
source/libs/wal/src/walMgmt.c
+1
-1
source/os/src/osDir.c
source/os/src/osDir.c
+9
-9
source/util/src/tconfig.c
source/util/src/tconfig.c
+1
-1
src/client/src/tscSub.c
src/client/src/tscSub.c
+1
-1
src/tfs/src/tfs.c
src/tfs/src/tfs.c
+1
-1
未找到文件。
include/dnode/mgmt/dnode.h
浏览文件 @
94eac805
...
...
@@ -26,38 +26,112 @@ extern "C" {
typedef
struct
SDnode
SDnode
;
typedef
struct
{
int32_t
sver
;
int32_t
numOfCores
;
float
numOfThreadsPerCore
;
float
ratioOfQueryCores
;
int32_t
maxShellConns
;
int32_t
shellActivityTimer
;
int32_t
statusInterval
;
/**
* @brief software version of the program.
*
*/
int32_t
sver
;
/**
* @brief num of CPU cores.
*
*/
int32_t
numOfCores
;
/**
* @brief number of threads per CPU core.
*
*/
float
numOfThreadsPerCore
;
/**
* @brief the proportion of total CPU cores available for query processing.
*
*/
float
ratioOfQueryCores
;
/**
* @brief max number of connections allowed in dnode.
*
*/
int32_t
maxShellConns
;
/**
* @brief time interval of heart beat from shell to dnode, seconds.
*
*/
int32_t
shellActivityTimer
;
/**
* @brief time interval of dnode status reporting to mnode, seconds, for cluster only.
*
*/
int32_t
statusInterval
;
/**
* @brief first port number for the connection (12 continuous UDP/TCP port number are used).
*
*/
uint16_t
serverPort
;
char
dataDir
[
PATH_MAX
];
char
localEp
[
TSDB_EP_LEN
];
char
localFqdn
[
TSDB_FQDN_LEN
];
char
firstEp
[
TSDB_EP_LEN
];
char
timezone
[
TSDB_TIMEZONE_LEN
];
char
locale
[
TSDB_LOCALE_LEN
];
char
charset
[
TSDB_LOCALE_LEN
];
/**
* @brief data file's directory.
*
*/
char
dataDir
[
PATH_MAX
];
/**
* @brief local endpoint.
*
*/
char
localEp
[
TSDB_EP_LEN
];
/**
* @brieflocal fully qualified domain name (FQDN).
*
*/
char
localFqdn
[
TSDB_FQDN_LEN
];
/**
* @brief first fully qualified domain name (FQDN) for TDengine system.
*
*/
char
firstEp
[
TSDB_EP_LEN
];
/**
* @brief system time zone.
*
*/
char
timezone
[
TSDB_TIMEZONE_LEN
];
/**
* @brief system locale.
*
*/
char
locale
[
TSDB_LOCALE_LEN
];
/**
* @briefdefault system charset.
*
*/
char
charset
[
TSDB_LOCALE_LEN
];
}
SDnodeOpt
;
/* ------------------------ SDnode ------------------------ */
/**
* @brief Initialize and start the dnode.
*
* @param
cfgPath Config file path
.
* @param
pOptions Options of the dnode
.
* @return SDnode* The dnode object.
*/
SDnode
*
dndInit
(
SDnodeOpt
*
pOptions
);
/**
* @brief Stop and cleanup dnode.
* @brief Stop and cleanup
the
dnode.
*
* @param pDn
d
The dnode object to close.
* @param pDn
ode
The dnode object to close.
*/
void
dndCleanup
(
SDnode
*
pDn
d
);
void
dndCleanup
(
SDnode
*
pDn
ode
);
#ifdef __cplusplus
}
...
...
include/os/osDir.h
浏览文件 @
94eac805
...
...
@@ -20,12 +20,12 @@
extern
"C"
{
#endif
void
taosRemoveDir
(
const
char
*
dirname
);
bool
taosDirExist
(
char
*
dirname
);
bool
taosMkDir
(
const
char
*
dirname
);
void
taosRemoveOldFiles
(
char
*
dirname
,
int32_t
keepDays
);
bool
taosExpandDir
(
char
*
dirname
,
char
*
outname
,
int32_t
maxlen
);
bool
taosRealPath
(
char
*
dirname
,
int32_t
maxlen
);
void
taosRemoveDir
(
const
char
*
dirname
);
int32_t
taosDirExist
(
char
*
dirname
);
int32_t
taosMkDir
(
const
char
*
dirname
);
void
taosRemoveOldFiles
(
char
*
dirname
,
int32_t
keepDays
);
int32_t
taosExpandDir
(
char
*
dirname
,
char
*
outname
,
int32_t
maxlen
);
int32_t
taosRealPath
(
char
*
dirname
,
int32_t
maxlen
);
#ifdef __cplusplus
}
...
...
source/common/src/tglobal.c
浏览文件 @
94eac805
...
...
@@ -1679,7 +1679,7 @@ int32_t taosCheckGlobalCfg() {
taosCheckDataDirCfg
();
if
(
!
taosDirExist
(
tsTempDir
)
)
{
if
(
taosDirExist
(
tsTempDir
)
!=
0
)
{
return
-
1
;
}
...
...
source/dnode/mgmt/daemon/src/daemon.c
浏览文件 @
94eac805
...
...
@@ -40,7 +40,7 @@ void dmnSetSignalHandle() {
taosSetSignal
(
SIGBREAK
,
dmnSigintHandle
);
}
int
dmnParseOpt
s
(
int
argc
,
char
const
*
argv
[])
{
int
dmnParseOpt
ion
(
int
argc
,
char
const
*
argv
[])
{
tstrncpy
(
global
.
configDir
,
"/etc/taos"
,
PATH_MAX
);
for
(
int
i
=
1
;
i
<
argc
;
++
i
)
{
...
...
@@ -52,7 +52,7 @@ int dmnParseOpts(int argc, char const *argv[]) {
}
tstrncpy
(
global
.
configDir
,
argv
[
i
],
PATH_MAX
);
}
else
{
printf
(
"'-c' requires a parameter, default
:
%s
\n
"
,
configDir
);
printf
(
"'-c' requires a parameter, default
is
%s
\n
"
,
configDir
);
return
-
1
;
}
}
else
if
(
strcmp
(
argv
[
i
],
"-C"
)
==
0
)
{
...
...
@@ -78,11 +78,11 @@ void dmnGenerateGrant() {
void
dmnPrintVersion
()
{
#ifdef TD_ENTERPRISE
char
*
versionStr
=
"enterprise"
;
char
*
releaseName
=
"enterprise"
;
#else
char
*
versionStr
=
"community"
;
char
*
releaseName
=
"community"
;
#endif
printf
(
"%s version: %s compatible_version: %s
\n
"
,
versionStr
,
version
,
compatible_version
);
printf
(
"%s version: %s compatible_version: %s
\n
"
,
releaseName
,
version
,
compatible_version
);
printf
(
"gitinfo: %s
\n
"
,
gitinfo
);
printf
(
"gitinfoI: %s
\n
"
,
gitinfoOfInternal
);
printf
(
"builuInfo: %s
\n
"
,
buildinfo
);
...
...
@@ -164,7 +164,7 @@ int dmnRunDnode() {
}
int
main
(
int
argc
,
char
const
*
argv
[])
{
if
(
dmnParseOpt
s
(
argc
,
argv
)
!=
0
)
{
if
(
dmnParseOpt
ion
(
argc
,
argv
)
!=
0
)
{
return
-
1
;
}
...
...
source/dnode/mgmt/impl/src/dndInt.c
浏览文件 @
94eac805
...
...
@@ -98,19 +98,19 @@ static int32_t dndInitEnv(SDnode *pDnode, SDnodeOpt *pOptions) {
return
-
1
;
}
if
(
!
taosMkDir
(
pDnode
->
dir
.
dnode
)
)
{
if
(
taosMkDir
(
pDnode
->
dir
.
dnode
)
!=
0
)
{
dError
(
"failed to create dir:%s since %s"
,
pDnode
->
dir
.
dnode
,
strerror
(
errno
));
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
return
-
1
;
}
if
(
!
taosMkDir
(
pDnode
->
dir
.
mnode
)
)
{
if
(
taosMkDir
(
pDnode
->
dir
.
mnode
)
!=
0
)
{
dError
(
"failed to create dir:%s since %s"
,
pDnode
->
dir
.
mnode
,
strerror
(
errno
));
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
return
-
1
;
}
if
(
!
taosMkDir
(
pDnode
->
dir
.
vnodes
)
)
{
if
(
taosMkDir
(
pDnode
->
dir
.
vnodes
)
!=
0
)
{
dError
(
"failed to create dir:%s since %s"
,
pDnode
->
dir
.
vnodes
,
strerror
(
errno
));
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
return
-
1
;
...
...
source/dnode/mnode/sdb/src/sdbFile.c
浏览文件 @
94eac805
...
...
@@ -21,19 +21,19 @@
static
int32_t
sdbCreateDir
()
{
mDebug
(
"start to create mnode at %s"
,
tsMnodeDir
);
if
(
!
taosMkDir
(
tsSdb
.
currDir
)
)
{
if
(
taosMkDir
(
tsSdb
.
currDir
)
!=
0
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
mError
(
"failed to create dir:%s since %s"
,
tsSdb
.
currDir
,
terrstr
());
return
-
1
;
}
if
(
!
taosMkDir
(
tsSdb
.
syncDir
)
)
{
if
(
taosMkDir
(
tsSdb
.
syncDir
)
!=
0
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
mError
(
"failed to create dir:%s since %s"
,
tsSdb
.
syncDir
,
terrstr
());
return
-
1
;
}
if
(
!
taosMkDir
(
tsSdb
.
tmpDir
)
)
{
if
(
taosMkDir
(
tsSdb
.
tmpDir
)
!=
0
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
mError
(
"failed to create dir:%s since %s"
,
tsSdb
.
tmpDir
,
terrstr
());
return
-
1
;
...
...
source/dnode/vnode/tq/src/tqMetaStore.c
浏览文件 @
94eac805
...
...
@@ -92,7 +92,7 @@ TqMetaStore* tqStoreOpen(const char* path,
char
name
[
pathLen
+
10
];
strcpy
(
name
,
path
);
if
(
!
taosDirExist
(
name
)
&&
!
taosMkDir
(
name
)
)
{
if
(
taosDirExist
(
name
)
!=
0
&&
taosMkDir
(
name
)
!=
0
)
{
ASSERT
(
false
);
}
strcat
(
name
,
"/"
TQ_IDX_NAME
);
...
...
source/libs/wal/src/walMgmt.c
浏览文件 @
94eac805
...
...
@@ -136,7 +136,7 @@ void walClose(SWal *pWal) {
}
static
int32_t
walInitObj
(
SWal
*
pWal
)
{
if
(
!
taosMkDir
(
pWal
->
path
)
)
{
if
(
taosMkDir
(
pWal
->
path
)
!=
0
)
{
wError
(
"vgId:%d, path:%s, failed to create directory since %s"
,
pWal
->
vgId
,
pWal
->
path
,
strerror
(
errno
));
return
TAOS_SYSTEM_ERROR
(
errno
);
}
...
...
source/os/src/osDir.c
浏览文件 @
94eac805
...
...
@@ -58,15 +58,15 @@ void taosRemoveDir(const char *dirname) {
printf
(
"dir:%s is removed
\n
"
,
dirname
);
}
bool
taosDirExist
(
char
*
dirname
)
{
return
access
(
dirname
,
F_OK
)
==
0
;
}
int32_t
taosDirExist
(
char
*
dirname
)
{
return
access
(
dirname
,
F_OK
)
;
}
bool
taosMkDir
(
const
char
*
dirname
)
{
int32_t
taosMkDir
(
const
char
*
dirname
)
{
int32_t
code
=
mkdir
(
dirname
,
0755
);
if
(
code
<
0
&&
errno
==
EEXIST
)
{
return
true
;
return
0
;
}
return
code
==
0
;
return
code
;
}
void
taosRemoveOldFiles
(
char
*
dirname
,
int32_t
keepDays
)
{
...
...
@@ -112,12 +112,12 @@ void taosRemoveOldFiles(char *dirname, int32_t keepDays) {
rmdir
(
dirname
);
}
bool
taosExpandDir
(
char
*
dirname
,
char
*
outname
,
int32_t
maxlen
)
{
int32_t
taosExpandDir
(
char
*
dirname
,
char
*
outname
,
int32_t
maxlen
)
{
wordexp_t
full_path
;
if
(
0
!=
wordexp
(
dirname
,
&
full_path
,
0
))
{
printf
(
"failed to expand path:%s since %s"
,
dirname
,
strerror
(
errno
));
wordfree
(
&
full_path
);
return
false
;
return
-
1
;
}
if
(
full_path
.
we_wordv
!=
NULL
&&
full_path
.
we_wordv
[
0
]
!=
NULL
)
{
...
...
@@ -126,16 +126,16 @@ bool taosExpandDir(char *dirname, char *outname, int32_t maxlen) {
wordfree
(
&
full_path
);
return
true
;
return
0
;
}
bool
taosRealPath
(
char
*
dirname
,
int32_t
maxlen
)
{
int32_t
taosRealPath
(
char
*
dirname
,
int32_t
maxlen
)
{
char
tmp
[
PATH_MAX
]
=
{
0
};
if
(
realpath
(
dirname
,
tmp
)
!=
NULL
)
{
strncpy
(
dirname
,
tmp
,
maxlen
);
}
return
true
;
return
0
;
}
#endif
source/util/src/tconfig.c
浏览文件 @
94eac805
...
...
@@ -154,7 +154,7 @@ static bool taosReadDirectoryConfig(SGlobalCfg *cfg, char *input_value) {
taosExpandDir
(
input_value
,
option
,
cfg
->
ptrLength
);
taosRealPath
(
option
,
cfg
->
ptrLength
);
if
(
!
taosMkDir
(
option
)
)
{
if
(
taosMkDir
(
option
)
!=
0
)
{
uError
(
"config option:%s, input value:%s, directory not exist, create fail:%s"
,
cfg
->
option
,
input_value
,
strerror
(
errno
));
return
false
;
...
...
src/client/src/tscSub.c
浏览文件 @
94eac805
...
...
@@ -371,7 +371,7 @@ void tscSaveSubscriptionProgress(void* sub) {
char
path
[
256
];
sprintf
(
path
,
"%s/subscribe"
,
tsDataDir
);
if
(
!
taosMkDir
(
path
)
)
{
if
(
taosMkDir
(
path
)
!=
0
)
{
tscError
(
"failed to create subscribe dir: %s"
,
path
);
}
...
...
src/tfs/src/tfs.c
浏览文件 @
94eac805
...
...
@@ -252,7 +252,7 @@ int tfsMkdirAt(const char *rname, int level, int id) {
char
aname
[
TMPNAME_LEN
];
snprintf
(
aname
,
TMPNAME_LEN
,
"%s/%s"
,
DISK_DIR
(
pDisk
),
rname
);
if
(
!
taosMkDir
(
aname
)
)
{
if
(
taosMkDir
(
aname
)
!=
0
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
return
-
1
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录