Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e69fbd54
TDengine
项目概览
taosdata
/
TDengine
12 个月 前同步成功
通知
1180
Star
22014
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e69fbd54
编写于
9月 07, 2020
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-1263] add config items, logKeepDays and logbakDir
上级
e5adfe51
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
43 addition
and
3 deletion
+43
-3
src/client/src/tscSystem.c
src/client/src/tscSystem.c
+4
-0
src/common/inc/tglobal.h
src/common/inc/tglobal.h
+2
-0
src/common/src/tglobal.c
src/common/src/tglobal.c
+20
-0
src/dnode/src/dnodeMain.c
src/dnode/src/dnodeMain.c
+5
-0
src/os/src/alpine/alpineEnv.c
src/os/src/alpine/alpineEnv.c
+1
-0
src/os/src/darwin/darwinEnv.c
src/os/src/darwin/darwinEnv.c
+1
-0
src/os/src/linux/linuxEnv.c
src/os/src/linux/linuxEnv.c
+2
-0
src/os/src/windows/wEnv.c
src/os/src/windows/wEnv.c
+2
-0
src/util/src/tconfig.c
src/util/src/tconfig.c
+3
-3
src/util/src/tlog.c
src/util/src/tlog.c
+3
-0
未找到文件。
src/client/src/tscSystem.c
浏览文件 @
e69fbd54
...
...
@@ -94,6 +94,10 @@ void taos_init_imp(void) {
printf
(
"failed to create log dir:%s
\n
"
,
tsLogDir
);
}
if
(
mkdir
(
tsLogbakDir
,
0755
)
!=
0
&&
errno
!=
EEXIST
)
{
printf
(
"failed to create logbak dir:%s
\n
"
,
tsLogbakDir
);
}
sprintf
(
temp
,
"%s/taoslog"
,
tsLogDir
);
if
(
taosInitLog
(
temp
,
tsNumOfLogLines
,
10
)
<
0
)
{
printf
(
"failed to open log file in directory:%s
\n
"
,
tsLogDir
);
...
...
src/common/inc/tglobal.h
浏览文件 @
e69fbd54
...
...
@@ -126,6 +126,7 @@ extern char tsDnodeDir[];
extern
char
tsMnodeDir
[];
extern
char
tsDataDir
[];
extern
char
tsLogDir
[];
extern
char
tsLogbakDir
[];
extern
char
tsScriptDir
[];
extern
int64_t
tsMsPerDay
[
3
];
extern
char
tsVnodeBakDir
[];
...
...
@@ -158,6 +159,7 @@ extern char buildinfo[];
// log
extern
int32_t
tsAsyncLog
;
extern
int32_t
tsNumOfLogLines
;
extern
int32_t
tsLogKeepDays
;
extern
int32_t
dDebugFlag
;
extern
int32_t
vDebugFlag
;
extern
int32_t
mDebugFlag
;
...
...
src/common/src/tglobal.c
浏览文件 @
e69fbd54
...
...
@@ -370,6 +370,16 @@ static void doInitGlobalConfig(void) {
cfg
.
unitType
=
TAOS_CFG_UTYPE_NONE
;
taosInitConfigOption
(
cfg
);
cfg
.
option
=
"logBakDir"
;
cfg
.
ptr
=
tsLogbakDir
;
cfg
.
valType
=
TAOS_CFG_VTYPE_DIRECTORY
;
cfg
.
cfgType
=
TSDB_CFG_CTYPE_B_CONFIG
|
TSDB_CFG_CTYPE_B_CLIENT
|
TSDB_CFG_CTYPE_B_LOG
;
cfg
.
minValue
=
0
;
cfg
.
maxValue
=
0
;
cfg
.
ptrLength
=
TSDB_FILENAME_LEN
;
cfg
.
unitType
=
TAOS_CFG_UTYPE_NONE
;
taosInitConfigOption
(
cfg
);
cfg
.
option
=
"scriptDir"
;
cfg
.
ptr
=
tsScriptDir
;
cfg
.
valType
=
TAOS_CFG_VTYPE_DIRECTORY
;
...
...
@@ -1019,6 +1029,16 @@ static void doInitGlobalConfig(void) {
cfg
.
unitType
=
TAOS_CFG_UTYPE_NONE
;
taosInitConfigOption
(
cfg
);
cfg
.
option
=
"logKeepDays"
;
cfg
.
ptr
=
&
tsNumOfLogLines
;
cfg
.
valType
=
TAOS_CFG_VTYPE_INT32
;
cfg
.
cfgType
=
TSDB_CFG_CTYPE_B_CONFIG
|
TSDB_CFG_CTYPE_B_LOG
|
TSDB_CFG_CTYPE_B_CLIENT
;
cfg
.
minValue
=
0
;
cfg
.
maxValue
=
3650
;
cfg
.
ptrLength
=
0
;
cfg
.
unitType
=
TAOS_CFG_UTYPE_NONE
;
taosInitConfigOption
(
cfg
);
cfg
.
option
=
"asyncLog"
;
cfg
.
ptr
=
&
tsAsyncLog
;
cfg
.
valType
=
TAOS_CFG_VTYPE_INT16
;
...
...
src/dnode/src/dnodeMain.c
浏览文件 @
e69fbd54
...
...
@@ -106,6 +106,11 @@ int32_t dnodeInitSystem() {
return
-
1
;
}
if
(
dnodeCreateDir
(
tsLogbakDir
)
<
0
)
{
printf
(
"failed to create dir: %s, reason: %s
\n
"
,
tsLogbakDir
,
strerror
(
errno
));
return
-
1
;
}
char
temp
[
TSDB_FILENAME_LEN
];
sprintf
(
temp
,
"%s/taosdlog"
,
tsLogDir
);
if
(
taosInitLog
(
temp
,
tsNumOfLogLines
,
1
)
<
0
)
{
...
...
src/os/src/alpine/alpineEnv.c
浏览文件 @
e69fbd54
...
...
@@ -27,6 +27,7 @@ void osInit() {
strcpy
(
tsMnodeDir
,
""
);
strcpy
(
tsDataDir
,
"/var/lib/taos"
);
strcpy
(
tsLogDir
,
"/var/log/taos"
);
strcpy
(
tsLogbakDir
,
"/var/log/taos/bak"
);
strcpy
(
tsScriptDir
,
"/etc/taos"
);
strcpy
(
tsOsName
,
"Linux"
);
}
\ No newline at end of file
src/os/src/darwin/darwinEnv.c
浏览文件 @
e69fbd54
...
...
@@ -27,6 +27,7 @@ void osInit() {
strcpy
(
tsMnodeDir
,
""
);
strcpy
(
tsDataDir
,
"~/TDengine/data"
);
strcpy
(
tsLogDir
,
"~/TDengine/log"
);
strcpy
(
tsLogbakDir
,
"~/TDengine/log/bak"
);
strcpy
(
tsScriptDir
,
"~/TDengine/cfg"
);
strcpy
(
tsOsName
,
"Darwin"
);
}
src/os/src/linux/linuxEnv.c
浏览文件 @
e69fbd54
...
...
@@ -25,6 +25,7 @@ void osInit() {
}
strcpy
(
tsDataDir
,
"/var/lib/power"
);
strcpy
(
tsLogDir
,
"/var/log/power"
);
strcpy
(
tsLogbakDir
,
"/var/log/power/bak"
);
strcpy
(
tsScriptDir
,
"/etc/power"
);
#else
if
(
configDir
[
0
]
==
0
)
{
...
...
@@ -32,6 +33,7 @@ void osInit() {
}
strcpy
(
tsDataDir
,
"/var/lib/taos"
);
strcpy
(
tsLogDir
,
"/var/log/taos"
);
strcpy
(
tsLogbakDir
,
"/var/log/taos/bak"
);
strcpy
(
tsScriptDir
,
"/etc/taos"
);
#endif
...
...
src/os/src/windows/wEnv.c
浏览文件 @
e69fbd54
...
...
@@ -30,6 +30,7 @@ void osInit() {
strcpy
(
tsVnodeDir
,
"C:/PowerDB/data"
);
strcpy
(
tsDataDir
,
"C:/PowerDB/data"
);
strcpy
(
tsLogDir
,
"C:/PowerDB/log"
);
strcpy
(
tsLogbakDir
,
"C:/PowerDB/log/bak"
);
strcpy
(
tsScriptDir
,
"C:/PowerDB/script"
);
#else
...
...
@@ -40,6 +41,7 @@ void osInit() {
strcpy
(
tsVnodeDir
,
"C:/TDengine/data"
);
strcpy
(
tsDataDir
,
"C:/TDengine/data"
);
strcpy
(
tsLogDir
,
"C:/TDengine/log"
);
strcpy
(
tsLogbakDir
,
"C:/TDengine/log/bak"
);
strcpy
(
tsScriptDir
,
"C:/TDengine/script"
);
#endif
...
...
src/util/src/tconfig.c
浏览文件 @
e69fbd54
...
...
@@ -270,7 +270,7 @@ void taosReadGlobalLogCfg() {
}
wordfree
(
&
full_path
);
taosReadLogOption
(
"
tsL
ogDir"
,
tsLogDir
);
taosReadLogOption
(
"
l
ogDir"
,
tsLogDir
);
sprintf
(
fileName
,
"%s/taos.cfg"
,
configDir
);
fp
=
fopen
(
fileName
,
"r"
);
...
...
@@ -288,9 +288,9 @@ void taosReadGlobalLogCfg() {
option
=
value
=
NULL
;
olen
=
vlen
=
0
;
taosGetline
(
&
line
,
&
len
,
fp
);
taosGetline
(
&
line
,
&
len
,
fp
);
line
[
len
-
1
]
=
0
;
paGetToken
(
line
,
&
option
,
&
olen
);
if
(
olen
==
0
)
continue
;
option
[
olen
]
=
0
;
...
...
src/util/src/tlog.c
浏览文件 @
e69fbd54
...
...
@@ -62,14 +62,17 @@ typedef struct {
pthread_mutex_t
logMutex
;
}
SLogObj
;
int32_t
tsLogKeepDays
=
0
;
int32_t
tsAsyncLog
=
1
;
float
tsTotalLogDirGB
=
0
;
float
tsAvailLogDirGB
=
0
;
float
tsMinimalLogDirGB
=
0
.
1
f
;
#ifdef _TD_POWER_
char
tsLogDir
[
TSDB_FILENAME_LEN
]
=
"/var/log/power"
;
char
tsLogbakDir
[
TSDB_FILENAME_LEN
]
=
"/var/log/power/bak"
;
#else
char
tsLogDir
[
TSDB_FILENAME_LEN
]
=
"/var/log/taos"
;
char
tsLogbakDir
[
TSDB_FILENAME_LEN
]
=
"/var/log/taos/bak"
;
#endif
static
SLogObj
tsLogObj
=
{
.
fileNum
=
1
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录