Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
f0e69747
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看板
提交
f0e69747
编写于
2月 16, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
serialize node msg
上级
bec7a0d5
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
267 addition
and
152 deletion
+267
-152
source/client/src/clientHb.c
source/client/src/clientHb.c
+1
-1
source/dnode/mgmt/impl/src/dndBnode.c
source/dnode/mgmt/impl/src/dndBnode.c
+14
-8
source/dnode/mgmt/impl/src/dndQnode.c
source/dnode/mgmt/impl/src/dndQnode.c
+14
-8
source/dnode/mgmt/impl/src/dndSnode.c
source/dnode/mgmt/impl/src/dndSnode.c
+14
-8
source/dnode/mgmt/impl/test/bnode/dbnode.cpp
source/dnode/mgmt/impl/test/bnode/dbnode.cpp
+45
-28
source/dnode/mgmt/impl/test/qnode/dqnode.cpp
source/dnode/mgmt/impl/test/qnode/dqnode.cpp
+45
-27
source/dnode/mgmt/impl/test/snode/dsnode.cpp
source/dnode/mgmt/impl/test/snode/dsnode.cpp
+45
-27
source/dnode/mnode/impl/src/mndAuth.c
source/dnode/mnode/impl/src/mndAuth.c
+1
-1
source/dnode/mnode/impl/src/mndBnode.c
source/dnode/mnode/impl/src/mndBnode.c
+21
-9
source/dnode/mnode/impl/src/mndProfile.c
source/dnode/mnode/impl/src/mndProfile.c
+2
-2
source/dnode/mnode/impl/src/mndQnode.c
source/dnode/mnode/impl/src/mndQnode.c
+21
-9
source/dnode/mnode/impl/src/mndSnode.c
source/dnode/mnode/impl/src/mndSnode.c
+22
-10
source/dnode/mnode/impl/test/profile/profile.cpp
source/dnode/mnode/impl/test/profile/profile.cpp
+22
-14
未找到文件。
source/client/src/clientHb.c
浏览文件 @
f0e69747
...
...
@@ -315,7 +315,7 @@ void hbFreeReq(void *req) {
SClientHbBatchReq
*
hbGatherAllInfo
(
SAppHbMgr
*
pAppHbMgr
)
{
SClientHbBatchReq
*
pBatchReq
=
malloc
(
sizeof
(
SClientHbBatchReq
));
SClientHbBatchReq
*
pBatchReq
=
calloc
(
1
,
sizeof
(
SClientHbBatchReq
));
if
(
pBatchReq
==
NULL
)
{
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
return
NULL
;
...
...
source/dnode/mgmt/impl/src/dndBnode.c
浏览文件 @
f0e69747
...
...
@@ -258,11 +258,14 @@ static int32_t dndDropBnode(SDnode *pDnode) {
return
0
;
}
int32_t
dndProcessCreateBnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pRpcMsg
)
{
SDCreateBnodeReq
*
pMsg
=
pRpcMsg
->
pCont
;
pMsg
->
dnodeId
=
htonl
(
pMsg
->
dnodeId
);
int32_t
dndProcessCreateBnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
)
{
SDCreateBnodeReq
createReq
=
{
0
};
if
(
tDeserializeSMCreateDropQSBNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
if
(
pMsg
->
dnodeId
!=
dndGetDnodeId
(
pDnode
))
{
if
(
createReq
.
dnodeId
!=
dndGetDnodeId
(
pDnode
))
{
terrno
=
TSDB_CODE_DND_BNODE_INVALID_OPTION
;
dError
(
"failed to create bnode since %s"
,
terrstr
());
return
-
1
;
...
...
@@ -271,11 +274,14 @@ int32_t dndProcessCreateBnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg) {
}
}
int32_t
dndProcessDropBnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pRpcMsg
)
{
SDDropBnodeReq
*
pMsg
=
pRpcMsg
->
pCont
;
pMsg
->
dnodeId
=
htonl
(
pMsg
->
dnodeId
);
int32_t
dndProcessDropBnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
)
{
SDDropBnodeReq
dropReq
=
{
0
};
if
(
tDeserializeSMCreateDropQSBNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
dropReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
if
(
pMsg
->
dnodeId
!=
dndGetDnodeId
(
pDnode
))
{
if
(
dropReq
.
dnodeId
!=
dndGetDnodeId
(
pDnode
))
{
terrno
=
TSDB_CODE_DND_BNODE_INVALID_OPTION
;
dError
(
"failed to drop bnode since %s"
,
terrstr
());
return
-
1
;
...
...
source/dnode/mgmt/impl/src/dndQnode.c
浏览文件 @
f0e69747
...
...
@@ -264,11 +264,14 @@ static int32_t dndDropQnode(SDnode *pDnode) {
return
0
;
}
int32_t
dndProcessCreateQnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pRpcMsg
)
{
SDCreateQnodeReq
*
pMsg
=
pRpcMsg
->
pCont
;
pMsg
->
dnodeId
=
htonl
(
pMsg
->
dnodeId
);
int32_t
dndProcessCreateQnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
)
{
SDCreateQnodeReq
createReq
=
{
0
};
if
(
tDeserializeSMCreateDropQSBNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
if
(
pMsg
->
dnodeId
!=
dndGetDnodeId
(
pDnode
))
{
if
(
createReq
.
dnodeId
!=
dndGetDnodeId
(
pDnode
))
{
terrno
=
TSDB_CODE_DND_QNODE_INVALID_OPTION
;
dError
(
"failed to create qnode since %s"
,
terrstr
());
return
-
1
;
...
...
@@ -277,11 +280,14 @@ int32_t dndProcessCreateQnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg) {
}
}
int32_t
dndProcessDropQnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pRpcMsg
)
{
SDDropQnodeReq
*
pMsg
=
pRpcMsg
->
pCont
;
pMsg
->
dnodeId
=
htonl
(
pMsg
->
dnodeId
);
int32_t
dndProcessDropQnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
)
{
SDDropQnodeReq
dropReq
=
{
0
};
if
(
tDeserializeSMCreateDropQSBNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
dropReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
if
(
pMsg
->
dnodeId
!=
dndGetDnodeId
(
pDnode
))
{
if
(
dropReq
.
dnodeId
!=
dndGetDnodeId
(
pDnode
))
{
terrno
=
TSDB_CODE_DND_QNODE_INVALID_OPTION
;
dError
(
"failed to drop qnode since %s"
,
terrstr
());
return
-
1
;
...
...
source/dnode/mgmt/impl/src/dndSnode.c
浏览文件 @
f0e69747
...
...
@@ -258,11 +258,14 @@ static int32_t dndDropSnode(SDnode *pDnode) {
return
0
;
}
int32_t
dndProcessCreateSnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pRpcMsg
)
{
SDCreateSnodeReq
*
pMsg
=
pRpcMsg
->
pCont
;
pMsg
->
dnodeId
=
htonl
(
pMsg
->
dnodeId
);
int32_t
dndProcessCreateSnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
)
{
SDCreateSnodeReq
createReq
=
{
0
};
if
(
tDeserializeSMCreateDropQSBNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
if
(
pMsg
->
dnodeId
!=
dndGetDnodeId
(
pDnode
))
{
if
(
createReq
.
dnodeId
!=
dndGetDnodeId
(
pDnode
))
{
terrno
=
TSDB_CODE_DND_SNODE_INVALID_OPTION
;
dError
(
"failed to create snode since %s"
,
terrstr
());
return
-
1
;
...
...
@@ -271,11 +274,14 @@ int32_t dndProcessCreateSnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg) {
}
}
int32_t
dndProcessDropSnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pRpcMsg
)
{
SDDropSnodeReq
*
pMsg
=
pRpcMsg
->
pCont
;
pMsg
->
dnodeId
=
htonl
(
pMsg
->
dnodeId
);
int32_t
dndProcessDropSnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
)
{
SDDropSnodeReq
dropReq
=
{
0
};
if
(
tDeserializeSMCreateDropQSBNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
dropReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
if
(
pMsg
->
dnodeId
!=
dndGetDnodeId
(
pDnode
))
{
if
(
dropReq
.
dnodeId
!=
dndGetDnodeId
(
pDnode
))
{
terrno
=
TSDB_CODE_DND_SNODE_INVALID_OPTION
;
dError
(
"failed to drop snode since %s"
,
terrstr
());
return
-
1
;
...
...
source/dnode/mgmt/impl/test/bnode/dbnode.cpp
浏览文件 @
f0e69747
...
...
@@ -27,10 +27,12 @@ Testbase DndTestBnode::test;
TEST_F
(
DndTestBnode
,
01
_Create_Bnode
)
{
{
int32_t
contLen
=
sizeof
(
SDCreateBnodeReq
);
SDCreateBnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
SDCreateBnodeReq
*
pReq
=
(
SDCreateBnodeReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
dnodeId
=
htonl
(
2
);
int32_t
contLen
=
tSerializeSMCreateDropQSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSMCreateDropQSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -38,10 +40,12 @@ TEST_F(DndTestBnode, 01_Create_Bnode) {
}
{
int32_t
contLen
=
sizeof
(
SDCreateBnodeReq
);
SDCreateBnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
SDCreateBnodeReq
*
pReq
=
(
SDCreateBnodeReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
dnodeId
=
htonl
(
1
);
int32_t
contLen
=
tSerializeSMCreateDropQSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSMCreateDropQSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -49,10 +53,12 @@ TEST_F(DndTestBnode, 01_Create_Bnode) {
}
{
int32_t
contLen
=
sizeof
(
SDCreateBnodeReq
);
SDCreateBnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
SDCreateBnodeReq
*
pReq
=
(
SDCreateBnodeReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
dnodeId
=
htonl
(
1
);
int32_t
contLen
=
tSerializeSMCreateDropQSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSMCreateDropQSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -62,11 +68,12 @@ TEST_F(DndTestBnode, 01_Create_Bnode) {
test
.
Restart
();
{
int32_t
contLen
=
sizeof
(
SDCreateBnodeReq
);
SDCreateBnodeReq
*
pReq
=
(
SDCreateBnodeReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
dnodeId
=
htonl
(
1
);
SDCreateBnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeSMCreateDropQSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSMCreateDropQSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_DND_BNODE_ALREADY_DEPLOYED
);
...
...
@@ -75,10 +82,12 @@ TEST_F(DndTestBnode, 01_Create_Bnode) {
TEST_F
(
DndTestBnode
,
01
_Drop_Bnode
)
{
{
int32_t
contLen
=
sizeof
(
SDDropBnodeReq
);
SDDropBnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
2
;
SDDropBnodeReq
*
pReq
=
(
SDDropBnodeReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
dnodeId
=
htonl
(
2
);
int32_t
contLen
=
tSerializeSMCreateDropQSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSMCreateDropQSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -86,10 +95,12 @@ TEST_F(DndTestBnode, 01_Drop_Bnode) {
}
{
int32_t
contLen
=
sizeof
(
SDDropBnodeReq
);
SDDropBnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
1
;
SDDropBnodeReq
*
pReq
=
(
SDDropBnodeReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
dnodeId
=
htonl
(
1
);
int32_t
contLen
=
tSerializeSMCreateDropQSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSMCreateDropQSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -97,10 +108,12 @@ TEST_F(DndTestBnode, 01_Drop_Bnode) {
}
{
int32_t
contLen
=
sizeof
(
SDDropBnodeReq
);
SDDropBnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
1
;
SDDropBnodeReq
*
pReq
=
(
SDDropBnodeReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
dnodeId
=
htonl
(
1
);
int32_t
contLen
=
tSerializeSMCreateDropQSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSMCreateDropQSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -110,10 +123,12 @@ TEST_F(DndTestBnode, 01_Drop_Bnode) {
test
.
Restart
();
{
int32_t
contLen
=
sizeof
(
SDDropBnodeReq
);
SDDropBnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
1
;
SDDropBnodeReq
*
pReq
=
(
SDDropBnodeReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
dnodeId
=
htonl
(
1
);
int32_t
contLen
=
tSerializeSMCreateDropQSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSMCreateDropQSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -121,10 +136,12 @@ TEST_F(DndTestBnode, 01_Drop_Bnode) {
}
{
int32_t
contLen
=
sizeof
(
SDCreateBnodeReq
);
SDCreateBnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
SDCreateBnodeReq
*
pReq
=
(
SDCreateBnodeReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
dnodeId
=
htonl
(
1
);
int32_t
contLen
=
tSerializeSMCreateDropQSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSMCreateDropQSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
source/dnode/mgmt/impl/test/qnode/dqnode.cpp
浏览文件 @
f0e69747
...
...
@@ -27,10 +27,12 @@ Testbase DndTestQnode::test;
TEST_F
(
DndTestQnode
,
01
_Create_Qnode
)
{
{
int32_t
contLen
=
sizeof
(
SDCreateQnodeReq
);
SDCreateQnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
SDCreateQnodeReq
*
pReq
=
(
SDCreateQnodeReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
dnodeId
=
htonl
(
2
);
int32_t
contLen
=
tSerializeSMCreateDropQSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSMCreateDropQSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -38,10 +40,12 @@ TEST_F(DndTestQnode, 01_Create_Qnode) {
}
{
int32_t
contLen
=
sizeof
(
SDCreateQnodeReq
);
SDCreateQnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
SDCreateQnodeReq
*
pReq
=
(
SDCreateQnodeReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
dnodeId
=
htonl
(
1
);
int32_t
contLen
=
tSerializeSMCreateDropQSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSMCreateDropQSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -49,10 +53,12 @@ TEST_F(DndTestQnode, 01_Create_Qnode) {
}
{
int32_t
contLen
=
sizeof
(
SDCreateQnodeReq
);
SDCreateQnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
SDCreateQnodeReq
*
pReq
=
(
SDCreateQnodeReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
dnodeId
=
htonl
(
1
);
int32_t
contLen
=
tSerializeSMCreateDropQSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSMCreateDropQSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -62,10 +68,12 @@ TEST_F(DndTestQnode, 01_Create_Qnode) {
test
.
Restart
();
{
int32_t
contLen
=
sizeof
(
SDCreateQnodeReq
);
SDCreateQnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
SDCreateQnodeReq
*
pReq
=
(
SDCreateQnodeReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
dnodeId
=
htonl
(
1
);
int32_t
contLen
=
tSerializeSMCreateDropQSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSMCreateDropQSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -75,10 +83,12 @@ TEST_F(DndTestQnode, 01_Create_Qnode) {
TEST_F
(
DndTestQnode
,
02
_Drop_Qnode
)
{
{
int32_t
contLen
=
sizeof
(
SDDropQnodeReq
);
SDDropQnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
2
;
SDDropQnodeReq
*
pReq
=
(
SDDropQnodeReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
dnodeId
=
htonl
(
2
);
int32_t
contLen
=
tSerializeSMCreateDropQSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSMCreateDropQSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -86,10 +96,12 @@ TEST_F(DndTestQnode, 02_Drop_Qnode) {
}
{
int32_t
contLen
=
sizeof
(
SDDropQnodeReq
);
SDDropQnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
1
;
SDDropQnodeReq
*
pReq
=
(
SDDropQnodeReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
dnodeId
=
htonl
(
1
);
int32_t
contLen
=
tSerializeSMCreateDropQSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSMCreateDropQSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -97,10 +109,12 @@ TEST_F(DndTestQnode, 02_Drop_Qnode) {
}
{
int32_t
contLen
=
sizeof
(
SDDropQnodeReq
);
SDDropQnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
1
;
SDDropQnodeReq
*
pReq
=
(
SDDropQnodeReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
dnodeId
=
htonl
(
1
);
int32_t
contLen
=
tSerializeSMCreateDropQSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSMCreateDropQSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -110,10 +124,12 @@ TEST_F(DndTestQnode, 02_Drop_Qnode) {
test
.
Restart
();
{
int32_t
contLen
=
sizeof
(
SDDropQnodeReq
);
SDDropQnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
1
;
SDDropQnodeReq
*
pReq
=
(
SDDropQnodeReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
dnodeId
=
htonl
(
1
);
int32_t
contLen
=
tSerializeSMCreateDropQSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSMCreateDropQSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -121,10 +137,12 @@ TEST_F(DndTestQnode, 02_Drop_Qnode) {
}
{
int32_t
contLen
=
sizeof
(
SDCreateQnodeReq
);
SDCreateQnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
SDCreateQnodeReq
*
pReq
=
(
SDCreateQnodeReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
dnodeId
=
htonl
(
1
);
int32_t
contLen
=
tSerializeSMCreateDropQSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSMCreateDropQSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
source/dnode/mgmt/impl/test/snode/dsnode.cpp
浏览文件 @
f0e69747
...
...
@@ -27,10 +27,12 @@ Testbase DndTestSnode::test;
TEST_F
(
DndTestSnode
,
01
_Create_Snode
)
{
{
int32_t
contLen
=
sizeof
(
SDCreateSnodeReq
);
SDCreateSnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
SDCreateSnodeReq
*
pReq
=
(
SDCreateSnodeReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
dnodeId
=
htonl
(
2
);
int32_t
contLen
=
tSerializeSMCreateDropQSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSMCreateDropQSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -38,10 +40,12 @@ TEST_F(DndTestSnode, 01_Create_Snode) {
}
{
int32_t
contLen
=
sizeof
(
SDCreateSnodeReq
);
SDCreateSnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
SDCreateSnodeReq
*
pReq
=
(
SDCreateSnodeReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
dnodeId
=
htonl
(
1
);
int32_t
contLen
=
tSerializeSMCreateDropQSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSMCreateDropQSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -49,10 +53,12 @@ TEST_F(DndTestSnode, 01_Create_Snode) {
}
{
int32_t
contLen
=
sizeof
(
SDCreateSnodeReq
);
SDCreateSnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
SDCreateSnodeReq
*
pReq
=
(
SDCreateSnodeReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
dnodeId
=
htonl
(
1
);
int32_t
contLen
=
tSerializeSMCreateDropQSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSMCreateDropQSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -62,10 +68,12 @@ TEST_F(DndTestSnode, 01_Create_Snode) {
test
.
Restart
();
{
int32_t
contLen
=
sizeof
(
SDCreateSnodeReq
);
SDCreateSnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
SDCreateSnodeReq
*
pReq
=
(
SDCreateSnodeReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
dnodeId
=
htonl
(
1
);
int32_t
contLen
=
tSerializeSMCreateDropQSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSMCreateDropQSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -75,10 +83,12 @@ TEST_F(DndTestSnode, 01_Create_Snode) {
TEST_F
(
DndTestSnode
,
01
_Drop_Snode
)
{
{
int32_t
contLen
=
sizeof
(
SDDropSnodeReq
);
SDDropSnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
2
;
SDDropSnodeReq
*
pReq
=
(
SDDropSnodeReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
dnodeId
=
htonl
(
2
);
int32_t
contLen
=
tSerializeSMCreateDropQSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSMCreateDropQSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -86,10 +96,12 @@ TEST_F(DndTestSnode, 01_Drop_Snode) {
}
{
int32_t
contLen
=
sizeof
(
SDDropSnodeReq
);
SDDropSnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
1
;
SDDropSnodeReq
*
pReq
=
(
SDDropSnodeReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
dnodeId
=
htonl
(
1
);
int32_t
contLen
=
tSerializeSMCreateDropQSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSMCreateDropQSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -97,10 +109,12 @@ TEST_F(DndTestSnode, 01_Drop_Snode) {
}
{
int32_t
contLen
=
sizeof
(
SDDropSnodeReq
);
SDDropSnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
1
;
SDDropSnodeReq
*
pReq
=
(
SDDropSnodeReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
dnodeId
=
htonl
(
1
);
int32_t
contLen
=
tSerializeSMCreateDropQSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSMCreateDropQSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -110,10 +124,12 @@ TEST_F(DndTestSnode, 01_Drop_Snode) {
test
.
Restart
();
{
int32_t
contLen
=
sizeof
(
SDDropSnodeReq
);
SDDropSnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
1
;
SDDropSnodeReq
*
pReq
=
(
SDDropSnodeReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
dnodeId
=
htonl
(
1
);
int32_t
contLen
=
tSerializeSMCreateDropQSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSMCreateDropQSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -121,10 +137,12 @@ TEST_F(DndTestSnode, 01_Drop_Snode) {
}
{
int32_t
contLen
=
sizeof
(
SDCreateSnodeReq
);
SDCreateSnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
SDCreateSnodeReq
*
pReq
=
(
SDCreateSnodeReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
dnodeId
=
htonl
(
1
);
int32_t
contLen
=
tSerializeSMCreateDropQSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSMCreateDropQSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
source/dnode/mnode/impl/src/mndAuth.c
浏览文件 @
f0e69747
...
...
@@ -47,7 +47,7 @@ int32_t mndRetriveAuth(SMnode *pMnode, char *user, char *spi, char *encrypt, cha
static
int32_t
mndProcessAuthReq
(
SMnodeMsg
*
pReq
)
{
SAuthReq
authReq
=
{
0
};
if
(
tDeserializeSAuthReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
authReq
)
!=
0
)
{
if
(
tDeserializeSAuthReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
authReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
...
...
source/dnode/mnode/impl/src/mndBnode.c
浏览文件 @
f0e69747
...
...
@@ -187,17 +187,21 @@ static int32_t mndSetCreateBnodeCommitLogs(STrans *pTrans, SBnodeObj *pObj) {
}
static
int32_t
mndSetCreateBnodeRedoActions
(
STrans
*
pTrans
,
SDnodeObj
*
pDnode
,
SBnodeObj
*
pObj
)
{
SDCreateBnodeReq
*
pReq
=
malloc
(
sizeof
(
SDCreateBnodeReq
));
SDCreateBnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
pDnode
->
id
;
int32_t
contLen
=
tSerializeSMCreateDropQSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
malloc
(
contLen
);
if
(
pReq
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
pReq
->
dnodeId
=
htonl
(
pDnode
->
id
);
tSerializeSMCreateDropQSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
STransAction
action
=
{
0
};
action
.
epSet
=
mndGetDnodeEpset
(
pDnode
);
action
.
pCont
=
pReq
;
action
.
contLen
=
sizeof
(
SDCreateBnodeReq
)
;
action
.
contLen
=
contLen
;
action
.
msgType
=
TDMT_DND_CREATE_BNODE
;
action
.
acceptableCode
=
TSDB_CODE_DND_BNODE_ALREADY_DEPLOYED
;
...
...
@@ -210,17 +214,21 @@ static int32_t mndSetCreateBnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, S
}
static
int32_t
mndSetCreateBnodeUndoActions
(
STrans
*
pTrans
,
SDnodeObj
*
pDnode
,
SBnodeObj
*
pObj
)
{
SDDropBnodeReq
*
pReq
=
malloc
(
sizeof
(
SDDropBnodeReq
));
SDDropBnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
pDnode
->
id
;
int32_t
contLen
=
tSerializeSMCreateDropQSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
malloc
(
contLen
);
if
(
pReq
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
pReq
->
dnodeId
=
htonl
(
pDnode
->
id
);
tSerializeSMCreateDropQSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
STransAction
action
=
{
0
};
action
.
epSet
=
mndGetDnodeEpset
(
pDnode
);
action
.
pCont
=
pReq
;
action
.
contLen
=
sizeof
(
SDDropBnodeReq
)
;
action
.
contLen
=
contLen
;
action
.
msgType
=
TDMT_DND_DROP_BNODE
;
action
.
acceptableCode
=
TSDB_CODE_DND_BNODE_NOT_DEPLOYED
;
...
...
@@ -329,17 +337,21 @@ static int32_t mndSetDropBnodeCommitLogs(STrans *pTrans, SBnodeObj *pObj) {
}
static
int32_t
mndSetDropBnodeRedoActions
(
STrans
*
pTrans
,
SDnodeObj
*
pDnode
,
SBnodeObj
*
pObj
)
{
SDDropBnodeReq
*
pReq
=
malloc
(
sizeof
(
SDDropBnodeReq
));
SDDropBnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
pDnode
->
id
;
int32_t
contLen
=
tSerializeSMCreateDropQSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
malloc
(
contLen
);
if
(
pReq
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
pReq
->
dnodeId
=
htonl
(
pDnode
->
id
);
tSerializeSMCreateDropQSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
STransAction
action
=
{
0
};
action
.
epSet
=
mndGetDnodeEpset
(
pDnode
);
action
.
pCont
=
pReq
;
action
.
contLen
=
sizeof
(
SDDropBnodeReq
)
;
action
.
contLen
=
contLen
;
action
.
msgType
=
TDMT_DND_DROP_BNODE
;
action
.
acceptableCode
=
TSDB_CODE_DND_BNODE_NOT_DEPLOYED
;
...
...
source/dnode/mnode/impl/src/mndProfile.c
浏览文件 @
f0e69747
...
...
@@ -517,7 +517,7 @@ static int32_t mndProcessKillQueryReq(SMnodeMsg *pReq) {
mndReleaseUser
(
pMnode
,
pUser
);
SKillQueryReq
killReq
=
{
0
};
if
(
tDeserializeSKillQueryReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
killReq
)
!=
0
)
{
if
(
tDeserializeSKillQueryReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
killReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
...
...
@@ -551,7 +551,7 @@ static int32_t mndProcessKillConnReq(SMnodeMsg *pReq) {
mndReleaseUser
(
pMnode
,
pUser
);
SKillConnReq
killReq
=
{
0
};
if
(
tDeserializeSKillConnReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
killReq
)
!=
0
)
{
if
(
tDeserializeSKillConnReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
killReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
...
...
source/dnode/mnode/impl/src/mndQnode.c
浏览文件 @
f0e69747
...
...
@@ -187,17 +187,21 @@ static int32_t mndSetCreateQnodeCommitLogs(STrans *pTrans, SQnodeObj *pObj) {
}
static
int32_t
mndSetCreateQnodeRedoActions
(
STrans
*
pTrans
,
SDnodeObj
*
pDnode
,
SQnodeObj
*
pObj
)
{
SDCreateQnodeReq
*
pReq
=
malloc
(
sizeof
(
SDCreateQnodeReq
));
SDCreateQnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
pDnode
->
id
;
int32_t
contLen
=
tSerializeSMCreateDropQSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
malloc
(
contLen
);
if
(
pReq
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
pReq
->
dnodeId
=
htonl
(
pDnode
->
id
);
tSerializeSMCreateDropQSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
STransAction
action
=
{
0
};
action
.
epSet
=
mndGetDnodeEpset
(
pDnode
);
action
.
pCont
=
pReq
;
action
.
contLen
=
sizeof
(
SDCreateQnodeReq
)
;
action
.
contLen
=
contLen
;
action
.
msgType
=
TDMT_DND_CREATE_QNODE
;
action
.
acceptableCode
=
TSDB_CODE_DND_QNODE_ALREADY_DEPLOYED
;
...
...
@@ -210,17 +214,21 @@ static int32_t mndSetCreateQnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, S
}
static
int32_t
mndSetCreateQnodeUndoActions
(
STrans
*
pTrans
,
SDnodeObj
*
pDnode
,
SQnodeObj
*
pObj
)
{
SDDropQnodeReq
*
pReq
=
malloc
(
sizeof
(
SDDropQnodeReq
));
SDDropQnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
pDnode
->
id
;
int32_t
contLen
=
tSerializeSMCreateDropQSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
malloc
(
contLen
);
if
(
pReq
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
pReq
->
dnodeId
=
htonl
(
pDnode
->
id
);
tSerializeSMCreateDropQSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
STransAction
action
=
{
0
};
action
.
epSet
=
mndGetDnodeEpset
(
pDnode
);
action
.
pCont
=
pReq
;
action
.
contLen
=
sizeof
(
SDDropQnodeReq
)
;
action
.
contLen
=
contLen
;
action
.
msgType
=
TDMT_DND_DROP_QNODE
;
action
.
acceptableCode
=
TSDB_CODE_DND_QNODE_NOT_DEPLOYED
;
...
...
@@ -329,17 +337,21 @@ static int32_t mndSetDropQnodeCommitLogs(STrans *pTrans, SQnodeObj *pObj) {
}
static
int32_t
mndSetDropQnodeRedoActions
(
STrans
*
pTrans
,
SDnodeObj
*
pDnode
,
SQnodeObj
*
pObj
)
{
SDDropQnodeReq
*
pReq
=
malloc
(
sizeof
(
SDDropQnodeReq
));
SDDropQnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
pDnode
->
id
;
int32_t
contLen
=
tSerializeSMCreateDropQSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
malloc
(
contLen
);
if
(
pReq
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
pReq
->
dnodeId
=
htonl
(
pDnode
->
id
);
tSerializeSMCreateDropQSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
STransAction
action
=
{
0
};
action
.
epSet
=
mndGetDnodeEpset
(
pDnode
);
action
.
pCont
=
pReq
;
action
.
contLen
=
sizeof
(
SDDropQnodeReq
)
;
action
.
contLen
=
contLen
;
action
.
msgType
=
TDMT_DND_DROP_QNODE
;
action
.
acceptableCode
=
TSDB_CODE_DND_QNODE_NOT_DEPLOYED
;
...
...
source/dnode/mnode/impl/src/mndSnode.c
浏览文件 @
f0e69747
...
...
@@ -187,17 +187,21 @@ static int32_t mndSetCreateSnodeCommitLogs(STrans *pTrans, SSnodeObj *pObj) {
}
static
int32_t
mndSetCreateSnodeRedoActions
(
STrans
*
pTrans
,
SDnodeObj
*
pDnode
,
SSnodeObj
*
pObj
)
{
SDCreateSnodeReq
*
pReq
=
malloc
(
sizeof
(
SDCreateSnodeReq
));
SDCreateSnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
pDnode
->
id
;
int32_t
contLen
=
tSerializeSMCreateDropQSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
malloc
(
contLen
);
if
(
pReq
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
pReq
->
dnodeId
=
htonl
(
pDnode
->
id
);
tSerializeSMCreateDropQSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
STransAction
action
=
{
0
};
action
.
epSet
=
mndGetDnodeEpset
(
pDnode
);
action
.
pCont
=
pReq
;
action
.
contLen
=
sizeof
(
SDCreateSnodeReq
)
;
action
.
contLen
=
contLen
;
action
.
msgType
=
TDMT_DND_CREATE_SNODE
;
action
.
acceptableCode
=
TSDB_CODE_DND_SNODE_ALREADY_DEPLOYED
;
...
...
@@ -210,17 +214,21 @@ static int32_t mndSetCreateSnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, S
}
static
int32_t
mndSetCreateSnodeUndoActions
(
STrans
*
pTrans
,
SDnodeObj
*
pDnode
,
SSnodeObj
*
pObj
)
{
SDDropSnodeReq
*
pReq
=
malloc
(
sizeof
(
SDDropSnodeReq
));
SDDropSnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
pDnode
->
id
;
int32_t
contLen
=
tSerializeSMCreateDropQSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
malloc
(
contLen
);
if
(
pReq
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
pReq
->
dnodeId
=
htonl
(
pDnode
->
id
);
tSerializeSMCreateDropQSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
STransAction
action
=
{
0
};
action
.
epSet
=
mndGetDnodeEpset
(
pDnode
);
action
.
pCont
=
pReq
;
action
.
contLen
=
sizeof
(
SDDropSnodeReq
)
;
action
.
contLen
=
contLen
;
action
.
msgType
=
TDMT_DND_DROP_SNODE
;
action
.
acceptableCode
=
TSDB_CODE_DND_SNODE_NOT_DEPLOYED
;
...
...
@@ -302,7 +310,7 @@ static int32_t mndProcessCreateSnodeReq(SMnodeMsg *pReq) {
if
(
code
==
0
)
code
=
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
CREATE_SNODE_OVER:
if
(
code
!=
0
&&
code
!=
TSDB_CODE_MND_ACTION_IN_PROGRESS
)
{
if
(
code
!=
0
&&
code
!=
TSDB_CODE_MND_ACTION_IN_PROGRESS
)
{
mError
(
"snode:%d, failed to create since %s"
,
createReq
.
dnodeId
,
terrstr
());
return
-
1
;
}
...
...
@@ -331,17 +339,21 @@ static int32_t mndSetDropSnodeCommitLogs(STrans *pTrans, SSnodeObj *pObj) {
}
static
int32_t
mndSetDropSnodeRedoActions
(
STrans
*
pTrans
,
SDnodeObj
*
pDnode
,
SSnodeObj
*
pObj
)
{
SDDropSnodeReq
*
pReq
=
malloc
(
sizeof
(
SDDropSnodeReq
));
SDDropSnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
pDnode
->
id
;
int32_t
contLen
=
tSerializeSMCreateDropQSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
malloc
(
contLen
);
if
(
pReq
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
pReq
->
dnodeId
=
htonl
(
pDnode
->
id
);
tSerializeSMCreateDropQSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
STransAction
action
=
{
0
};
action
.
epSet
=
mndGetDnodeEpset
(
pDnode
);
action
.
pCont
=
pReq
;
action
.
contLen
=
sizeof
(
SDDropSnodeReq
)
;
action
.
contLen
=
contLen
;
action
.
msgType
=
TDMT_DND_DROP_SNODE
;
action
.
acceptableCode
=
TSDB_CODE_DND_SNODE_NOT_DEPLOYED
;
...
...
source/dnode/mnode/impl/test/profile/profile.cpp
浏览文件 @
f0e69747
...
...
@@ -167,10 +167,12 @@ TEST_F(MndTestProfile, 05_KillConnMsg) {
// temporary remove since kill will use new heartbeat msg
#if 0
{
int32_t contLen = sizeof(SKillConnReq);
SKillConnReq killReq = {0};
killReq.connId = connId;
SKillConnReq* pReq = (SKillConnReq*)rpcMallocCont(contLen);
pReq->connId = htonl(connId);
int32_t contLen = tSerializeSKillConnReq(NULL, 0, &killReq);
void* pReq = rpcMallocCont(contLen);
tSerializeSKillConnReq(pReq, contLen, &killReq);
SRpcMsg* pRsp = test.SendReq(TDMT_MND_KILL_CONN, pReq, contLen);
ASSERT_NE(pRsp, nullptr);
...
...
@@ -226,10 +228,12 @@ TEST_F(MndTestProfile, 05_KillConnMsg) {
}
TEST_F
(
MndTestProfile
,
06
_KillConnMsg_InvalidConn
)
{
int32_t
contLen
=
sizeof
(
SKillConnReq
);
SKillConnReq
killReq
=
{
0
};
killReq
.
connId
=
2345
;
SKillConnReq
*
pReq
=
(
SKillConnReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
connId
=
htonl
(
2345
);
int32_t
contLen
=
tSerializeSKillConnReq
(
NULL
,
0
,
&
killReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSKillConnReq
(
pReq
,
contLen
,
&
killReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_KILL_CONN
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -240,11 +244,13 @@ TEST_F(MndTestProfile, 07_KillQueryMsg) {
// temporary remove since kill will use new heartbeat msg
#if 0
{
int32_t contLen = sizeof(SKillQueryReq);
SKillQueryReq killReq = {0};
killReq.connId = connId;
killReq.queryId = 1234;
SKillQueryReq* pReq = (SKillQueryReq*)rpcMallocCont(contLen
);
pReq->connId = htonl(connId
);
pReq->queryId = htonl(1234
);
int32_t contLen = tSerializeSKillQueryReq(NULL, 0, &killReq
);
void* pReq = rpcMallocCont(contLen
);
tSerializeSKillQueryReq(pReq, contLen, &killReq
);
SRpcMsg* pRsp = test.SendReq(TDMT_MND_KILL_QUERY, pReq, contLen);
ASSERT_NE(pRsp, nullptr);
...
...
@@ -291,11 +297,13 @@ TEST_F(MndTestProfile, 07_KillQueryMsg) {
}
TEST_F
(
MndTestProfile
,
08
_KillQueryMsg_InvalidConn
)
{
int32_t
contLen
=
sizeof
(
SKillQueryReq
);
SKillQueryReq
killReq
=
{
0
};
killReq
.
connId
=
2345
;
killReq
.
queryId
=
2345
;
SKillQueryReq
*
pReq
=
(
SKillQueryReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
connId
=
htonl
(
2345
);
pReq
->
queryId
=
htonl
(
1234
);
int32_t
contLen
=
tSerializeSKillQueryReq
(
NULL
,
0
,
&
killReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSKillQueryReq
(
pReq
,
contLen
,
&
killReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_KILL_QUERY
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录