Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
4cf8c0ac
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看板
提交
4cf8c0ac
编写于
3月 02, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
monitor
上级
10fd8620
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
51 addition
and
9 deletion
+51
-9
include/common/tglobal.h
include/common/tglobal.h
+6
-0
source/common/src/tglobal.c
source/common/src/tglobal.c
+18
-1
source/dnode/mgmt/impl/src/dndEnv.c
source/dnode/mgmt/impl/src/dndEnv.c
+4
-5
source/dnode/mgmt/impl/src/dndMgmt.c
source/dnode/mgmt/impl/src/dndMgmt.c
+23
-3
未找到文件。
include/common/tglobal.h
浏览文件 @
4cf8c0ac
...
...
@@ -52,6 +52,12 @@ extern bool tsEnableSlaveQuery;
extern
bool
tsPrintAuth
;
extern
int64_t
tsTickPerDay
[
3
];
// monitor
extern
bool
tsEnableMonitor
;
extern
int32_t
tsMonitorInterval
;
extern
char
tsMonitorFqdn
[];
extern
uint16_t
tsMonitorPort
;
// query buffer management
extern
int32_t
tsQueryBufferSize
;
// maximum allowed usage buffer size in MB for each data node during query processing
extern
int64_t
tsQueryBufferSizeBytes
;
// maximum allowed usage buffer size in byte for each data node
...
...
source/common/src/tglobal.c
浏览文件 @
4cf8c0ac
...
...
@@ -46,6 +46,12 @@ int32_t tsMaxBinaryDisplayWidth = 30;
bool
tsEnableSlaveQuery
=
1
;
bool
tsPrintAuth
=
0
;
// monitor
bool
tsEnableMonitor
=
1
;
int32_t
tsMonitorInterval
=
5
;
char
tsMonitorFqdn
[
TSDB_FQDN_LEN
]
=
{
0
};
uint16_t
tsMonitorPort
=
6043
;
/*
* denote if the server needs to compress response message at the application layer to client, including query rsp,
* metricmeta rsp, and multi-meter query rsp message body. The client compress the submit message to server.
...
...
@@ -314,6 +320,12 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
if
(
cfgAddBool
(
pCfg
,
"printAuth"
,
tsPrintAuth
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddBool
(
pCfg
,
"slaveQuery"
,
tsEnableSlaveQuery
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddBool
(
pCfg
,
"deadLockKillQuery"
,
tsDeadLockKillQuery
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddBool
(
pCfg
,
"monitor"
,
tsEnableMonitor
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"monitorInterval"
,
tsMonitorInterval
,
1
,
360000
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddString
(
pCfg
,
"monitorFqdn"
,
tsMonitorFqdn
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"monitorPort"
,
tsMonitorPort
,
1
,
65056
,
0
)
!=
0
)
return
-
1
;
return
0
;
}
...
...
@@ -345,7 +357,7 @@ static void taosSetServerLogCfg(SConfig *pCfg) {
}
static
void
taosSetClientCfg
(
SConfig
*
pCfg
)
{
tstrncpy
(
tsLocalFqdn
,
cfgGetItem
(
pCfg
,
"fqdn"
)
->
str
,
TSDB_
EP
_LEN
);
tstrncpy
(
tsLocalFqdn
,
cfgGetItem
(
pCfg
,
"fqdn"
)
->
str
,
TSDB_
FQDN
_LEN
);
tsServerPort
=
(
uint16_t
)
cfgGetItem
(
pCfg
,
"serverPort"
)
->
i32
;
snprintf
(
tsLocalEp
,
sizeof
(
tsLocalEp
),
"%s:%u"
,
tsLocalFqdn
,
tsServerPort
);
...
...
@@ -425,6 +437,11 @@ static void taosSetServerCfg(SConfig *pCfg) {
tsEnableSlaveQuery
=
cfgGetItem
(
pCfg
,
"slaveQuery"
)
->
bval
;
tsDeadLockKillQuery
=
cfgGetItem
(
pCfg
,
"deadLockKillQuery"
)
->
bval
;
tsEnableMonitor
=
cfgGetItem
(
pCfg
,
"monitor"
)
->
bval
;
tsMonitorInterval
=
cfgGetItem
(
pCfg
,
"monitorInterval"
)
->
i32
;
tstrncpy
(
tsMonitorFqdn
,
cfgGetItem
(
pCfg
,
"monitorFqdn"
)
->
str
,
TSDB_FQDN_LEN
);
tsMonitorPort
=
(
uint16_t
)
cfgGetItem
(
pCfg
,
"monitorPort"
)
->
i32
;
if
(
tsQueryBufferSize
>=
0
)
{
tsQueryBufferSizeBytes
=
tsQueryBufferSize
*
1048576UL
;
}
...
...
source/dnode/mgmt/impl/src/dndEnv.c
浏览文件 @
4cf8c0ac
...
...
@@ -140,7 +140,7 @@ static int32_t dndInitDir(SDnode *pDnode, SDnodeObjCfg *pCfg) {
return
0
;
}
static
void
dndClose
Imp
(
SDnode
*
pDnode
)
{
static
void
dndClose
Dir
(
SDnode
*
pDnode
)
{
tfree
(
pDnode
->
dir
.
mnode
);
tfree
(
pDnode
->
dir
.
vnodes
);
tfree
(
pDnode
->
dir
.
dnode
);
...
...
@@ -260,7 +260,7 @@ void dndClose(SDnode *pDnode) {
dndCleanupMgmt
(
pDnode
);
tfsClose
(
pDnode
->
pTfs
);
dndClose
Imp
(
pDnode
);
dndClose
Dir
(
pDnode
);
free
(
pDnode
);
dInfo
(
"dnode object is closed, data:%p"
,
pDnode
);
}
...
...
@@ -288,9 +288,8 @@ int32_t dndInit() {
return
-
1
;
}
SVnodeOpt
vnodeOpt
=
{.
nthreads
=
tsNumOfCommitThreads
,
.
putReqToVQueryQFp
=
dndPutReqToVQueryQ
,
.
sendReqToDnodeFp
=
dndSendReqToDnode
};
SVnodeOpt
vnodeOpt
=
{
.
nthreads
=
tsNumOfCommitThreads
,
.
putReqToVQueryQFp
=
dndPutReqToVQueryQ
,
.
sendReqToDnodeFp
=
dndSendReqToDnode
};
if
(
vnodeInit
(
&
vnodeOpt
)
!=
0
)
{
dError
(
"failed to init vnode since %s"
,
terrstr
());
...
...
source/dnode/mgmt/impl/src/dndMgmt.c
浏览文件 @
4cf8c0ac
...
...
@@ -473,19 +473,39 @@ void dndProcessStartupReq(SDnode *pDnode, SRpcMsg *pReq) {
rpcSendResponse
(
&
rpcRsp
);
}
static
void
dndSendMonitorReport
(
SDnode
*
pDnode
)
{
if
(
!
tsEnableMonitor
||
tsMonitorFqdn
[
0
]
==
0
)
return
;
dTrace
(
"pDnode:%p, send monitor report to %s:%u"
,
pDnode
,
tsMonitorFqdn
,
tsMonitorPort
);
}
static
void
*
dnodeThreadRoutine
(
void
*
param
)
{
SDnode
*
pDnode
=
param
;
SDnodeMgmt
*
pMgmt
=
&
pDnode
->
dmgmt
;
int32_t
ms
=
tsStatusInterval
*
1000
;
int64_t
lastStatusTime
=
taosGetTimestampMs
();
int64_t
lastMonitorTime
=
lastStatusTime
;
setThreadName
(
"dnode-hb"
);
while
(
true
)
{
pthread_testcancel
();
taosMsleep
(
ms
);
taosMsleep
(
200
);
if
(
dndGetStat
(
pDnode
)
!=
DND_STAT_RUNNING
||
pMgmt
->
dropped
)
{
continue
;
}
if
(
dndGetStat
(
pDnode
)
==
DND_STAT_RUNNING
&&
!
pMgmt
->
statusSent
&&
!
pMgmt
->
dropped
)
{
int64_t
curTime
=
taosGetTimestampMs
();
float
statusInterval
=
(
curTime
-
lastStatusTime
)
/
1000
.
0
f
;
if
(
statusInterval
>=
tsStatusInterval
&&
!
pMgmt
->
statusSent
)
{
dndSendStatusReq
(
pDnode
);
lastStatusTime
=
curTime
;
}
float
monitorInterval
=
(
curTime
-
lastMonitorTime
)
/
1000
.
0
f
;
if
(
monitorInterval
>=
tsMonitorInterval
)
{
dndSendMonitorReport
(
pDnode
);
lastMonitorTime
=
curTime
;
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录