Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
dd0f7be3
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
未验证
提交
dd0f7be3
编写于
3月 19, 2021
作者:
S
Shengliang Guan
提交者:
GitHub
3月 19, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #5502 from taosdata/fix/TD-3370
[TD-3370]<fix>: fix used disk size, show acctual used instead of non-…
上级
66217d30
20f2a7b7
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
25 addition
and
5 deletion
+25
-5
src/common/inc/tglobal.h
src/common/inc/tglobal.h
+1
-0
src/common/src/tglobal.c
src/common/src/tglobal.c
+1
-0
src/inc/tfs.h
src/inc/tfs.h
+2
-1
src/os/inc/osSysinfo.h
src/os/inc/osSysinfo.h
+1
-0
src/os/src/darwin/darwinSysInfo.c
src/os/src/darwin/darwinSysInfo.c
+3
-0
src/os/src/detail/osSysinfo.c
src/os/src/detail/osSysinfo.c
+3
-0
src/os/src/windows/wSysinfo.c
src/os/src/windows/wSysinfo.c
+4
-1
src/plugins/monitor/src/monMain.c
src/plugins/monitor/src/monMain.c
+1
-1
src/tfs/inc/tfsint.h
src/tfs/inc/tfsint.h
+4
-1
src/tfs/src/tdisk.c
src/tfs/src/tdisk.c
+1
-0
src/tfs/src/tfs.c
src/tfs/src/tfs.c
+2
-0
src/tfs/src/ttier.c
src/tfs/src/ttier.c
+2
-1
未找到文件。
src/common/inc/tglobal.h
浏览文件 @
dd0f7be3
...
...
@@ -163,6 +163,7 @@ extern float tsTotalDataDirGB;
extern
float
tsAvailLogDirGB
;
extern
float
tsAvailTmpDirectorySpace
;
extern
float
tsAvailDataDirGB
;
extern
float
tsUsedDataDirGB
;
extern
float
tsMinimalLogDirGB
;
extern
float
tsReservedTmpDirectorySpace
;
extern
float
tsMinimalDataDirGB
;
...
...
src/common/src/tglobal.c
浏览文件 @
dd0f7be3
...
...
@@ -210,6 +210,7 @@ float tsTotalTmpDirGB = 0;
float
tsTotalDataDirGB
=
0
;
float
tsAvailTmpDirectorySpace
=
0
;
float
tsAvailDataDirGB
=
0
;
float
tsUsedDataDirGB
=
0
;
float
tsReservedTmpDirectorySpace
=
1
.
0
f
;
float
tsMinimalDataDirGB
=
1
.
0
f
;
int32_t
tsTotalMemoryMB
=
0
;
...
...
src/inc/tfs.h
浏览文件 @
dd0f7be3
...
...
@@ -35,6 +35,7 @@ typedef struct {
// FS APIs ====================================
typedef
struct
{
int64_t
tsize
;
int64_t
used
;
int64_t
avail
;
}
SFSMeta
;
...
...
@@ -90,4 +91,4 @@ void tfsClosedir(TDIR *tdir);
}
#endif
#endif
\ No newline at end of file
#endif
src/os/inc/osSysinfo.h
浏览文件 @
dd0f7be3
...
...
@@ -23,6 +23,7 @@ extern "C" {
// TAOS_OS_FUNC_SYSINFO
typedef
struct
{
int64_t
tsize
;
int64_t
used
;
int64_t
avail
;
}
SysDiskSize
;
...
...
src/os/src/darwin/darwinSysInfo.c
浏览文件 @
dd0f7be3
...
...
@@ -138,6 +138,8 @@ void taosPrintOsInfo() {
// uInfo(" os streamMax: %" PRId64, tsStreamMax);
uInfo
(
" os numOfCores: %d"
,
tsNumOfCores
);
uInfo
(
" os totalDisk: %f(GB)"
,
tsTotalDataDirGB
);
uInfo
(
" os usedDisk: %f(GB)"
,
tsUsedDataDirGB
);
uInfo
(
" os availDisk: %f(GB)"
,
tsAvailDataDirGB
);
uInfo
(
" os totalMemory: %d(MB)"
,
tsTotalMemoryMB
);
struct
utsname
buf
;
...
...
@@ -222,6 +224,7 @@ int32_t taosGetDiskSize(char *dataDir, SysDiskSize *diskSize) {
}
else
{
diskSize
->
tsize
=
info
.
f_blocks
*
info
.
f_frsize
;
diskSize
->
avail
=
info
.
f_bavail
*
info
.
f_frsize
;
diskSize
->
used
=
(
info
.
f_blocks
-
info
.
f_bfree
)
*
info
.
f_frsize
;
return
0
;
}
}
...
...
src/os/src/detail/osSysinfo.c
浏览文件 @
dd0f7be3
...
...
@@ -326,6 +326,7 @@ int32_t taosGetDiskSize(char *dataDir, SysDiskSize *diskSize) {
}
else
{
diskSize
->
tsize
=
info
.
f_blocks
*
info
.
f_frsize
;
diskSize
->
avail
=
info
.
f_bavail
*
info
.
f_frsize
;
diskSize
->
used
=
(
info
.
f_blocks
-
info
.
f_bfree
)
*
info
.
f_frsize
;
return
0
;
}
}
...
...
@@ -506,6 +507,8 @@ void taosPrintOsInfo() {
uInfo
(
" os streamMax: %"
PRId64
,
tsStreamMax
);
uInfo
(
" os numOfCores: %d"
,
tsNumOfCores
);
uInfo
(
" os totalDisk: %f(GB)"
,
tsTotalDataDirGB
);
uInfo
(
" os usedDisk: %f(GB)"
,
tsUsedDataDirGB
);
uInfo
(
" os availDisk: %f(GB)"
,
tsAvailDataDirGB
);
uInfo
(
" os totalMemory: %d(MB)"
,
tsTotalMemoryMB
);
struct
utsname
buf
;
...
...
src/os/src/windows/wSysinfo.c
浏览文件 @
dd0f7be3
...
...
@@ -136,7 +136,8 @@ int32_t taosGetDiskSize(char *dataDir, SysDiskSize *diskSize) {
(
PULARGE_INTEGER
)
&
i64FreeBytes
);
if
(
fResult
)
{
diskSize
->
tsize
=
(
int64_t
)(
i64TotalBytes
);
diskSize
->
avail
=
(
int64_t
)(
i64FreeBytes
);
diskSize
->
avail
=
(
int64_t
)(
i64FreeBytesToCaller
);
diskSize
->
used
=
(
int64_t
)(
i64TotalBytes
-
i64FreeBytes
);
return
0
;
}
else
{
uError
(
"failed to get disk size, dataDir:%s errno:%s"
,
tsDataDir
,
strerror
(
errno
));
...
...
@@ -205,6 +206,8 @@ void taosGetSystemInfo() {
void
taosPrintOsInfo
()
{
uInfo
(
" os numOfCores: %d"
,
tsNumOfCores
);
uInfo
(
" os totalDisk: %f(GB)"
,
tsTotalDataDirGB
);
uInfo
(
" os usedDisk: %f(GB)"
,
tsUsedDataDirGB
);
uInfo
(
" os availDisk: %f(GB)"
,
tsAvailDataDirGB
);
uInfo
(
" os totalMemory: %d(MB)"
,
tsTotalMemoryMB
);
uInfo
(
"=================================="
);
}
...
...
src/plugins/monitor/src/monMain.c
浏览文件 @
dd0f7be3
...
...
@@ -292,7 +292,7 @@ static int32_t monBuildCpuSql(char *sql) {
// unit is GB
static
int32_t
monBuildDiskSql
(
char
*
sql
)
{
return
sprintf
(
sql
,
", %f, %d"
,
(
tsTotalDataDirGB
-
tsAvailDataDirGB
)
,
(
int32_t
)
tsTotalDataDirGB
);
return
sprintf
(
sql
,
", %f, %d"
,
tsUsedDataDirGB
,
(
int32_t
)
tsTotalDataDirGB
);
}
// unit is Kb
...
...
src/tfs/inc/tfsint.h
浏览文件 @
dd0f7be3
...
...
@@ -41,6 +41,7 @@ extern int fsDebugFlag;
// tdisk.c ======================================================
typedef
struct
{
int64_t
size
;
int64_t
used
;
int64_t
free
;
}
SDiskMeta
;
...
...
@@ -56,6 +57,7 @@ typedef struct SDisk {
#define DISK_DIR(pd) ((pd)->dir)
#define DISK_META(pd) ((pd)->dmeta)
#define DISK_SIZE(pd) ((pd)->dmeta.size)
#define DISK_USED_SIZE(pd) ((pd)->dmeta.used)
#define DISK_FREE_SIZE(pd) ((pd)->dmeta.free)
SDisk
*
tfsNewDisk
(
int
level
,
int
id
,
const
char
*
dir
);
...
...
@@ -65,6 +67,7 @@ int tfsUpdateDiskInfo(SDisk *pDisk);
// ttier.c ======================================================
typedef
struct
{
int64_t
size
;
int64_t
used
;
int64_t
free
;
int16_t
nAvailDisks
;
// # of Available disks
}
STierMeta
;
...
...
@@ -96,4 +99,4 @@ void tfsPosNextId(STier *pTier);
}
#endif
#endif
\ No newline at end of file
#endif
src/tfs/src/tdisk.c
浏览文件 @
dd0f7be3
...
...
@@ -52,6 +52,7 @@ int tfsUpdateDiskInfo(SDisk *pDisk) {
}
pDisk
->
dmeta
.
size
=
diskSize
.
tsize
;
pDisk
->
dmeta
.
used
=
diskSize
.
used
;
pDisk
->
dmeta
.
free
=
diskSize
.
avail
;
return
code
;
...
...
src/tfs/src/tfs.c
浏览文件 @
dd0f7be3
...
...
@@ -134,6 +134,7 @@ void tfsUpdateInfo(SFSMeta *pFSMeta) {
tfsUpdateTierInfo
(
pTier
,
&
tierMeta
);
pFSMeta
->
tsize
+=
tierMeta
.
size
;
pFSMeta
->
avail
+=
tierMeta
.
free
;
pFSMeta
->
used
+=
tierMeta
.
used
;
}
tfsLock
();
...
...
@@ -585,6 +586,7 @@ void taosGetDisk() {
if
(
tscEmbedded
)
{
tfsUpdateInfo
(
&
fsMeta
);
tsTotalDataDirGB
=
(
float
)(
fsMeta
.
tsize
/
unit
);
tsUsedDataDirGB
=
(
float
)(
fsMeta
.
used
/
unit
);
tsAvailDataDirGB
=
(
float
)(
fsMeta
.
avail
/
unit
);
}
...
...
src/tfs/src/ttier.c
浏览文件 @
dd0f7be3
...
...
@@ -100,6 +100,7 @@ void tfsUpdateTierInfo(STier *pTier, STierMeta *pTierMeta) {
continue
;
}
pTierMeta
->
size
+=
DISK_SIZE
(
DISK_AT_TIER
(
pTier
,
id
));
pTierMeta
->
used
+=
DISK_USED_SIZE
(
DISK_AT_TIER
(
pTier
,
id
));
pTierMeta
->
free
+=
DISK_FREE_SIZE
(
DISK_AT_TIER
(
pTier
,
id
));
pTierMeta
->
nAvailDisks
++
;
}
...
...
@@ -166,4 +167,4 @@ void tfsPosNextId(STier *pTier) {
}
pTier
->
nextid
=
nextid
;
}
\ No newline at end of file
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录