Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
896977e3
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看板
提交
896977e3
编写于
1月 07, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
minor changes
上级
b472f95f
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
51 addition
and
37 deletion
+51
-37
source/dnode/mgmt/impl/src/dndMnode.c
source/dnode/mgmt/impl/src/dndMnode.c
+11
-0
source/dnode/mgmt/impl/test/mnode/qmnode.cpp
source/dnode/mgmt/impl/test/mnode/qmnode.cpp
+39
-36
source/dnode/mgmt/impl/test/sut/src/sut.cpp
source/dnode/mgmt/impl/test/sut/src/sut.cpp
+1
-1
未找到文件。
source/dnode/mgmt/impl/src/dndMnode.c
浏览文件 @
896977e3
...
...
@@ -438,12 +438,14 @@ int32_t dndProcessCreateMnodeReq(SDnode *pDnode, SRpcMsg *pReq) {
if
(
pCreate
->
replica
<=
1
||
pCreate
->
dnodeId
!=
dndGetDnodeId
(
pDnode
))
{
terrno
=
TSDB_CODE_DND_MNODE_INVALID_OPTION
;
dError
(
"failed to create mnode since %s"
,
terrstr
());
return
-
1
;
}
SMnodeOpt
option
=
{
0
};
if
(
dndBuildMnodeOptionFromReq
(
pDnode
,
&
option
,
pCreate
)
!=
0
)
{
terrno
=
TSDB_CODE_DND_MNODE_INVALID_OPTION
;
dError
(
"failed to create mnode since %s"
,
terrstr
());
return
-
1
;
}
...
...
@@ -451,9 +453,11 @@ int32_t dndProcessCreateMnodeReq(SDnode *pDnode, SRpcMsg *pReq) {
if
(
pMnode
!=
NULL
)
{
dndReleaseMnode
(
pDnode
,
pMnode
);
terrno
=
TSDB_CODE_DND_MNODE_ALREADY_DEPLOYED
;
dError
(
"failed to create mnode since %s"
,
terrstr
());
return
-
1
;
}
dDebug
(
"start to create mnode"
);
return
dndOpenMnode
(
pDnode
,
&
option
);
}
...
...
@@ -462,21 +466,25 @@ int32_t dndProcessAlterMnodeReq(SDnode *pDnode, SRpcMsg *pReq) {
if
(
pAlter
->
dnodeId
!=
dndGetDnodeId
(
pDnode
))
{
terrno
=
TSDB_CODE_DND_MNODE_INVALID_OPTION
;
dError
(
"failed to alter mnode since %s"
,
terrstr
());
return
-
1
;
}
SMnodeOpt
option
=
{
0
};
if
(
dndBuildMnodeOptionFromReq
(
pDnode
,
&
option
,
pAlter
)
!=
0
)
{
terrno
=
TSDB_CODE_DND_MNODE_INVALID_OPTION
;
dError
(
"failed to alter mnode since %s"
,
terrstr
());
return
-
1
;
}
SMnode
*
pMnode
=
dndAcquireMnode
(
pDnode
);
if
(
pMnode
==
NULL
)
{
terrno
=
TSDB_CODE_DND_MNODE_NOT_DEPLOYED
;
dError
(
"failed to alter mnode since %s"
,
terrstr
());
return
-
1
;
}
dDebug
(
"start to alter mnode"
);
int32_t
code
=
dndAlterMnode
(
pDnode
,
&
option
);
dndReleaseMnode
(
pDnode
,
pMnode
);
...
...
@@ -489,15 +497,18 @@ int32_t dndProcessDropMnodeReq(SDnode *pDnode, SRpcMsg *pReq) {
if
(
pDrop
->
dnodeId
!=
dndGetDnodeId
(
pDnode
))
{
terrno
=
TSDB_CODE_DND_MNODE_INVALID_OPTION
;
dError
(
"failed to drop mnode since %s"
,
terrstr
());
return
-
1
;
}
SMnode
*
pMnode
=
dndAcquireMnode
(
pDnode
);
if
(
pMnode
!=
NULL
)
{
terrno
=
TSDB_CODE_DND_MNODE_NOT_DEPLOYED
;
dError
(
"failed to drop mnode since %s"
,
terrstr
());
return
-
1
;
}
dDebug
(
"start to drop mnode"
);
int32_t
code
=
dndDropMnode
(
pDnode
);
dndReleaseMnode
(
pDnode
,
pMnode
);
...
...
source/dnode/mgmt/impl/test/mnode/qmnode.cpp
浏览文件 @
896977e3
...
...
@@ -54,50 +54,53 @@ TEST_F(DndTestMnode, 01_Create_Dnode) {
}
TEST_F
(
DndTestMnode
,
01
_Create_Mnode
)
{
//
{
//
int32_t contLen = sizeof(SDCreateMnodeReq);
{
int32_t
contLen
=
sizeof
(
SDCreateMnodeReq
);
//
SDCreateMnodeReq* pReq = (SDCreateMnodeReq*)rpcMallocCont(contLen);
//
pReq->dnodeId = htonl(2);
//
pReq->replica = 1;
//
pReq->replicas[0].id = htonl(1);
//
pReq->replicas[0].port = htonl(9113);
//
strcpy(pReq->replicas[0].fqdn, "localhost");
SDCreateMnodeReq
*
pReq
=
(
SDCreateMnodeReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
dnodeId
=
htonl
(
2
);
pReq
->
replica
=
1
;
pReq
->
replicas
[
0
].
id
=
htonl
(
1
);
pReq
->
replicas
[
0
].
port
=
htonl
(
9113
);
strcpy
(
pReq
->
replicas
[
0
].
fqdn
,
"localhost"
);
//
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_MNODE, pReq, contLen);
//
ASSERT_NE(pRsp, nullptr);
// ASSERT_EQ(pRsp->code, TSDB_CODE_DND_MNODE_ID_INVALID
);
//
}
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_MNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_DND_MNODE_INVALID_OPTION
);
}
//
{
//
int32_t contLen = sizeof(SDCreateMnodeReq);
{
int32_t
contLen
=
sizeof
(
SDCreateMnodeReq
);
//
SDCreateMnodeReq* pReq = (SDCreateMnodeReq*)rpcMallocCont(contLen);
//
pReq->dnodeId = htonl(1);
//
pReq->replica = 1;
//
pReq->replicas[0].id = htonl(2);
//
pReq->replicas[0].port = htonl(9113);
//
strcpy(pReq->replicas[0].fqdn, "localhost");
SDCreateMnodeReq
*
pReq
=
(
SDCreateMnodeReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
dnodeId
=
htonl
(
1
);
pReq
->
replica
=
1
;
pReq
->
replicas
[
0
].
id
=
htonl
(
2
);
pReq
->
replicas
[
0
].
port
=
htonl
(
9113
);
strcpy
(
pReq
->
replicas
[
0
].
fqdn
,
"localhost"
);
//
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_MNODE, pReq, contLen);
//
ASSERT_NE(pRsp, nullptr);
// ASSERT_EQ(pRsp->code, TSDB_CODE_DND_MNODE_ID_NOT_FOUND
);
//
}
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_MNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_DND_MNODE_INVALID_OPTION
);
}
//
{
//
int32_t contLen = sizeof(SDCreateMnodeReq);
{
int32_t
contLen
=
sizeof
(
SDCreateMnodeReq
);
// SDCreateMnodeReq* pReq = (SDCreateMnodeReq*)rpcMallocCont(contLen);
// pReq->dnodeId = htonl(1);
// pReq->replica = 1;
// pReq->replicas[0].id = htonl(1);
// pReq->replicas[0].port = htonl(9113);
// strcpy(pReq->replicas[0].fqdn, "localhost");
SDCreateMnodeReq
*
pReq
=
(
SDCreateMnodeReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
dnodeId
=
htonl
(
1
);
pReq
->
replica
=
2
;
pReq
->
replicas
[
0
].
id
=
htonl
(
1
);
pReq
->
replicas
[
0
].
port
=
htonl
(
9113
);
strcpy
(
pReq
->
replicas
[
0
].
fqdn
,
"localhost"
);
pReq
->
replicas
[
1
].
id
=
htonl
(
1
);
pReq
->
replicas
[
1
].
port
=
htonl
(
9114
);
strcpy
(
pReq
->
replicas
[
1
].
fqdn
,
"localhost"
);
//
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_MNODE, pReq, contLen);
//
ASSERT_NE(pRsp, nullptr);
//
ASSERT_EQ(pRsp->code, TSDB_CODE_DND_MNODE_ALREADY_DEPLOYED);
//
}
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_MNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_DND_MNODE_ALREADY_DEPLOYED
);
}
// {
// int32_t contLen = sizeof(SDCreateMnodeReq);
...
...
source/dnode/mgmt/impl/test/sut/src/sut.cpp
浏览文件 @
896977e3
...
...
@@ -16,7 +16,7 @@
#include "sut.h"
void
Testbase
::
InitLog
(
const
char
*
path
)
{
dDebugFlag
=
0
;
dDebugFlag
=
143
;
vDebugFlag
=
0
;
mDebugFlag
=
143
;
cDebugFlag
=
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录