Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
6cfff92b
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看板
提交
6cfff92b
编写于
3月 03, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
get tfs monitor info
上级
cc82966e
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
51 addition
and
10 deletion
+51
-10
include/libs/tfs/tfs.h
include/libs/tfs/tfs.h
+9
-0
source/dnode/mgmt/impl/inc/dndEnv.h
source/dnode/mgmt/impl/inc/dndEnv.h
+2
-3
source/dnode/mgmt/impl/src/dndEnv.c
source/dnode/mgmt/impl/src/dndEnv.c
+8
-1
source/dnode/mgmt/impl/src/dndMgmt.c
source/dnode/mgmt/impl/src/dndMgmt.c
+10
-5
source/libs/tfs/CMakeLists.txt
source/libs/tfs/CMakeLists.txt
+1
-1
source/libs/tfs/src/tfs.c
source/libs/tfs/src/tfs.c
+21
-0
未找到文件。
include/libs/tfs/tfs.h
浏览文件 @
6cfff92b
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
#define _TD_TFS_H_
#define _TD_TFS_H_
#include "tdef.h"
#include "tdef.h"
#include "monitor.h"
#ifdef __cplusplus
#ifdef __cplusplus
extern
"C"
{
extern
"C"
{
...
@@ -237,6 +238,14 @@ const STfsFile *tfsReaddir(STfsDir *pDir);
...
@@ -237,6 +238,14 @@ const STfsFile *tfsReaddir(STfsDir *pDir);
*/
*/
void
tfsClosedir
(
STfsDir
*
pDir
);
void
tfsClosedir
(
STfsDir
*
pDir
);
/**
* @brief Get disk info of tfs.
*
* @param pTfs The fs object.
* @param pInfo The info object.
*/
int32_t
tfsGetMonitorInfo
(
STfs
*
pTfs
,
SMonDiskInfo
*
pInfo
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
source/dnode/mgmt/impl/inc/dndEnv.h
浏览文件 @
6cfff92b
...
@@ -31,7 +31,7 @@ typedef struct {
...
@@ -31,7 +31,7 @@ typedef struct {
SDnode
*
pDnode
;
SDnode
*
pDnode
;
STaosQueue
*
queue
;
STaosQueue
*
queue
;
union
{
union
{
SQWorkerPool
pool
;
SQWorkerPool
pool
;
SWWorkerPool
mpool
;
SWWorkerPool
mpool
;
};
};
}
SDnodeWorker
;
}
SDnodeWorker
;
...
@@ -137,8 +137,7 @@ typedef struct SDnode {
...
@@ -137,8 +137,7 @@ typedef struct SDnode {
SStartupReq
startup
;
SStartupReq
startup
;
}
SDnode
;
}
SDnode
;
int32_t
dndGetMonitorDiskInfo
(
SDnode
*
pDnode
,
SMonDiskInfo
*
pInfo
);
int32_t
dndGetDiskInfo
(
SDnode
*
pDnode
,
SMonDiskInfo
*
pInfo
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
source/dnode/mgmt/impl/src/dndEnv.c
浏览文件 @
6cfff92b
...
@@ -324,4 +324,11 @@ void dndCleanup() {
...
@@ -324,4 +324,11 @@ void dndCleanup() {
dInfo
(
"dnode env is cleaned up"
);
dInfo
(
"dnode env is cleaned up"
);
}
}
int32_t
dndGetDiskInfo
(
SDnode
*
pDnode
,
SMonDiskInfo
*
pInfo
)
{
return
0
;
}
int32_t
dndGetMonitorDiskInfo
(
SDnode
*
pDnode
,
SMonDiskInfo
*
pInfo
)
{
\ No newline at end of file
tstrncpy
(
pInfo
->
logdir
.
name
,
tsLogDir
,
sizeof
(
pInfo
->
logdir
.
name
));
pInfo
->
logdir
.
size
=
tsLogSpace
.
size
;
tstrncpy
(
pInfo
->
tempdir
.
name
,
tsTempDir
,
sizeof
(
pInfo
->
tempdir
.
name
));
pInfo
->
tempdir
.
size
=
tsTempSpace
.
size
;
return
tfsGetMonitorInfo
(
pDnode
->
pTfs
,
pInfo
);
}
\ No newline at end of file
source/dnode/mgmt/impl/src/dndMgmt.c
浏览文件 @
6cfff92b
...
@@ -474,13 +474,13 @@ void dndProcessStartupReq(SDnode *pDnode, SRpcMsg *pReq) {
...
@@ -474,13 +474,13 @@ void dndProcessStartupReq(SDnode *pDnode, SRpcMsg *pReq) {
rpcSendResponse
(
&
rpcRsp
);
rpcSendResponse
(
&
rpcRsp
);
}
}
static
int32_t
dndGetBasicInfo
(
SDnode
*
pDnode
,
SMonBasicInfo
*
pInfo
)
{
static
int32_t
dndGet
Monitor
BasicInfo
(
SDnode
*
pDnode
,
SMonBasicInfo
*
pInfo
)
{
pInfo
->
dnode_id
=
dndGetDnodeId
(
pDnode
);
pInfo
->
dnode_id
=
dndGetDnodeId
(
pDnode
);
tstrncpy
(
pInfo
->
dnode_ep
,
tsLocalEp
,
TSDB_EP_LEN
);
tstrncpy
(
pInfo
->
dnode_ep
,
tsLocalEp
,
TSDB_EP_LEN
);
return
0
;
return
0
;
}
}
static
int32_t
dndGetDnodeInfo
(
SDnode
*
pDnode
,
SMonDnodeInfo
*
pInfo
)
{
return
0
;
}
static
int32_t
dndGet
Monitor
DnodeInfo
(
SDnode
*
pDnode
,
SMonDnodeInfo
*
pInfo
)
{
return
0
;
}
static
void
dndSendMonitorReport
(
SDnode
*
pDnode
)
{
static
void
dndSendMonitorReport
(
SDnode
*
pDnode
)
{
if
(
!
tsEnableMonitor
||
tsMonitorFqdn
[
0
]
==
0
||
tsMonitorPort
==
0
)
return
;
if
(
!
tsEnableMonitor
||
tsMonitorFqdn
[
0
]
==
0
||
tsMonitorPort
==
0
)
return
;
...
@@ -490,7 +490,7 @@ static void dndSendMonitorReport(SDnode *pDnode) {
...
@@ -490,7 +490,7 @@ static void dndSendMonitorReport(SDnode *pDnode) {
if
(
pMonitor
==
NULL
)
return
;
if
(
pMonitor
==
NULL
)
return
;
SMonBasicInfo
basicInfo
=
{
0
};
SMonBasicInfo
basicInfo
=
{
0
};
if
(
dndGetBasicInfo
(
pDnode
,
&
basicInfo
)
==
0
)
{
if
(
dndGet
Monitor
BasicInfo
(
pDnode
,
&
basicInfo
)
==
0
)
{
monSetBasicInfo
(
pMonitor
,
&
basicInfo
);
monSetBasicInfo
(
pMonitor
,
&
basicInfo
);
}
}
...
@@ -504,15 +504,20 @@ static void dndSendMonitorReport(SDnode *pDnode) {
...
@@ -504,15 +504,20 @@ static void dndSendMonitorReport(SDnode *pDnode) {
}
}
SMonDnodeInfo
dnodeInfo
=
{
0
};
SMonDnodeInfo
dnodeInfo
=
{
0
};
if
(
dndGetDnodeInfo
(
pDnode
,
&
dnodeInfo
)
==
0
)
{
if
(
dndGet
Monitor
DnodeInfo
(
pDnode
,
&
dnodeInfo
)
==
0
)
{
monSetDnodeInfo
(
pMonitor
,
&
dnodeInfo
);
monSetDnodeInfo
(
pMonitor
,
&
dnodeInfo
);
}
}
SMonDiskInfo
diskInfo
=
{
0
};
SMonDiskInfo
diskInfo
=
{
0
};
if
(
dndGetDiskInfo
(
pDnode
,
&
diskInfo
)
==
0
)
{
if
(
dndGet
Monitor
DiskInfo
(
pDnode
,
&
diskInfo
)
==
0
)
{
monSetDiskInfo
(
pMonitor
,
&
diskInfo
);
monSetDiskInfo
(
pMonitor
,
&
diskInfo
);
}
}
taosArrayDestroy
(
clusterInfo
.
dnodes
);
taosArrayDestroy
(
clusterInfo
.
mnodes
);
taosArrayDestroy
(
vgroupInfo
.
vgroups
);
taosArrayDestroy
(
diskInfo
.
datadirs
);
monSendReport
(
pMonitor
);
monSendReport
(
pMonitor
);
monCleanupMonitorInfo
(
pMonitor
);
monCleanupMonitorInfo
(
pMonitor
);
}
}
...
...
source/libs/tfs/CMakeLists.txt
浏览文件 @
6cfff92b
...
@@ -6,7 +6,7 @@ target_include_directories(
...
@@ -6,7 +6,7 @@ target_include_directories(
PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/inc"
PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/inc"
)
)
target_link_libraries
(
tfs os util common
)
target_link_libraries
(
tfs os util common
monitor
)
if
(
${
BUILD_TEST
}
)
if
(
${
BUILD_TEST
}
)
add_subdirectory
(
test
)
add_subdirectory
(
test
)
...
...
source/libs/tfs/src/tfs.c
浏览文件 @
6cfff92b
...
@@ -544,3 +544,24 @@ static STfsDisk *tfsNextDisk(STfs *pTfs, SDiskIter *pIter) {
...
@@ -544,3 +544,24 @@ static STfsDisk *tfsNextDisk(STfs *pTfs, SDiskIter *pIter) {
return
pDisk
;
return
pDisk
;
}
}
int32_t
tfsGetMonitorInfo
(
STfs
*
pTfs
,
SMonDiskInfo
*
pInfo
)
{
pInfo
->
datadirs
=
taosArrayInit
(
32
,
sizeof
(
SMonDiskDesc
));
if
(
pInfo
->
datadirs
==
NULL
)
return
-
1
;
tfsUpdateSize
(
pTfs
);
tfsLock
(
pTfs
);
for
(
int32_t
level
=
0
;
level
<
pTfs
->
nlevel
;
level
++
)
{
STfsTier
*
pTier
=
&
pTfs
->
tiers
[
level
];
for
(
int32_t
disk
=
0
;
disk
<
pTier
->
ndisk
;
++
disk
)
{
STfsDisk
*
pDisk
=
pTier
->
disks
[
disk
];
SMonDiskDesc
dinfo
=
{
0
};
dinfo
.
size
=
pDisk
->
size
;
dinfo
.
level
=
pDisk
->
level
;
tstrncpy
(
dinfo
.
name
,
pDisk
->
path
,
sizeof
(
dinfo
.
name
));
taosArrayPush
(
pInfo
->
datadirs
,
&
dinfo
);
}
}
tfsUnLock
(
pTfs
);
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录