Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
552c3a1a
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1187
Star
22018
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看板
提交
552c3a1a
编写于
3月 05, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
monitor for vnodes
上级
a11a2f37
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
81 addition
and
31 deletion
+81
-31
include/common/tmsg.h
include/common/tmsg.h
+5
-0
source/dnode/mgmt/impl/inc/dndEnv.h
source/dnode/mgmt/impl/inc/dndEnv.h
+16
-3
source/dnode/mgmt/impl/inc/dndMnode.h
source/dnode/mgmt/impl/inc/dndMnode.h
+0
-1
source/dnode/mgmt/impl/src/dndMgmt.c
source/dnode/mgmt/impl/src/dndMgmt.c
+13
-11
source/dnode/mgmt/impl/src/dndMnode.c
source/dnode/mgmt/impl/src/dndMnode.c
+0
-7
source/dnode/mgmt/impl/src/dndVnodes.c
source/dnode/mgmt/impl/src/dndVnodes.c
+42
-9
source/dnode/vnode/src/vnd/vnodeInt.c
source/dnode/vnode/src/vnd/vnodeInt.c
+5
-0
未找到文件。
include/common/tmsg.h
浏览文件 @
552c3a1a
...
...
@@ -671,6 +671,11 @@ typedef struct {
int64_t
totalStorage
;
int64_t
compStorage
;
int64_t
pointsWritten
;
int64_t
numOfSelectReqs
;
int64_t
numOfInsertReqs
;
int64_t
numOfInsertSuccessReqs
;
int64_t
numOfBatchInsertReqs
;
int64_t
numOfBatchInsertSuccessReqs
;
}
SVnodeLoad
;
typedef
struct
{
...
...
source/dnode/mgmt/impl/inc/dndEnv.h
浏览文件 @
552c3a1a
...
...
@@ -105,10 +105,23 @@ typedef struct {
}
SBnodeMgmt
;
typedef
struct
{
int32_t
openVnodes
;
int32_t
totalVnodes
;
int32_t
masterNum
;
int64_t
numOfSelectReqs
;
double
speedOfSelectReqs
;
int64_t
numOfInsertReqs
;
int64_t
numOfInsertSuccessReqs
;
double
speedOfInsertReqs
;
int64_t
numOfBatchInsertReqs
;
int64_t
numOfBatchInsertSuccessReqs
;
double
speedOfBatchInsertReqs
;
int64_t
lastTime
;
}
SVnodesStat
;
typedef
struct
{
SVnodesStat
stat
;
SHashObj
*
hash
;
int32_t
openVnodes
;
int32_t
totalVnodes
;
int32_t
masterNum
;
SRWLatch
latch
;
SQWorkerPool
queryPool
;
SFWorkerPool
fetchPool
;
...
...
source/dnode/mgmt/impl/inc/dndMnode.h
浏览文件 @
552c3a1a
...
...
@@ -34,7 +34,6 @@ int32_t dndProcessDropMnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg);
int32_t
dndGetMnodeMonitorInfo
(
SDnode
*
pDnode
,
SMonClusterInfo
*
pClusterInfo
,
SMonVgroupInfo
*
pVgroupInfo
,
SMonGrantInfo
*
pGrantInfo
);
int8_t
dndIsMnode
(
SDnode
*
pDnode
);
#ifdef __cplusplus
}
...
...
source/dnode/mgmt/impl/src/dndMgmt.c
浏览文件 @
552c3a1a
...
...
@@ -491,18 +491,20 @@ static void dndGetMonitorDnodeInfo(SDnode *pDnode, SMonDnodeInfo *pInfo) {
pInfo
->
disk_total
=
tsDataSpace
.
size
.
total
;
taosGetBandSpeed
(
&
pInfo
->
net_in
,
&
pInfo
->
net_out
);
taosGetIOSpeed
(
&
pInfo
->
io_read
,
&
pInfo
->
io_write
,
&
pInfo
->
io_read_disk
,
&
pInfo
->
io_write_disk
);
pInfo
->
req_select
=
0
;
pInfo
->
req_select_rate
=
0
;
pInfo
->
req_insert
=
0
;
pInfo
->
req_insert_success
=
0
;
pInfo
->
req_insert_rate
=
0
;
pInfo
->
req_insert_batch
=
0
;
pInfo
->
req_insert_batch_success
=
0
;
pInfo
->
req_insert_batch_rate
=
0
;
SVnodesStat
*
pStat
=
&
pDnode
->
vmgmt
.
stat
;
pInfo
->
req_select
=
pStat
->
numOfSelectReqs
;
pInfo
->
req_select_rate
=
pStat
->
speedOfSelectReqs
;
pInfo
->
req_insert
=
pStat
->
numOfInsertReqs
;
pInfo
->
req_insert_success
=
pStat
->
numOfInsertSuccessReqs
;
pInfo
->
req_insert_rate
=
pStat
->
speedOfInsertReqs
;
pInfo
->
req_insert_batch
=
pStat
->
numOfBatchInsertReqs
;
pInfo
->
req_insert_batch_success
=
pStat
->
numOfBatchInsertSuccessReqs
;
pInfo
->
req_insert_batch_rate
=
pStat
->
speedOfBatchInsertReqs
;
pInfo
->
errors
=
tsNumOfErrorLogs
;
pInfo
->
vnodes_num
=
p
Dnode
->
vmgmt
.
totalVnodes
;
pInfo
->
masters
=
p
Dnode
->
vmgmt
.
masterNum
;
pInfo
->
has_mnode
=
dndIsMnode
(
pDnode
)
;
pInfo
->
vnodes_num
=
p
Stat
->
totalVnodes
;
pInfo
->
masters
=
p
Stat
->
masterNum
;
pInfo
->
has_mnode
=
pDnode
->
mmgmt
.
deployed
;
}
static
void
dndSendMonitorReport
(
SDnode
*
pDnode
)
{
...
...
source/dnode/mgmt/impl/src/dndMnode.c
浏览文件 @
552c3a1a
...
...
@@ -640,10 +640,3 @@ int32_t dndGetMnodeMonitorInfo(SDnode *pDnode, SMonClusterInfo *pClusterInfo, SM
dndReleaseMnode
(
pDnode
,
pMnode
);
return
code
;
}
int8_t
dndIsMnode
(
SDnode
*
pDnode
)
{
SMnode
*
pMnode
=
dndAcquireMnode
(
pDnode
);
if
(
pMnode
==
NULL
)
return
0
;
dndReleaseMnode
(
pDnode
,
pMnode
);
return
1
;
}
\ No newline at end of file
source/dnode/mgmt/impl/src/dndVnodes.c
浏览文件 @
552c3a1a
...
...
@@ -382,7 +382,7 @@ static void *dnodeOpenVnodeFunc(void *param) {
char
stepDesc
[
TSDB_STEP_DESC_LEN
]
=
{
0
};
snprintf
(
stepDesc
,
TSDB_STEP_DESC_LEN
,
"vgId:%d, start to restore, %d of %d have been opened"
,
pCfg
->
vgId
,
pMgmt
->
openVnodes
,
pMgmt
->
totalVnodes
);
pMgmt
->
stat
.
openVnodes
,
pMgmt
->
stat
.
totalVnodes
);
dndReportStartup
(
pDnode
,
"open-vnodes"
,
stepDesc
);
SVnodeCfg
cfg
=
{.
pDnode
=
pDnode
,
.
pTfs
=
pDnode
->
pTfs
,
.
vgId
=
pCfg
->
vgId
,
.
dbId
=
pCfg
->
dbUid
};
...
...
@@ -396,7 +396,7 @@ static void *dnodeOpenVnodeFunc(void *param) {
pThread
->
opened
++
;
}
atomic_add_fetch_32
(
&
pMgmt
->
openVnodes
,
1
);
atomic_add_fetch_32
(
&
pMgmt
->
stat
.
openVnodes
,
1
);
}
dDebug
(
"thread:%d, total vnodes:%d, opened:%d failed:%d"
,
pThread
->
threadIndex
,
pThread
->
vnodeNum
,
pThread
->
opened
,
...
...
@@ -422,7 +422,7 @@ static int32_t dndOpenVnodes(SDnode *pDnode) {
return
-
1
;
}
pMgmt
->
totalVnodes
=
numOfVnodes
;
pMgmt
->
stat
.
totalVnodes
=
numOfVnodes
;
int32_t
threadNum
=
tsNumOfCores
;
#if 1
...
...
@@ -470,11 +470,11 @@ static int32_t dndOpenVnodes(SDnode *pDnode) {
free
(
threads
);
free
(
pCfgs
);
if
(
pMgmt
->
openVnodes
!=
pMgmt
->
totalVnodes
)
{
dError
(
"there are total vnodes:%d, opened:%d"
,
pMgmt
->
totalVnodes
,
pMgmt
->
openVnodes
);
if
(
pMgmt
->
stat
.
openVnodes
!=
pMgmt
->
stat
.
totalVnodes
)
{
dError
(
"there are total vnodes:%d, opened:%d"
,
pMgmt
->
stat
.
totalVnodes
,
pMgmt
->
stat
.
openVnodes
);
return
-
1
;
}
else
{
dInfo
(
"total vnodes:%d open successfully"
,
pMgmt
->
totalVnodes
);
dInfo
(
"total vnodes:%d open successfully"
,
pMgmt
->
stat
.
totalVnodes
);
return
0
;
}
}
...
...
@@ -982,10 +982,14 @@ void dndGetVnodeLoads(SDnode *pDnode, SArray *pLoads) {
SVnodesMgmt
*
pMgmt
=
&
pDnode
->
vmgmt
;
int32_t
totalVnodes
=
0
;
int32_t
masterNum
=
0
;
int64_t
numOfSelectReqs
=
0
;
int64_t
numOfInsertReqs
=
0
;
int64_t
numOfInsertSuccessReqs
=
0
;
int64_t
numOfBatchInsertReqs
=
0
;
int64_t
numOfBatchInsertSuccessReqs
=
0
;
taosRLockLatch
(
&
pMgmt
->
latch
);
int32_t
v
=
0
;
void
*
pIter
=
taosHashIterate
(
pMgmt
->
hash
,
NULL
);
while
(
pIter
)
{
SVnodeObj
**
ppVnode
=
pIter
;
...
...
@@ -996,12 +1000,41 @@ void dndGetVnodeLoads(SDnode *pDnode, SArray *pLoads) {
vnodeGetLoad
(
pVnode
->
pImpl
,
&
vload
);
taosArrayPush
(
pLoads
,
&
vload
);
numOfSelectReqs
+=
vload
.
numOfSelectReqs
;
numOfInsertReqs
+=
vload
.
numOfInsertReqs
;
numOfInsertSuccessReqs
+=
vload
.
numOfInsertSuccessReqs
;
numOfBatchInsertReqs
+=
vload
.
numOfBatchInsertReqs
;
numOfBatchInsertSuccessReqs
+=
vload
.
numOfBatchInsertSuccessReqs
;
totalVnodes
++
;
if
(
vload
.
role
==
TAOS_SYNC_STATE_LEADER
)
masterNum
++
;
pIter
=
taosHashIterate
(
pMgmt
->
hash
,
pIter
);
}
taosRUnLockLatch
(
&
pMgmt
->
latch
);
pMgmt
->
totalVnodes
=
totalVnodes
;
pMgmt
->
masterNum
=
masterNum
;
SVnodesStat
*
pStat
=
&
pMgmt
->
stat
;
pStat
->
totalVnodes
=
totalVnodes
;
pStat
->
masterNum
=
masterNum
;
int64_t
curTime
=
taosGetTimestampMs
();
if
(
pStat
->
lastTime
==
0
||
pStat
->
lastTime
>=
curTime
)
{
pStat
->
lastTime
=
curTime
;
pStat
->
numOfSelectReqs
=
numOfSelectReqs
;
pStat
->
numOfInsertReqs
=
numOfInsertReqs
;
pStat
->
numOfInsertSuccessReqs
=
numOfInsertSuccessReqs
;
pStat
->
numOfBatchInsertReqs
=
numOfBatchInsertReqs
;
pStat
->
numOfBatchInsertSuccessReqs
=
numOfBatchInsertSuccessReqs
;
return
;
}
double
interval
=
(
curTime
-
pStat
->
lastTime
)
*
1000
.
0
;
pStat
->
speedOfSelectReqs
=
(
numOfSelectReqs
-
pStat
->
numOfSelectReqs
)
/
interval
;
pStat
->
speedOfInsertReqs
=
(
numOfInsertReqs
-
pStat
->
numOfInsertReqs
)
/
interval
;
pStat
->
speedOfBatchInsertReqs
=
(
numOfBatchInsertReqs
-
pStat
->
numOfBatchInsertReqs
)
/
interval
;
pStat
->
numOfSelectReqs
=
numOfSelectReqs
;
pStat
->
numOfInsertReqs
=
numOfInsertReqs
;
pStat
->
numOfInsertSuccessReqs
=
numOfInsertSuccessReqs
;
pStat
->
numOfBatchInsertReqs
=
numOfBatchInsertReqs
;
pStat
->
numOfBatchInsertSuccessReqs
=
numOfBatchInsertSuccessReqs
;
}
source/dnode/vnode/src/vnd/vnodeInt.c
浏览文件 @
552c3a1a
...
...
@@ -32,6 +32,11 @@ int32_t vnodeGetLoad(SVnode *pVnode, SVnodeLoad *pLoad) {
pLoad
->
totalStorage
=
300
;
pLoad
->
compStorage
=
200
;
pLoad
->
pointsWritten
=
100
;
pLoad
->
numOfSelectReqs
=
1
;
pLoad
->
numOfInsertReqs
=
3
;
pLoad
->
numOfInsertSuccessReqs
=
2
;
pLoad
->
numOfBatchInsertReqs
=
5
;
pLoad
->
numOfBatchInsertSuccessReqs
=
4
;
return
0
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录