Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
dd4e01ee
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看板
提交
dd4e01ee
编写于
6月 07, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: drop dnode
上级
e5f2b786
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
26 addition
and
17 deletion
+26
-17
include/util/taoserror.h
include/util/taoserror.h
+1
-1
source/dnode/mnode/impl/src/mndDnode.c
source/dnode/mnode/impl/src/mndDnode.c
+20
-11
source/dnode/mnode/impl/src/mndMnode.c
source/dnode/mnode/impl/src/mndMnode.c
+1
-1
source/util/src/terror.c
source/util/src/terror.c
+3
-3
tests/script/jenkins/basic.txt
tests/script/jenkins/basic.txt
+1
-1
tests/script/tsim/dnode/create_dnode.sim
tests/script/tsim/dnode/create_dnode.sim
+0
-0
未找到文件。
include/util/taoserror.h
浏览文件 @
dd4e01ee
...
...
@@ -185,7 +185,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_MND_BNODE_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0357)
#define TSDB_CODE_MND_TOO_FEW_MNODES TAOS_DEF_ERROR_CODE(0, 0x0358)
#define TSDB_CODE_MND_TOO_MANY_MNODES TAOS_DEF_ERROR_CODE(0, 0x0359)
#define TSDB_CODE_MND_CANT_DROP_
MAST
ER TAOS_DEF_ERROR_CODE(0, 0x035A)
#define TSDB_CODE_MND_CANT_DROP_
LEAD
ER TAOS_DEF_ERROR_CODE(0, 0x035A)
// mnode-acct
#define TSDB_CODE_MND_ACCT_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0360)
...
...
source/dnode/mnode/impl/src/mndDnode.c
浏览文件 @
dd4e01ee
...
...
@@ -427,7 +427,7 @@ static int32_t mndProcessStatusReq(SRpcMsg *pReq) {
if
(
!
online
)
{
mInfo
(
"dnode:%d, from offline to online"
,
pDnode
->
id
);
}
else
{
mDebug
(
"dnode:%d, send dnode epset, online:%d dnode_ver:%
"
PRId64
":%"
PRId64
" reboot:%d"
,
pDnode
->
id
,
online
,
mDebug
(
"dnode:%d, send dnode epset, online:%d dnode_ver:%"
PRId64
":%"
PRId64
" reboot:%d"
,
pDnode
->
id
,
online
,
statusReq
.
dnodeVer
,
dnodeVer
,
reboot
);
}
...
...
@@ -545,7 +545,7 @@ _OVER:
return
code
;
}
static
int32_t
mndDropDnode
(
SMnode
*
pMnode
,
SRpcMsg
*
pReq
,
SDnodeObj
*
pDnode
,
SMnodeObj
*
pMObj
)
{
static
int32_t
mndDropDnode
(
SMnode
*
pMnode
,
SRpcMsg
*
pReq
,
SDnodeObj
*
pDnode
,
SMnodeObj
*
pMObj
,
int32_t
numOfVnodes
)
{
int32_t
code
=
-
1
;
SSdbRaw
*
pRaw
=
NULL
;
STrans
*
pTrans
=
NULL
;
...
...
@@ -565,8 +565,12 @@ static int32_t mndDropDnode(SMnode *pMnode, SRpcMsg *pReq, SDnodeObj *pDnode, SM
sdbSetRawStatus
(
pRaw
,
SDB_STATUS_DROPPED
);
pRaw
=
NULL
;
if
(
pMObj
!=
NULL
)
{
if
(
mndSetDropMnodeInfoToTrans
(
pMnode
,
pTrans
,
pMObj
)
!=
0
)
goto
_OVER
;
}
if
(
numOfVnodes
>
0
)
{
if
(
mndSetMoveVgroupsInfoToTrans
(
pMnode
,
pTrans
,
pDnode
->
id
)
!=
0
)
goto
_OVER
;
}
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
goto
_OVER
;
code
=
0
;
...
...
@@ -603,11 +607,6 @@ static int32_t mndProcessDropDnodeReq(SRpcMsg *pReq) {
goto
_OVER
;
}
if
(
!
mndIsDnodeOnline
(
pDnode
,
taosGetTimestampMs
()))
{
terrno
=
TSDB_CODE_NODE_OFFLINE
;
goto
_OVER
;
}
pMObj
=
mndAcquireMnode
(
pMnode
,
dropReq
.
dnodeId
);
if
(
pMObj
!=
NULL
)
{
if
(
sdbGetSize
(
pMnode
->
pSdb
,
SDB_MNODE
)
<=
1
)
{
...
...
@@ -615,7 +614,17 @@ static int32_t mndProcessDropDnodeReq(SRpcMsg *pReq) {
goto
_OVER
;
}
if
(
pMnode
->
selfDnodeId
==
dropReq
.
dnodeId
)
{
terrno
=
TSDB_CODE_MND_CANT_DROP_MASTER
;
terrno
=
TSDB_CODE_MND_CANT_DROP_LEADER
;
goto
_OVER
;
}
}
int32_t
numOfVnodes
=
mndGetVnodesNum
(
pMnode
,
pDnode
->
id
);
if
(
numOfVnodes
>
0
||
pMObj
!=
NULL
)
{
if
(
!
mndIsDnodeOnline
(
pDnode
,
taosGetTimestampMs
()))
{
terrno
=
TSDB_CODE_NODE_OFFLINE
;
mError
(
"dnode:%d, failed to drop since %s, has_mnode:%d numOfVnodes:%d"
,
pDnode
->
id
,
terrstr
(),
pMObj
!=
NULL
,
numOfVnodes
);
goto
_OVER
;
}
}
...
...
@@ -630,7 +639,7 @@ static int32_t mndProcessDropDnodeReq(SRpcMsg *pReq) {
goto
_OVER
;
}
code
=
mndDropDnode
(
pMnode
,
pReq
,
pDnode
,
pMObj
);
code
=
mndDropDnode
(
pMnode
,
pReq
,
pDnode
,
pMObj
,
numOfVnodes
);
if
(
code
==
0
)
code
=
TSDB_CODE_ACTION_IN_PROGRESS
;
_OVER:
...
...
source/dnode/mnode/impl/src/mndMnode.c
浏览文件 @
dd4e01ee
...
...
@@ -588,7 +588,7 @@ static int32_t mndProcessDropMnodeReq(SRpcMsg *pReq) {
}
if
(
pMnode
->
selfDnodeId
==
dropReq
.
dnodeId
)
{
terrno
=
TSDB_CODE_MND_CANT_DROP_
MAST
ER
;
terrno
=
TSDB_CODE_MND_CANT_DROP_
LEAD
ER
;
goto
_OVER
;
}
...
...
source/util/src/terror.c
浏览文件 @
dd4e01ee
...
...
@@ -188,9 +188,9 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_SNODE_ALREADY_EXIST, "Snode already exists"
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_SNODE_NOT_EXIST
,
"Snode not there"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_BNODE_ALREADY_EXIST
,
"Bnode already exists"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_BNODE_NOT_EXIST
,
"Bnode not there"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_TOO_FEW_MNODES
,
"The replica
s
of mnode cannot less than 1"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_TOO_MANY_MNODES
,
"The replica
s
of mnode cannot exceed 3"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_CANT_DROP_
MASTER
,
"Can'
t drop mnode which is leader"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_TOO_FEW_MNODES
,
"The replica of mnode cannot less than 1"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_TOO_MANY_MNODES
,
"The replica of mnode cannot exceed 3"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_CANT_DROP_
LEADER
,
"Canno
t drop mnode which is leader"
)
// mnode-acct
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_ACCT_ALREADY_EXIST
,
"Account already exists"
)
...
...
tests/script/jenkins/basic.txt
浏览文件 @
dd4e01ee
...
...
@@ -21,7 +21,7 @@
./test.sh -f tsim/db/taosdlog.sim
# ---- dnode
./test.sh -f tsim/dnode/
basic1
.sim
./test.sh -f tsim/dnode/
create_dnode
.sim
# ---- insert
./test.sh -f tsim/insert/basic0.sim
...
...
tests/script/tsim/dnode/
basic1
.sim
→
tests/script/tsim/dnode/
create_dnode
.sim
浏览文件 @
dd4e01ee
文件已移动
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录