Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
823691b6
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看板
提交
823691b6
编写于
5月 12, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: node mgmt
上级
5669f2a1
变更
16
隐藏空白更改
内联
并排
Showing
16 changed file
with
85 addition
and
67 deletion
+85
-67
source/dnode/mgmt/mgmt_bnode/inc/bmInt.h
source/dnode/mgmt/mgmt_bnode/inc/bmInt.h
+1
-1
source/dnode/mgmt/mgmt_bnode/src/bmHandle.c
source/dnode/mgmt/mgmt_bnode/src/bmHandle.c
+5
-5
source/dnode/mgmt/mgmt_dnode/inc/dmInt.h
source/dnode/mgmt/mgmt_dnode/inc/dmInt.h
+2
-2
source/dnode/mgmt/mgmt_dnode/src/dmInt.c
source/dnode/mgmt/mgmt_dnode/src/dmInt.c
+1
-0
source/dnode/mgmt/mgmt_dnode/src/dmWorker.c
source/dnode/mgmt/mgmt_dnode/src/dmWorker.c
+18
-18
source/dnode/mgmt/mgmt_mnode/inc/mmInt.h
source/dnode/mgmt/mgmt_mnode/inc/mmInt.h
+1
-1
source/dnode/mgmt/mgmt_mnode/src/mmFile.c
source/dnode/mgmt/mgmt_mnode/src/mmFile.c
+13
-15
source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
+8
-4
source/dnode/mgmt/mgmt_qnode/inc/qmInt.h
source/dnode/mgmt/mgmt_qnode/inc/qmInt.h
+1
-1
source/dnode/mgmt/mgmt_qnode/src/qmHandle.c
source/dnode/mgmt/mgmt_qnode/src/qmHandle.c
+4
-4
source/dnode/mgmt/mgmt_snode/inc/smInt.h
source/dnode/mgmt/mgmt_snode/inc/smInt.h
+1
-1
source/dnode/mgmt/mgmt_snode/src/smHandle.c
source/dnode/mgmt/mgmt_snode/src/smHandle.c
+4
-4
source/dnode/mgmt/node_mgmt/src/dmMgmt.c
source/dnode/mgmt/node_mgmt/src/dmMgmt.c
+7
-2
source/dnode/mgmt/node_mgmt/src/dmRun.c
source/dnode/mgmt/node_mgmt/src/dmRun.c
+1
-0
source/dnode/mgmt/node_mgmt/src/dmTransport.c
source/dnode/mgmt/node_mgmt/src/dmTransport.c
+12
-4
source/dnode/mgmt/node_util/inc/dmUtil.h
source/dnode/mgmt/node_util/inc/dmUtil.h
+6
-5
未找到文件。
source/dnode/mgmt/mgmt_bnode/inc/bmInt.h
浏览文件 @
823691b6
...
...
@@ -36,7 +36,7 @@ typedef struct SBnodeMgmt {
// bmHandle.c
SArray
*
bmGetMsgHandles
();
int32_t
bmProcessCreateReq
(
SBnodeMgmt
*
pMgm
t
,
SNodeMsg
*
pMsg
);
int32_t
bmProcessCreateReq
(
const
SMgmtInputOpt
*
pInpu
t
,
SNodeMsg
*
pMsg
);
int32_t
bmProcessDropReq
(
SBnodeMgmt
*
pMgmt
,
SNodeMsg
*
pMsg
);
int32_t
bmProcessGetMonBmInfoReq
(
SBnodeMgmt
*
pMgmt
,
SNodeMsg
*
pReq
);
...
...
source/dnode/mgmt/mgmt_bnode/src/bmHandle.c
浏览文件 @
823691b6
...
...
@@ -43,7 +43,7 @@ int32_t bmProcessGetMonBmInfoReq(SBnodeMgmt *pMgmt, SNodeMsg *pReq) {
return
0
;
}
int32_t
bmProcessCreateReq
(
SBnodeMgmt
*
pMgm
t
,
SNodeMsg
*
pMsg
)
{
int32_t
bmProcessCreateReq
(
const
SMgmtInputOpt
*
pInpu
t
,
SNodeMsg
*
pMsg
)
{
SRpcMsg
*
pReq
=
&
pMsg
->
rpcMsg
;
SDCreateBnodeReq
createReq
=
{
0
};
...
...
@@ -52,14 +52,14 @@ int32_t bmProcessCreateReq(SBnodeMgmt *pMgmt, SNodeMsg *pMsg) {
return
-
1
;
}
if
(
p
Mgmt
->
dnodeId
!=
0
&&
createReq
.
dnodeId
!=
pMgm
t
->
dnodeId
)
{
if
(
p
Input
->
dnodeId
!=
0
&&
createReq
.
dnodeId
!=
pInpu
t
->
dnodeId
)
{
terrno
=
TSDB_CODE_INVALID_OPTION
;
dError
(
"failed to create bnode since %s, input:%d cur:%d"
,
terrstr
(),
createReq
.
dnodeId
,
p
Mgm
t
->
dnodeId
);
dError
(
"failed to create bnode since %s, input:%d cur:%d"
,
terrstr
(),
createReq
.
dnodeId
,
p
Inpu
t
->
dnodeId
);
return
-
1
;
}
bool
deployed
=
true
;
if
(
dmWriteFile
(
p
Mgmt
->
path
,
pMgm
t
->
name
,
deployed
)
!=
0
)
{
if
(
dmWriteFile
(
p
Input
->
path
,
pInpu
t
->
name
,
deployed
)
!=
0
)
{
dError
(
"failed to write bnode file since %s"
,
terrstr
());
return
-
1
;
}
...
...
@@ -76,7 +76,7 @@ int32_t bmProcessDropReq(SBnodeMgmt *pMgmt, SNodeMsg *pMsg) {
return
-
1
;
}
if
(
dropReq
.
dnodeId
!=
pMgmt
->
dnodeId
)
{
if
(
pMgmt
->
dnodeId
!=
0
&&
dropReq
.
dnodeId
!=
pMgmt
->
dnodeId
)
{
terrno
=
TSDB_CODE_INVALID_OPTION
;
dError
(
"failed to drop bnode since %s"
,
terrstr
());
return
-
1
;
...
...
source/dnode/mgmt/mgmt_dnode/inc/dmInt.h
浏览文件 @
823691b6
...
...
@@ -27,8 +27,8 @@ typedef struct SDnodeMgmt {
SMsgCb
msgCb
;
const
char
*
path
;
const
char
*
name
;
TdThread
*
statusThreadI
d
;
TdThread
*
monitorThreadI
d
;
TdThread
statusThrea
d
;
TdThread
monitorThrea
d
;
SSingleWorker
mgmtWorker
;
ProcessCreateNodeFp
processCreateNodeFp
;
ProcessDropNodeFp
processDropNodeFp
;
...
...
source/dnode/mgmt/mgmt_dnode/src/dmInt.c
浏览文件 @
823691b6
...
...
@@ -27,6 +27,7 @@ static int32_t dmStartMgmt(SDnodeMgmt *pMgmt) {
}
static
void
dmStopMgmt
(
SDnodeMgmt
*
pMgmt
)
{
pMgmt
->
data
.
stopped
=
true
;
dmStopMonitorThread
(
pMgmt
);
dmStopStatusThread
(
pMgmt
);
}
...
...
source/dnode/mgmt/mgmt_dnode/src/dmWorker.c
浏览文件 @
823691b6
...
...
@@ -24,8 +24,7 @@ static void *dmStatusThreadFp(void *param) {
while
(
1
)
{
taosMsleep
(
200
);
taosThreadTestCancel
();
if
(
pMgmt
->
data
.
dropped
)
continue
;
if
(
pMgmt
->
data
.
dropped
||
pMgmt
->
data
.
stopped
)
break
;
int64_t
curTime
=
taosGetTimestampMs
();
float
interval
=
(
curTime
-
lastTime
)
/
1000
.
0
f
;
...
...
@@ -46,8 +45,7 @@ static void *dmMonitorThreadFp(void *param) {
while
(
1
)
{
taosMsleep
(
200
);
taosThreadTestCancel
();
if
(
pMgmt
->
data
.
dropped
)
continue
;
if
(
pMgmt
->
data
.
dropped
||
pMgmt
->
data
.
stopped
)
break
;
int64_t
curTime
=
taosGetTimestampMs
();
float
interval
=
(
curTime
-
lastTime
)
/
1000
.
0
f
;
...
...
@@ -61,40 +59,42 @@ static void *dmMonitorThreadFp(void *param) {
}
int32_t
dmStartStatusThread
(
SDnodeMgmt
*
pMgmt
)
{
pMgmt
->
statusThreadId
=
taosCreateThread
(
dmStatusThreadFp
,
pMgmt
);
if
(
pMgmt
->
statusThreadId
==
NULL
)
{
dError
(
"failed to init dnode status thread"
);
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
TdThreadAttr
thAttr
;
taosThreadAttrInit
(
&
thAttr
);
taosThreadAttrSetDetachState
(
&
thAttr
,
PTHREAD_CREATE_JOINABLE
);
if
(
taosThreadCreate
(
&
pMgmt
->
statusThread
,
&
thAttr
,
dmStatusThreadFp
,
pMgmt
)
!=
0
)
{
dError
(
"failed to create status thread since %s"
,
strerror
(
errno
));
return
-
1
;
}
taosThreadAttrDestroy
(
&
thAttr
);
tmsgReportStartup
(
"dnode-status"
,
"initialized"
);
return
0
;
}
void
dmStopStatusThread
(
SDnodeMgmt
*
pMgmt
)
{
if
(
pMgmt
->
statusThreadId
!=
NULL
)
{
taosDestoryThread
(
pMgmt
->
statusThreadId
);
pMgmt
->
statusThreadId
=
NULL
;
if
(
taosCheckPthreadValid
(
pMgmt
->
statusThread
))
{
taosThreadJoin
(
pMgmt
->
statusThread
,
NULL
);
}
}
int32_t
dmStartMonitorThread
(
SDnodeMgmt
*
pMgmt
)
{
pMgmt
->
monitorThreadId
=
taosCreateThread
(
dmMonitorThreadFp
,
pMgmt
);
if
(
pMgmt
->
monitorThreadId
==
NULL
)
{
dError
(
"failed to init dnode monitor thread"
);
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
TdThreadAttr
thAttr
;
taosThreadAttrInit
(
&
thAttr
);
taosThreadAttrSetDetachState
(
&
thAttr
,
PTHREAD_CREATE_JOINABLE
);
if
(
taosThreadCreate
(
&
pMgmt
->
monitorThread
,
&
thAttr
,
dmMonitorThreadFp
,
pMgmt
)
!=
0
)
{
dError
(
"failed to create monitor thread since %s"
,
strerror
(
errno
));
return
-
1
;
}
taosThreadAttrDestroy
(
&
thAttr
);
tmsgReportStartup
(
"dnode-monitor"
,
"initialized"
);
return
0
;
}
void
dmStopMonitorThread
(
SDnodeMgmt
*
pMgmt
)
{
if
(
pMgmt
->
monitorThreadId
!=
NULL
)
{
taosDestoryThread
(
pMgmt
->
monitorThreadId
);
pMgmt
->
monitorThreadId
=
NULL
;
if
(
taosCheckPthreadValid
(
pMgmt
->
monitorThread
))
{
taosThreadJoin
(
pMgmt
->
monitorThread
,
NULL
);
}
}
...
...
source/dnode/mgmt/mgmt_mnode/inc/mmInt.h
浏览文件 @
823691b6
...
...
@@ -48,7 +48,7 @@ int32_t mmAlter(SMnodeMgmt *pMgmt, SDAlterMnodeReq *pReq);
// mmHandle.c
SArray
*
mmGetMsgHandles
();
int32_t
mmProcessCreateReq
(
SMnodeMgmt
*
pMgm
t
,
SNodeMsg
*
pMsg
);
int32_t
mmProcessCreateReq
(
const
SMgmtInputOpt
*
pInpu
t
,
SNodeMsg
*
pMsg
);
int32_t
mmProcessDropReq
(
SMnodeMgmt
*
pMgmt
,
SNodeMsg
*
pMsg
);
int32_t
mmProcessAlterReq
(
SMnodeMgmt
*
pMgmt
,
SNodeMsg
*
pMsg
);
int32_t
mmProcessGetMonitorInfoReq
(
SMnodeMgmt
*
pMgmt
,
SNodeMsg
*
pReq
);
...
...
source/dnode/mgmt/mgmt_mnode/src/mmFile.c
浏览文件 @
823691b6
...
...
@@ -124,21 +124,19 @@ int32_t mmWriteFile(SMnodeMgmt *pMgmt, SDCreateMnodeReq *pReq, bool deployed) {
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"{
\n
"
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
mnodes
\"
: [{
\n
"
);
if
(
pReq
!=
NULL
||
pMgmt
!=
NULL
)
{
int8_t
replica
=
(
pReq
!=
NULL
?
pReq
->
replica
:
pMgmt
->
replica
);
for
(
int32_t
i
=
0
;
i
<
replica
;
++
i
)
{
SReplica
*
pReplica
=
&
pMgmt
->
replicas
[
i
];
if
(
pReq
!=
NULL
)
{
pReplica
=
&
pReq
->
replicas
[
i
];
}
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
id
\"
: %d,
\n
"
,
pReplica
->
id
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
fqdn
\"
:
\"
%s
\"
,
\n
"
,
pReplica
->
fqdn
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
port
\"
: %u
\n
"
,
pReplica
->
port
);
if
(
i
<
replica
-
1
)
{
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
" },{
\n
"
);
}
else
{
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
" }],
\n
"
);
}
int8_t
replica
=
(
pReq
!=
NULL
?
pReq
->
replica
:
pMgmt
->
replica
);
for
(
int32_t
i
=
0
;
i
<
replica
;
++
i
)
{
SReplica
*
pReplica
=
&
pMgmt
->
replicas
[
i
];
if
(
pReq
!=
NULL
)
{
pReplica
=
&
pReq
->
replicas
[
i
];
}
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
id
\"
: %d,
\n
"
,
pReplica
->
id
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
fqdn
\"
:
\"
%s
\"
,
\n
"
,
pReplica
->
fqdn
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
port
\"
: %u
\n
"
,
pReplica
->
port
);
if
(
i
<
replica
-
1
)
{
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
" },{
\n
"
);
}
else
{
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
" }],
\n
"
);
}
}
...
...
source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
浏览文件 @
823691b6
...
...
@@ -72,7 +72,7 @@ int32_t mmProcessGetLoadsReq(SMnodeMgmt *pMgmt, SNodeMsg *pReq) {
return
0
;
}
int32_t
mmProcessCreateReq
(
SMnodeMgmt
*
pMgm
t
,
SNodeMsg
*
pMsg
)
{
int32_t
mmProcessCreateReq
(
const
SMgmtInputOpt
*
pInpu
t
,
SNodeMsg
*
pMsg
)
{
SRpcMsg
*
pReq
=
&
pMsg
->
rpcMsg
;
SDCreateMnodeReq
createReq
=
{
0
};
...
...
@@ -81,14 +81,18 @@ int32_t mmProcessCreateReq(SMnodeMgmt *pMgmt, SNodeMsg *pMsg) {
return
-
1
;
}
if
(
createReq
.
replica
<=
1
||
createReq
.
dnodeId
!=
pMgmt
->
dnodeId
)
{
if
(
createReq
.
replica
<=
1
||
(
createReq
.
dnodeId
!=
pInput
->
dnodeId
&&
pInput
->
dnodeId
!=
0
)
)
{
terrno
=
TSDB_CODE_INVALID_OPTION
;
dError
(
"failed to create mnode since %s"
,
terrstr
());
return
-
1
;
}
bool
deployed
=
true
;
if
(
mmWriteFile
(
pMgmt
,
&
createReq
,
deployed
)
!=
0
)
{
SMnodeMgmt
mgmt
=
{
0
};
mgmt
.
path
=
pInput
->
path
;
mgmt
.
name
=
pInput
->
name
;
if
(
mmWriteFile
(
&
mgmt
,
&
createReq
,
deployed
)
!=
0
)
{
dError
(
"failed to write mnode file since %s"
,
terrstr
());
return
-
1
;
}
...
...
@@ -105,7 +109,7 @@ int32_t mmProcessDropReq(SMnodeMgmt *pMgmt, SNodeMsg *pMsg) {
return
-
1
;
}
if
(
dropReq
.
dnodeId
!=
pMgmt
->
dnodeId
)
{
if
(
pMgmt
->
dnodeId
!=
0
&&
dropReq
.
dnodeId
!=
pMgmt
->
dnodeId
)
{
terrno
=
TSDB_CODE_INVALID_OPTION
;
dError
(
"failed to drop mnode since %s"
,
terrstr
());
return
-
1
;
...
...
source/dnode/mgmt/mgmt_qnode/inc/qmInt.h
浏览文件 @
823691b6
...
...
@@ -37,7 +37,7 @@ typedef struct SQnodeMgmt {
// qmHandle.c
SArray
*
qmGetMsgHandles
();
int32_t
qmProcessCreateReq
(
SQnodeMgmt
*
pMgm
t
,
SNodeMsg
*
pMsg
);
int32_t
qmProcessCreateReq
(
const
SMgmtInputOpt
*
pInpu
t
,
SNodeMsg
*
pMsg
);
int32_t
qmProcessDropReq
(
SQnodeMgmt
*
pMgmt
,
SNodeMsg
*
pMsg
);
int32_t
qmProcessGetMonitorInfoReq
(
SQnodeMgmt
*
pMgmt
,
SNodeMsg
*
pReq
);
...
...
source/dnode/mgmt/mgmt_qnode/src/qmHandle.c
浏览文件 @
823691b6
...
...
@@ -43,7 +43,7 @@ int32_t qmProcessGetMonitorInfoReq(SQnodeMgmt *pMgmt, SNodeMsg *pReq) {
return
0
;
}
int32_t
qmProcessCreateReq
(
SQnodeMgmt
*
pMgm
t
,
SNodeMsg
*
pMsg
)
{
int32_t
qmProcessCreateReq
(
const
SMgmtInputOpt
*
pInpu
t
,
SNodeMsg
*
pMsg
)
{
SRpcMsg
*
pReq
=
&
pMsg
->
rpcMsg
;
SDCreateQnodeReq
createReq
=
{
0
};
...
...
@@ -52,14 +52,14 @@ int32_t qmProcessCreateReq(SQnodeMgmt *pMgmt, SNodeMsg *pMsg) {
return
-
1
;
}
if
(
createReq
.
dnodeId
!=
pMgm
t
->
dnodeId
)
{
if
(
pInput
->
dnodeId
!=
0
&&
createReq
.
dnodeId
!=
pInpu
t
->
dnodeId
)
{
terrno
=
TSDB_CODE_INVALID_OPTION
;
dError
(
"failed to create qnode since %s"
,
terrstr
());
return
-
1
;
}
bool
deployed
=
true
;
if
(
dmWriteFile
(
p
Mgmt
->
path
,
pMgm
t
->
name
,
deployed
)
!=
0
)
{
if
(
dmWriteFile
(
p
Input
->
path
,
pInpu
t
->
name
,
deployed
)
!=
0
)
{
dError
(
"failed to write qnode file since %s"
,
terrstr
());
return
-
1
;
}
...
...
@@ -76,7 +76,7 @@ int32_t qmProcessDropReq(SQnodeMgmt *pMgmt, SNodeMsg *pMsg) {
return
-
1
;
}
if
(
dropReq
.
dnodeId
!=
pMgmt
->
dnodeId
)
{
if
(
pMgmt
->
dnodeId
!=
0
&&
dropReq
.
dnodeId
!=
pMgmt
->
dnodeId
)
{
terrno
=
TSDB_CODE_INVALID_OPTION
;
dError
(
"failed to drop qnode since %s"
,
terrstr
());
return
-
1
;
...
...
source/dnode/mgmt/mgmt_snode/inc/smInt.h
浏览文件 @
823691b6
...
...
@@ -39,7 +39,7 @@ typedef struct SSnodeMgmt {
// smHandle.c
SArray
*
smGetMsgHandles
();
int32_t
smProcessCreateReq
(
SSnodeMgmt
*
pMgm
t
,
SNodeMsg
*
pMsg
);
int32_t
smProcessCreateReq
(
const
SMgmtInputOpt
*
pInpu
t
,
SNodeMsg
*
pMsg
);
int32_t
smProcessDropReq
(
SSnodeMgmt
*
pMgmt
,
SNodeMsg
*
pMsg
);
int32_t
smProcessGetMonitorInfoReq
(
SSnodeMgmt
*
pMgmt
,
SNodeMsg
*
pReq
);
...
...
source/dnode/mgmt/mgmt_snode/src/smHandle.c
浏览文件 @
823691b6
...
...
@@ -43,7 +43,7 @@ int32_t smProcessGetMonitorInfoReq(SSnodeMgmt *pMgmt, SNodeMsg *pReq) {
return
0
;
}
int32_t
smProcessCreateReq
(
SSnodeMgmt
*
pMgm
t
,
SNodeMsg
*
pMsg
)
{
int32_t
smProcessCreateReq
(
const
SMgmtInputOpt
*
pInpu
t
,
SNodeMsg
*
pMsg
)
{
SRpcMsg
*
pReq
=
&
pMsg
->
rpcMsg
;
SDCreateSnodeReq
createReq
=
{
0
};
...
...
@@ -52,14 +52,14 @@ int32_t smProcessCreateReq(SSnodeMgmt *pMgmt, SNodeMsg *pMsg) {
return
-
1
;
}
if
(
createReq
.
dnodeId
!=
pMgm
t
->
dnodeId
)
{
if
(
pInput
->
dnodeId
!=
0
&&
createReq
.
dnodeId
!=
pInpu
t
->
dnodeId
)
{
terrno
=
TSDB_CODE_INVALID_OPTION
;
dError
(
"failed to create snode since %s"
,
terrstr
());
return
-
1
;
}
bool
deployed
=
true
;
if
(
dmWriteFile
(
p
Mgmt
->
path
,
pMgm
t
->
name
,
deployed
)
!=
0
)
{
if
(
dmWriteFile
(
p
Input
->
path
,
pInpu
t
->
name
,
deployed
)
!=
0
)
{
dError
(
"failed to write snode file since %s"
,
terrstr
());
return
-
1
;
}
...
...
@@ -76,7 +76,7 @@ int32_t smProcessDropReq(SSnodeMgmt *pMgmt, SNodeMsg *pMsg) {
return
-
1
;
}
if
(
dropReq
.
dnodeId
!=
pMgmt
->
dnodeId
)
{
if
(
pMgmt
->
dnodeId
!=
0
&&
dropReq
.
dnodeId
!=
pMgmt
->
dnodeId
)
{
terrno
=
TSDB_CODE_INVALID_OPTION
;
dError
(
"failed to drop snode since %s"
,
terrstr
());
return
-
1
;
...
...
source/dnode/mgmt/node_mgmt/src/dmMgmt.c
浏览文件 @
823691b6
...
...
@@ -320,7 +320,12 @@ int32_t dmProcessCreateNodeReq(SDnode *pDnode, EDndNodeType ntype, SNodeMsg *pMs
return
-
1
;
}
int32_t
code
=
(
*
pWrapper
->
func
.
createFp
)(
pWrapper
,
pMsg
);
SMgmtInputOpt
*
pInput
=
&
pWrapper
->
pDnode
->
input
;
pInput
->
name
=
pWrapper
->
name
;
pInput
->
path
=
pWrapper
->
path
;
pInput
->
msgCb
=
dmGetMsgcb
(
pWrapper
);
int32_t
code
=
(
*
pWrapper
->
func
.
createFp
)(
pInput
,
pMsg
);
if
(
code
!=
0
)
{
dError
(
"node:%s, failed to create since %s"
,
pWrapper
->
name
,
terrstr
());
}
else
{
...
...
@@ -345,7 +350,7 @@ int32_t dmProcessDropNodeReq(SDnode *pDnode, EDndNodeType ntype, SNodeMsg *pMsg)
taosThreadMutexLock
(
&
pDnode
->
mutex
);
int32_t
code
=
(
*
pWrapper
->
func
.
dropFp
)(
pWrapper
,
pMsg
);
int32_t
code
=
(
*
pWrapper
->
func
.
dropFp
)(
pWrapper
->
pMgmt
,
pMsg
);
if
(
code
!=
0
)
{
dError
(
"node:%s, failed to drop since %s"
,
pWrapper
->
name
,
terrstr
());
}
else
{
...
...
source/dnode/mgmt/node_mgmt/src/dmRun.c
浏览文件 @
823691b6
...
...
@@ -181,6 +181,7 @@ int32_t dmStartNode(SMgmtWrapper *pWrapper) {
void
dmStopNode
(
SMgmtWrapper
*
pWrapper
)
{
if
(
pWrapper
->
func
.
stopFp
!=
NULL
&&
pWrapper
->
pMgmt
!=
NULL
)
{
(
*
pWrapper
->
func
.
stopFp
)(
pWrapper
->
pMgmt
);
dDebug
(
"node:%s, has been stopped"
,
pWrapper
->
name
);
}
}
...
...
source/dnode/mgmt/node_mgmt/src/dmTransport.c
浏览文件 @
823691b6
...
...
@@ -257,13 +257,21 @@ static inline void dmSendRpcRsp(SDnode *pDnode, const SRpcMsg *pRsp) {
}
static
inline
void
dmSendRecv
(
SDnode
*
pDnode
,
SEpSet
*
pEpSet
,
SRpcMsg
*
pReq
,
SRpcMsg
*
pRsp
)
{
rpcSendRecv
(
pDnode
->
trans
.
clientRpc
,
pEpSet
,
pReq
,
pRsp
);
if
(
pDnode
->
status
!=
DND_STAT_RUNNING
)
{
pRsp
->
code
=
TSDB_CODE_NODE_OFFLINE
;
}
else
{
rpcSendRecv
(
pDnode
->
trans
.
clientRpc
,
pEpSet
,
pReq
,
pRsp
);
}
}
static
inline
void
dmSendToMnodeRecv
(
SMgmtWrapper
*
pWrapper
,
SRpcMsg
*
pReq
,
SRpcMsg
*
pRsp
)
{
SEpSet
epSet
=
{
0
};
dmGetMnodeEpSet
(
pWrapper
->
pDnode
,
&
epSet
);
dmSendRecv
(
pWrapper
->
pDnode
,
&
epSet
,
pReq
,
pRsp
);
if
(
pWrapper
->
pDnode
->
status
!=
DND_STAT_RUNNING
)
{
pRsp
->
code
=
TSDB_CODE_NODE_OFFLINE
;
}
else
{
SEpSet
epSet
=
{
0
};
dmGetMnodeEpSet
(
pWrapper
->
pDnode
,
&
epSet
);
dmSendRecv
(
pWrapper
->
pDnode
,
&
epSet
,
pReq
,
pRsp
);
}
}
static
inline
int32_t
dmSendReq
(
SMgmtWrapper
*
pWrapper
,
const
SEpSet
*
pEpSet
,
SRpcMsg
*
pReq
)
{
...
...
source/dnode/mgmt/node_util/inc/dmUtil.h
浏览文件 @
823691b6
...
...
@@ -54,10 +54,10 @@ extern "C" {
typedef
enum
{
DNODE
=
0
,
V
NODE
=
1
,
Q
NODE
=
2
,
S
NODE
=
3
,
M
NODE
=
4
,
M
NODE
=
1
,
V
NODE
=
2
,
Q
NODE
=
3
,
S
NODE
=
4
,
BNODE
=
5
,
NODE_END
=
6
,
}
EDndNodeType
;
...
...
@@ -117,7 +117,7 @@ typedef int32_t (*NodeOpenFp)(const SMgmtInputOpt *pInput, SMgmtOutputOpt *pOutp
typedef
void
(
*
NodeCloseFp
)(
void
*
pMgmt
);
typedef
int32_t
(
*
NodeStartFp
)(
void
*
pMgmt
);
typedef
void
(
*
NodeStopFp
)(
void
*
pMgmt
);
typedef
int32_t
(
*
NodeCreateFp
)(
void
*
pMgm
t
,
SNodeMsg
*
pMsg
);
typedef
int32_t
(
*
NodeCreateFp
)(
const
SMgmtInputOpt
*
pInpu
t
,
SNodeMsg
*
pMsg
);
typedef
int32_t
(
*
NodeDropFp
)(
void
*
pMgmt
,
SNodeMsg
*
pMsg
);
typedef
int32_t
(
*
NodeRequireFp
)(
const
SMgmtInputOpt
*
pInput
,
bool
*
required
);
typedef
SArray
*
(
*
NodeGetHandlesFp
)();
// array of SMgmtHandle
...
...
@@ -167,6 +167,7 @@ typedef struct {
ESyncState
vndState
;
ESyncState
mndState
;
bool
dropped
;
bool
stopped
;
SEpSet
mnodeEps
;
SArray
*
dnodeEps
;
SHashObj
*
dnodeHash
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录