Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_50753323
TDengine
提交
06b7af06
T
TDengine
项目概览
qq_50753323
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
06b7af06
编写于
8月 23, 2019
作者:
S
slguan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix the issue #404
上级
35aa9a95
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
52 addition
and
25 deletion
+52
-25
src/inc/taosmsg.h
src/inc/taosmsg.h
+1
-0
src/inc/tglobalcfg.h
src/inc/tglobalcfg.h
+3
-0
src/inc/tsystem.h
src/inc/tsystem.h
+1
-1
src/modules/monitor/src/monitorSystem.c
src/modules/monitor/src/monitorSystem.c
+12
-10
src/rpc/src/tstring.c
src/rpc/src/tstring.c
+2
-1
src/system/src/mgmtSystem.c
src/system/src/mgmtSystem.c
+1
-4
src/system/src/vnodeShell.c
src/system/src/vnodeShell.c
+6
-0
src/util/src/tglobalcfg.c
src/util/src/tglobalcfg.c
+7
-4
src/util/src/tlog.c
src/util/src/tlog.c
+14
-0
src/util/src/tsystem.c
src/util/src/tsystem.c
+5
-5
未找到文件。
src/inc/taosmsg.h
浏览文件 @
06b7af06
...
...
@@ -130,6 +130,7 @@ extern "C" {
#define TSDB_CODE_CACHE_BLOCK_TS_DISORDERED 107 // time stamp in cache block is disordered
#define TSDB_CODE_FILE_BLOCK_TS_DISORDERED 108 // time stamp in file block is disordered
#define TSDB_CODE_INVALID_COMMIT_LOG 109 // invalid commit log may be caused by insufficient sotrage
#define TSDB_CODE_SERVER_NO_SPACE 110
// message type
#define TSDB_MSG_TYPE_REG 1
...
...
src/inc/tglobalcfg.h
浏览文件 @
06b7af06
...
...
@@ -30,6 +30,9 @@ extern int64_t tsOpenMax;
extern
int64_t
tsStreamMax
;
extern
int32_t
tsNumOfCores
;
extern
int32_t
tsTotalDiskGB
;
extern
float
tsDiskAvailGB
;
extern
float
tsDiskUsedGB
;
extern
float
tsDiskMinimalGB
;
extern
int32_t
tsTotalMemoryMB
;
extern
int32_t
tsVersion
;
...
...
src/inc/tsystem.h
浏览文件 @
06b7af06
...
...
@@ -27,7 +27,7 @@ bool taosGetSysMemory(float *memoryUsedMB);
bool
taosGetProcMemory
(
float
*
memoryUsedMB
);
bool
taosGetDisk
(
float
*
diskUsedGB
);
bool
taosGetDisk
();
bool
taosGetCpuUsage
(
float
*
sysCpuUsage
,
float
*
procCpuUsage
);
...
...
src/modules/monitor/src/monitorSystem.c
浏览文件 @
06b7af06
...
...
@@ -25,9 +25,10 @@
#include "ttimer.h"
#include "tutil.h"
#define SQL_LENGTH 1024
#define LOG_LEN_STR 80
#define IP_LEN_STR 15
#define SQL_LENGTH 1024
#define LOG_LEN_STR 80
#define IP_LEN_STR 15
#define CHECK_INTERVAL 1000
typedef
enum
{
MONITOR_CMD_CREATE_DB
,
...
...
@@ -53,6 +54,7 @@ typedef struct {
int8_t
state
;
char
sql
[
SQL_LENGTH
];
void
*
initTimer
;
void
*
diskTimer
;
}
MonitorConn
;
MonitorConn
*
monitor
=
NULL
;
...
...
@@ -69,9 +71,15 @@ void monitorSaveLog(int level, const char *const format, ...);
void
(
*
monitorCountReqFp
)(
SCountInfo
*
info
)
=
NULL
;
void
monitorExecuteSQL
(
char
*
sql
);
void
monitorCheckDiskUsage
(
void
*
para
,
void
*
unused
)
{
taosGetDisk
();
taosTmrReset
(
monitorCheckDiskUsage
,
CHECK_INTERVAL
,
NULL
,
tscTmr
,
&
monitor
->
diskTimer
);
}
int
monitorInitSystem
()
{
monitor
=
(
MonitorConn
*
)
malloc
(
sizeof
(
MonitorConn
));
memset
(
monitor
,
0
,
sizeof
(
MonitorConn
));
taosTmrReset
(
monitorCheckDiskUsage
,
CHECK_INTERVAL
,
NULL
,
tscTmr
,
&
monitor
->
diskTimer
);
return
0
;
}
...
...
@@ -265,13 +273,7 @@ int monitorBuildCpuSql(char *sql) {
// unit is GB
int
monitorBuildDiskSql
(
char
*
sql
)
{
float
diskUsedGB
=
0
;
bool
suc
=
taosGetDisk
(
&
diskUsedGB
);
if
(
!
suc
)
{
monitorError
(
"monitor:%p, get disk info failed."
,
monitor
->
conn
);
}
return
sprintf
(
sql
,
", %f, %d"
,
diskUsedGB
,
tsTotalDiskGB
);
return
sprintf
(
sql
,
", %f, %d"
,
tsDiskUsedGB
,
tsTotalDiskGB
);
}
// unit is Kb
...
...
src/rpc/src/tstring.c
浏览文件 @
06b7af06
...
...
@@ -233,5 +233,6 @@ char *tsError[] = {"success",
"invalid query message"
,
"timestamp disordered in cache block"
,
"timestamp disordered in file block"
,
"invalid commit log"
"invalid commit log"
,
"server no disk space"
,
};
src/system/src/mgmtSystem.c
浏览文件 @
06b7af06
...
...
@@ -64,10 +64,7 @@ void mgmtProcessDnodeStatus(void *handle, void *tmrId) {
float
memoryUsedMB
=
0
;
taosGetSysMemory
(
&
memoryUsedMB
);
pObj
->
memoryAvailable
=
tsTotalMemoryMB
-
memoryUsedMB
;
float
diskUsedGB
=
0
;
taosGetDisk
(
&
diskUsedGB
);
pObj
->
diskAvailable
=
tsTotalDiskGB
-
diskUsedGB
;
pObj
->
diskAvailable
=
tsDiskAvailGB
;
for
(
int
vnode
=
0
;
vnode
<
pObj
->
numOfVnodes
;
++
vnode
)
{
SVnodeLoad
*
pVload
=
&
(
pObj
->
vload
[
vnode
]);
...
...
src/system/src/vnodeShell.c
浏览文件 @
06b7af06
...
...
@@ -471,6 +471,12 @@ int vnodeProcessShellSubmitRequest(char *pMsg, int msgLen, SShellObj *pObj) {
goto
_submit_over
;
}
if
(
tsDiskAvailGB
<
tsDiskMinimalGB
)
{
dError
(
"server disk space remain %.3f GB, need at least %.2f GB, stop writing"
,
tsDiskAvailGB
,
tsDiskMinimalGB
);
code
=
TSDB_CODE_SERVER_NO_SPACE
;
goto
_submit_over
;
}
pObj
->
count
=
pSubmit
->
numOfSid
;
// for import
pObj
->
code
=
0
;
// for import
pObj
->
numOfTotalPoints
=
0
;
// for import
...
...
src/util/src/tglobalcfg.c
浏览文件 @
06b7af06
...
...
@@ -33,9 +33,12 @@
int64_t
tsPageSize
;
int64_t
tsOpenMax
;
int64_t
tsStreamMax
;
int32_t
tsNumOfCores
;
int32_t
tsTotalDiskGB
;
int32_t
tsTotalMemoryMB
;
int32_t
tsNumOfCores
=
1
;
int32_t
tsTotalDiskGB
=
0
;
float
tsDiskAvailGB
=
0
;
float
tsDiskUsedGB
=
0
;
float
tsDiskMinimalGB
=
0
.
5
;
int32_t
tsTotalMemoryMB
=
0
;
int32_t
tsVersion
=
0
;
// global, not configurable
...
...
@@ -733,7 +736,7 @@ int tsCfgDynamicOptions(char *msg) {
tsPrintGlobalConfig
();
return
code
;
}
if
(
strncasecmp
(
option
,
"resetQueryCache"
,
15
)
==
0
)
{
if
(
taosLogSqlFp
)
{
pPrint
(
"the query cache of internal client will reset"
);
...
...
src/util/src/tlog.c
浏览文件 @
06b7af06
...
...
@@ -323,6 +323,10 @@ char *tprefix(char *prefix) {
}
void
tprintf
(
const
char
*
const
flags
,
int
dflag
,
const
char
*
const
format
,
...)
{
if
(
tsTotalDiskGB
!=
0
&&
tsDiskAvailGB
<
(
tsDiskMinimalGB
/
2
))
{
printf
(
"server disk space remain %.3f GB, stop write log
\n
"
,
tsDiskAvailGB
);
}
va_list
argpointer
;
char
buffer
[
MAX_LOGLINE_SIZE
+
10
]
=
{
0
};
int
len
;
...
...
@@ -369,6 +373,11 @@ void tprintf(const char *const flags, int dflag, const char *const format, ...)
}
void
taosDumpData
(
unsigned
char
*
msg
,
int
len
)
{
if
(
tsTotalDiskGB
!=
0
&&
tsDiskAvailGB
<
(
tsDiskMinimalGB
/
2
))
{
printf
(
"server disk space remain %.3f GB, stop write log
\n
"
,
tsDiskAvailGB
);
return
;
}
char
temp
[
256
];
int
i
,
pos
=
0
,
c
=
0
;
...
...
@@ -392,6 +401,11 @@ void taosDumpData(unsigned char *msg, int len) {
}
void
taosPrintLongString
(
const
char
*
const
flags
,
int
dflag
,
const
char
*
const
format
,
...)
{
if
(
tsTotalDiskGB
!=
0
&&
tsDiskAvailGB
<
(
tsDiskMinimalGB
/
2
))
{
printf
(
"server disk space remain %.3f GB, stop write log
\n
"
,
tsDiskAvailGB
);
return
;
}
va_list
argpointer
;
char
buffer
[
65
*
1024
+
10
];
int
len
;
...
...
src/util/src/tsystem.c
浏览文件 @
06b7af06
...
...
@@ -322,19 +322,19 @@ bool taosGetCpuUsage(float *sysCpuUsage, float *procCpuUsage) {
return
true
;
}
bool
taosGetDisk
(
float
*
diskUsedGB
)
{
bool
taosGetDisk
()
{
struct
statvfs
info
;
const
double
unit
=
1024
*
1024
*
1024
;
if
(
statvfs
(
tsDirectory
,
&
info
))
{
*
d
iskUsedGB
=
0
;
tsD
iskUsedGB
=
0
;
tsTotalDiskGB
=
0
;
return
false
;
}
float
diskAvail
=
(
float
)((
double
)
info
.
f_bavail
*
(
double
)
info
.
f_frsize
/
unit
);
tsDiskAvailGB
=
(
float
)((
double
)
info
.
f_bavail
*
(
double
)
info
.
f_frsize
/
unit
);
tsTotalDiskGB
=
(
int32_t
)((
double
)
info
.
f_blocks
*
(
double
)
info
.
f_frsize
/
unit
);
*
diskUsedGB
=
(
float
)
tsTotalDiskGB
-
diskAvail
;
tsDiskUsedGB
=
(
float
)
tsTotalDiskGB
-
tsDiskAvailGB
;
return
true
;
}
...
...
@@ -549,7 +549,7 @@ void taosGetSystemInfo() {
float
tmp1
,
tmp2
;
taosGetSysMemory
(
&
tmp1
);
taosGetProcMemory
(
&
tmp2
);
taosGetDisk
(
&
tmp1
);
taosGetDisk
();
taosGetBandSpeed
(
&
tmp1
);
taosGetCpuUsage
(
&
tmp1
,
&
tmp2
);
taosGetProcIO
(
&
tmp1
,
&
tmp2
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录