Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
890c4ec8
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看板
提交
890c4ec8
编写于
12月 12, 2021
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-10431 dnode mange in mnode module
上级
e29bb8b6
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
77 addition
and
91 deletion
+77
-91
include/common/taosmsg.h
include/common/taosmsg.h
+1
-2
include/common/tglobal.h
include/common/tglobal.h
+0
-1
include/dnode/mgmt/dnode.h
include/dnode/mgmt/dnode.h
+0
-1
include/dnode/mnode/mnode.h
include/dnode/mnode/mnode.h
+0
-1
include/util/taoserror.h
include/util/taoserror.h
+12
-11
include/util/tdef.h
include/util/tdef.h
+2
-0
source/common/src/tglobal.c
source/common/src/tglobal.c
+0
-12
source/dnode/mgmt/daemon/src/daemon.c
source/dnode/mgmt/daemon/src/daemon.c
+0
-1
source/dnode/mgmt/impl/src/dndDnode.c
source/dnode/mgmt/impl/src/dndDnode.c
+0
-1
source/dnode/mgmt/impl/src/dndMnode.c
source/dnode/mgmt/impl/src/dndMnode.c
+0
-1
source/dnode/mgmt/impl/test/sut/deploy.cpp
source/dnode/mgmt/impl/test/sut/deploy.cpp
+0
-1
source/dnode/mnode/impl/inc/mndDef.h
source/dnode/mnode/impl/inc/mndDef.h
+1
-1
source/dnode/mnode/impl/src/mndDnode.c
source/dnode/mnode/impl/src/mndDnode.c
+50
-47
source/dnode/mnode/impl/src/mnode.c
source/dnode/mnode/impl/src/mnode.c
+1
-2
source/util/src/terror.c
source/util/src/terror.c
+10
-9
未找到文件。
include/common/taosmsg.h
浏览文件 @
890c4ec8
...
...
@@ -670,7 +670,6 @@ typedef struct {
typedef
struct
{
int32_t
statusInterval
;
int32_t
mnodeEqualVnodeNum
;
int64_t
checkTime
;
// 1970-01-01 00:00:00.000
char
timezone
[
TSDB_TIMEZONE_LEN
];
// tsTimezone
char
locale
[
TSDB_LOCALE_LEN
];
// tsLocale
...
...
@@ -869,7 +868,7 @@ typedef struct {
typedef
struct
{
int32_t
dnodeId
;
char
config
[
128
];
char
config
[
TSDB_DNODE_CONFIG_LEN
];
}
SCfgDnodeMsg
;
typedef
struct
{
...
...
include/common/tglobal.h
浏览文件 @
890c4ec8
...
...
@@ -108,7 +108,6 @@ extern int8_t tsEnableBalance;
extern
int8_t
tsAlternativeRole
;
extern
int32_t
tsBalanceInterval
;
extern
int32_t
tsOfflineThreshold
;
extern
int32_t
tsMnodeEqualVnodeNum
;
extern
int8_t
tsEnableFlowCtrl
;
extern
int8_t
tsEnableSlaveQuery
;
extern
int8_t
tsEnableAdjustMaster
;
...
...
include/dnode/mgmt/dnode.h
浏览文件 @
890c4ec8
...
...
@@ -33,7 +33,6 @@ typedef struct {
int16_t
numOfSupportQnodes
;
int8_t
enableTelem
;
int32_t
statusInterval
;
int32_t
mnodeEqualVnodeNum
;
float
numOfThreadsPerCore
;
float
ratioOfQueryCores
;
int32_t
maxShellConns
;
...
...
include/dnode/mnode/mnode.h
浏览文件 @
890c4ec8
...
...
@@ -47,7 +47,6 @@ typedef struct SMnodeCfg {
int32_t
sver
;
int8_t
enableTelem
;
int32_t
statusInterval
;
int32_t
mnodeEqualVnodeNum
;
int32_t
shellActivityTimer
;
char
*
timezone
;
char
*
locale
;
...
...
include/util/taoserror.h
浏览文件 @
890c4ec8
...
...
@@ -152,22 +152,23 @@ int32_t* taosGetErrno();
#define TSDB_CODE_SDB_INVALID_DATA_LEN TAOS_DEF_ERROR_CODE(0, 0x032A)
#define TSDB_CODE_SDB_INVALID_DATA_CONTENT TAOS_DEF_ERROR_CODE(0, 0x032B)
#define TSDB_CODE_MND_DNODE_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0330) //"DNode already exists")
#define TSDB_CODE_MND_DNODE_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0331) //"DNode does not exist")
// mnode-dnode
#define TSDB_CODE_MND_DNODE_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0330)
#define TSDB_CODE_MND_DNODE_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0331)
#define TSDB_CODE_MND_NO_ENOUGH_DNODES TAOS_DEF_ERROR_CODE(0, 0x0332)
#define TSDB_CODE_MND_INVALID_CLUSTER_CFG TAOS_DEF_ERROR_CODE(0, 0x0333)
#define TSDB_CODE_MND_INVALID_CLUSTER_ID TAOS_DEF_ERROR_CODE(0, 0x0334)
#define TSDB_CODE_MND_INVALID_DNODE_CFG TAOS_DEF_ERROR_CODE(0, 0x0335)
#define TSDB_CODE_MND_INVALID_DNODE_EP TAOS_DEF_ERROR_CODE(0, 0x0336)
#define TSDB_CODE_MND_INVALID_DNODE_ID TAOS_DEF_ERROR_CODE(0, 0x0337)
// mnode-vgroup
#define TSDB_CODE_MND_VGROUP_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0332) //"VGroup does not exist")
#define TSDB_CODE_MND_NO_REMOVE_MASTER TAOS_DEF_ERROR_CODE(0, 0x0333) //"Master DNode cannot be removed")
#define TSDB_CODE_MND_NO_ENOUGH_DNODES TAOS_DEF_ERROR_CODE(0, 0x0334) //"Out of DNodes")
#define TSDB_CODE_MND_CLUSTER_CFG_INCONSISTENT TAOS_DEF_ERROR_CODE(0, 0x0335) //"Cluster cfg inconsistent")
#define TSDB_CODE_MND_INVALID_DNODE_CFG_OPTION TAOS_DEF_ERROR_CODE(0, 0x0336) //"Invalid dnode cfg option")
#define TSDB_CODE_MND_BALANCE_ENABLED TAOS_DEF_ERROR_CODE(0, 0x0337) //"Balance already enabled")
#define TSDB_CODE_MND_VGROUP_NOT_IN_DNODE TAOS_DEF_ERROR_CODE(0, 0x0338) //"Vgroup not in dnode")
#define TSDB_CODE_MND_VGROUP_ALREADY_IN_DNODE TAOS_DEF_ERROR_CODE(0, 0x0339) //"Vgroup already in dnode")
#define TSDB_CODE_MND_DNODE_NOT_FREE TAOS_DEF_ERROR_CODE(0, 0x033A) //"Dnode not avaliable")
#define TSDB_CODE_MND_INVALID_CLUSTER_ID TAOS_DEF_ERROR_CODE(0, 0x033B) //"Cluster id not match")
#define TSDB_CODE_MND_NOT_READY TAOS_DEF_ERROR_CODE(0, 0x033C) //"Cluster not ready")
#define TSDB_CODE_MND_DNODE_ID_NOT_CONFIGURED TAOS_DEF_ERROR_CODE(0, 0x033D) //"Dnode Id not configured")
#define TSDB_CODE_MND_DNODE_EP_NOT_CONFIGURED TAOS_DEF_ERROR_CODE(0, 0x033E) //"Dnode Ep not configured")
// mnode-acct
#define TSDB_CODE_MND_ACCT_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0340) //"Account already exists")
#define TSDB_CODE_MND_ACCT_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0341) //"Invalid account")
#define TSDB_CODE_MND_INVALID_ACCT_OPTION TAOS_DEF_ERROR_CODE(0, 0x0342) //"Invalid account options")
...
...
include/util/tdef.h
浏览文件 @
890c4ec8
...
...
@@ -209,6 +209,8 @@ do { \
#define TSDB_STEP_NAME_LEN 32
#define TSDB_STEP_DESC_LEN 128
#define TSDB_DNODE_CONFIG_LEN 128
#define TSDB_MQTT_HOSTNAME_LEN 64
#define TSDB_MQTT_PORT_LEN 8
#define TSDB_MQTT_USER_LEN 24
...
...
source/common/src/tglobal.c
浏览文件 @
890c4ec8
...
...
@@ -156,7 +156,6 @@ int8_t tsEnableBalance = 1;
int8_t
tsAlternativeRole
=
0
;
int32_t
tsBalanceInterval
=
300
;
// seconds
int32_t
tsOfflineThreshold
=
86400
*
10
;
// seconds of 10 days
int32_t
tsMnodeEqualVnodeNum
=
4
;
int8_t
tsEnableFlowCtrl
=
1
;
int8_t
tsEnableSlaveQuery
=
1
;
int8_t
tsEnableAdjustMaster
=
1
;
...
...
@@ -1072,17 +1071,6 @@ static void doInitGlobalConfig(void) {
cfg
.
maxValue
=
10000000
;
cfg
.
ptrLength
=
0
;
cfg
.
unitType
=
TAOS_CFG_UTYPE_GB
;
taosInitConfigOption
(
cfg
);
// module configs
cfg
.
option
=
"mnodeEqualVnodeNum"
;
cfg
.
ptr
=
&
tsMnodeEqualVnodeNum
;
cfg
.
valType
=
TAOS_CFG_VTYPE_INT32
;
cfg
.
cfgType
=
TSDB_CFG_CTYPE_B_CONFIG
|
TSDB_CFG_CTYPE_B_SHOW
;
cfg
.
minValue
=
0
;
cfg
.
maxValue
=
1000
;
cfg
.
ptrLength
=
0
;
cfg
.
unitType
=
TAOS_CFG_UTYPE_NONE
;
taosInitConfigOption
(
cfg
);
// module configs
...
...
source/dnode/mgmt/daemon/src/daemon.c
浏览文件 @
890c4ec8
...
...
@@ -142,7 +142,6 @@ void dmnInitOption(SDnodeOpt *pOption) {
pOption
->
numOfSupportVnodes
=
1
;
pOption
->
numOfSupportQnodes
=
1
;
pOption
->
statusInterval
=
tsStatusInterval
;
pOption
->
mnodeEqualVnodeNum
=
tsMnodeEqualVnodeNum
;
pOption
->
numOfThreadsPerCore
=
tsNumOfThreadsPerCore
;
pOption
->
ratioOfQueryCores
=
tsRatioOfQueryCores
;
pOption
->
maxShellConns
=
tsMaxShellConns
;
...
...
source/dnode/mgmt/impl/src/dndDnode.c
浏览文件 @
890c4ec8
...
...
@@ -357,7 +357,6 @@ static void dndSendStatusMsg(SDnode *pDnode) {
tstrncpy
(
pStatus
->
dnodeEp
,
pDnode
->
opt
.
localEp
,
TSDB_EP_LEN
);
pStatus
->
clusterCfg
.
statusInterval
=
htonl
(
pDnode
->
opt
.
statusInterval
);
pStatus
->
clusterCfg
.
mnodeEqualVnodeNum
=
htonl
(
pDnode
->
opt
.
mnodeEqualVnodeNum
);
pStatus
->
clusterCfg
.
checkTime
=
0
;
char
timestr
[
32
]
=
"1970-01-01 00:00:00.00"
;
(
void
)
taosParseTime
(
timestr
,
&
pStatus
->
clusterCfg
.
checkTime
,
(
int32_t
)
strlen
(
timestr
),
TSDB_TIME_PRECISION_MILLI
,
0
);
...
...
source/dnode/mgmt/impl/src/dndMnode.c
浏览文件 @
890c4ec8
...
...
@@ -334,7 +334,6 @@ static void dndInitMnodeOption(SDnode *pDnode, SMnodeOpt *pOption) {
pOption
->
cfg
.
sver
=
pDnode
->
opt
.
sver
;
pOption
->
cfg
.
enableTelem
=
pDnode
->
opt
.
enableTelem
;
pOption
->
cfg
.
statusInterval
=
pDnode
->
opt
.
statusInterval
;
pOption
->
cfg
.
mnodeEqualVnodeNum
=
pDnode
->
opt
.
mnodeEqualVnodeNum
;
pOption
->
cfg
.
shellActivityTimer
=
pDnode
->
opt
.
shellActivityTimer
;
pOption
->
cfg
.
timezone
=
pDnode
->
opt
.
timezone
;
pOption
->
cfg
.
charset
=
pDnode
->
opt
.
charset
;
...
...
source/dnode/mgmt/impl/test/sut/deploy.cpp
浏览文件 @
890c4ec8
...
...
@@ -57,7 +57,6 @@ void initOption(SDnodeOpt* pOption, const char* path, const char* fqdn, uint16_t
pOption
->
numOfSupportVnodes
=
1
;
pOption
->
numOfSupportQnodes
=
1
;
pOption
->
statusInterval
=
1
;
pOption
->
mnodeEqualVnodeNum
=
1
;
pOption
->
numOfThreadsPerCore
=
1
;
pOption
->
ratioOfQueryCores
=
1
;
pOption
->
maxShellConns
=
1000
;
...
...
source/dnode/mnode/impl/inc/mndDef.h
浏览文件 @
890c4ec8
...
...
@@ -92,7 +92,6 @@ typedef enum {
DND_REASON_VERSION_NOT_MATCH
,
DND_REASON_DNODE_ID_NOT_MATCH
,
DND_REASON_CLUSTER_ID_NOT_MATCH
,
DND_REASON_MN_EQUAL_VN_NOT_MATCH
,
DND_REASON_STATUS_INTERVAL_NOT_MATCH
,
DND_REASON_TIME_ZONE_NOT_MATCH
,
DND_REASON_LOCALE_NOT_MATCH
,
...
...
@@ -125,6 +124,7 @@ typedef struct SDnodeObj {
int64_t
createdTime
;
int64_t
updateTime
;
int64_t
rebootTime
;
int64_t
lastAccessTime
;
int32_t
accessTimes
;
int16_t
numOfMnodes
;
int16_t
numOfVnodes
;
...
...
source/dnode/mnode/impl/src/mndDnode.c
浏览文件 @
890c4ec8
...
...
@@ -22,10 +22,13 @@
#include "tutil.h"
#define TSDB_DNODE_VER 1
#define TSDB_DNODE_RESERVE_SIZE 64
#define TSDB_CONFIG_OPTION_LEN 16
#define TSDB_CONIIG_VALUE_LEN 48
#define TSDB_CONFIG_NUMBER 8
static
int32_t
id
=
2
;
static
const
char
*
offlineReason
[]
=
{
""
,
"status msg timeout"
,
...
...
@@ -33,7 +36,6 @@ static const char *offlineReason[] = {
"version not match"
,
"dnodeId not match"
,
"clusterId not match"
,
"mnEqualVn not match"
,
"interval not match"
,
"timezone not match"
,
"locale not match"
,
...
...
@@ -117,6 +119,7 @@ static SSdbRaw *mndDnodeActionEncode(SDnodeObj *pDnode) {
SDB_SET_INT64
(
pRaw
,
dataPos
,
pDnode
->
updateTime
)
SDB_SET_INT16
(
pRaw
,
dataPos
,
pDnode
->
port
)
SDB_SET_BINARY
(
pRaw
,
dataPos
,
pDnode
->
fqdn
,
TSDB_FQDN_LEN
)
SDB_SET_RESERVE
(
pRaw
,
dataPos
,
TSDB_DNODE_RESERVE_SIZE
)
SDB_SET_DATALEN
(
pRaw
,
dataPos
);
return
pRaw
;
...
...
@@ -142,28 +145,28 @@ static SSdbRow *mndDnodeActionDecode(SSdbRaw *pRaw) {
SDB_GET_INT64
(
pRaw
,
pRow
,
dataPos
,
&
pDnode
->
updateTime
)
SDB_GET_INT16
(
pRaw
,
pRow
,
dataPos
,
&
pDnode
->
port
)
SDB_GET_BINARY
(
pRaw
,
pRow
,
dataPos
,
pDnode
->
fqdn
,
TSDB_FQDN_LEN
)
SDB_GET_RESERVE
(
pRaw
,
pRow
,
dataPos
,
TSDB_DNODE_RESERVE_SIZE
)
return
pRow
;
}
static
void
mnodeResetDnode
(
SDnodeObj
*
pDnode
)
{
static
int32_t
mndDnodeActionInsert
(
SSdb
*
pSdb
,
SDnodeObj
*
pDnode
)
{
mTrace
(
"dnode:%d, perform insert action"
,
pDnode
->
id
);
pDnode
->
rebootTime
=
0
;
pDnode
->
lastAccessTime
=
0
;
pDnode
->
accessTimes
=
0
;
pDnode
->
numOfCores
=
0
;
pDnode
->
numOfMnodes
=
0
;
pDnode
->
numOfVnodes
=
0
;
pDnode
->
numOfQnodes
=
0
;
pDnode
->
numOfSupportMnodes
=
0
;
pDnode
->
numOfSupportVnodes
=
0
;
pDnode
->
numOfSupportQnodes
=
0
;
pDnode
->
numOfCores
=
0
;
pDnode
->
status
=
DND_STATUS_OFFLINE
;
pDnode
->
offlineReason
=
DND_REASON_STATUS_NOT_RECEIVED
;
snprintf
(
pDnode
->
ep
,
TSDB_EP_LEN
,
"%s:%u"
,
pDnode
->
fqdn
,
pDnode
->
port
);
}
static
int32_t
mndDnodeActionInsert
(
SSdb
*
pSdb
,
SDnodeObj
*
pDnode
)
{
mTrace
(
"dnode:%d, perform insert action"
,
pDnode
->
id
);
mnodeResetDnode
(
pDnode
);
return
0
;
}
...
...
@@ -174,11 +177,6 @@ static int32_t mndDnodeActionDelete(SSdb *pSdb, SDnodeObj *pDnode) {
static
int32_t
mndDnodeActionUpdate
(
SSdb
*
pSdb
,
SDnodeObj
*
pOldDnode
,
SDnodeObj
*
pNewDnode
)
{
mTrace
(
"dnode:%d, perform update action"
,
pOldDnode
->
id
);
pOldDnode
->
id
=
pNewDnode
->
id
;
pOldDnode
->
createdTime
=
pNewDnode
->
createdTime
;
pOldDnode
->
updateTime
=
pNewDnode
->
updateTime
;
pOldDnode
->
port
=
pNewDnode
->
port
;
memcpy
(
pOldDnode
->
fqdn
,
pNewDnode
->
fqdn
,
TSDB_FQDN_LEN
);
return
0
;
}
...
...
@@ -232,6 +230,7 @@ static void mndGetDnodeData(SMnode *pMnode, SDnodeEps *pEps, int32_t numOfEps) {
if
(
pIter
==
NULL
)
break
;
if
(
i
>=
numOfEps
)
{
sdbCancelFetch
(
pSdb
,
pIter
);
sdbRelease
(
pSdb
,
pDnode
);
break
;
}
...
...
@@ -244,20 +243,15 @@ static void mndGetDnodeData(SMnode *pMnode, SDnodeEps *pEps, int32_t numOfEps) {
pEp
->
isMnode
=
1
;
}
i
++
;
sdbRelease
(
pSdb
,
pDnode
);
}
pEps
->
num
=
htonl
(
i
);
}
static
int32_t
mndCheckClusterCfgPara
(
SMnode
*
pMnode
,
const
SClusterCfg
*
pCfg
)
{
if
(
pCfg
->
mnodeEqualVnodeNum
!=
pMnode
->
cfg
.
mnodeEqualVnodeNum
)
{
mError
(
"
\"
mnodeEqualVnodeNum
\"
[%d - %d] cfg inconsistent"
,
pCfg
->
mnodeEqualVnodeNum
,
pMnode
->
cfg
.
mnodeEqualVnodeNum
);
return
DND_REASON_MN_EQUAL_VN_NOT_MATCH
;
}
if
(
pCfg
->
statusInterval
!=
pMnode
->
cfg
.
statusInterval
)
{
mError
(
"
\"
statusInterval
\"
[%d - %d] cfg inconsistent"
,
pCfg
->
statusInterval
,
pMnode
->
cfg
.
statusInterval
);
mError
(
"
statusInterval
[%d - %d] cfg inconsistent"
,
pCfg
->
statusInterval
,
pMnode
->
cfg
.
statusInterval
);
return
DND_REASON_STATUS_INTERVAL_NOT_MATCH
;
}
...
...
@@ -265,18 +259,18 @@ static int32_t mndCheckClusterCfgPara(SMnode *pMnode, const SClusterCfg *pCfg) {
char
timestr
[
32
]
=
"1970-01-01 00:00:00.00"
;
(
void
)
taosParseTime
(
timestr
,
&
checkTime
,
(
int32_t
)
strlen
(
timestr
),
TSDB_TIME_PRECISION_MILLI
,
0
);
if
((
0
!=
strcasecmp
(
pCfg
->
timezone
,
pMnode
->
cfg
.
timezone
))
&&
(
checkTime
!=
pCfg
->
checkTime
))
{
mError
(
"
\"
timezone
\"
[%s - %s] [%"
PRId64
" - %"
PRId64
"] cfg inconsistent"
,
pCfg
->
timezone
,
pMnode
->
cfg
.
timezone
,
mError
(
"
timezone
[%s - %s] [%"
PRId64
" - %"
PRId64
"] cfg inconsistent"
,
pCfg
->
timezone
,
pMnode
->
cfg
.
timezone
,
pCfg
->
checkTime
,
checkTime
);
return
DND_REASON_TIME_ZONE_NOT_MATCH
;
}
if
(
0
!=
strcasecmp
(
pCfg
->
locale
,
pMnode
->
cfg
.
locale
))
{
mError
(
"
\"
locale
\"
[%s - %s] cfg parameters
inconsistent"
,
pCfg
->
locale
,
pMnode
->
cfg
.
locale
);
mError
(
"
locale [%s - %s] cfg
inconsistent"
,
pCfg
->
locale
,
pMnode
->
cfg
.
locale
);
return
DND_REASON_LOCALE_NOT_MATCH
;
}
if
(
0
!=
strcasecmp
(
pCfg
->
charset
,
pMnode
->
cfg
.
charset
))
{
mError
(
"
\"
charset
\"
[%s - %s] cfg parameters
inconsistent."
,
pCfg
->
charset
,
pMnode
->
cfg
.
charset
);
mError
(
"
charset [%s - %s] cfg
inconsistent."
,
pCfg
->
charset
,
pMnode
->
cfg
.
charset
);
return
DND_REASON_CHARSET_NOT_MATCH
;
}
...
...
@@ -292,9 +286,7 @@ static void mndParseStatusMsg(SStatusMsg *pStatus) {
pStatus
->
numOfSupportMnodes
=
htons
(
pStatus
->
numOfSupportMnodes
);
pStatus
->
numOfSupportVnodes
=
htons
(
pStatus
->
numOfSupportVnodes
);
pStatus
->
numOfSupportQnodes
=
htons
(
pStatus
->
numOfSupportQnodes
);
pStatus
->
clusterCfg
.
statusInterval
=
htonl
(
pStatus
->
clusterCfg
.
statusInterval
);
pStatus
->
clusterCfg
.
mnodeEqualVnodeNum
=
htonl
(
pStatus
->
clusterCfg
.
mnodeEqualVnodeNum
);
pStatus
->
clusterCfg
.
checkTime
=
htobe64
(
pStatus
->
clusterCfg
.
checkTime
);
}
...
...
@@ -308,7 +300,8 @@ static int32_t mndProcessStatusMsg(SMnodeMsg *pMsg) {
pDnode
=
mndAcquireDnodeByEp
(
pMnode
,
pStatus
->
dnodeEp
);
if
(
pDnode
==
NULL
)
{
mDebug
(
"dnode:%s, not created yet"
,
pStatus
->
dnodeEp
);
return
TSDB_CODE_MND_DNODE_NOT_EXIST
;
terrno
=
TSDB_CODE_MND_DNODE_NOT_EXIST
;
return
-
1
;
}
}
else
{
pDnode
=
mndAcquireDnode
(
pMnode
,
pStatus
->
dnodeId
);
...
...
@@ -319,7 +312,8 @@ static int32_t mndProcessStatusMsg(SMnodeMsg *pMsg) {
}
mError
(
"dnode:%d, %s not exist"
,
pStatus
->
dnodeId
,
pStatus
->
dnodeEp
);
mndReleaseDnode
(
pMnode
,
pDnode
);
return
TSDB_CODE_MND_DNODE_NOT_EXIST
;
terrno
=
TSDB_CODE_MND_DNODE_NOT_EXIST
;
return
-
1
;
}
}
...
...
@@ -329,7 +323,8 @@ static int32_t mndProcessStatusMsg(SMnodeMsg *pMsg) {
}
mndReleaseDnode
(
pMnode
,
pDnode
);
mError
(
"dnode:%d, status msg version:%d not match cluster:%d"
,
pStatus
->
dnodeId
,
pStatus
->
sver
,
pMnode
->
cfg
.
sver
);
return
TSDB_CODE_MND_INVALID_MSG_VERSION
;
terrno
=
TSDB_CODE_MND_INVALID_MSG_VERSION
;
return
-
1
;
}
if
(
pStatus
->
dnodeId
==
0
)
{
...
...
@@ -341,7 +336,8 @@ static int32_t mndProcessStatusMsg(SMnodeMsg *pMsg) {
}
mError
(
"dnode:%d, clusterId %d not match exist %d"
,
pDnode
->
id
,
pStatus
->
clusterId
,
pMnode
->
clusterId
);
mndReleaseDnode
(
pMnode
,
pDnode
);
return
TSDB_CODE_MND_INVALID_CLUSTER_ID
;
terrno
!=
TSDB_CODE_MND_INVALID_CLUSTER_ID
;
return
-
1
;
}
else
{
pDnode
->
accessTimes
++
;
mTrace
(
"dnode:%d, status received, access times %d"
,
pDnode
->
id
,
pDnode
->
accessTimes
);
...
...
@@ -355,7 +351,8 @@ static int32_t mndProcessStatusMsg(SMnodeMsg *pMsg) {
pDnode
->
offlineReason
=
ret
;
mError
(
"dnode:%d, cluster cfg inconsistent since:%s"
,
pDnode
->
id
,
offlineReason
[
ret
]);
mndReleaseDnode
(
pMnode
,
pDnode
);
return
TSDB_CODE_MND_CLUSTER_CFG_INCONSISTENT
;
terrno
=
TSDB_CODE_MND_INVALID_CLUSTER_CFG
;
return
-
1
;
}
mInfo
(
"dnode:%d, from offline to online"
,
pDnode
->
id
);
...
...
@@ -366,6 +363,7 @@ static int32_t mndProcessStatusMsg(SMnodeMsg *pMsg) {
pDnode
->
numOfSupportMnodes
=
pStatus
->
numOfSupportMnodes
;
pDnode
->
numOfSupportVnodes
=
pStatus
->
numOfSupportVnodes
;
pDnode
->
numOfSupportQnodes
=
pStatus
->
numOfSupportQnodes
;
pDnode
->
lastAccessTime
=
taosGetTimestampMs
();
pDnode
->
status
=
DND_STATUS_READY
;
int32_t
numOfEps
=
mndGetDnodeSize
(
pMnode
);
...
...
@@ -373,7 +371,8 @@ static int32_t mndProcessStatusMsg(SMnodeMsg *pMsg) {
SStatusRsp
*
pRsp
=
rpcMallocCont
(
contLen
);
if
(
pRsp
==
NULL
)
{
mndReleaseDnode
(
pMnode
,
pDnode
);
return
TSDB_CODE_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
pRsp
->
dnodeCfg
.
dnodeId
=
htonl
(
pDnode
->
id
);
...
...
@@ -390,13 +389,13 @@ static int32_t mndProcessStatusMsg(SMnodeMsg *pMsg) {
static
int32_t
mndCreateDnode
(
SMnode
*
pMnode
,
SMnodeMsg
*
pMsg
,
SCreateDnodeMsg
*
pCreate
)
{
SDnodeObj
dnodeObj
=
{
0
};
dnodeObj
.
id
=
1
;
// todo
dnodeObj
.
id
=
id
++
;
dnodeObj
.
createdTime
=
taosGetTimestampMs
();
dnodeObj
.
updateTime
=
dnodeObj
.
createdTime
;
taosGetFqdnPortFromEp
(
pCreate
->
ep
,
dnodeObj
.
fqdn
,
&
dnodeObj
.
port
);
if
(
dnodeObj
.
fqdn
[
0
]
==
0
||
dnodeObj
.
port
<=
0
)
{
terrno
=
TSDB_CODE_
SDB_APP_ERROR
;
terrno
=
TSDB_CODE_
MND_INVALID_DNODE_EP
;
mError
(
"dnode:%s, failed to create since %s"
,
pCreate
->
ep
,
terrstr
());
return
terrno
;
}
...
...
@@ -449,7 +448,7 @@ static int32_t mndProcessCreateDnodeMsg(SMnodeMsg *pMsg) {
mDebug
(
"dnode:%s, start to create"
,
pCreate
->
ep
);
if
(
pCreate
->
ep
[
0
]
==
0
)
{
terrno
=
TSDB_CODE_
SDB_APP_ERROR
;
terrno
=
TSDB_CODE_
MND_INVALID_DNODE_EP
;
mError
(
"dnode:%s, failed to create since %s"
,
pCreate
->
ep
,
terrstr
());
return
-
1
;
}
...
...
@@ -457,7 +456,7 @@ static int32_t mndProcessCreateDnodeMsg(SMnodeMsg *pMsg) {
SDnodeObj
*
pDnode
=
mndAcquireDnodeByEp
(
pMnode
,
pCreate
->
ep
);
if
(
pDnode
!=
NULL
)
{
mError
(
"dnode:%d, already exist"
,
pDnode
->
id
);
sdbRelease
(
pMnode
->
pSdb
,
pDnode
);
mndReleaseDnode
(
pMnode
,
pDnode
);
terrno
=
TSDB_CODE_MND_DNODE_ALREADY_EXIST
;
return
-
1
;
}
...
...
@@ -478,7 +477,7 @@ static int32_t mndDropDnode(SMnode *pMnode, SMnodeMsg *pMsg, SDnodeObj *pDnode)
mError
(
"dnode:%d, failed to drop since %s"
,
pDnode
->
id
,
terrstr
());
return
-
1
;
}
mDebug
(
"trans:%d, used to drop
user
:%d"
,
pTrans
->
id
,
pDnode
->
id
);
mDebug
(
"trans:%d, used to drop
dnode
:%d"
,
pTrans
->
id
,
pDnode
->
id
);
SSdbRaw
*
pRedoRaw
=
mndDnodeActionEncode
(
pDnode
);
if
(
pRedoRaw
==
NULL
||
mndTransAppendRedolog
(
pTrans
,
pRedoRaw
)
!=
0
)
{
...
...
@@ -522,26 +521,26 @@ static int32_t mndProcessDropDnodeMsg(SMnodeMsg *pMsg) {
mDebug
(
"dnode:%d, start to drop"
,
pDrop
->
dnodeId
);
if
(
pDrop
->
dnodeId
<=
0
)
{
terrno
=
TSDB_CODE_
SDB_APP_ERROR
;
terrno
=
TSDB_CODE_
MND_INVALID_DNODE_ID
;
mError
(
"dnode:%d, failed to drop since %s"
,
pDrop
->
dnodeId
,
terrstr
());
return
-
1
;
}
SDnodeObj
*
pDnode
=
mndAcquireDnode
(
pMnode
,
pDrop
->
dnodeId
);
if
(
pDnode
==
NULL
)
{
mError
(
"dnode:%d, not exist"
,
pDrop
->
dnodeId
);
terrno
=
TSDB_CODE_MND_DNODE_NOT_EXIST
;
mError
(
"dnode:%d, failed to drop since %s"
,
pDrop
->
dnodeId
,
terrstr
());
return
-
1
;
}
int32_t
code
=
mndDropDnode
(
pMnode
,
pMsg
,
pDnode
);
if
(
code
!=
0
)
{
mndReleaseDnode
(
pMnode
,
pDnode
);
mError
(
"dnode:%d, failed to drop since %s"
,
pDrop
->
dnodeId
,
terrstr
());
return
-
1
;
}
sdbRelease
(
pMnode
->
pSdb
,
pDnode
);
mndReleaseDnode
(
pMnode
,
pDnode
);
return
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
}
...
...
@@ -553,7 +552,7 @@ static int32_t mndProcessConfigDnodeMsg(SMnodeMsg *pMsg) {
SDnodeObj
*
pDnode
=
mndAcquireDnode
(
pMnode
,
pCfg
->
dnodeId
);
if
(
pDnode
==
NULL
)
{
terrno
=
TSDB_CODE_MND_DNODE_NOT_EXIST
;
mError
(
"dnode:%d, failed to c
f
g since %s "
,
pCfg
->
dnodeId
,
terrstr
());
mError
(
"dnode:%d, failed to c
onfi
g since %s "
,
pCfg
->
dnodeId
,
terrstr
());
return
-
1
;
}
...
...
@@ -562,17 +561,22 @@ static int32_t mndProcessConfigDnodeMsg(SMnodeMsg *pMsg) {
SCfgDnodeMsg
*
pCfgDnode
=
rpcMallocCont
(
sizeof
(
SCfgDnodeMsg
));
pCfgDnode
->
dnodeId
=
htonl
(
pCfg
->
dnodeId
);
memcpy
(
pCfgDnode
->
config
,
pCfg
->
config
,
128
);
memcpy
(
pCfgDnode
->
config
,
pCfg
->
config
,
TSDB_DNODE_CONFIG_LEN
);
SRpcMsg
rpcMsg
=
{.
msgType
=
TSDB_MSG_TYPE_CONFIG_DNODE_IN
,
.
pCont
=
pCfgDnode
,
.
contLen
=
sizeof
(
SCfgDnodeMsg
)};
SRpcMsg
rpcMsg
=
{.
msgType
=
TSDB_MSG_TYPE_CONFIG_DNODE_IN
,
.
pCont
=
pCfgDnode
,
.
contLen
=
sizeof
(
SCfgDnodeMsg
),
.
ahandle
=
pMsg
->
rpcMsg
.
ahandle
};
mInfo
(
"dnode:%d,
is configured"
,
pCfg
->
dnodeId
);
mInfo
(
"dnode:%d,
app:%p config:%s req send to dnode"
,
pCfg
->
dnodeId
,
rpcMsg
.
ahandle
,
pCfg
->
config
);
mndSendMsgToDnode
(
pMnode
,
&
epSet
,
&
rpcMsg
);
return
0
;
}
static
int32_t
mndProcessConfigDnodeRsp
(
SMnodeMsg
*
pMsg
)
{
mInfo
(
"cfg dnode rsp is received"
);
}
static
int32_t
mndProcessConfigDnodeRsp
(
SMnodeMsg
*
pMsg
)
{
mInfo
(
"app:%p config rsp from dnode"
,
pMsg
->
rpcMsg
.
ahandle
);
}
static
int32_t
mndGetConfigMeta
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
STableMetaMsg
*
pMeta
)
{
int32_t
cols
=
0
;
...
...
@@ -600,7 +604,6 @@ static int32_t mndGetConfigMeta(SMnodeMsg *pMsg, SShowObj *pShow, STableMetaMsg
pShow
->
numOfRows
=
TSDB_CONFIG_NUMBER
;
pShow
->
rowSize
=
pShow
->
offset
[
cols
-
1
]
+
pShow
->
bytes
[
cols
-
1
];
pShow
->
pIter
=
NULL
;
strcpy
(
pMeta
->
tableFname
,
mndShowStr
(
pShow
->
type
));
return
0
;
...
...
@@ -676,7 +679,7 @@ static int32_t mndGetDnodeMeta(SMnodeMsg *pMsg, SShowObj *pShow, STableMetaMsg *
pShow
->
bytes
[
cols
]
=
2
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_SMALLINT
;
strcpy
(
pSchema
[
cols
].
name
,
"
cor
es"
);
strcpy
(
pSchema
[
cols
].
name
,
"
max vnod
es"
);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
cols
++
;
...
...
@@ -740,7 +743,7 @@ static int32_t mndRetrieveDnodes(SMnodeMsg *pMsg, SShowObj *pShow, char *data, i
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
*
(
int16_t
*
)
pWrite
=
pDnode
->
numOf
Cor
es
;
*
(
int16_t
*
)
pWrite
=
pDnode
->
numOf
SupportVnod
es
;
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
...
...
source/dnode/mnode/impl/src/mnode.c
浏览文件 @
890c4ec8
...
...
@@ -205,7 +205,6 @@ static int32_t mndSetOptions(SMnode *pMnode, const SMnodeOpt *pOption) {
pMnode
->
cfg
.
sver
=
pOption
->
cfg
.
sver
;
pMnode
->
cfg
.
enableTelem
=
pOption
->
cfg
.
enableTelem
;
pMnode
->
cfg
.
statusInterval
=
pOption
->
cfg
.
statusInterval
;
pMnode
->
cfg
.
mnodeEqualVnodeNum
=
pOption
->
cfg
.
mnodeEqualVnodeNum
;
pMnode
->
cfg
.
shellActivityTimer
=
pOption
->
cfg
.
shellActivityTimer
;
pMnode
->
cfg
.
timezone
=
strdup
(
pOption
->
cfg
.
timezone
);
pMnode
->
cfg
.
locale
=
strdup
(
pOption
->
cfg
.
locale
);
...
...
@@ -215,7 +214,7 @@ static int32_t mndSetOptions(SMnode *pMnode, const SMnodeOpt *pOption) {
if
(
pMnode
->
sendMsgToDnodeFp
==
NULL
||
pMnode
->
sendMsgToMnodeFp
==
NULL
||
pMnode
->
sendRedirectMsgFp
==
NULL
||
pMnode
->
putMsgToApplyMsgFp
==
NULL
||
pMnode
->
dnodeId
<
0
||
pMnode
->
clusterId
<
0
||
pMnode
->
cfg
.
statusInterval
<
1
||
pOption
->
cfg
.
mnodeEqualVnodeNum
<
0
)
{
pMnode
->
cfg
.
statusInterval
<
1
)
{
terrno
=
TSDB_CODE_MND_INVALID_OPTIONS
;
return
-
1
;
}
...
...
source/util/src/terror.c
浏览文件 @
890c4ec8
...
...
@@ -162,22 +162,23 @@ TAOS_DEFINE_ERROR(TSDB_CODE_SDB_INVALID_DATA_VER, "Invalid raw data vers
TAOS_DEFINE_ERROR
(
TSDB_CODE_SDB_INVALID_DATA_LEN
,
"Invalid raw data len"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_SDB_INVALID_DATA_CONTENT
,
"Invalid raw data content"
)
// mnode-dnode
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_DNODE_ALREADY_EXIST
,
"DNode already exists"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_DNODE_NOT_EXIST
,
"DNode does not exist"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_VGROUP_NOT_EXIST
,
"VGroup does not exist"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_NO_REMOVE_MASTER
,
"Master DNode cannot be removed"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_NO_ENOUGH_DNODES
,
"Out of DNodes"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_CLUSTER_CFG_INCONSISTENT
,
"Cluster cfg inconsistent"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_DNODE_CFG_OPTION
,
"Invalid dnode cfg option"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_BALANCE_ENABLED
,
"Balance already enabled"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_CLUSTER_CFG
,
"Cluster cfg inconsistent"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_CLUSTER_ID
,
"Cluster id not match"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_DNODE_CFG
,
"Invalid dnode cfg"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_DNODE_EP
,
"Invalid dnode end point"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_DNODE_ID
,
"Invalid dnode id"
)
// mnode-vgroup
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_VGROUP_NOT_EXIST
,
"VGroup does not exist"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_VGROUP_NOT_IN_DNODE
,
"Vgroup not in dnode"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_VGROUP_ALREADY_IN_DNODE
,
"Vgroup already in dnode"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_DNODE_NOT_FREE
,
"Dnode not avaliable"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_CLUSTER_ID
,
"Cluster id not match"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_NOT_READY
,
"Cluster not ready"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_DNODE_ID_NOT_CONFIGURED
,
"Dnode Id not configured"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_DNODE_EP_NOT_CONFIGURED
,
"Dnode Ep not configured"
)
// mnode-acct
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_ACCT_ALREADY_EXIST
,
"Account already exists"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_ACCT_NOT_EXIST
,
"Invalid account"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_ACCT_OPTION
,
"Invalid account options"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录