Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
893abf43
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看板
提交
893abf43
编写于
5月 13, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: taosShellNetChk.py failed if set numOfRpcThreads to 1
上级
eebd3f0f
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
81 addition
and
42 deletion
+81
-42
source/dnode/mgmt/mgmt_dnode/inc/dmInt.h
source/dnode/mgmt/mgmt_dnode/inc/dmInt.h
+1
-0
source/dnode/mgmt/mgmt_dnode/src/dmHandle.c
source/dnode/mgmt/mgmt_dnode/src/dmHandle.c
+54
-0
source/dnode/mgmt/mgmt_dnode/src/dmWorker.c
source/dnode/mgmt/mgmt_dnode/src/dmWorker.c
+11
-5
source/dnode/mgmt/node_mgmt/inc/dmMgmt.h
source/dnode/mgmt/node_mgmt/inc/dmMgmt.h
+1
-1
source/dnode/mgmt/node_mgmt/src/dmMgmt.c
source/dnode/mgmt/node_mgmt/src/dmMgmt.c
+7
-33
source/dnode/mgmt/node_mgmt/src/dmTransport.c
source/dnode/mgmt/node_mgmt/src/dmTransport.c
+7
-3
未找到文件。
source/dnode/mgmt/mgmt_dnode/inc/dmInt.h
浏览文件 @
893abf43
...
...
@@ -47,6 +47,7 @@ void dmSendStatusReq(SDnodeMgmt *pMgmt);
int32_t
dmProcessConfigReq
(
SDnodeMgmt
*
pMgmt
,
SNodeMsg
*
pMsg
);
int32_t
dmProcessAuthRsp
(
SDnodeMgmt
*
pMgmt
,
SNodeMsg
*
pMsg
);
int32_t
dmProcessGrantRsp
(
SDnodeMgmt
*
pMgmt
,
SNodeMsg
*
pMsg
);
int32_t
dmProcessServerRunStatus
(
SDnodeMgmt
*
pMgmt
,
SNodeMsg
*
pMsg
);
// dmMonitor.c
void
dmGetVnodeLoads
(
SDnodeMgmt
*
pMgmt
,
SMonVloadInfo
*
pInfo
);
...
...
source/dnode/mgmt/mgmt_dnode/src/dmHandle.c
浏览文件 @
893abf43
...
...
@@ -120,6 +120,59 @@ int32_t dmProcessConfigReq(SDnodeMgmt *pMgmt, SNodeMsg *pMsg) {
return
TSDB_CODE_OPS_NOT_SUPPORT
;
}
static
void
dmGetServerRunStatus
(
SDnodeMgmt
*
pMgmt
,
SServerStatusRsp
*
pStatus
)
{
pStatus
->
statusCode
=
TSDB_SRV_STATUS_SERVICE_OK
;
pStatus
->
details
[
0
]
=
0
;
SServerStatusRsp
statusRsp
=
{
0
};
SMonMloadInfo
minfo
=
{
0
};
dmGetMnodeLoads
(
pMgmt
,
&
minfo
);
if
(
minfo
.
isMnode
&&
minfo
.
load
.
syncState
!=
TAOS_SYNC_STATE_LEADER
&&
minfo
.
load
.
syncState
!=
TAOS_SYNC_STATE_CANDIDATE
)
{
pStatus
->
statusCode
=
TSDB_SRV_STATUS_SERVICE_DEGRADED
;
snprintf
(
pStatus
->
details
,
sizeof
(
pStatus
->
details
),
"mnode sync state is %s"
,
syncStr
(
minfo
.
load
.
syncState
));
return
;
}
SMonVloadInfo
vinfo
=
{
0
};
dmGetVnodeLoads
(
pMgmt
,
&
vinfo
);
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
vinfo
.
pVloads
);
++
i
)
{
SVnodeLoad
*
pLoad
=
taosArrayGet
(
vinfo
.
pVloads
,
i
);
if
(
pLoad
->
syncState
!=
TAOS_SYNC_STATE_LEADER
&&
pLoad
->
syncState
!=
TAOS_SYNC_STATE_FOLLOWER
)
{
pStatus
->
statusCode
=
TSDB_SRV_STATUS_SERVICE_DEGRADED
;
snprintf
(
pStatus
->
details
,
sizeof
(
pStatus
->
details
),
"vnode:%d sync state is %s"
,
pLoad
->
vgId
,
syncStr
(
pLoad
->
syncState
));
break
;
}
}
taosArrayDestroy
(
vinfo
.
pVloads
);
}
int32_t
dmProcessServerRunStatus
(
SDnodeMgmt
*
pMgmt
,
SNodeMsg
*
pMsg
)
{
dDebug
(
"server run status req is received"
);
SServerStatusRsp
statusRsp
=
{
0
};
dmGetServerRunStatus
(
pMgmt
,
&
statusRsp
);
SRpcMsg
rspMsg
=
{.
handle
=
pMsg
->
rpcMsg
.
handle
,
.
ahandle
=
pMsg
->
rpcMsg
.
ahandle
,
.
refId
=
pMsg
->
rpcMsg
.
refId
};
int32_t
rspLen
=
tSerializeSServerStatusRsp
(
NULL
,
0
,
&
statusRsp
);
if
(
rspLen
<
0
)
{
rspMsg
.
code
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
void
*
pRsp
=
rpcMallocCont
(
rspLen
);
if
(
pRsp
==
NULL
)
{
rspMsg
.
code
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
tSerializeSServerStatusRsp
(
pRsp
,
rspLen
,
&
statusRsp
);
pMsg
->
pRsp
=
pRsp
;
pMsg
->
rspLen
=
rspLen
;
return
0
;
}
SArray
*
dmGetMsgHandles
()
{
int32_t
code
=
-
1
;
SArray
*
pArray
=
taosArrayInit
(
16
,
sizeof
(
SMgmtHandle
));
...
...
@@ -135,6 +188,7 @@ SArray *dmGetMsgHandles() {
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_DND_CREATE_BNODE
,
dmPutNodeMsgToMgmtQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_DND_DROP_BNODE
,
dmPutNodeMsgToMgmtQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_DND_CONFIG_DNODE
,
dmPutNodeMsgToMgmtQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_DND_SERVER_STATUS
,
dmPutNodeMsgToMgmtQueue
,
0
)
==
NULL
)
goto
_OVER
;
// Requests handled by MNODE
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_GRANT_RSP
,
dmPutNodeMsgToMgmtQueue
,
0
)
==
NULL
)
goto
_OVER
;
...
...
source/dnode/mgmt/mgmt_dnode/src/dmWorker.c
浏览文件 @
893abf43
...
...
@@ -100,10 +100,10 @@ void dmStopMonitorThread(SDnodeMgmt *pMgmt) {
static
void
dmProcessMgmtQueue
(
SQueueInfo
*
pInfo
,
SNodeMsg
*
pMsg
)
{
SDnodeMgmt
*
pMgmt
=
pInfo
->
ahandle
;
int32_t
code
=
-
1
;
tmsg_t
msgType
=
pMsg
->
rpcMsg
.
msgType
;
dTrace
(
"msg:%p, will be processed in dnode-mgmt queue
"
,
pMsg
);
int32_t
code
=
-
1
;
tmsg_t
msgType
=
pMsg
->
rpcMsg
.
msgType
;
bool
isRequest
=
msgType
&
1u
;
dTrace
(
"msg:%p, will be processed in dnode-mgmt queue
, type:%s"
,
pMsg
,
TMSG_INFO
(
msgType
)
);
switch
(
msgType
)
{
case
TDMT_DND_CONFIG_DNODE
:
...
...
@@ -139,17 +139,23 @@ static void dmProcessMgmtQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
case
TDMT_DND_DROP_BNODE
:
code
=
(
*
pMgmt
->
processDropNodeFp
)(
pMgmt
->
pDnode
,
BNODE
,
pMsg
);
break
;
case
TDMT_DND_SERVER_STATUS
:
code
=
dmProcessServerRunStatus
(
pMgmt
,
pMsg
);
break
;
default:
terrno
=
TSDB_CODE_MSG_NOT_PROCESSED
;
break
;
}
if
(
msgType
&
1u
)
{
if
(
isRequest
)
{
if
(
code
!=
0
&&
terrno
!=
0
)
code
=
terrno
;
SRpcMsg
rsp
=
{
.
handle
=
pMsg
->
rpcMsg
.
handle
,
.
ahandle
=
pMsg
->
rpcMsg
.
ahandle
,
.
code
=
code
,
.
refId
=
pMsg
->
rpcMsg
.
refId
,
.
pCont
=
pMsg
->
pRsp
,
.
contLen
=
pMsg
->
rspLen
,
};
rpcSendResponse
(
&
rsp
);
}
...
...
source/dnode/mgmt/node_mgmt/inc/dmMgmt.h
浏览文件 @
893abf43
...
...
@@ -104,7 +104,7 @@ void dmSetEvent(SDnode *pDnode, EDndEvent event);
void
dmReportStartup
(
SDnode
*
pDnode
,
const
char
*
pName
,
const
char
*
pDesc
);
void
dmReportStartupByWrapper
(
SMgmtWrapper
*
pWrapper
,
const
char
*
pName
,
const
char
*
pDesc
);
void
dmProcessServerSta
tusReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
);
void
dmProcessServerSta
rtupStatus
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
);
void
dmProcessNetTestReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
);
int32_t
dmProcessCreateNodeReq
(
SDnode
*
pDnode
,
EDndNodeType
ntype
,
SNodeMsg
*
pMsg
);
int32_t
dmProcessDropNodeReq
(
SDnode
*
pDnode
,
EDndNodeType
ntype
,
SNodeMsg
*
pMsg
);
...
...
source/dnode/mgmt/node_mgmt/src/dmMgmt.c
浏览文件 @
893abf43
...
...
@@ -235,44 +235,18 @@ void dmReportStartupByWrapper(SMgmtWrapper *pWrapper, const char *pName, const c
dmReportStartup
(
pWrapper
->
pDnode
,
pName
,
pDesc
);
}
static
void
dmGetServerStatus
(
SDnode
*
pDnode
,
SServerStatusRsp
*
pStatus
)
{
static
void
dmGetServerSta
rtupSta
tus
(
SDnode
*
pDnode
,
SServerStatusRsp
*
pStatus
)
{
SDnodeMgmt
*
pMgmt
=
pDnode
->
wrappers
[
DNODE
].
pMgmt
;
pStatus
->
statusCode
=
TSDB_SRV_STATUS_SERVICE_OK
;
pStatus
->
details
[
0
]
=
0
;
if
(
pDnode
->
status
==
DND_STAT_INIT
)
{
pStatus
->
statusCode
=
TSDB_SRV_STATUS_NETWORK_OK
;
snprintf
(
pStatus
->
details
,
sizeof
(
pStatus
->
details
),
"%s: %s"
,
pDnode
->
startup
.
name
,
pDnode
->
startup
.
desc
);
return
;
}
if
(
pDnode
->
status
==
DND_STAT_STOPPED
)
{
}
else
if
(
pDnode
->
status
==
DND_STAT_STOPPED
)
{
pStatus
->
statusCode
=
TSDB_SRV_STATUS_EXTING
;
return
;
}
SMonMloadInfo
minfo
=
{
0
};
dmGetMnodeLoads
(
pMgmt
,
&
minfo
);
if
(
minfo
.
isMnode
&&
minfo
.
load
.
syncState
!=
TAOS_SYNC_STATE_LEADER
&&
minfo
.
load
.
syncState
!=
TAOS_SYNC_STATE_CANDIDATE
)
{
pStatus
->
statusCode
=
TSDB_SRV_STATUS_SERVICE_DEGRADED
;
snprintf
(
pStatus
->
details
,
sizeof
(
pStatus
->
details
),
"mnode sync state is %s"
,
syncStr
(
minfo
.
load
.
syncState
));
return
;
}
SMonVloadInfo
vinfo
=
{
0
};
dmGetVnodeLoads
(
pMgmt
,
&
vinfo
);
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
vinfo
.
pVloads
);
++
i
)
{
SVnodeLoad
*
pLoad
=
taosArrayGet
(
vinfo
.
pVloads
,
i
);
if
(
pLoad
->
syncState
!=
TAOS_SYNC_STATE_LEADER
&&
pLoad
->
syncState
!=
TAOS_SYNC_STATE_FOLLOWER
)
{
pStatus
->
statusCode
=
TSDB_SRV_STATUS_SERVICE_DEGRADED
;
snprintf
(
pStatus
->
details
,
sizeof
(
pStatus
->
details
),
"vnode:%d sync state is %s"
,
pLoad
->
vgId
,
syncStr
(
pLoad
->
syncState
));
break
;
}
}
else
{
pStatus
->
statusCode
=
TSDB_SRV_STATUS_SERVICE_OK
;
}
taosArrayDestroy
(
vinfo
.
pVloads
);
}
void
dmProcessNetTestReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
)
{
...
...
@@ -288,11 +262,11 @@ void dmProcessNetTestReq(SDnode *pDnode, SRpcMsg *pReq) {
rpcFreeCont
(
pReq
->
pCont
);
}
void
dmProcessServerSta
tusReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
)
{
dDebug
(
"server status req is received"
);
void
dmProcessServerSta
rtupStatus
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
)
{
dDebug
(
"server sta
rtup sta
tus req is received"
);
SServerStatusRsp
statusRsp
=
{
0
};
dmGetServerStatus
(
pDnode
,
&
statusRsp
);
dmGetServerSta
rtupSta
tus
(
pDnode
,
&
statusRsp
);
SRpcMsg
rspMsg
=
{.
handle
=
pReq
->
handle
,
.
ahandle
=
pReq
->
ahandle
,
.
refId
=
pReq
->
refId
};
int32_t
rspLen
=
tSerializeSServerStatusRsp
(
NULL
,
0
,
&
statusRsp
);
...
...
source/dnode/mgmt/node_mgmt/src/dmTransport.c
浏览文件 @
893abf43
...
...
@@ -132,9 +132,13 @@ static void dmProcessMsg(SDnode *pDnode, SRpcMsg *pMsg, SEpSet *pEpSet) {
switch
(
msgType
)
{
case
TDMT_DND_SERVER_STATUS
:
dTrace
(
"server status req will be processed, handle:%p, app:%p"
,
pMsg
->
handle
,
pMsg
->
ahandle
);
dmProcessServerStatusReq
(
pDnode
,
pMsg
);
return
;
if
(
pDnode
->
status
!=
DND_STAT_RUNNING
)
{
dTrace
(
"server status req will be processed, handle:%p, app:%p"
,
pMsg
->
handle
,
pMsg
->
ahandle
);
dmProcessServerStartupStatus
(
pDnode
,
pMsg
);
return
;
}
else
{
break
;
}
case
TDMT_DND_NET_TEST
:
dTrace
(
"net test req will be processed, handle:%p, app:%p"
,
pMsg
->
handle
,
pMsg
->
ahandle
);
dmProcessNetTestReq
(
pDnode
,
pMsg
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录