Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
76aecee1
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看板
未验证
提交
76aecee1
编写于
12月 22, 2022
作者:
S
Shengliang Guan
提交者:
GitHub
12月 22, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #19063 from taosdata/fix/TD-21424_TD-21389_TD-21420
enh: add dropping and creating status for dnode
上级
2454cf0c
1e3f6470
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
71 addition
and
5 deletion
+71
-5
include/util/taoserror.h
include/util/taoserror.h
+8
-0
source/dnode/mgmt/mgmt_dnode/src/dmHandle.c
source/dnode/mgmt/mgmt_dnode/src/dmHandle.c
+2
-0
source/dnode/mnode/impl/src/mndDnode.c
source/dnode/mnode/impl/src/mndDnode.c
+59
-5
source/util/src/terror.c
source/util/src/terror.c
+2
-0
未找到文件。
include/util/taoserror.h
浏览文件 @
76aecee1
...
@@ -203,9 +203,15 @@ int32_t* taosGetErrno();
...
@@ -203,9 +203,15 @@ int32_t* taosGetErrno();
#define TSDB_CODE_MND_CANT_DROP_LEADER TAOS_DEF_ERROR_CODE(0, 0x0333)
#define TSDB_CODE_MND_CANT_DROP_LEADER TAOS_DEF_ERROR_CODE(0, 0x0333)
#define TSDB_CODE_MND_NO_ENOUGH_DNODES TAOS_DEF_ERROR_CODE(0, 0x0334)
#define TSDB_CODE_MND_NO_ENOUGH_DNODES TAOS_DEF_ERROR_CODE(0, 0x0334)
#define TSDB_CODE_MND_INVALID_CLUSTER_CFG TAOS_DEF_ERROR_CODE(0, 0x0335)
#define TSDB_CODE_MND_INVALID_CLUSTER_CFG TAOS_DEF_ERROR_CODE(0, 0x0335)
// #define TSDB_CODE_MND_INVALID_DNODE_CFG_... TAOS_DEF_ERROR_CODE(0, 0x0336) // 2.x
// #define TSDB_CODE_MND_BALANCE_ENABLED TAOS_DEF_ERROR_CODE(0, 0x0337) // 2.x
#define TSDB_CODE_MND_VGROUP_NOT_IN_DNODE TAOS_DEF_ERROR_CODE(0, 0x0338)
#define TSDB_CODE_MND_VGROUP_NOT_IN_DNODE TAOS_DEF_ERROR_CODE(0, 0x0338)
#define TSDB_CODE_MND_VGROUP_ALREADY_IN_DNODE TAOS_DEF_ERROR_CODE(0, 0x0339)
#define TSDB_CODE_MND_VGROUP_ALREADY_IN_DNODE TAOS_DEF_ERROR_CODE(0, 0x0339)
// #define TSDB_CODE_MND_DNODE_NOT_FREE TAOS_DEF_ERROR_CODE(0, 0x033A) // 2.x
#define TSDB_CODE_MND_INVALID_CLUSTER_ID TAOS_DEF_ERROR_CODE(0, 0x033B)
#define TSDB_CODE_MND_INVALID_CLUSTER_ID TAOS_DEF_ERROR_CODE(0, 0x033B)
// #define TSDB_CODE_MND_NOT_READY TAOS_DEF_ERROR_CODE(0, 0x033C) // 2.x
// #define TSDB_CODE_MND_DNODE_ID_NOT_CONFIGUREDTAOS_DEF_ERROR_CODE(0, 0x033D) // 2.x
// #define TSDB_CODE_MND_DNODE_EP_NOT_CONFIGUREDTAOS_DEF_ERROR_CODE(0, 0x033E) // 2.x
// mnode-acct
// mnode-acct
#define TSDB_CODE_MND_ACCT_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0340)
#define TSDB_CODE_MND_ACCT_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0340)
...
@@ -297,6 +303,8 @@ int32_t* taosGetErrno();
...
@@ -297,6 +303,8 @@ int32_t* taosGetErrno();
#define TSDB_CODE_MND_VGROUP_UN_CHANGED TAOS_DEF_ERROR_CODE(0, 0x03B5)
#define TSDB_CODE_MND_VGROUP_UN_CHANGED TAOS_DEF_ERROR_CODE(0, 0x03B5)
#define TSDB_CODE_MND_HAS_OFFLINE_DNODE TAOS_DEF_ERROR_CODE(0, 0x03B6)
#define TSDB_CODE_MND_HAS_OFFLINE_DNODE TAOS_DEF_ERROR_CODE(0, 0x03B6)
#define TSDB_CODE_MND_INVALID_REPLICA TAOS_DEF_ERROR_CODE(0, 0x03B7)
#define TSDB_CODE_MND_INVALID_REPLICA TAOS_DEF_ERROR_CODE(0, 0x03B7)
#define TSDB_CODE_MND_DNODE_IN_CREATING TAOS_DEF_ERROR_CODE(0, 0x03B8)
#define TSDB_CODE_MND_DNODE_IN_DROPPING TAOS_DEF_ERROR_CODE(0, 0x03B9)
// mnode-stable-part2
// mnode-stable-part2
#define TSDB_CODE_MND_NAME_CONFLICT_WITH_TOPIC TAOS_DEF_ERROR_CODE(0, 0x03C0)
#define TSDB_CODE_MND_NAME_CONFLICT_WITH_TOPIC TAOS_DEF_ERROR_CODE(0, 0x03C0)
...
...
source/dnode/mgmt/mgmt_dnode/src/dmHandle.c
浏览文件 @
76aecee1
...
@@ -41,6 +41,8 @@ static void dmProcessStatusRsp(SDnodeMgmt *pMgmt, SRpcMsg *pRsp) {
...
@@ -41,6 +41,8 @@ static void dmProcessStatusRsp(SDnodeMgmt *pMgmt, SRpcMsg *pRsp) {
pMgmt
->
statusSeq
);
pMgmt
->
statusSeq
);
pMgmt
->
pData
->
dropped
=
1
;
pMgmt
->
pData
->
dropped
=
1
;
dmWriteEps
(
pMgmt
->
pData
);
dmWriteEps
(
pMgmt
->
pData
);
dInfo
(
"dnode will exit since it is in the dropped state"
);
raise
(
SIGINT
);
}
}
}
else
{
}
else
{
SStatusRsp
statusRsp
=
{
0
};
SStatusRsp
statusRsp
=
{
0
};
...
...
source/dnode/mnode/impl/src/mndDnode.c
浏览文件 @
76aecee1
...
@@ -217,8 +217,18 @@ SDnodeObj *mndAcquireDnode(SMnode *pMnode, int32_t dnodeId) {
...
@@ -217,8 +217,18 @@ SDnodeObj *mndAcquireDnode(SMnode *pMnode, int32_t dnodeId) {
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SDnodeObj
*
pDnode
=
sdbAcquire
(
pSdb
,
SDB_DNODE
,
&
dnodeId
);
SDnodeObj
*
pDnode
=
sdbAcquire
(
pSdb
,
SDB_DNODE
,
&
dnodeId
);
if
(
pDnode
==
NULL
)
{
if
(
pDnode
==
NULL
)
{
if
(
terrno
==
TSDB_CODE_SDB_OBJ_NOT_THERE
)
{
terrno
=
TSDB_CODE_MND_DNODE_NOT_EXIST
;
terrno
=
TSDB_CODE_MND_DNODE_NOT_EXIST
;
}
else
if
(
terrno
==
TSDB_CODE_SDB_OBJ_CREATING
)
{
terrno
=
TSDB_CODE_MND_DNODE_IN_CREATING
;
}
else
if
(
terrno
==
TSDB_CODE_SDB_OBJ_DROPPING
)
{
terrno
=
TSDB_CODE_MND_DNODE_IN_DROPPING
;
}
else
{
terrno
=
TSDB_CODE_APP_ERROR
;
mFatal
(
"dnode:%d, failed to acquire db since %s"
,
dnodeId
,
terrstr
());
}
}
}
return
pDnode
;
return
pDnode
;
}
}
...
@@ -254,6 +264,27 @@ static SDnodeObj *mndAcquireDnodeByEp(SMnode *pMnode, char *pEpStr) {
...
@@ -254,6 +264,27 @@ static SDnodeObj *mndAcquireDnodeByEp(SMnode *pMnode, char *pEpStr) {
return
NULL
;
return
NULL
;
}
}
static
SDnodeObj
*
mndAcquireDnodeAllStatusByEp
(
SMnode
*
pMnode
,
char
*
pEpStr
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
void
*
pIter
=
NULL
;
while
(
1
)
{
SDnodeObj
*
pDnode
=
NULL
;
ESdbStatus
objStatus
=
0
;
pIter
=
sdbFetchAll
(
pSdb
,
SDB_DNODE
,
pIter
,
(
void
**
)
&
pDnode
,
&
objStatus
,
true
);
if
(
pIter
==
NULL
)
break
;
if
(
strncasecmp
(
pEpStr
,
pDnode
->
ep
,
TSDB_EP_LEN
)
==
0
)
{
sdbCancelFetch
(
pSdb
,
pIter
);
return
pDnode
;
}
sdbRelease
(
pSdb
,
pDnode
);
}
return
NULL
;
}
int32_t
mndGetDnodeSize
(
SMnode
*
pMnode
)
{
int32_t
mndGetDnodeSize
(
SMnode
*
pMnode
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
return
sdbGetSize
(
pSdb
,
SDB_DNODE
);
return
sdbGetSize
(
pSdb
,
SDB_DNODE
);
...
@@ -340,12 +371,22 @@ static int32_t mndProcessStatusReq(SRpcMsg *pReq) {
...
@@ -340,12 +371,22 @@ static int32_t mndProcessStatusReq(SRpcMsg *pReq) {
}
else
{
}
else
{
pDnode
=
mndAcquireDnode
(
pMnode
,
statusReq
.
dnodeId
);
pDnode
=
mndAcquireDnode
(
pMnode
,
statusReq
.
dnodeId
);
if
(
pDnode
==
NULL
)
{
if
(
pDnode
==
NULL
)
{
int32_t
err
=
terrno
;
pDnode
=
mndAcquireDnodeByEp
(
pMnode
,
statusReq
.
dnodeEp
);
pDnode
=
mndAcquireDnodeByEp
(
pMnode
,
statusReq
.
dnodeEp
);
if
(
pDnode
!=
NULL
)
{
if
(
pDnode
!=
NULL
)
{
pDnode
->
offlineReason
=
DND_REASON_DNODE_ID_NOT_MATCH
;
pDnode
->
offlineReason
=
DND_REASON_DNODE_ID_NOT_MATCH
;
terrno
=
err
;
goto
_OVER
;
}
}
mError
(
"dnode:%d, %s not exist"
,
statusReq
.
dnodeId
,
statusReq
.
dnodeEp
);
mError
(
"dnode:%d, %s not exist, code:0x%x"
,
statusReq
.
dnodeId
,
statusReq
.
dnodeEp
,
err
);
if
(
err
==
TSDB_CODE_MND_DNODE_NOT_EXIST
)
{
terrno
=
err
;
goto
_OVER
;
goto
_OVER
;
}
else
{
pDnode
=
mndAcquireDnodeAllStatusByEp
(
pMnode
,
statusReq
.
dnodeEp
);
if
(
pDnode
==
NULL
)
goto
_OVER
;
}
}
}
}
}
...
@@ -967,11 +1008,12 @@ static int32_t mndRetrieveDnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
...
@@ -967,11 +1008,12 @@ static int32_t mndRetrieveDnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int32_t
numOfRows
=
0
;
int32_t
numOfRows
=
0
;
int32_t
cols
=
0
;
int32_t
cols
=
0
;
ESdbStatus
objStatus
=
0
;
SDnodeObj
*
pDnode
=
NULL
;
SDnodeObj
*
pDnode
=
NULL
;
int64_t
curMs
=
taosGetTimestampMs
();
int64_t
curMs
=
taosGetTimestampMs
();
while
(
numOfRows
<
rows
)
{
while
(
numOfRows
<
rows
)
{
pShow
->
pIter
=
sdbFetch
(
pSdb
,
SDB_DNODE
,
pShow
->
pIter
,
(
void
**
)
&
pDnod
e
);
pShow
->
pIter
=
sdbFetch
All
(
pSdb
,
SDB_DNODE
,
pShow
->
pIter
,
(
void
**
)
&
pDnode
,
&
objStatus
,
tru
e
);
if
(
pShow
->
pIter
==
NULL
)
break
;
if
(
pShow
->
pIter
==
NULL
)
break
;
bool
online
=
mndIsDnodeOnline
(
pDnode
,
curMs
);
bool
online
=
mndIsDnodeOnline
(
pDnode
,
curMs
);
...
@@ -993,8 +1035,20 @@ static int32_t mndRetrieveDnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
...
@@ -993,8 +1035,20 @@ static int32_t mndRetrieveDnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pDnode
->
numOfSupportVnodes
,
false
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pDnode
->
numOfSupportVnodes
,
false
);
const
char
*
status
=
"ready"
;
if
(
objStatus
==
SDB_STATUS_CREATING
)
status
=
"creating"
;
if
(
objStatus
==
SDB_STATUS_DROPPING
)
status
=
"dropping"
;
if
(
!
online
)
{
if
(
objStatus
==
SDB_STATUS_CREATING
)
status
=
"creating*"
;
else
if
(
objStatus
==
SDB_STATUS_DROPPING
)
status
=
"dropping*"
;
else
status
=
"offline"
;
}
char
b1
[
9
]
=
{
0
};
char
b1
[
9
]
=
{
0
};
STR_TO_VARSTR
(
b1
,
online
?
"ready"
:
"offline"
);
STR_TO_VARSTR
(
b1
,
status
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
b1
,
false
);
colDataAppend
(
pColInfo
,
numOfRows
,
b1
,
false
);
...
...
source/util/src/terror.c
浏览文件 @
76aecee1
...
@@ -248,6 +248,8 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_SINGLE_STB_MODE_DB, "Database is single st
...
@@ -248,6 +248,8 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_SINGLE_STB_MODE_DB, "Database is single st
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_SCHEMA_VER
,
"Invalid schema version while alter stb"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_SCHEMA_VER
,
"Invalid schema version while alter stb"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_STABLE_UID_NOT_MATCH
,
"Invalid stable uid while alter stb"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_STABLE_UID_NOT_MATCH
,
"Invalid stable uid while alter stb"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_FIELD_CONFLICT_WITH_TSMA
,
"Field used by tsma"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_FIELD_CONFLICT_WITH_TSMA
,
"Field used by tsma"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_DNODE_IN_CREATING
,
"Dnode in creating status"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_DNODE_IN_DROPPING
,
"Dnode in dropping status"
)
// mnode-trans
// mnode-trans
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_TRANS_ALREADY_EXIST
,
"Transaction already exists"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_TRANS_ALREADY_EXIST
,
"Transaction already exists"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录