Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
a536e608
T
TDengine
项目概览
taosdata
/
TDengine
接近 2 年 前同步成功
通知
1192
Star
22018
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看板
提交
a536e608
编写于
12月 27, 2021
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add show dnodes case
上级
c6e81f92
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
48 addition
and
60 deletion
+48
-60
include/common/tmsg.h
include/common/tmsg.h
+1
-1
source/dnode/mgmt/impl/test/dnode/dnode.cpp
source/dnode/mgmt/impl/test/dnode/dnode.cpp
+8
-4
source/dnode/mgmt/impl/test/mnode/mnode.cpp
source/dnode/mgmt/impl/test/mnode/mnode.cpp
+2
-1
source/dnode/mnode/impl/src/mndDnode.c
source/dnode/mnode/impl/src/mndDnode.c
+14
-15
source/libs/parser/src/astToMsg.c
source/libs/parser/src/astToMsg.c
+2
-2
tests/script/unique/dnode/basic1.sim
tests/script/unique/dnode/basic1.sim
+20
-2
tests/tsim/src/simSystem.c
tests/tsim/src/simSystem.c
+1
-35
未找到文件。
include/common/tmsg.h
浏览文件 @
a536e608
...
...
@@ -826,7 +826,7 @@ typedef struct SShowRsp {
}
SShowRsp
;
typedef
struct
{
char
ep
[
TSDB_FQDN_LEN
];
// end point, hostname:port
char
fqdn
[
TSDB_FQDN_LEN
];
// end point, hostname:port
int32_t
port
;
}
SCreateDnodeMsg
;
...
...
source/dnode/mgmt/impl/test/dnode/dnode.cpp
浏览文件 @
a536e608
...
...
@@ -91,7 +91,8 @@ TEST_F(DndTestDnode, 03_Create_Drop_Restart_Dnode) {
int32_t
contLen
=
sizeof
(
SCreateDnodeMsg
);
SCreateDnodeMsg
*
pReq
=
(
SCreateDnodeMsg
*
)
rpcMallocCont
(
contLen
);
strcpy
(
pReq
->
ep
,
"localhost:9042"
);
strcpy
(
pReq
->
fqdn
,
"localhost"
);
pReq
->
port
=
htonl
(
9042
);
SRpcMsg
*
pMsg
=
test
.
SendMsg
(
TDMT_MND_CREATE_DNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pMsg
,
nullptr
);
...
...
@@ -148,7 +149,8 @@ TEST_F(DndTestDnode, 03_Create_Drop_Restart_Dnode) {
int32_t
contLen
=
sizeof
(
SCreateDnodeMsg
);
SCreateDnodeMsg
*
pReq
=
(
SCreateDnodeMsg
*
)
rpcMallocCont
(
contLen
);
strcpy
(
pReq
->
ep
,
"localhost:9043"
);
strcpy
(
pReq
->
fqdn
,
"localhost"
);
pReq
->
port
=
htonl
(
9043
);
SRpcMsg
*
pMsg
=
test
.
SendMsg
(
TDMT_MND_CREATE_DNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pMsg
,
nullptr
);
...
...
@@ -159,7 +161,8 @@ TEST_F(DndTestDnode, 03_Create_Drop_Restart_Dnode) {
int32_t
contLen
=
sizeof
(
SCreateDnodeMsg
);
SCreateDnodeMsg
*
pReq
=
(
SCreateDnodeMsg
*
)
rpcMallocCont
(
contLen
);
strcpy
(
pReq
->
ep
,
"localhost:9044"
);
strcpy
(
pReq
->
fqdn
,
"localhost"
);
pReq
->
port
=
htonl
(
904
);
SRpcMsg
*
pMsg
=
test
.
SendMsg
(
TDMT_MND_CREATE_DNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pMsg
,
nullptr
);
...
...
@@ -170,7 +173,8 @@ TEST_F(DndTestDnode, 03_Create_Drop_Restart_Dnode) {
int32_t
contLen
=
sizeof
(
SCreateDnodeMsg
);
SCreateDnodeMsg
*
pReq
=
(
SCreateDnodeMsg
*
)
rpcMallocCont
(
contLen
);
strcpy
(
pReq
->
ep
,
"localhost:9045"
);
strcpy
(
pReq
->
fqdn
,
"localhost"
);
pReq
->
port
=
htonl
(
9045
);
SRpcMsg
*
pMsg
=
test
.
SendMsg
(
TDMT_MND_CREATE_DNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pMsg
,
nullptr
);
...
...
source/dnode/mgmt/impl/test/mnode/mnode.cpp
浏览文件 @
a536e608
...
...
@@ -102,7 +102,8 @@ TEST_F(DndTestMnode, 04_Create_Mnode) {
int32_t
contLen
=
sizeof
(
SCreateDnodeMsg
);
SCreateDnodeMsg
*
pReq
=
(
SCreateDnodeMsg
*
)
rpcMallocCont
(
contLen
);
strcpy
(
pReq
->
ep
,
"localhost:9062"
);
strcpy
(
pReq
->
fqdn
,
"localhost"
);
pReq
->
port
=
htonl
(
9062
);
SRpcMsg
*
pMsg
=
test
.
SendMsg
(
TDMT_MND_CREATE_DNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pMsg
,
nullptr
);
...
...
source/dnode/mnode/impl/src/mndDnode.c
浏览文件 @
a536e608
...
...
@@ -386,20 +386,16 @@ static int32_t mndCreateDnode(SMnode *pMnode, SMnodeMsg *pMsg, SCreateDnodeMsg *
dnodeObj
.
id
=
sdbGetMaxId
(
pMnode
->
pSdb
,
SDB_DNODE
);
dnodeObj
.
createdTime
=
taosGetTimestampMs
();
dnodeObj
.
updateTime
=
dnodeObj
.
createdTime
;
taosGetFqdnPortFromEp
(
pCreate
->
ep
,
dnodeObj
.
fqdn
,
&
dnodeObj
.
port
);
if
(
dnodeObj
.
fqdn
[
0
]
==
0
||
dnodeObj
.
port
<=
0
)
{
terrno
=
TSDB_CODE_MND_INVALID_DNODE_EP
;
mError
(
"dnode:%s, failed to create since %s"
,
pCreate
->
ep
,
terrstr
());
return
terrno
;
}
dnodeObj
.
port
=
pCreate
->
port
;
memcpy
(
dnodeObj
.
fqdn
,
pCreate
->
fqdn
,
TSDB_FQDN_LEN
);
snprintf
(
dnodeObj
.
ep
,
"%s:%u"
,
dnodeObj
.
fqdn
,
dnodeObj
.
port
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
&
pMsg
->
rpcMsg
);
if
(
pTrans
==
NULL
)
{
mError
(
"dnode:%s, failed to create since %s"
,
pCreate
->
ep
,
terrstr
());
mError
(
"dnode:%s, failed to create since %s"
,
dnodeObj
.
ep
,
terrstr
());
return
-
1
;
}
mDebug
(
"trans:%d, used to create dnode:%s"
,
pTrans
->
id
,
pCreate
->
ep
);
mDebug
(
"trans:%d, used to create dnode:%s"
,
pTrans
->
id
,
dnodeObj
.
ep
);
SSdbRaw
*
pRedoRaw
=
mndDnodeActionEncode
(
&
dnodeObj
);
if
(
pRedoRaw
==
NULL
||
mndTransAppendRedolog
(
pTrans
,
pRedoRaw
)
!=
0
)
{
...
...
@@ -423,17 +419,20 @@ static int32_t mndProcessCreateDnodeMsg(SMnodeMsg *pMsg) {
SMnode
*
pMnode
=
pMsg
->
pMnode
;
SCreateDnodeMsg
*
pCreate
=
pMsg
->
rpcMsg
.
pCont
;
mDebug
(
"dnode:%s
, start to create"
,
pCreate
->
ep
);
mDebug
(
"dnode:%s
:%d, start to create"
,
pCreate
->
fqdn
,
pCreate
->
port
);
if
(
pCreate
->
ep
[
0
]
==
0
)
{
pCreate
->
port
=
htonl
(
pCreate
->
port
);
if
(
pCreate
->
fqdn
[
0
]
==
0
||
pCreate
->
port
<=
0
||
pCreate
->
port
>
UINT16_MAX
)
{
terrno
=
TSDB_CODE_MND_INVALID_DNODE_EP
;
mError
(
"dnode:%s
, failed to create since %s"
,
pCreate
->
ep
,
terrstr
());
mError
(
"dnode:%s
:%d, failed to create since %s"
,
pCreate
->
fqdn
,
pCreate
->
port
,
terrstr
());
return
-
1
;
}
SDnodeObj
*
pDnode
=
mndAcquireDnodeByEp
(
pMnode
,
pCreate
->
ep
);
char
ep
[
TSDB_EP_LEN
];
snprintf
(
ep
,
TSDB_EP_LEN
,
"%s:%d"
,
pCreate
->
fqdn
,
pCreate
->
port
);
SDnodeObj
*
pDnode
=
mndAcquireDnodeByEp
(
pMnode
,
ep
);
if
(
pDnode
!=
NULL
)
{
mError
(
"dnode:%d, already exist
"
,
pDnode
->
id
);
mError
(
"dnode:%d, already exist
, %s:%u"
,
pDnode
->
id
,
pCreate
->
fqdn
,
pCreate
->
port
);
mndReleaseDnode
(
pMnode
,
pDnode
);
terrno
=
TSDB_CODE_MND_DNODE_ALREADY_EXIST
;
return
-
1
;
...
...
@@ -442,7 +441,7 @@ static int32_t mndProcessCreateDnodeMsg(SMnodeMsg *pMsg) {
int32_t
code
=
mndCreateDnode
(
pMnode
,
pMsg
,
pCreate
);
if
(
code
!=
0
)
{
mError
(
"dnode:%s
, failed to create since %s"
,
pCreate
->
ep
,
terrstr
());
mError
(
"dnode:%s
:%d, failed to create since %s"
,
pCreate
->
fqdn
,
pCreate
->
port
,
terrstr
());
return
-
1
;
}
...
...
source/libs/parser/src/astToMsg.c
浏览文件 @
a536e608
...
...
@@ -414,8 +414,8 @@ SCreateDnodeMsg *buildCreateDnodeMsg(SSqlInfo* pInfo, int32_t* len, SMsgBuf* pMs
return
NULL
;
}
strncpy
(
pCreate
->
ep
,
id
->
z
,
id
->
n
);
pCreate
->
port
=
val
;
strncpy
(
pCreate
->
fqdn
,
id
->
z
,
id
->
n
);
pCreate
->
port
=
htonl
(
val
)
;
*
len
=
sizeof
(
SCreateDnodeMsg
);
return
pCreate
;
...
...
tests/script/unique/dnode/basic1.sim
浏览文件 @
a536e608
...
...
@@ -33,7 +33,9 @@ if $data02 != master then
endi
print =============== create dnodes
sql create dnode $hostname2
sql create dnode $hostname port 7200
sleep 2000
sql show dnodes;
if $rows != 2 then
return -1
...
...
@@ -47,6 +49,22 @@ if $data10 != 2 then
return -1
endi
if $data02 != 0 then
return -1
endi
if $data12 != 0 then
return -1
endi
if $data04 != ready then
return -1
endi
if $data14 != ready then
return -1
endi
sql show mnodes;
if $rows != 1 then
return -1
...
...
@@ -56,7 +74,7 @@ if $data00 != 1 then
return -1
endi
if $data0
1
!= master then
if $data0
2
!= master then
return -1
endi
...
...
tests/tsim/src/simSystem.c
浏览文件 @
a536e608
...
...
@@ -42,41 +42,7 @@ char *simParseArbitratorName(char *varName) {
char
*
simParseHostName
(
char
*
varName
)
{
static
char
hostName
[
140
];
int32_t
index
=
atoi
(
varName
+
8
);
int32_t
port
=
7100
;
switch
(
index
)
{
case
1
:
port
=
7100
;
break
;
case
2
:
port
=
7200
;
break
;
case
3
:
port
=
7300
;
break
;
case
4
:
port
=
7400
;
break
;
case
5
:
port
=
7500
;
break
;
case
6
:
port
=
7600
;
break
;
case
7
:
port
=
7700
;
break
;
case
8
:
port
=
7800
;
break
;
case
9
:
port
=
7900
;
break
;
}
sprintf
(
hostName
,
"'%s:%d'"
,
simHostName
,
port
);
// simInfo("hostName:%s", hostName);
sprintf
(
hostName
,
"%s"
,
simHostName
);
return
hostName
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录