Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
268c3343
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看板
提交
268c3343
编写于
1月 04, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
minor changes
上级
7974143d
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
109 addition
and
68 deletion
+109
-68
include/common/tmsg.h
include/common/tmsg.h
+3
-3
source/dnode/mgmt/impl/src/dndBnode.c
source/dnode/mgmt/impl/src/dndBnode.c
+4
-4
source/dnode/mgmt/impl/src/dndQnode.c
source/dnode/mgmt/impl/src/dndQnode.c
+4
-4
source/dnode/mgmt/impl/src/dndSnode.c
source/dnode/mgmt/impl/src/dndSnode.c
+4
-4
source/dnode/mgmt/impl/test/bnode/bnode.cpp
source/dnode/mgmt/impl/test/bnode/bnode.cpp
+8
-8
source/dnode/mgmt/impl/test/qnode/dqnode.cpp
source/dnode/mgmt/impl/test/qnode/dqnode.cpp
+41
-0
source/dnode/mnode/impl/src/mndBnode.c
source/dnode/mnode/impl/src/mndBnode.c
+7
-7
source/dnode/mnode/impl/src/mndQnode.c
source/dnode/mnode/impl/src/mndQnode.c
+7
-7
source/dnode/mnode/impl/src/mndSnode.c
source/dnode/mnode/impl/src/mndSnode.c
+7
-7
source/dnode/mnode/impl/test/bnode/bnode.cpp
source/dnode/mnode/impl/test/bnode/bnode.cpp
+8
-8
source/dnode/mnode/impl/test/qnode/qnode.cpp
source/dnode/mnode/impl/test/qnode/qnode.cpp
+8
-8
source/dnode/mnode/impl/test/snode/snode.cpp
source/dnode/mnode/impl/test/snode/snode.cpp
+8
-8
未找到文件。
include/common/tmsg.h
浏览文件 @
268c3343
...
...
@@ -851,15 +851,15 @@ typedef struct {
typedef
struct
{
int32_t
dnodeId
;
}
SMCreateQnode
Msg
,
SMDropQnodeMsg
,
SDCreateQnodeMsg
,
SDDropQnodeMsg
;
}
SMCreateQnode
Req
,
SMDropQnodeReq
,
SDCreateQnodeReq
,
SDDropQnodeReq
;
typedef
struct
{
int32_t
dnodeId
;
}
SMCreateSnode
Msg
,
SMDropSnodeMsg
,
SDCreateSnodeMsg
,
SDDropSnodeMsg
;
}
SMCreateSnode
Req
,
SMDropSnodeReq
,
SDCreateSnodeReq
,
SDDropSnodeReq
;
typedef
struct
{
int32_t
dnodeId
;
}
SMCreateBnode
Msg
,
SMDropBnodeMsg
,
SDCreateBnodeMsg
,
SDDropBnodeMsg
;
}
SMCreateBnode
Req
,
SMDropBnodeReq
,
SDCreateBnodeReq
,
SDDropBnodeReq
;
typedef
struct
{
int32_t
dnodeId
;
...
...
source/dnode/mgmt/impl/src/dndBnode.c
浏览文件 @
268c3343
...
...
@@ -60,7 +60,7 @@ static int32_t dndReadBnodeFile(SDnode *pDnode) {
SBnodeMgmt
*
pMgmt
=
&
pDnode
->
bmgmt
;
int32_t
code
=
TSDB_CODE_DND_BNODE_READ_FILE_ERROR
;
int32_t
len
=
0
;
int32_t
maxLen
=
4096
;
int32_t
maxLen
=
1024
;
char
*
content
=
calloc
(
1
,
maxLen
+
1
);
cJSON
*
root
=
NULL
;
...
...
@@ -127,7 +127,7 @@ static int32_t dndWriteBnodeFile(SDnode *pDnode) {
}
int32_t
len
=
0
;
int32_t
maxLen
=
4096
;
int32_t
maxLen
=
1024
;
char
*
content
=
calloc
(
1
,
maxLen
+
1
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"{
\n
"
);
...
...
@@ -256,7 +256,7 @@ static int32_t dndDropBnode(SDnode *pDnode) {
}
int32_t
dndProcessCreateBnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pRpcMsg
)
{
SDCreateBnode
Msg
*
pMsg
=
pRpcMsg
->
pCont
;
SDCreateBnode
Req
*
pMsg
=
pRpcMsg
->
pCont
;
pMsg
->
dnodeId
=
htonl
(
pMsg
->
dnodeId
);
if
(
pMsg
->
dnodeId
!=
dndGetDnodeId
(
pDnode
))
{
...
...
@@ -268,7 +268,7 @@ int32_t dndProcessCreateBnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg) {
}
int32_t
dndProcessDropBnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pRpcMsg
)
{
SDDropBnode
Msg
*
pMsg
=
pRpcMsg
->
pCont
;
SDDropBnode
Req
*
pMsg
=
pRpcMsg
->
pCont
;
pMsg
->
dnodeId
=
htonl
(
pMsg
->
dnodeId
);
if
(
pMsg
->
dnodeId
!=
dndGetDnodeId
(
pDnode
))
{
...
...
source/dnode/mgmt/impl/src/dndQnode.c
浏览文件 @
268c3343
...
...
@@ -60,7 +60,7 @@ static int32_t dndReadQnodeFile(SDnode *pDnode) {
SQnodeMgmt
*
pMgmt
=
&
pDnode
->
qmgmt
;
int32_t
code
=
TSDB_CODE_DND_QNODE_READ_FILE_ERROR
;
int32_t
len
=
0
;
int32_t
maxLen
=
4096
;
int32_t
maxLen
=
1024
;
char
*
content
=
calloc
(
1
,
maxLen
+
1
);
cJSON
*
root
=
NULL
;
...
...
@@ -127,7 +127,7 @@ static int32_t dndWriteQnodeFile(SDnode *pDnode) {
}
int32_t
len
=
0
;
int32_t
maxLen
=
4096
;
int32_t
maxLen
=
1024
;
char
*
content
=
calloc
(
1
,
maxLen
+
1
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"{
\n
"
);
...
...
@@ -261,7 +261,7 @@ static int32_t dndDropQnode(SDnode *pDnode) {
}
int32_t
dndProcessCreateQnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pRpcMsg
)
{
SDCreateQnode
Msg
*
pMsg
=
pRpcMsg
->
pCont
;
SDCreateQnode
Req
*
pMsg
=
pRpcMsg
->
pCont
;
pMsg
->
dnodeId
=
htonl
(
pMsg
->
dnodeId
);
if
(
pMsg
->
dnodeId
!=
dndGetDnodeId
(
pDnode
))
{
...
...
@@ -273,7 +273,7 @@ int32_t dndProcessCreateQnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg) {
}
int32_t
dndProcessDropQnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pRpcMsg
)
{
SDDropQnode
Msg
*
pMsg
=
pRpcMsg
->
pCont
;
SDDropQnode
Req
*
pMsg
=
pRpcMsg
->
pCont
;
pMsg
->
dnodeId
=
htonl
(
pMsg
->
dnodeId
);
if
(
pMsg
->
dnodeId
!=
dndGetDnodeId
(
pDnode
))
{
...
...
source/dnode/mgmt/impl/src/dndSnode.c
浏览文件 @
268c3343
...
...
@@ -60,7 +60,7 @@ static int32_t dndReadSnodeFile(SDnode *pDnode) {
SSnodeMgmt
*
pMgmt
=
&
pDnode
->
smgmt
;
int32_t
code
=
TSDB_CODE_DND_SNODE_READ_FILE_ERROR
;
int32_t
len
=
0
;
int32_t
maxLen
=
4096
;
int32_t
maxLen
=
1024
;
char
*
content
=
calloc
(
1
,
maxLen
+
1
);
cJSON
*
root
=
NULL
;
...
...
@@ -127,7 +127,7 @@ static int32_t dndWriteSnodeFile(SDnode *pDnode) {
}
int32_t
len
=
0
;
int32_t
maxLen
=
4096
;
int32_t
maxLen
=
1024
;
char
*
content
=
calloc
(
1
,
maxLen
+
1
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"{
\n
"
);
...
...
@@ -256,7 +256,7 @@ static int32_t dndDropSnode(SDnode *pDnode) {
}
int32_t
dndProcessCreateSnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pRpcMsg
)
{
SDCreateSnode
Msg
*
pMsg
=
pRpcMsg
->
pCont
;
SDCreateSnode
Req
*
pMsg
=
pRpcMsg
->
pCont
;
pMsg
->
dnodeId
=
htonl
(
pMsg
->
dnodeId
);
if
(
pMsg
->
dnodeId
!=
dndGetDnodeId
(
pDnode
))
{
...
...
@@ -268,7 +268,7 @@ int32_t dndProcessCreateSnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg) {
}
int32_t
dndProcessDropSnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pRpcMsg
)
{
SDDropSnode
Msg
*
pMsg
=
pRpcMsg
->
pCont
;
SDDropSnode
Req
*
pMsg
=
pRpcMsg
->
pCont
;
pMsg
->
dnodeId
=
htonl
(
pMsg
->
dnodeId
);
if
(
pMsg
->
dnodeId
!=
dndGetDnodeId
(
pDnode
))
{
...
...
source/dnode/mgmt/impl/test/bnode/bnode.cpp
浏览文件 @
268c3343
...
...
@@ -52,9 +52,9 @@ TEST_F(DndTestBnode, 01_ShowBnode) {
TEST_F
(
DndTestBnode
,
02
_Create_Bnode_Invalid_Id
)
{
{
int32_t
contLen
=
sizeof
(
SMCreateBnode
Msg
);
int32_t
contLen
=
sizeof
(
SMCreateBnode
Req
);
SMCreateBnode
Msg
*
pReq
=
(
SMCreateBnodeMsg
*
)
rpcMallocCont
(
contLen
);
SMCreateBnode
Req
*
pReq
=
(
SMCreateBnodeReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
dnodeId
=
htonl
(
1
);
SRpcMsg
*
pMsg
=
test
.
SendMsg
(
TDMT_MND_CREATE_BNODE
,
pReq
,
contLen
);
...
...
@@ -79,9 +79,9 @@ TEST_F(DndTestBnode, 02_Create_Bnode_Invalid_Id) {
TEST_F
(
DndTestBnode
,
03
_Create_Bnode_Invalid_Id
)
{
{
int32_t
contLen
=
sizeof
(
SMCreateBnode
Msg
);
int32_t
contLen
=
sizeof
(
SMCreateBnode
Req
);
SMCreateBnode
Msg
*
pReq
=
(
SMCreateBnodeMsg
*
)
rpcMallocCont
(
contLen
);
SMCreateBnode
Req
*
pReq
=
(
SMCreateBnodeReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
dnodeId
=
htonl
(
2
);
SRpcMsg
*
pMsg
=
test
.
SendMsg
(
TDMT_MND_CREATE_BNODE
,
pReq
,
contLen
);
...
...
@@ -111,9 +111,9 @@ TEST_F(DndTestBnode, 04_Create_Bnode) {
{
// create bnode
int32_t
contLen
=
sizeof
(
SMCreateBnode
Msg
);
int32_t
contLen
=
sizeof
(
SMCreateBnode
Req
);
SMCreateBnode
Msg
*
pReq
=
(
SMCreateBnodeMsg
*
)
rpcMallocCont
(
contLen
);
SMCreateBnode
Req
*
pReq
=
(
SMCreateBnodeReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
dnodeId
=
htonl
(
2
);
SRpcMsg
*
pMsg
=
test
.
SendMsg
(
TDMT_MND_CREATE_BNODE
,
pReq
,
contLen
);
...
...
@@ -134,9 +134,9 @@ TEST_F(DndTestBnode, 04_Create_Bnode) {
{
// drop bnode
int32_t
contLen
=
sizeof
(
SMDropBnode
Msg
);
int32_t
contLen
=
sizeof
(
SMDropBnode
Req
);
SMDropBnode
Msg
*
pReq
=
(
SMDropBnodeMsg
*
)
rpcMallocCont
(
contLen
);
SMDropBnode
Req
*
pReq
=
(
SMDropBnodeReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
dnodeId
=
htonl
(
2
);
SRpcMsg
*
pMsg
=
test
.
SendMsg
(
TDMT_MND_DROP_BNODE
,
pReq
,
contLen
);
...
...
source/dnode/mgmt/impl/test/qnode/dqnode.cpp
浏览文件 @
268c3343
...
...
@@ -24,3 +24,44 @@ class DndTestQnode : public ::testing::Test {
};
Testbase
DndTestQnode
::
test
;
TEST_F
(
DndTestQnode
,
04
_Drop_User
)
{
{
int32_t
contLen
=
sizeof
(
SDropUserReq
);
SDropUserReq
*
pReq
=
(
SDropUserReq
*
)
rpcMallocCont
(
contLen
);
strcpy
(
pReq
->
user
,
""
);
SRpcMsg
*
pMsg
=
test
.
SendMsg
(
TDMT_MND_DROP_USER
,
pReq
,
contLen
);
ASSERT_NE
(
pMsg
,
nullptr
);
ASSERT_EQ
(
pMsg
->
code
,
TSDB_CODE_MND_INVALID_USER_FORMAT
);
}
// {
// int32_t contLen = sizeof(SDropUserReq);
// SDropUserReq* pReq = (SDropUserReq*)rpcMallocCont(contLen);
// strcpy(pReq->user, "u4");
// SRpcMsg* pMsg = test.SendMsg(TDMT_MND_DROP_USER, pReq, contLen);
// ASSERT_NE(pMsg, nullptr);
// ASSERT_EQ(pMsg->code, TSDB_CODE_MND_USER_NOT_EXIST);
// }
// {
// int32_t contLen = sizeof(SDropUserReq);
// SDropUserReq* pReq = (SDropUserReq*)rpcMallocCont(contLen);
// strcpy(pReq->user, "u1");
// SRpcMsg* pMsg = test.SendMsg(TDMT_MND_DROP_USER, pReq, contLen);
// ASSERT_NE(pMsg, nullptr);
// ASSERT_EQ(pMsg->code, 0);
// }
// test.SendShowMetaMsg(TSDB_MGMT_TABLE_USER, "");
// CHECK_META("show users", 4);
// test.SendShowRetrieveMsg();
// EXPECT_EQ(test.GetShowRows(), 1);
}
\ No newline at end of file
source/dnode/mnode/impl/src/mndBnode.c
浏览文件 @
268c3343
...
...
@@ -178,7 +178,7 @@ static int32_t mndSetCreateBnodeCommitLogs(STrans *pTrans, SBnodeObj *pObj) {
}
static
int32_t
mndSetCreateBnodeRedoActions
(
STrans
*
pTrans
,
SDnodeObj
*
pDnode
,
SBnodeObj
*
pObj
)
{
SDCreateBnode
Msg
*
pMsg
=
malloc
(
sizeof
(
SDCreateBnodeMsg
));
SDCreateBnode
Req
*
pMsg
=
malloc
(
sizeof
(
SDCreateBnodeReq
));
if
(
pMsg
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
...
...
@@ -188,7 +188,7 @@ static int32_t mndSetCreateBnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, S
STransAction
action
=
{
0
};
action
.
epSet
=
mndGetDnodeEpset
(
pDnode
);
action
.
pCont
=
pMsg
;
action
.
contLen
=
sizeof
(
SDCreateBnode
Msg
);
action
.
contLen
=
sizeof
(
SDCreateBnode
Req
);
action
.
msgType
=
TDMT_DND_CREATE_BNODE
;
if
(
mndTransAppendRedoAction
(
pTrans
,
&
action
)
!=
0
)
{
...
...
@@ -199,7 +199,7 @@ static int32_t mndSetCreateBnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, S
return
0
;
}
static
int32_t
mndCreateBnode
(
SMnode
*
pMnode
,
SMnodeMsg
*
pMsg
,
SDnodeObj
*
pDnode
,
SMCreateBnode
Msg
*
pCreate
)
{
static
int32_t
mndCreateBnode
(
SMnode
*
pMnode
,
SMnodeMsg
*
pMsg
,
SDnodeObj
*
pDnode
,
SMCreateBnode
Req
*
pCreate
)
{
SBnodeObj
bnodeObj
=
{
0
};
bnodeObj
.
id
=
pDnode
->
id
;
bnodeObj
.
createdTime
=
taosGetTimestampMs
();
...
...
@@ -242,7 +242,7 @@ CREATE_BNODE_OVER:
static
int32_t
mndProcessCreateBnodeReq
(
SMnodeMsg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
pMnode
;
SMCreateBnode
Msg
*
pCreate
=
pMsg
->
rpcMsg
.
pCont
;
SMCreateBnode
Req
*
pCreate
=
pMsg
->
rpcMsg
.
pCont
;
pCreate
->
dnodeId
=
htonl
(
pCreate
->
dnodeId
);
...
...
@@ -290,7 +290,7 @@ static int32_t mndSetDropBnodeCommitLogs(STrans *pTrans, SBnodeObj *pObj) {
}
static
int32_t
mndSetDropBnodeRedoActions
(
STrans
*
pTrans
,
SDnodeObj
*
pDnode
,
SBnodeObj
*
pObj
)
{
SDDropBnode
Msg
*
pMsg
=
malloc
(
sizeof
(
SDDropBnodeMsg
));
SDDropBnode
Req
*
pMsg
=
malloc
(
sizeof
(
SDDropBnodeReq
));
if
(
pMsg
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
...
...
@@ -300,7 +300,7 @@ static int32_t mndSetDropBnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SBn
STransAction
action
=
{
0
};
action
.
epSet
=
mndGetDnodeEpset
(
pDnode
);
action
.
pCont
=
pMsg
;
action
.
contLen
=
sizeof
(
SDDropBnode
Msg
);
action
.
contLen
=
sizeof
(
SDDropBnode
Req
);
action
.
msgType
=
TDMT_DND_DROP_BNODE
;
if
(
mndTransAppendRedoAction
(
pTrans
,
&
action
)
!=
0
)
{
...
...
@@ -350,7 +350,7 @@ DROP_BNODE_OVER:
static
int32_t
mndProcessDropBnodeReq
(
SMnodeMsg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
pMnode
;
SMDropBnode
Msg
*
pDrop
=
pMsg
->
rpcMsg
.
pCont
;
SMDropBnode
Req
*
pDrop
=
pMsg
->
rpcMsg
.
pCont
;
pDrop
->
dnodeId
=
htonl
(
pDrop
->
dnodeId
);
mDebug
(
"bnode:%d, start to drop"
,
pDrop
->
dnodeId
);
...
...
source/dnode/mnode/impl/src/mndQnode.c
浏览文件 @
268c3343
...
...
@@ -178,7 +178,7 @@ static int32_t mndSetCreateQnodeCommitLogs(STrans *pTrans, SQnodeObj *pObj) {
}
static
int32_t
mndSetCreateQnodeRedoActions
(
STrans
*
pTrans
,
SDnodeObj
*
pDnode
,
SQnodeObj
*
pObj
)
{
SDCreateQnode
Msg
*
pMsg
=
malloc
(
sizeof
(
SDCreateQnodeMsg
));
SDCreateQnode
Req
*
pMsg
=
malloc
(
sizeof
(
SDCreateQnodeReq
));
if
(
pMsg
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
...
...
@@ -188,7 +188,7 @@ static int32_t mndSetCreateQnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, S
STransAction
action
=
{
0
};
action
.
epSet
=
mndGetDnodeEpset
(
pDnode
);
action
.
pCont
=
pMsg
;
action
.
contLen
=
sizeof
(
SDCreateQnode
Msg
);
action
.
contLen
=
sizeof
(
SDCreateQnode
Req
);
action
.
msgType
=
TDMT_DND_CREATE_QNODE
;
if
(
mndTransAppendRedoAction
(
pTrans
,
&
action
)
!=
0
)
{
...
...
@@ -199,7 +199,7 @@ static int32_t mndSetCreateQnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, S
return
0
;
}
static
int32_t
mndCreateQnode
(
SMnode
*
pMnode
,
SMnodeMsg
*
pMsg
,
SDnodeObj
*
pDnode
,
SMCreateQnode
Msg
*
pCreate
)
{
static
int32_t
mndCreateQnode
(
SMnode
*
pMnode
,
SMnodeMsg
*
pMsg
,
SDnodeObj
*
pDnode
,
SMCreateQnode
Req
*
pCreate
)
{
SQnodeObj
qnodeObj
=
{
0
};
qnodeObj
.
id
=
pDnode
->
id
;
qnodeObj
.
createdTime
=
taosGetTimestampMs
();
...
...
@@ -242,7 +242,7 @@ CREATE_QNODE_OVER:
static
int32_t
mndProcessCreateQnodeReq
(
SMnodeMsg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
pMnode
;
SMCreateQnode
Msg
*
pCreate
=
pMsg
->
rpcMsg
.
pCont
;
SMCreateQnode
Req
*
pCreate
=
pMsg
->
rpcMsg
.
pCont
;
pCreate
->
dnodeId
=
htonl
(
pCreate
->
dnodeId
);
...
...
@@ -290,7 +290,7 @@ static int32_t mndSetDropQnodeCommitLogs(STrans *pTrans, SQnodeObj *pObj) {
}
static
int32_t
mndSetDropQnodeRedoActions
(
STrans
*
pTrans
,
SDnodeObj
*
pDnode
,
SQnodeObj
*
pObj
)
{
SDDropQnode
Msg
*
pMsg
=
malloc
(
sizeof
(
SDDropQnodeMsg
));
SDDropQnode
Req
*
pMsg
=
malloc
(
sizeof
(
SDDropQnodeReq
));
if
(
pMsg
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
...
...
@@ -300,7 +300,7 @@ static int32_t mndSetDropQnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SQn
STransAction
action
=
{
0
};
action
.
epSet
=
mndGetDnodeEpset
(
pDnode
);
action
.
pCont
=
pMsg
;
action
.
contLen
=
sizeof
(
SDDropQnode
Msg
);
action
.
contLen
=
sizeof
(
SDDropQnode
Req
);
action
.
msgType
=
TDMT_DND_DROP_QNODE
;
if
(
mndTransAppendRedoAction
(
pTrans
,
&
action
)
!=
0
)
{
...
...
@@ -350,7 +350,7 @@ DROP_QNODE_OVER:
static
int32_t
mndProcessDropQnodeReq
(
SMnodeMsg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
pMnode
;
SMDropQnode
Msg
*
pDrop
=
pMsg
->
rpcMsg
.
pCont
;
SMDropQnode
Req
*
pDrop
=
pMsg
->
rpcMsg
.
pCont
;
pDrop
->
dnodeId
=
htonl
(
pDrop
->
dnodeId
);
mDebug
(
"qnode:%d, start to drop"
,
pDrop
->
dnodeId
);
...
...
source/dnode/mnode/impl/src/mndSnode.c
浏览文件 @
268c3343
...
...
@@ -178,7 +178,7 @@ static int32_t mndSetCreateSnodeCommitLogs(STrans *pTrans, SSnodeObj *pObj) {
}
static
int32_t
mndSetCreateSnodeRedoActions
(
STrans
*
pTrans
,
SDnodeObj
*
pDnode
,
SSnodeObj
*
pObj
)
{
SDCreateSnode
Msg
*
pMsg
=
malloc
(
sizeof
(
SDCreateSnodeMsg
));
SDCreateSnode
Req
*
pMsg
=
malloc
(
sizeof
(
SDCreateSnodeReq
));
if
(
pMsg
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
...
...
@@ -188,7 +188,7 @@ static int32_t mndSetCreateSnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, S
STransAction
action
=
{
0
};
action
.
epSet
=
mndGetDnodeEpset
(
pDnode
);
action
.
pCont
=
pMsg
;
action
.
contLen
=
sizeof
(
SDCreateSnode
Msg
);
action
.
contLen
=
sizeof
(
SDCreateSnode
Req
);
action
.
msgType
=
TDMT_DND_CREATE_SNODE
;
if
(
mndTransAppendRedoAction
(
pTrans
,
&
action
)
!=
0
)
{
...
...
@@ -199,7 +199,7 @@ static int32_t mndSetCreateSnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, S
return
0
;
}
static
int32_t
mndCreateSnode
(
SMnode
*
pMnode
,
SMnodeMsg
*
pMsg
,
SDnodeObj
*
pDnode
,
SMCreateSnode
Msg
*
pCreate
)
{
static
int32_t
mndCreateSnode
(
SMnode
*
pMnode
,
SMnodeMsg
*
pMsg
,
SDnodeObj
*
pDnode
,
SMCreateSnode
Req
*
pCreate
)
{
SSnodeObj
snodeObj
=
{
0
};
snodeObj
.
id
=
pDnode
->
id
;
snodeObj
.
createdTime
=
taosGetTimestampMs
();
...
...
@@ -242,7 +242,7 @@ CREATE_SNODE_OVER:
static
int32_t
mndProcessCreateSnodeReq
(
SMnodeMsg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
pMnode
;
SMCreateSnode
Msg
*
pCreate
=
pMsg
->
rpcMsg
.
pCont
;
SMCreateSnode
Req
*
pCreate
=
pMsg
->
rpcMsg
.
pCont
;
pCreate
->
dnodeId
=
htonl
(
pCreate
->
dnodeId
);
...
...
@@ -290,7 +290,7 @@ static int32_t mndSetDropSnodeCommitLogs(STrans *pTrans, SSnodeObj *pObj) {
}
static
int32_t
mndSetDropSnodeRedoActions
(
STrans
*
pTrans
,
SDnodeObj
*
pDnode
,
SSnodeObj
*
pObj
)
{
SDDropSnode
Msg
*
pMsg
=
malloc
(
sizeof
(
SDDropSnodeMsg
));
SDDropSnode
Req
*
pMsg
=
malloc
(
sizeof
(
SDDropSnodeReq
));
if
(
pMsg
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
...
...
@@ -300,7 +300,7 @@ static int32_t mndSetDropSnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SSn
STransAction
action
=
{
0
};
action
.
epSet
=
mndGetDnodeEpset
(
pDnode
);
action
.
pCont
=
pMsg
;
action
.
contLen
=
sizeof
(
SDDropSnode
Msg
);
action
.
contLen
=
sizeof
(
SDDropSnode
Req
);
action
.
msgType
=
TDMT_DND_DROP_SNODE
;
if
(
mndTransAppendRedoAction
(
pTrans
,
&
action
)
!=
0
)
{
...
...
@@ -350,7 +350,7 @@ DROP_SNODE_OVER:
static
int32_t
mndProcessDropSnodeReq
(
SMnodeMsg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
pMnode
;
SMDropSnode
Msg
*
pDrop
=
pMsg
->
rpcMsg
.
pCont
;
SMDropSnode
Req
*
pDrop
=
pMsg
->
rpcMsg
.
pCont
;
pDrop
->
dnodeId
=
htonl
(
pDrop
->
dnodeId
);
mDebug
(
"snode:%d, start to drop"
,
pDrop
->
dnodeId
);
...
...
source/dnode/mnode/impl/test/bnode/bnode.cpp
浏览文件 @
268c3343
...
...
@@ -52,9 +52,9 @@ TEST_F(MndTestBnode, 01_Show_Bnode) {
TEST_F
(
MndTestBnode
,
02
_Create_Bnode_Invalid_Id
)
{
{
int32_t
contLen
=
sizeof
(
SMCreateBnode
Msg
);
int32_t
contLen
=
sizeof
(
SMCreateBnode
Req
);
SMCreateBnode
Msg
*
pReq
=
(
SMCreateBnodeMsg
*
)
rpcMallocCont
(
contLen
);
SMCreateBnode
Req
*
pReq
=
(
SMCreateBnodeReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
dnodeId
=
htonl
(
1
);
SRpcMsg
*
pMsg
=
test
.
SendMsg
(
TDMT_MND_CREATE_BNODE
,
pReq
,
contLen
);
...
...
@@ -79,9 +79,9 @@ TEST_F(MndTestBnode, 02_Create_Bnode_Invalid_Id) {
TEST_F
(
MndTestBnode
,
03
_Create_Bnode_Invalid_Id
)
{
{
int32_t
contLen
=
sizeof
(
SMCreateBnode
Msg
);
int32_t
contLen
=
sizeof
(
SMCreateBnode
Req
);
SMCreateBnode
Msg
*
pReq
=
(
SMCreateBnodeMsg
*
)
rpcMallocCont
(
contLen
);
SMCreateBnode
Req
*
pReq
=
(
SMCreateBnodeReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
dnodeId
=
htonl
(
2
);
SRpcMsg
*
pMsg
=
test
.
SendMsg
(
TDMT_MND_CREATE_BNODE
,
pReq
,
contLen
);
...
...
@@ -111,9 +111,9 @@ TEST_F(MndTestBnode, 04_Create_Bnode) {
{
// create bnode
int32_t
contLen
=
sizeof
(
SMCreateBnode
Msg
);
int32_t
contLen
=
sizeof
(
SMCreateBnode
Req
);
SMCreateBnode
Msg
*
pReq
=
(
SMCreateBnodeMsg
*
)
rpcMallocCont
(
contLen
);
SMCreateBnode
Req
*
pReq
=
(
SMCreateBnodeReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
dnodeId
=
htonl
(
2
);
SRpcMsg
*
pMsg
=
test
.
SendMsg
(
TDMT_MND_CREATE_BNODE
,
pReq
,
contLen
);
...
...
@@ -134,9 +134,9 @@ TEST_F(MndTestBnode, 04_Create_Bnode) {
{
// drop bnode
int32_t
contLen
=
sizeof
(
SMDropBnode
Msg
);
int32_t
contLen
=
sizeof
(
SMDropBnode
Req
);
SMDropBnode
Msg
*
pReq
=
(
SMDropBnodeMsg
*
)
rpcMallocCont
(
contLen
);
SMDropBnode
Req
*
pReq
=
(
SMDropBnodeReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
dnodeId
=
htonl
(
2
);
SRpcMsg
*
pMsg
=
test
.
SendMsg
(
TDMT_MND_DROP_BNODE
,
pReq
,
contLen
);
...
...
source/dnode/mnode/impl/test/qnode/qnode.cpp
浏览文件 @
268c3343
...
...
@@ -52,9 +52,9 @@ TEST_F(MndTestQnode, 01_Show_Qnode) {
TEST_F
(
MndTestQnode
,
02
_Create_Qnode_Invalid_Id
)
{
{
int32_t
contLen
=
sizeof
(
SMCreateQnode
Msg
);
int32_t
contLen
=
sizeof
(
SMCreateQnode
Req
);
SMCreateQnode
Msg
*
pReq
=
(
SMCreateQnodeMsg
*
)
rpcMallocCont
(
contLen
);
SMCreateQnode
Req
*
pReq
=
(
SMCreateQnodeReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
dnodeId
=
htonl
(
1
);
SRpcMsg
*
pMsg
=
test
.
SendMsg
(
TDMT_MND_CREATE_QNODE
,
pReq
,
contLen
);
...
...
@@ -79,9 +79,9 @@ TEST_F(MndTestQnode, 02_Create_Qnode_Invalid_Id) {
TEST_F
(
MndTestQnode
,
03
_Create_Qnode_Invalid_Id
)
{
{
int32_t
contLen
=
sizeof
(
SMCreateQnode
Msg
);
int32_t
contLen
=
sizeof
(
SMCreateQnode
Req
);
SMCreateQnode
Msg
*
pReq
=
(
SMCreateQnodeMsg
*
)
rpcMallocCont
(
contLen
);
SMCreateQnode
Req
*
pReq
=
(
SMCreateQnodeReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
dnodeId
=
htonl
(
2
);
SRpcMsg
*
pMsg
=
test
.
SendMsg
(
TDMT_MND_CREATE_QNODE
,
pReq
,
contLen
);
...
...
@@ -111,9 +111,9 @@ TEST_F(MndTestQnode, 04_Create_Qnode) {
{
// create qnode
int32_t
contLen
=
sizeof
(
SMCreateQnode
Msg
);
int32_t
contLen
=
sizeof
(
SMCreateQnode
Req
);
SMCreateQnode
Msg
*
pReq
=
(
SMCreateQnodeMsg
*
)
rpcMallocCont
(
contLen
);
SMCreateQnode
Req
*
pReq
=
(
SMCreateQnodeReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
dnodeId
=
htonl
(
2
);
SRpcMsg
*
pMsg
=
test
.
SendMsg
(
TDMT_MND_CREATE_QNODE
,
pReq
,
contLen
);
...
...
@@ -134,9 +134,9 @@ TEST_F(MndTestQnode, 04_Create_Qnode) {
{
// drop qnode
int32_t
contLen
=
sizeof
(
SMDropQnode
Msg
);
int32_t
contLen
=
sizeof
(
SMDropQnode
Req
);
SMDropQnode
Msg
*
pReq
=
(
SMDropQnodeMsg
*
)
rpcMallocCont
(
contLen
);
SMDropQnode
Req
*
pReq
=
(
SMDropQnodeReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
dnodeId
=
htonl
(
2
);
SRpcMsg
*
pMsg
=
test
.
SendMsg
(
TDMT_MND_DROP_QNODE
,
pReq
,
contLen
);
...
...
source/dnode/mnode/impl/test/snode/snode.cpp
浏览文件 @
268c3343
...
...
@@ -52,9 +52,9 @@ TEST_F(MndTestSnode, 01_Show_Snode) {
TEST_F
(
MndTestSnode
,
02
_Create_Snode_Invalid_Id
)
{
{
int32_t
contLen
=
sizeof
(
SMCreateSnode
Msg
);
int32_t
contLen
=
sizeof
(
SMCreateSnode
Req
);
SMCreateSnode
Msg
*
pReq
=
(
SMCreateSnodeMsg
*
)
rpcMallocCont
(
contLen
);
SMCreateSnode
Req
*
pReq
=
(
SMCreateSnodeReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
dnodeId
=
htonl
(
1
);
SRpcMsg
*
pMsg
=
test
.
SendMsg
(
TDMT_MND_CREATE_SNODE
,
pReq
,
contLen
);
...
...
@@ -79,9 +79,9 @@ TEST_F(MndTestSnode, 02_Create_Snode_Invalid_Id) {
TEST_F
(
MndTestSnode
,
03
_Create_Snode_Invalid_Id
)
{
{
int32_t
contLen
=
sizeof
(
SMCreateSnode
Msg
);
int32_t
contLen
=
sizeof
(
SMCreateSnode
Req
);
SMCreateSnode
Msg
*
pReq
=
(
SMCreateSnodeMsg
*
)
rpcMallocCont
(
contLen
);
SMCreateSnode
Req
*
pReq
=
(
SMCreateSnodeReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
dnodeId
=
htonl
(
2
);
SRpcMsg
*
pMsg
=
test
.
SendMsg
(
TDMT_MND_CREATE_SNODE
,
pReq
,
contLen
);
...
...
@@ -111,9 +111,9 @@ TEST_F(MndTestSnode, 04_Create_Snode) {
{
// create snode
int32_t
contLen
=
sizeof
(
SMCreateSnode
Msg
);
int32_t
contLen
=
sizeof
(
SMCreateSnode
Req
);
SMCreateSnode
Msg
*
pReq
=
(
SMCreateSnodeMsg
*
)
rpcMallocCont
(
contLen
);
SMCreateSnode
Req
*
pReq
=
(
SMCreateSnodeReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
dnodeId
=
htonl
(
2
);
SRpcMsg
*
pMsg
=
test
.
SendMsg
(
TDMT_MND_CREATE_SNODE
,
pReq
,
contLen
);
...
...
@@ -134,9 +134,9 @@ TEST_F(MndTestSnode, 04_Create_Snode) {
{
// drop snode
int32_t
contLen
=
sizeof
(
SMDropSnode
Msg
);
int32_t
contLen
=
sizeof
(
SMDropSnode
Req
);
SMDropSnode
Msg
*
pReq
=
(
SMDropSnodeMsg
*
)
rpcMallocCont
(
contLen
);
SMDropSnode
Req
*
pReq
=
(
SMDropSnodeReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
dnodeId
=
htonl
(
2
);
SRpcMsg
*
pMsg
=
test
.
SendMsg
(
TDMT_MND_DROP_SNODE
,
pReq
,
contLen
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录