Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
9b29cfe8
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看板
提交
9b29cfe8
编写于
5月 10, 2023
作者:
D
dmchen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix/restore check
上级
3fab2201
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
23 addition
and
65 deletion
+23
-65
source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
+19
-18
source/dnode/mgmt/node_mgmt/src/dmEnv.c
source/dnode/mgmt/node_mgmt/src/dmEnv.c
+1
-0
source/dnode/mnode/impl/src/mndDnode.c
source/dnode/mnode/impl/src/mndDnode.c
+1
-47
source/util/src/terror.c
source/util/src/terror.c
+2
-0
未找到文件。
source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
浏览文件 @
9b29cfe8
...
...
@@ -245,22 +245,6 @@ int32_t vmProcessCreateVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
vmGenerateVnodeCfg
(
&
req
,
&
vnodeCfg
);
snprintf
(
path
,
TSDB_FILENAME_LEN
,
"vnode%svnode%d"
,
TD_DIRSEP
,
vnodeCfg
.
vgId
);
if
(
pMgmt
->
pTfs
)
{
if
(
tfsDirExistAt
(
pMgmt
->
pTfs
,
path
,
(
SDiskID
){
0
}))
{
terrno
=
TSDB_CODE_VND_DIR_ALREADY_EXIST
;
dError
(
"vgId:%d, failed to restore vnode since %s"
,
req
.
vgId
,
terrstr
());
return
-
1
;
}
}
else
{
if
(
taosDirExist
(
path
))
{
terrno
=
TSDB_CODE_VND_DIR_ALREADY_EXIST
;
dError
(
"vgId:%d, failed to restore vnode since %s"
,
req
.
vgId
,
terrstr
());
return
-
1
;
}
}
if
(
vmTsmaAdjustDays
(
&
vnodeCfg
,
&
req
)
<
0
)
{
dError
(
"vgId:%d, failed to adjust tsma days since %s"
,
req
.
vgId
,
terrstr
());
code
=
terrno
;
...
...
@@ -271,7 +255,7 @@ int32_t vmProcessCreateVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
SVnodeObj
*
pVnode
=
vmAcquireVnode
(
pMgmt
,
req
.
vgId
);
if
(
pVnode
!=
NULL
)
{
d
Info
(
"vgId:%d, already exist"
,
req
.
vgId
);
d
Error
(
"vgId:%d, already exist"
,
req
.
vgId
);
tFreeSCreateVnodeReq
(
&
req
);
vmReleaseVnode
(
pMgmt
,
pVnode
);
terrno
=
TSDB_CODE_VND_ALREADY_EXIST
;
...
...
@@ -279,7 +263,23 @@ int32_t vmProcessCreateVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
return
0
;
}
if
(
vnodeCreate
(
path
,
&
vnodeCfg
,
pMgmt
->
pTfs
)
<
0
)
{
snprintf
(
path
,
TSDB_FILENAME_LEN
,
"vnode%svnode%d"
,
TD_DIRSEP
,
vnodeCfg
.
vgId
);
if
(
pMgmt
->
pTfs
)
{
if
(
tfsDirExistAt
(
pMgmt
->
pTfs
,
path
,
(
SDiskID
){
0
}))
{
terrno
=
TSDB_CODE_VND_DIR_ALREADY_EXIST
;
dError
(
"vgId:%d, failed to restore vnode since %s"
,
req
.
vgId
,
terrstr
());
return
-
1
;
}
}
else
{
if
(
taosDirExist
(
path
))
{
terrno
=
TSDB_CODE_VND_DIR_ALREADY_EXIST
;
dError
(
"vgId:%d, failed to restore vnode since %s"
,
req
.
vgId
,
terrstr
());
return
-
1
;
}
}
if
(
vnodeCreate
(
path
,
&
vnodeCfg
,
pMgmt
->
pTfs
)
<
0
)
{
tFreeSCreateVnodeReq
(
&
req
);
dError
(
"vgId:%d, failed to create vnode since %s"
,
req
.
vgId
,
terrstr
());
code
=
terrno
;
...
...
@@ -359,6 +359,7 @@ int32_t vmProcessAlterVnodeTypeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
ESyncRole
role
=
vnodeGetRole
(
pVnode
->
pImpl
);
dInfo
(
"vgId:%d, checking node role:%d"
,
req
.
vgId
,
role
);
if
(
role
==
TAOS_SYNC_ROLE_VOTER
){
dError
(
"vgId:%d, failed to alter vnode type since node already is role:%d"
,
req
.
vgId
,
role
);
terrno
=
TSDB_CODE_VND_ALREADY_IS_VOTER
;
vmReleaseVnode
(
pMgmt
,
pVnode
);
return
-
1
;
...
...
source/dnode/mgmt/node_mgmt/src/dmEnv.c
浏览文件 @
9b29cfe8
...
...
@@ -218,6 +218,7 @@ static int32_t dmProcessAlterNodeTypeReq(EDndNodeType ntype, SRpcMsg *pMsg) {
ESyncRole
role
=
(
*
pWrapper
->
func
.
nodeRoleFp
)(
pWrapper
->
pMgmt
);
dInfo
(
"node:%s, checking node role:%d"
,
pWrapper
->
name
,
role
);
if
(
role
==
TAOS_SYNC_ROLE_VOTER
){
dError
(
"node:%s, failed to alter node type since node already is role:%d"
,
pWrapper
->
name
,
role
);
terrno
=
TSDB_CODE_MNODE_ALREADY_IS_VOTER
;
return
-
1
;
}
...
...
source/dnode/mnode/impl/src/mndDnode.c
浏览文件 @
9b29cfe8
...
...
@@ -625,7 +625,6 @@ static int32_t mndRestoreDnode(SMnode *pMnode, SRpcMsg *pReq, SDnodeObj *pDnode,
newMnodeObj
.
role
=
TAOS_SYNC_ROLE_LEARNER
;
newMnodeObj
.
lastIndex
=
pMnode
->
applied
;
if
(
mndSetRestoreCreateMnodeRedoActions
(
pMnode
,
pTrans
,
pDnode
,
&
newMnodeObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetRestoreCreateMnodeRedoLogs
(
pMnode
,
pTrans
,
&
newMnodeObj
)
!=
0
)
goto
_OVER
;
SMnodeObj
mnodeLeaderObj
=
{
0
};
mnodeLeaderObj
.
id
=
pDnode
->
id
;
...
...
@@ -634,7 +633,6 @@ static int32_t mndRestoreDnode(SMnode *pMnode, SRpcMsg *pReq, SDnodeObj *pDnode,
mnodeLeaderObj
.
role
=
TAOS_SYNC_ROLE_VOTER
;
mnodeLeaderObj
.
lastIndex
=
pMnode
->
applied
+
1
;
if
(
mndSetRestoreAlterMnodeTypeRedoActions
(
pMnode
,
pTrans
,
pDnode
,
&
mnodeLeaderObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetRestoreCreateMnodeRedoLogs
(
pMnode
,
pTrans
,
&
mnodeLeaderObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetCreateMnodeCommitLogs
(
pMnode
,
pTrans
,
&
mnodeLeaderObj
)
!=
0
)
goto
_OVER
;
...
...
@@ -861,51 +859,7 @@ int32_t mndProcessRestoreDnodeReq(SRpcMsg *pReq){
#ifndef TD_ENTERPRISE
int32_t
mndProcessRestoreDnodeReqImpl
(
SRpcMsg
*
pReq
){
SMnode
*
pMnode
=
pReq
->
info
.
node
;
int32_t
code
=
-
1
;
SDnodeObj
*
pDnode
=
NULL
;
SMnodeObj
*
pMObj
=
NULL
;
SQnodeObj
*
pQObj
=
NULL
;
SSnodeObj
*
pSObj
=
NULL
;
SRestoreDnodeReq
restoreReq
=
{
0
};
if
(
tDeserializeSRestoreDnodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
restoreReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
_OVER
;
}
//mInfo("dnode:%d, start to restore, ep:%s:%d", restoreReq.dnodeId, restoreReq.fqdn, restoreReq.port);
mInfo
(
"dnode:%d, start to restore"
,
restoreReq
.
dnodeId
);
if
(
mndCheckOperPrivilege
(
pMnode
,
pReq
->
info
.
conn
.
user
,
MND_OPER_DROP_MNODE
)
!=
0
)
{
goto
_OVER
;
}
pDnode
=
mndAcquireDnode
(
pMnode
,
restoreReq
.
dnodeId
);
/*if (pDnode == NULL) {
int32_t err = terrno;
char ep[TSDB_EP_LEN + 1] = {0};
snprintf(ep, sizeof(ep), restoreReq.fqdn, restoreReq.port);
pDnode = mndAcquireDnodeByEp(pMnode, ep);
if (pDnode == NULL) {
terrno = err;
goto _OVER;
}
}
*/
if
(
pDnode
==
NULL
)
{
goto
_OVER
;
}
code
=
mndRestoreDnode
(
pMnode
,
pReq
,
pDnode
,
restoreReq
.
restoreType
);
if
(
code
==
0
)
code
=
TSDB_CODE_ACTION_IN_PROGRESS
;
_OVER:
if
(
code
!=
0
&&
code
!=
TSDB_CODE_ACTION_IN_PROGRESS
)
{
mError
(
"dnode:%d, failed to restore since %s"
,
restoreReq
.
dnodeId
,
terrstr
());
}
mndReleaseDnode
(
pMnode
,
pDnode
);
return
code
;
return
0
;
}
#endif
...
...
source/util/src/terror.c
浏览文件 @
9b29cfe8
...
...
@@ -335,6 +335,8 @@ TAOS_DEFINE_ERROR(TSDB_CODE_VND_NO_AVAIL_BUFPOOL, "No availabe buffer po
TAOS_DEFINE_ERROR
(
TSDB_CODE_VND_STOPPED
,
"Vnode stopped"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_VND_DUP_REQUEST
,
"Duplicate write request"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_VND_QUERY_BUSY
,
"Query busy"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_VND_NOT_CATCH_UP
,
"Vnode didn't catch up its leader"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_VND_ALREADY_IS_VOTER
,
"Vnode already is a voter"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_VND_DIR_ALREADY_EXIST
,
"Vnode directory already exist"
)
// tsdb
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录