Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
382adfac
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看板
提交
382adfac
编写于
10月 26, 2020
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-1413
上级
f17ec44e
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
47 addition
and
95 deletion
+47
-95
src/client/src/tscSystem.c
src/client/src/tscSystem.c
+4
-5
src/common/inc/tsystem.h
src/common/inc/tsystem.h
+0
-38
src/common/src/tdisk.c
src/common/src/tdisk.c
+26
-5
src/mnode/src/mnodePeer.c
src/mnode/src/mnodePeer.c
+0
-1
src/os/inc/osSysinfo.h
src/os/inc/osSysinfo.h
+7
-1
src/os/src/darwin/darwinSysInfo.c
src/os/src/darwin/darwinSysInfo.c
+1
-1
src/os/src/detail/osSysinfo.c
src/os/src/detail/osSysinfo.c
+8
-36
src/os/src/windows/wSysinfo.c
src/os/src/windows/wSysinfo.c
+1
-1
src/plugins/monitor/src/monitorMain.c
src/plugins/monitor/src/monitorMain.c
+0
-5
src/rpc/src/rpcUdp.c
src/rpc/src/rpcUdp.c
+0
-1
src/util/src/tconfig.c
src/util/src/tconfig.c
+0
-1
未找到文件。
src/client/src/tscSystem.c
浏览文件 @
382adfac
...
...
@@ -17,7 +17,6 @@
#include "taosmsg.h"
#include "tcache.h"
#include "trpc.h"
#include "tsystem.h"
#include "ttimer.h"
#include "tutil.h"
#include "tsched.h"
...
...
@@ -43,7 +42,7 @@ static pthread_once_t tscinit = PTHREAD_ONCE_INIT;
void
taosInitNote
(
int
numOfNoteLines
,
int
maxNotes
,
char
*
lable
);
//void tscUpdateEpSet(void *ahandle, SRpcEpSet *pEpSet);
void
tscCheckDiskUsage
(
void
*
UNUSED_PARAM
(
para
),
void
*
UNUSED_PARAM
(
param
))
{
void
tscCheckDiskUsage
(
void
*
UNUSED_PARAM
(
para
),
void
*
UNUSED_PARAM
(
param
))
{
taosGetDisk
();
taosTmrReset
(
tscCheckDiskUsage
,
1000
,
NULL
,
tscTmr
,
&
tscCheckDiskUsageTmr
);
}
...
...
@@ -136,11 +135,11 @@ void taos_init_imp(void) {
}
tscTmr
=
taosTmrInit
(
tsMaxConnections
*
2
,
200
,
60000
,
"TSC"
);
if
(
0
==
tscEmbedded
)
{
taosTmrReset
(
tscCheckDiskUsage
,
10
,
NULL
,
tscTmr
,
&
tscCheckDiskUsageTmr
);
if
(
0
==
tscEmbedded
)
{
taosTmrReset
(
tscCheckDiskUsage
,
10
,
NULL
,
tscTmr
,
&
tscCheckDiskUsageTmr
);
}
int64_t
refreshTime
=
10
;
// 10 seconds by default
int64_t
refreshTime
=
10
;
// 10 seconds by default
if
(
tscMetaCache
==
NULL
)
{
tscMetaCache
=
taosCacheInit
(
TSDB_DATA_TYPE_BINARY
,
refreshTime
,
false
,
tscFreeTableMetaHelper
,
"tableMeta"
);
tscObjCache
=
taosCacheInit
(
TSDB_CACHE_PTR_KEY
,
refreshTime
/
2
,
false
,
tscFreeRegisteredSqlObj
,
"sqlObj"
);
...
...
src/common/inc/tsystem.h
已删除
100644 → 0
浏览文件 @
f17ec44e
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TDENGINE_TSYSTEM_H
#define TDENGINE_TSYSTEM_H
#ifdef __cplusplus
extern
"C"
{
#endif
bool
taosGetSysMemory
(
float
*
memoryUsedMB
);
bool
taosGetProcMemory
(
float
*
memoryUsedMB
);
bool
taosGetDisk
();
bool
taosGetCpuUsage
(
float
*
sysCpuUsage
,
float
*
procCpuUsage
);
bool
taosGetBandSpeed
(
float
*
bandSpeedKb
);
bool
taosGetProcIO
(
float
*
readKB
,
float
*
writeKB
);
void
taosGetSystemInfo
();
void
taosPrintOsInfo
();
void
taosKillSystem
();
void
taosSetCoreDump
();
#ifdef __cplusplus
}
#endif
#endif
src/common/src/tdisk.c
浏览文件 @
382adfac
...
...
@@ -244,15 +244,15 @@ static int tdCheckDisk(char *dirName, int level, int primary) {
}
static
int
tdUpdateDiskMeta
(
SDisk
*
pDisk
)
{
struct
statvfs
dstat
;
if
(
statvfs
(
pDisk
->
dir
,
&
dstat
)
<
0
)
{
SysDiskSize
dstat
;
if
(
taosGetDiskSize
(
pDisk
->
dir
,
&
dstat
)
<
0
)
{
uError
(
"failed to get dir %s information since %s"
,
pDisk
->
dir
,
strerror
(
errno
));
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
return
-
1
;
}
pDisk
->
dmeta
.
size
=
dstat
.
f_bsize
*
dstat
.
f_blocks
;
pDisk
->
dmeta
.
free
=
dstat
.
f_bsize
*
dstat
.
f_b
avail
;
pDisk
->
dmeta
.
size
=
dstat
.
tsize
;
pDisk
->
dmeta
.
free
=
dstat
.
avail
;
return
0
;
}
...
...
@@ -349,4 +349,25 @@ static int tdAddDisk(SDnodeTier *pDnodeTier, char *dir, int level, int primary)
pDnodeTier
->
nTiers
=
MAX
(
pDnodeTier
->
nTiers
,
level
+
1
);
return
0
;
}
\ No newline at end of file
}
void
taosGetDisk
()
{
const
double
unit
=
1024
*
1024
*
1024
;
SysDiskSize
diskSize
;
if
(
tscEmbedded
)
{
tdUpdateTiersInfo
(
tsDnodeTier
);
tsTotalDataDirGB
=
(
float
)
tsDnodeTier
->
meta
.
tsize
/
unit
;
tsAvailDataDirGB
=
(
float
)
tsDnodeTier
->
meta
.
avail
/
unit
;
}
if
(
taosGetDiskSize
(
tsLogDir
,
&
diskSize
))
{
tsTotalLogDirGB
=
(
float
)
diskSize
.
tsize
/
unit
;
tsAvailLogDirGB
=
(
float
)
diskSize
.
avail
/
unit
;
}
if
(
taosGetDiskSize
(
"/tmp"
,
&
diskSize
))
{
tsTotalTmpDirGB
=
(
float
)
diskSize
.
tsize
/
unit
;
tsAvailTmpDirectorySpace
=
(
float
)
diskSize
.
avail
/
unit
;
}
}
src/mnode/src/mnodePeer.c
浏览文件 @
382adfac
...
...
@@ -17,7 +17,6 @@
#include "os.h"
#include "taoserror.h"
#include "tsched.h"
#include "tsystem.h"
#include "tutil.h"
#include "tgrant.h"
#include "tbalance.h"
...
...
src/os/inc/osSysinfo.h
浏览文件 @
382adfac
...
...
@@ -21,10 +21,16 @@ extern "C" {
#endif
// TAOS_OS_FUNC_SYSINFO
typedef
struct
{
int64_t
tsize
;
int64_t
avail
;
}
SysDiskSize
;
int32_t
taosGetDiskSize
(
char
*
dataDir
,
SysDiskSize
*
diskSize
);
void
taosGetSystemInfo
();
bool
taosGetProcIO
(
float
*
readKB
,
float
*
writeKB
);
bool
taosGetBandSpeed
(
float
*
bandSpeedKb
);
bool
taosGetDisk
();
void
taosGetDisk
();
bool
taosGetCpuUsage
(
float
*
sysCpuUsage
,
float
*
procCpuUsage
)
;
bool
taosGetProcMemory
(
float
*
memoryUsedMB
)
;
bool
taosGetSysMemory
(
float
*
memoryUsedMB
);
...
...
src/os/src/darwin/darwinSysInfo.c
浏览文件 @
382adfac
...
...
@@ -67,7 +67,7 @@ void taosGetSystemInfo() {
taosGetSystemLocale
();
}
bool
taosGetDisk
()
{
return
true
;
}
void
taosGetDisk
()
{
}
bool
taosGetProcIO
(
float
*
readKB
,
float
*
writeKB
)
{
*
readKB
=
0
;
...
...
src/os/src/detail/osSysinfo.c
浏览文件 @
382adfac
...
...
@@ -16,6 +16,7 @@
#define _DEFAULT_SOURCE
#include "os.h"
#include "tconfig.h"
#include "tdisk.h"
#include "tglobal.h"
#include "tulog.h"
...
...
@@ -297,45 +298,16 @@ bool taosGetCpuUsage(float *sysCpuUsage, float *procCpuUsage) {
return
true
;
}
bool
taosGetDisk
(
)
{
int32_t
taosGetDiskSize
(
char
*
dataDir
,
SysDiskSize
*
diskSize
)
{
struct
statvfs
info
;
const
double
unit
=
1024
*
1024
*
1024
;
#if 0
if (tscEmbedded) {
if (statvfs(tsDataDir, &info)) {
//tsTotalDataDirGB = 0;
//tsAvailDataDirGB = 0;
uError("failed to get disk size, dataDir:%s errno:%s", tsDataDir, strerror(errno));
return false;
} else {
tsTotalDataDirGB = (float)((double)info.f_blocks * (double)info.f_frsize / unit);
tsAvailDataDirGB = (float)((double)info.f_bavail * (double)info.f_frsize / unit);
}
}
#endif
if
(
statvfs
(
tsLogDir
,
&
info
))
{
//tsTotalLogDirGB = 0;
//tsAvailLogDirGB = 0;
uError
(
"failed to get disk size, logDir:%s errno:%s"
,
tsLogDir
,
strerror
(
errno
));
if
(
statvfs
(
tsDataDir
,
&
info
))
{
uError
(
"failed to get disk size, dataDir:%s errno:%s"
,
tsDataDir
,
strerror
(
errno
));
return
false
;
}
else
{
tsTotalLogDirGB
=
(
float
)((
double
)
info
.
f_blocks
*
(
double
)
info
.
f_frsize
/
unit
);
tsAvailLogDirGB
=
(
float
)((
double
)
info
.
f_bavail
*
(
double
)
info
.
f_frsize
/
unit
);
}
if
(
statvfs
(
"/tmp"
,
&
info
))
{
//tsTotalTmpDirGB = 0;
//tsAvailTmpDirectorySpace = 0;
uError
(
"failed to get disk size, tmpDir:/tmp errno:%s"
,
strerror
(
errno
));
return
false
;
}
else
{
tsTotalTmpDirGB
=
(
float
)((
double
)
info
.
f_blocks
*
(
double
)
info
.
f_frsize
/
unit
);
tsAvailTmpDirectorySpace
=
(
float
)((
double
)
info
.
f_bavail
*
(
double
)
info
.
f_frsize
/
unit
);
diskSize
->
tsize
=
info
.
f_blocks
*
info
.
f_frsize
;
diskSize
->
avail
=
info
.
f_bavail
*
info
.
f_frsize
;
return
true
;
}
return
true
;
}
static
bool
taosGetCardInfo
(
int64_t
*
bytes
)
{
...
...
@@ -508,7 +480,7 @@ void taosGetSystemInfo() {
float
tmp1
,
tmp2
;
taosGetSysMemory
(
&
tmp1
);
taosGetProcMemory
(
&
tmp2
);
taosGetDisk
();
//
taosGetDisk();
taosGetBandSpeed
(
&
tmp1
);
taosGetCpuUsage
(
&
tmp1
,
&
tmp2
);
taosGetProcIO
(
&
tmp1
,
&
tmp2
);
...
...
src/os/src/windows/wSysinfo.c
浏览文件 @
382adfac
...
...
@@ -80,7 +80,7 @@ void taosGetSystemInfo() {
taosGetSystemLocale
();
}
bool
taosGetDisk
()
{
void
taosGetDisk
()
{
const
double
unit
=
1024
*
1024
*
1024
;
BOOL
fResult
;
unsigned
_int64
i64FreeBytesToCaller
;
...
...
src/plugins/monitor/src/monitorMain.c
浏览文件 @
382adfac
...
...
@@ -21,7 +21,6 @@
#include "ttimer.h"
#include "tutil.h"
#include "tdisk.h"
#include "tsystem.h"
#include "tscUtil.h"
#include "tsclient.h"
#include "dnode.h"
...
...
@@ -126,10 +125,6 @@ static void *monitorThreadFunc(void *param) {
break
;
}
else
{
taosGetDisk
();
tdUpdateTiersInfo
(
tsDnodeTier
);
const
double
unit
=
1024
*
1024
*
1024
;
tsTotalDataDirGB
=
tsDnodeTier
->
meta
.
tsize
/
unit
;
tsAvailDataDirGB
=
tsDnodeTier
->
meta
.
avail
/
unit
;
}
if
(
tsMonitor
.
start
==
0
)
{
...
...
src/rpc/src/rpcUdp.c
浏览文件 @
382adfac
...
...
@@ -15,7 +15,6 @@
#include "os.h"
#include "tsocket.h"
#include "tsystem.h"
#include "ttimer.h"
#include "tutil.h"
#include "taosdef.h"
...
...
src/util/src/tconfig.c
浏览文件 @
382adfac
...
...
@@ -22,7 +22,6 @@
#include "tkey.h"
#include "tulog.h"
#include "tsocket.h"
#include "tsystem.h"
#include "tutil.h"
SGlobalCfg
tsGlobalConfig
[
TSDB_CFG_MAX_NUM
]
=
{{
0
}};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录