Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
79f5088f
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
79f5088f
编写于
1月 07, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
minor changes
上级
12bbc08d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
64 addition
and
64 deletion
+64
-64
source/dnode/mgmt/impl/test/mnode/dmnode.cpp
source/dnode/mgmt/impl/test/mnode/dmnode.cpp
+0
-0
source/dnode/mnode/impl/src/mndMnode.c
source/dnode/mnode/impl/src/mndMnode.c
+64
-64
未找到文件。
source/dnode/mgmt/impl/test/mnode/
q
mnode.cpp
→
source/dnode/mgmt/impl/test/mnode/
d
mnode.cpp
浏览文件 @
79f5088f
文件已移动
source/dnode/mnode/impl/src/mndMnode.c
浏览文件 @
79f5088f
...
...
@@ -27,14 +27,14 @@ static SSdbRaw *mndMnodeActionEncode(SMnodeObj *pObj);
static
SSdbRow
*
mndMnodeActionDecode
(
SSdbRaw
*
pRaw
);
static
int32_t
mndMnodeActionInsert
(
SSdb
*
pSdb
,
SMnodeObj
*
pObj
);
static
int32_t
mndMnodeActionDelete
(
SSdb
*
pSdb
,
SMnodeObj
*
pObj
);
static
int32_t
mndMnodeActionUpdate
(
SSdb
*
pSdb
,
SMnodeObj
*
pOld
Mnode
,
SMnodeObj
*
pNewMnode
);
static
int32_t
mndProcessCreateMnodeReq
(
SMnodeMsg
*
p
Msg
);
static
int32_t
mndProcessDropMnodeReq
(
SMnodeMsg
*
p
Msg
);
static
int32_t
mndProcessCreateMnodeRsp
(
SMnodeMsg
*
p
Msg
);
static
int32_t
mndProcessAlterMnodeRsp
(
SMnodeMsg
*
p
Msg
);
static
int32_t
mndProcessDropMnodeRsp
(
SMnodeMsg
*
p
Msg
);
static
int32_t
mndGetMnodeMeta
(
SMnodeMsg
*
p
Msg
,
SShowObj
*
pShow
,
STableMetaMsg
*
pMeta
);
static
int32_t
mndRetrieveMnodes
(
SMnodeMsg
*
p
Msg
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
int32_t
mndMnodeActionUpdate
(
SSdb
*
pSdb
,
SMnodeObj
*
pOld
,
SMnodeObj
*
pNew
);
static
int32_t
mndProcessCreateMnodeReq
(
SMnodeMsg
*
p
Req
);
static
int32_t
mndProcessDropMnodeReq
(
SMnodeMsg
*
p
Req
);
static
int32_t
mndProcessCreateMnodeRsp
(
SMnodeMsg
*
p
Rsp
);
static
int32_t
mndProcessAlterMnodeRsp
(
SMnodeMsg
*
p
Rsp
);
static
int32_t
mndProcessDropMnodeRsp
(
SMnodeMsg
*
p
Rsp
);
static
int32_t
mndGetMnodeMeta
(
SMnodeMsg
*
p
Req
,
SShowObj
*
pShow
,
STableMetaMsg
*
pMeta
);
static
int32_t
mndRetrieveMnodes
(
SMnodeMsg
*
p
Req
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
void
mndCancelGetNextMnode
(
SMnode
*
pMnode
,
void
*
pIter
);
int32_t
mndInitMnode
(
SMnode
*
pMnode
)
{
...
...
@@ -65,7 +65,7 @@ void mndCleanupMnode(SMnode *pMnode) {}
static
SMnodeObj
*
mndAcquireMnode
(
SMnode
*
pMnode
,
int32_t
mnodeId
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SMnodeObj
*
pObj
=
sdbAcquire
(
pSdb
,
SDB_MNODE
,
&
mnodeId
);
if
(
pObj
==
NULL
)
{
if
(
pObj
==
NULL
&&
terrno
==
TSDB_CODE_SDB_OBJ_NOT_THERE
)
{
terrno
=
TSDB_CODE_MND_MNODE_NOT_EXIST
;
}
return
pObj
;
...
...
@@ -207,9 +207,9 @@ static int32_t mndMnodeActionDelete(SSdb *pSdb, SMnodeObj *pObj) {
return
0
;
}
static
int32_t
mndMnodeActionUpdate
(
SSdb
*
pSdb
,
SMnodeObj
*
pOld
Mnode
,
SMnodeObj
*
pNewMnode
)
{
mTrace
(
"mnode:%d, perform update action, old_row:%p new_row:%p"
,
pOld
Mnode
->
id
,
pOldMnode
,
pNewMnode
);
pOld
Mnode
->
updateTime
=
pNewMnode
->
updateTime
;
static
int32_t
mndMnodeActionUpdate
(
SSdb
*
pSdb
,
SMnodeObj
*
pOld
,
SMnodeObj
*
pNew
)
{
mTrace
(
"mnode:%d, perform update action, old_row:%p new_row:%p"
,
pOld
->
id
,
pOld
,
pNew
);
pOld
->
updateTime
=
pNew
->
updateTime
;
return
0
;
}
...
...
@@ -277,13 +277,13 @@ static int32_t mndSetCreateMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDno
void
*
pIter
=
NULL
;
int32_t
numOfReplicas
=
0
;
SDCreateMnodeReq
create
Msg
=
{
0
};
SDCreateMnodeReq
create
Req
=
{
0
};
while
(
1
)
{
SMnodeObj
*
pMObj
=
NULL
;
pIter
=
sdbFetch
(
pSdb
,
SDB_MNODE
,
pIter
,
(
void
**
)
&
pMObj
);
if
(
pIter
==
NULL
)
break
;
SReplica
*
pReplica
=
&
create
Msg
.
replicas
[
numOfReplicas
];
SReplica
*
pReplica
=
&
create
Req
.
replicas
[
numOfReplicas
];
pReplica
->
id
=
htonl
(
pMObj
->
id
);
pReplica
->
port
=
htons
(
pMObj
->
pDnode
->
port
);
memcpy
(
pReplica
->
fqdn
,
pMObj
->
pDnode
->
fqdn
,
TSDB_FQDN_LEN
);
...
...
@@ -292,13 +292,13 @@ static int32_t mndSetCreateMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDno
sdbRelease
(
pSdb
,
pMObj
);
}
SReplica
*
pReplica
=
&
create
Msg
.
replicas
[
numOfReplicas
];
SReplica
*
pReplica
=
&
create
Req
.
replicas
[
numOfReplicas
];
pReplica
->
id
=
htonl
(
pDnode
->
id
);
pReplica
->
port
=
htons
(
pDnode
->
port
);
memcpy
(
pReplica
->
fqdn
,
pDnode
->
fqdn
,
TSDB_FQDN_LEN
);
numOfReplicas
++
;
create
Msg
.
replica
=
numOfReplicas
;
create
Req
.
replica
=
numOfReplicas
;
while
(
1
)
{
SMnodeObj
*
pMObj
=
NULL
;
...
...
@@ -307,22 +307,22 @@ static int32_t mndSetCreateMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDno
STransAction
action
=
{
0
};
SDAlterMnodeReq
*
p
Msg
=
malloc
(
sizeof
(
SDAlterMnodeReq
));
if
(
p
Msg
==
NULL
)
{
SDAlterMnodeReq
*
p
Req
=
malloc
(
sizeof
(
SDAlterMnodeReq
));
if
(
p
Req
==
NULL
)
{
sdbCancelFetch
(
pSdb
,
pIter
);
sdbRelease
(
pSdb
,
pMObj
);
return
-
1
;
}
memcpy
(
p
Msg
,
&
createMsg
,
sizeof
(
SDAlterMnodeReq
));
memcpy
(
p
Req
,
&
createReq
,
sizeof
(
SDAlterMnodeReq
));
p
Msg
->
dnodeId
=
htonl
(
pMObj
->
id
);
p
Req
->
dnodeId
=
htonl
(
pMObj
->
id
);
action
.
epSet
=
mndGetDnodeEpset
(
pMObj
->
pDnode
);
action
.
pCont
=
p
Msg
;
action
.
pCont
=
p
Req
;
action
.
contLen
=
sizeof
(
SDAlterMnodeReq
);
action
.
msgType
=
TDMT_DND_ALTER_MNODE
;
if
(
mndTransAppendRedoAction
(
pTrans
,
&
action
)
!=
0
)
{
free
(
p
Msg
);
free
(
p
Req
);
sdbCancelFetch
(
pSdb
,
pIter
);
sdbRelease
(
pSdb
,
pMObj
);
return
-
1
;
...
...
@@ -335,17 +335,17 @@ static int32_t mndSetCreateMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDno
STransAction
action
=
{
0
};
action
.
epSet
=
mndGetDnodeEpset
(
pDnode
);
SDCreateMnodeReq
*
p
Msg
=
malloc
(
sizeof
(
SDCreateMnodeReq
));
if
(
p
Msg
==
NULL
)
return
-
1
;
memcpy
(
p
Msg
,
&
createMsg
,
sizeof
(
SDAlterMnodeReq
));
p
Msg
->
dnodeId
=
htonl
(
pObj
->
id
);
SDCreateMnodeReq
*
p
Req
=
malloc
(
sizeof
(
SDCreateMnodeReq
));
if
(
p
Req
==
NULL
)
return
-
1
;
memcpy
(
p
Req
,
&
createReq
,
sizeof
(
SDAlterMnodeReq
));
p
Req
->
dnodeId
=
htonl
(
pObj
->
id
);
action
.
epSet
=
mndGetDnodeEpset
(
pDnode
);
action
.
pCont
=
p
Msg
;
action
.
pCont
=
p
Req
;
action
.
contLen
=
sizeof
(
SDCreateMnodeReq
);
action
.
msgType
=
TDMT_DND_CREATE_MNODE
;
if
(
mndTransAppendRedoAction
(
pTrans
,
&
action
)
!=
0
)
{
free
(
p
Msg
);
free
(
p
Req
);
return
-
1
;
}
}
...
...
@@ -353,14 +353,14 @@ static int32_t mndSetCreateMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDno
return
0
;
}
static
int32_t
mndCreateMnode
(
SMnode
*
pMnode
,
SMnodeMsg
*
p
Msg
,
SDnodeObj
*
pDnode
,
SMCreateMnodeReq
*
pCreate
)
{
static
int32_t
mndCreateMnode
(
SMnode
*
pMnode
,
SMnodeMsg
*
p
Req
,
SDnodeObj
*
pDnode
,
SMCreateMnodeReq
*
pCreate
)
{
SMnodeObj
mnodeObj
=
{
0
};
mnodeObj
.
id
=
pDnode
->
id
;
mnodeObj
.
createdTime
=
taosGetTimestampMs
();
mnodeObj
.
updateTime
=
mnodeObj
.
createdTime
;
int32_t
code
=
-
1
;
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
&
p
Msg
->
rpcMsg
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
&
p
Req
->
rpcMsg
);
if
(
pTrans
==
NULL
)
{
mError
(
"mnode:%d, failed to create since %s"
,
pCreate
->
dnodeId
,
terrstr
());
goto
CREATE_MNODE_OVER
;
...
...
@@ -394,9 +394,9 @@ CREATE_MNODE_OVER:
return
code
;
}
static
int32_t
mndProcessCreateMnodeReq
(
SMnodeMsg
*
p
Msg
)
{
SMnode
*
pMnode
=
p
Msg
->
pMnode
;
SMCreateMnodeReq
*
pCreate
=
p
Msg
->
rpcMsg
.
pCont
;
static
int32_t
mndProcessCreateMnodeReq
(
SMnodeMsg
*
p
Req
)
{
SMnode
*
pMnode
=
p
Req
->
pMnode
;
SMCreateMnodeReq
*
pCreate
=
p
Req
->
rpcMsg
.
pCont
;
pCreate
->
dnodeId
=
htonl
(
pCreate
->
dnodeId
);
...
...
@@ -417,7 +417,7 @@ static int32_t mndProcessCreateMnodeReq(SMnodeMsg *pMsg) {
return
-
1
;
}
int32_t
code
=
mndCreateMnode
(
pMnode
,
p
Msg
,
pDnode
,
pCreate
);
int32_t
code
=
mndCreateMnode
(
pMnode
,
p
Req
,
pDnode
,
pCreate
);
mndReleaseDnode
(
pMnode
,
pDnode
);
if
(
code
!=
0
)
{
...
...
@@ -449,14 +449,14 @@ static int32_t mndSetDropMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDnode
void
*
pIter
=
NULL
;
int32_t
numOfReplicas
=
0
;
SDAlterMnodeReq
alter
Msg
=
{
0
};
SDAlterMnodeReq
alter
Req
=
{
0
};
while
(
1
)
{
SMnodeObj
*
pMObj
=
NULL
;
pIter
=
sdbFetch
(
pSdb
,
SDB_MNODE
,
pIter
,
(
void
**
)
&
pMObj
);
if
(
pIter
==
NULL
)
break
;
if
(
pMObj
->
id
!=
pObj
->
id
)
{
SReplica
*
pReplica
=
&
alter
Msg
.
replicas
[
numOfReplicas
];
SReplica
*
pReplica
=
&
alter
Req
.
replicas
[
numOfReplicas
];
pReplica
->
id
=
htonl
(
pMObj
->
id
);
pReplica
->
port
=
htons
(
pMObj
->
pDnode
->
port
);
memcpy
(
pReplica
->
fqdn
,
pMObj
->
pDnode
->
fqdn
,
TSDB_FQDN_LEN
);
...
...
@@ -466,7 +466,7 @@ static int32_t mndSetDropMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDnode
sdbRelease
(
pSdb
,
pMObj
);
}
alter
Msg
.
replica
=
numOfReplicas
;
alter
Req
.
replica
=
numOfReplicas
;
while
(
1
)
{
SMnodeObj
*
pMObj
=
NULL
;
...
...
@@ -475,22 +475,22 @@ static int32_t mndSetDropMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDnode
if
(
pMObj
->
id
!=
pObj
->
id
)
{
STransAction
action
=
{
0
};
SDAlterMnodeReq
*
p
Msg
=
malloc
(
sizeof
(
SDAlterMnodeReq
));
if
(
p
Msg
==
NULL
)
{
SDAlterMnodeReq
*
p
Req
=
malloc
(
sizeof
(
SDAlterMnodeReq
));
if
(
p
Req
==
NULL
)
{
sdbCancelFetch
(
pSdb
,
pIter
);
sdbRelease
(
pSdb
,
pMObj
);
return
-
1
;
}
memcpy
(
p
Msg
,
&
alterMsg
,
sizeof
(
SDAlterMnodeReq
));
memcpy
(
p
Req
,
&
alterReq
,
sizeof
(
SDAlterMnodeReq
));
p
Msg
->
dnodeId
=
htonl
(
pMObj
->
id
);
p
Req
->
dnodeId
=
htonl
(
pMObj
->
id
);
action
.
epSet
=
mndGetDnodeEpset
(
pMObj
->
pDnode
);
action
.
pCont
=
p
Msg
;
action
.
pCont
=
p
Req
;
action
.
contLen
=
sizeof
(
SDAlterMnodeReq
);
action
.
msgType
=
TDMT_DND_ALTER_MNODE
;
if
(
mndTransAppendRedoAction
(
pTrans
,
&
action
)
!=
0
)
{
free
(
p
Msg
);
free
(
p
Req
);
sdbCancelFetch
(
pSdb
,
pIter
);
sdbRelease
(
pSdb
,
pMObj
);
return
-
1
;
...
...
@@ -504,19 +504,19 @@ static int32_t mndSetDropMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDnode
STransAction
action
=
{
0
};
action
.
epSet
=
mndGetDnodeEpset
(
pDnode
);
SDDropMnodeReq
*
p
Msg
=
malloc
(
sizeof
(
SDDropMnodeReq
));
if
(
p
Msg
==
NULL
)
{
SDDropMnodeReq
*
p
Req
=
malloc
(
sizeof
(
SDDropMnodeReq
));
if
(
p
Req
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
p
Msg
->
dnodeId
=
htonl
(
pObj
->
id
);
p
Req
->
dnodeId
=
htonl
(
pObj
->
id
);
action
.
epSet
=
mndGetDnodeEpset
(
pDnode
);
action
.
pCont
=
p
Msg
;
action
.
pCont
=
p
Req
;
action
.
contLen
=
sizeof
(
SDDropMnodeReq
);
action
.
msgType
=
TDMT_DND_DROP_MNODE
;
if
(
mndTransAppendRedoAction
(
pTrans
,
&
action
)
!=
0
)
{
free
(
p
Msg
);
free
(
p
Req
);
return
-
1
;
}
}
...
...
@@ -524,9 +524,9 @@ static int32_t mndSetDropMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDnode
return
0
;
}
static
int32_t
mndDropMnode
(
SMnode
*
pMnode
,
SMnodeMsg
*
p
Msg
,
SMnodeObj
*
pObj
)
{
static
int32_t
mndDropMnode
(
SMnode
*
pMnode
,
SMnodeMsg
*
p
Req
,
SMnodeObj
*
pObj
)
{
int32_t
code
=
-
1
;
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
&
p
Msg
->
rpcMsg
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
&
p
Req
->
rpcMsg
);
if
(
pTrans
==
NULL
)
{
mError
(
"mnode:%d, failed to drop since %s"
,
pObj
->
id
,
terrstr
());
goto
DROP_MNODE_OVER
;
...
...
@@ -561,9 +561,9 @@ DROP_MNODE_OVER:
return
code
;
}
static
int32_t
mndProcessDropMnodeReq
(
SMnodeMsg
*
p
Msg
)
{
SMnode
*
pMnode
=
p
Msg
->
pMnode
;
SMDropMnodeReq
*
pDrop
=
p
Msg
->
rpcMsg
.
pCont
;
static
int32_t
mndProcessDropMnodeReq
(
SMnodeMsg
*
p
Req
)
{
SMnode
*
pMnode
=
p
Req
->
pMnode
;
SMDropMnodeReq
*
pDrop
=
p
Req
->
rpcMsg
.
pCont
;
pDrop
->
dnodeId
=
htonl
(
pDrop
->
dnodeId
);
mDebug
(
"mnode:%d, start to drop"
,
pDrop
->
dnodeId
);
...
...
@@ -581,7 +581,7 @@ static int32_t mndProcessDropMnodeReq(SMnodeMsg *pMsg) {
return
-
1
;
}
int32_t
code
=
mndDropMnode
(
pMnode
,
p
Msg
,
pObj
);
int32_t
code
=
mndDropMnode
(
pMnode
,
p
Req
,
pObj
);
if
(
code
!=
0
)
{
mError
(
"mnode:%d, failed to drop since %s"
,
pMnode
->
dnodeId
,
terrstr
());
...
...
@@ -592,23 +592,23 @@ static int32_t mndProcessDropMnodeReq(SMnodeMsg *pMsg) {
return
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
}
static
int32_t
mndProcessCreateMnodeRsp
(
SMnodeMsg
*
p
Msg
)
{
mndTransProcessRsp
(
p
Msg
);
static
int32_t
mndProcessCreateMnodeRsp
(
SMnodeMsg
*
p
Rsp
)
{
mndTransProcessRsp
(
p
Rsp
);
return
0
;
}
static
int32_t
mndProcessAlterMnodeRsp
(
SMnodeMsg
*
p
Msg
)
{
mndTransProcessRsp
(
p
Msg
);
static
int32_t
mndProcessAlterMnodeRsp
(
SMnodeMsg
*
p
Rsp
)
{
mndTransProcessRsp
(
p
Rsp
);
return
0
;
}
static
int32_t
mndProcessDropMnodeRsp
(
SMnodeMsg
*
p
Msg
)
{
mndTransProcessRsp
(
p
Msg
);
static
int32_t
mndProcessDropMnodeRsp
(
SMnodeMsg
*
p
Rsp
)
{
mndTransProcessRsp
(
p
Rsp
);
return
0
;
}
static
int32_t
mndGetMnodeMeta
(
SMnodeMsg
*
p
Msg
,
SShowObj
*
pShow
,
STableMetaMsg
*
pMeta
)
{
SMnode
*
pMnode
=
p
Msg
->
pMnode
;
static
int32_t
mndGetMnodeMeta
(
SMnodeMsg
*
p
Req
,
SShowObj
*
pShow
,
STableMetaMsg
*
pMeta
)
{
SMnode
*
pMnode
=
p
Req
->
pMnode
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int32_t
cols
=
0
;
...
...
@@ -660,8 +660,8 @@ static int32_t mndGetMnodeMeta(SMnodeMsg *pMsg, SShowObj *pShow, STableMetaMsg *
return
0
;
}
static
int32_t
mndRetrieveMnodes
(
SMnodeMsg
*
p
Msg
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
)
{
SMnode
*
pMnode
=
p
Msg
->
pMnode
;
static
int32_t
mndRetrieveMnodes
(
SMnodeMsg
*
p
Req
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
)
{
SMnode
*
pMnode
=
p
Req
->
pMnode
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int32_t
numOfRows
=
0
;
int32_t
cols
=
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录