Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
4f353da4
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
4f353da4
编写于
2月 23, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
global config
上级
76d69529
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
68 addition
and
96 deletion
+68
-96
include/common/tglobal.h
include/common/tglobal.h
+1
-10
include/os/osEnv.h
include/os/osEnv.h
+15
-0
include/os/osSysinfo.h
include/os/osSysinfo.h
+15
-8
include/util/tlog.h
include/util/tlog.h
+0
-1
source/common/src/tglobal.c
source/common/src/tglobal.c
+0
-36
source/dnode/mgmt/daemon/src/dmnCfg.c
source/dnode/mgmt/daemon/src/dmnCfg.c
+8
-8
source/dnode/mgmt/daemon/src/dmnLog.c
source/dnode/mgmt/daemon/src/dmnLog.c
+2
-0
source/dnode/mgmt/impl/src/dndEnv.c
source/dnode/mgmt/impl/src/dndEnv.c
+0
-12
source/os/src/osEnv.c
source/os/src/osEnv.c
+24
-0
source/util/src/tlog.c
source/util/src/tlog.c
+3
-21
未找到文件。
include/common/tglobal.h
浏览文件 @
4f353da4
...
...
@@ -56,16 +56,7 @@ extern int32_t tsProjectExecInterval;
extern
int64_t
tsMaxRetentWindow
;
// system info
extern
float
tsTotalLogDirGB
;
extern
float
tsTotalTmpDirGB
;
extern
float
tsTotalDataDirGB
;
extern
float
tsAvailLogDirGB
;
extern
float
tsAvailTmpDirectorySpace
;
extern
float
tsAvailDataDirGB
;
extern
float
tsUsedDataDirGB
;
extern
float
tsMinimalLogDirGB
;
extern
float
tsReservedTmpDirectorySpace
;
extern
float
tsMinimalDataDirGB
;
extern
uint32_t
tsVersion
;
// build info
...
...
include/os/osEnv.h
浏览文件 @
4f353da4
...
...
@@ -21,9 +21,24 @@ extern "C" {
#endif
extern
char
tsOsName
[];
extern
char
tsDataDir
[];
extern
char
tsLogDir
[];
extern
char
tsTempDir
[];
extern
char
configDir
[];
extern
struct
SDiskSpace
tsLogSpace
;
extern
struct
SDiskSpace
tsTempSpace
;
extern
struct
SDiskSpace
tsDataSpace
;
void
taosUpdateLogSpace
();
void
taosUpdateTempSpace
();
void
taosUpdateDataSpace
();
bool
taosLogSpaceAvailable
();
bool
taosTmpSpaceAvailable
();
bool
taosDataSpaceAvailable
();
void
taosUpdateAllSpace
();
#ifdef __cplusplus
}
#endif
...
...
include/os/osSysinfo.h
浏览文件 @
4f353da4
...
...
@@ -25,20 +25,27 @@ extern "C" {
#define TSDB_LOCALE_LEN 64
#define TSDB_TIMEZONE_LEN 96
typedef
struct
{
int64_t
total
;
int64_t
used
;
int64_t
avail
;
}
SDiskSize
;
typedef
struct
SDiskSpace
{
int64_t
reserved
;
SDiskSize
size
;
}
SDiskSpace
;
extern
int64_t
tsPageSize
;
extern
int64_t
tsOpenMax
;
extern
int64_t
tsStreamMax
;
extern
int32_t
tsNumOfCores
;
extern
int32_t
tsTotalMemoryMB
;
extern
char
tsTimezone
[];
extern
char
tsLocale
[];
extern
char
tsCharset
[];
// default encode string
extern
char
tsTimezone
[];
extern
char
tsLocale
[];
extern
char
tsCharset
[];
// default encode string
typedef
struct
{
int64_t
total
;
int64_t
used
;
int64_t
avail
;
}
SDiskSize
;
int32_t
taosGetDiskSize
(
char
*
dataDir
,
SDiskSize
*
diskSize
);
int32_t
taosGetCpuCores
();
...
...
include/util/tlog.h
浏览文件 @
4f353da4
...
...
@@ -22,7 +22,6 @@
extern
"C"
{
#endif
extern
char
tsLogDir
[];
extern
bool
tsLogInited
;
extern
bool
tsAsyncLog
;
extern
int32_t
tsNumOfLogLines
;
...
...
source/common/src/tglobal.c
浏览文件 @
4f353da4
...
...
@@ -119,13 +119,6 @@ bool tsdbForceKeepFile = false;
int64_t
tsTickPerDay
[]
=
{
86400000L
,
86400000000L
,
86400000000000L
};
// system info
float
tsTotalTmpDirGB
=
0
;
float
tsTotalDataDirGB
=
0
;
float
tsAvailTmpDirectorySpace
=
0
;
float
tsAvailDataDirGB
=
0
;
float
tsUsedDataDirGB
=
0
;
float
tsReservedTmpDirectorySpace
=
1
.
0
f
;
float
tsMinimalDataDirGB
=
2
.
0
f
;
int32_t
tsTotalMemoryMB
=
0
;
uint32_t
tsVersion
=
0
;
...
...
@@ -422,35 +415,6 @@ static void doInitGlobalConfig(void) {
taosAddConfigOption(cfg);
cfg.option = "minimalLogDirGB";
cfg.ptr = &tsMinimalLogDirGB;
cfg.valType = TAOS_CFG_VTYPE_FLOAT;
cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_SHOW;
cfg.minValue = 0.001f;
cfg.maxValue = 10000000;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_GB;
taosAddConfigOption(cfg);
cfg.option = "minimalTmpDirGB";
cfg.ptr = &tsReservedTmpDirectorySpace;
cfg.valType = TAOS_CFG_VTYPE_FLOAT;
cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_SHOW;
cfg.minValue = 0.001f;
cfg.maxValue = 10000000;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_GB;
taosAddConfigOption(cfg);
cfg.option = "minimalDataDirGB";
cfg.ptr = &tsMinimalDataDirGB;
cfg.valType = TAOS_CFG_VTYPE_FLOAT;
cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_SHOW;
cfg.minValue = 0.001f;
cfg.maxValue = 10000000;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_GB;
taosAddConfigOption(cfg);
cfg.option = "slaveQuery";
cfg.ptr = &tsEnableSlaveQuery;
...
...
source/dnode/mgmt/daemon/src/dmnCfg.c
浏览文件 @
4f353da4
...
...
@@ -41,17 +41,17 @@ static int32_t dmnAddEpCfg(SConfig *pCfg) {
static
int32_t
dmnAddDirCfg
(
SConfig
*
pCfg
)
{
if
(
cfgAddDir
(
pCfg
,
"dataDir"
,
tsDataDir
)
!=
0
)
return
-
1
;
if
(
cfgAddDir
(
pCfg
,
"tmpDir"
,
tsTempDir
)
!=
0
)
return
-
1
;
if
(
cfgAddDir
(
pCfg
,
"tempDir"
,
tsTempDir
)
!=
0
)
return
-
1
;
if
(
cfgAddFloat
(
pCfg
,
"minimalDataDirGB"
,
2
.
0
f
,
0
.
001
f
,
10000000
)
!=
0
)
return
-
1
;
if
(
cfgAddFloat
(
pCfg
,
"minimalTempDirGB"
,
1
.
0
f
,
0
.
001
f
,
10000000
)
!=
0
)
return
-
1
;
return
0
;
}
static
int32_t
dmnCheckDirCfg
(
SConfig
*
pCfg
)
{
SConfigItem
*
pItem
=
NULL
;
pItem
=
cfgGetItem
(
pCfg
,
"tmpDir"
);
if
(
taosDirExist
(
pItem
->
str
)
!=
0
)
{
return
-
1
;
}
static
int32_t
dmnCheckDirCfg
(
SConfig
*
pCfg
)
{
tstrncpy
(
tsDataDir
,
cfgGetItem
(
pCfg
,
"dataDir"
)
->
str
,
PATH_MAX
);
tstrncpy
(
tsTempDir
,
cfgGetItem
(
pCfg
,
"tempDir"
)
->
str
,
PATH_MAX
);
tsDataSpace
.
reserved
=
cfgGetItem
(
pCfg
,
"minimalDataDirGB"
)
->
fval
;
tsTempSpace
.
reserved
=
cfgGetItem
(
pCfg
,
"minimalTempDirGB"
)
->
fval
;
return
0
;
}
...
...
source/dnode/mgmt/daemon/src/dmnLog.c
浏览文件 @
4f353da4
...
...
@@ -18,6 +18,7 @@
int32_t
dmnAddLogCfg
(
SConfig
*
pCfg
)
{
if
(
cfgAddDir
(
pCfg
,
"logDir"
,
"/var/log/taos"
)
!=
0
)
return
-
1
;
if
(
cfgAddFloat
(
pCfg
,
"minimalLogDirGB"
,
1
.
0
f
,
0
.
001
f
,
10000000
)
!=
0
)
return
-
1
;
if
(
cfgAddBool
(
pCfg
,
"asyncLog"
,
1
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"numOfLogLines"
,
10000000
,
1000
,
2000000000
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"logKeepDays"
,
0
,
-
365000
,
365000
)
!=
0
)
return
-
1
;
...
...
@@ -41,6 +42,7 @@ int32_t dmnAddLogCfg(SConfig *pCfg) {
int32_t
dmnSetLogCfg
(
SConfig
*
pCfg
)
{
tstrncpy
(
tsLogDir
,
cfgGetItem
(
pCfg
,
"logDir"
)
->
str
,
PATH_MAX
);
tsLogSpace
.
reserved
=
cfgGetItem
(
pCfg
,
"minimalLogDirGB"
)
->
fval
;
tsAsyncLog
=
cfgGetItem
(
pCfg
,
"asyncLog"
)
->
bval
;
tsNumOfLogLines
=
cfgGetItem
(
pCfg
,
"numOfLogLines"
)
->
i32
;
tsLogKeepDays
=
cfgGetItem
(
pCfg
,
"logKeepDays"
)
->
i32
;
...
...
source/dnode/mgmt/impl/src/dndEnv.c
浏览文件 @
4f353da4
...
...
@@ -325,18 +325,6 @@ void taosGetDisk() {
SDiskSize diskSize = tfsGetSize(pTfs);
tfsUpdateSize(&fsMeta);
tsTotalDataDirGB = (float)(fsMeta.total / unit);
tsUsedDataDirGB = (float)(fsMeta.used / unit);
tsAvailDataDirGB = (float)(fsMeta.avail / unit);
if (taosGetDiskSize(tsLogDir, &diskSize) == 0) {
tsTotalLogDirGB = (float)(diskSize.total / unit);
tsAvailLogDirGB = (float)(diskSize.avail / unit);
}
if (taosGetDiskSize(tsTempDir, &diskSize) == 0) {
tsTotalTmpDirGB = (float)(diskSize.total / unit);
tsAvailTmpDirectorySpace = (float)(diskSize.avail / unit);
}
#endif
}
\ No newline at end of file
source/os/src/osEnv.c
浏览文件 @
4f353da4
...
...
@@ -16,6 +16,30 @@
#define _DEFAULT_SOURCE
#include "os.h"
#include "osEnv.h"
#include "osSysinfo.h"
SDiskSpace
tsLogSpace
;
SDiskSpace
tsTempSpace
;
SDiskSpace
tsDataSpace
;
void
taosUpdateLogSpace
()
{
taosGetDiskSize
(
tsLogDir
,
&
tsLogSpace
.
size
);
}
void
taosUpdateTempSpace
()
{
taosGetDiskSize
(
tsTempDir
,
&
tsTempSpace
.
size
);
}
void
taosUpdateDataSpace
()
{
taosGetDiskSize
(
tsDataDir
,
&
tsDataSpace
.
size
);
}
bool
taosLogSpaceAvailable
()
{
return
tsDataSpace
.
reserved
>
tsDataSpace
.
size
.
avail
;
}
bool
taosTempSpaceAvailable
()
{
return
tsTempSpace
.
reserved
>
tsTempSpace
.
size
.
avail
;
}
bool
taosDataSpaceAvailable
()
{
return
tsDataSpace
.
reserved
>
tsDataSpace
.
size
.
avail
;
}
void
taosUpdateAllSpace
()
{
taosUpdateLogSpace
();
taosUpdateTempSpace
();
taosUpdateDataSpace
();
}
#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
...
...
source/util/src/tlog.c
浏览文件 @
4f353da4
...
...
@@ -72,9 +72,6 @@ int8_t tscEmbeddedInUtil = 0;
int32_t
tsLogKeepDays
=
0
;
bool
tsAsyncLog
=
true
;
bool
tsLogInited
=
false
;
float
tsTotalLogDirGB
=
0
;
float
tsAvailLogDirGB
=
0
;
float
tsMinimalLogDirGB
=
1
.
0
f
;
int64_t
asyncLogLostLines
=
0
;
int32_t
writeInterval
=
DEFAULT_LOG_INTERVAL
;
...
...
@@ -383,12 +380,7 @@ static int32_t taosOpenLogFile(char *fn, int32_t maxLines, int32_t maxFileNum) {
}
void
taosPrintLog
(
const
char
*
flags
,
int32_t
dflag
,
const
char
*
format
,
...)
{
if
(
tsTotalLogDirGB
!=
0
&&
tsAvailLogDirGB
<
tsMinimalLogDirGB
)
{
printf
(
"server disk:%s space remain %.3f GB, total %.1f GB, stop print log.
\n
"
,
tsLogDir
,
tsAvailLogDirGB
,
tsTotalLogDirGB
);
fflush
(
stdout
);
return
;
}
if
(
!
taosLogSpaceAvailable
())
return
;
va_list
argpointer
;
char
buffer
[
MAX_LOGLINE_BUFFER_SIZE
]
=
{
0
};
...
...
@@ -443,12 +435,7 @@ void taosPrintLog(const char *flags, int32_t dflag, const char *format, ...) {
}
void
taosDumpData
(
unsigned
char
*
msg
,
int32_t
len
)
{
if
(
tsTotalLogDirGB
!=
0
&&
tsAvailLogDirGB
<
tsMinimalLogDirGB
)
{
printf
(
"server disk:%s space remain %.3f GB, total %.1f GB, stop dump log.
\n
"
,
tsLogDir
,
tsAvailLogDirGB
,
tsTotalLogDirGB
);
fflush
(
stdout
);
return
;
}
if
(
!
taosLogSpaceAvailable
())
return
;
char
temp
[
256
];
int32_t
i
,
pos
=
0
,
c
=
0
;
...
...
@@ -471,12 +458,7 @@ void taosDumpData(unsigned char *msg, int32_t len) {
}
void
taosPrintLongString
(
const
char
*
flags
,
int32_t
dflag
,
const
char
*
format
,
...)
{
if
(
tsTotalLogDirGB
!=
0
&&
tsAvailLogDirGB
<
tsMinimalLogDirGB
)
{
printf
(
"server disk:%s space remain %.3f GB, total %.1f GB, stop write log.
\n
"
,
tsLogDir
,
tsAvailLogDirGB
,
tsTotalLogDirGB
);
fflush
(
stdout
);
return
;
}
if
(
!
taosLogSpaceAvailable
())
return
;
va_list
argpointer
;
char
buffer
[
MAX_LOGLINE_DUMP_BUFFER_SIZE
];
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录