Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
3c9fcc58
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
3c9fcc58
编写于
7月 26, 2020
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-998]
上级
90e23fb8
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
30 addition
and
6 deletion
+30
-6
src/dnode/src/dnodeMgmt.c
src/dnode/src/dnodeMgmt.c
+12
-1
src/inc/taoserror.h
src/inc/taoserror.h
+1
-0
src/inc/taosmsg.h
src/inc/taosmsg.h
+2
-0
src/mnode/src/mnodeCluster.c
src/mnode/src/mnodeCluster.c
+2
-1
src/mnode/src/mnodeDnode.c
src/mnode/src/mnodeDnode.c
+13
-4
未找到文件。
src/dnode/src/dnodeMgmt.c
浏览文件 @
3c9fcc58
...
@@ -492,6 +492,7 @@ static void dnodeProcessStatusRsp(SRpcMsg *pMsg) {
...
@@ -492,6 +492,7 @@ static void dnodeProcessStatusRsp(SRpcMsg *pMsg) {
pCfg
->
numOfVnodes
=
htonl
(
pCfg
->
numOfVnodes
);
pCfg
->
numOfVnodes
=
htonl
(
pCfg
->
numOfVnodes
);
pCfg
->
moduleStatus
=
htonl
(
pCfg
->
moduleStatus
);
pCfg
->
moduleStatus
=
htonl
(
pCfg
->
moduleStatus
);
pCfg
->
dnodeId
=
htonl
(
pCfg
->
dnodeId
);
pCfg
->
dnodeId
=
htonl
(
pCfg
->
dnodeId
);
pCfg
->
clusterId
=
htonl
(
pCfg
->
clusterId
);
for
(
int32_t
i
=
0
;
i
<
pMnodes
->
nodeNum
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pMnodes
->
nodeNum
;
++
i
)
{
SDMMnodeInfo
*
pMnodeInfo
=
&
pMnodes
->
nodeInfos
[
i
];
SDMMnodeInfo
*
pMnodeInfo
=
&
pMnodes
->
nodeInfos
[
i
];
...
@@ -697,6 +698,7 @@ static void dnodeSendStatusMsg(void *handle, void *tmrId) {
...
@@ -697,6 +698,7 @@ static void dnodeSendStatusMsg(void *handle, void *tmrId) {
//strcpy(pStatus->dnodeName, tsDnodeName);
//strcpy(pStatus->dnodeName, tsDnodeName);
pStatus
->
version
=
htonl
(
tsVersion
);
pStatus
->
version
=
htonl
(
tsVersion
);
pStatus
->
dnodeId
=
htonl
(
tsDnodeCfg
.
dnodeId
);
pStatus
->
dnodeId
=
htonl
(
tsDnodeCfg
.
dnodeId
);
pStatus
->
clusterId
=
htonl
(
tsDnodeCfg
.
clusterId
);
strcpy
(
pStatus
->
dnodeEp
,
tsLocalEp
);
strcpy
(
pStatus
->
dnodeEp
,
tsLocalEp
);
pStatus
->
lastReboot
=
htonl
(
tsRebootTime
);
pStatus
->
lastReboot
=
htonl
(
tsRebootTime
);
pStatus
->
numOfCores
=
htons
((
uint16_t
)
tsNumOfCores
);
pStatus
->
numOfCores
=
htons
((
uint16_t
)
tsNumOfCores
);
...
@@ -767,6 +769,13 @@ static bool dnodeReadDnodeCfg() {
...
@@ -767,6 +769,13 @@ static bool dnodeReadDnodeCfg() {
}
}
tsDnodeCfg
.
dnodeId
=
dnodeId
->
valueint
;
tsDnodeCfg
.
dnodeId
=
dnodeId
->
valueint
;
cJSON
*
clusterId
=
cJSON_GetObjectItem
(
root
,
"clusterId"
);
if
(
!
clusterId
||
clusterId
->
type
!=
cJSON_Number
)
{
dError
(
"failed to read dnodeCfg.json, clusterId not found"
);
goto
PARSE_CFG_OVER
;
}
tsDnodeCfg
.
clusterId
=
clusterId
->
valueint
;
ret
=
true
;
ret
=
true
;
dInfo
(
"read numOfVnodes successed, dnodeId:%d"
,
tsDnodeCfg
.
dnodeId
);
dInfo
(
"read numOfVnodes successed, dnodeId:%d"
,
tsDnodeCfg
.
dnodeId
);
...
@@ -791,6 +800,7 @@ static void dnodeSaveDnodeCfg() {
...
@@ -791,6 +800,7 @@ static void dnodeSaveDnodeCfg() {
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"{
\n
"
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"{
\n
"
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
dnodeId
\"
: %d
\n
"
,
tsDnodeCfg
.
dnodeId
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
dnodeId
\"
: %d
\n
"
,
tsDnodeCfg
.
dnodeId
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
clusterId
\"
: %d
\n
"
,
tsDnodeCfg
.
clusterId
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"}
\n
"
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"}
\n
"
);
fwrite
(
content
,
1
,
len
,
fp
);
fwrite
(
content
,
1
,
len
,
fp
);
...
@@ -803,8 +813,9 @@ static void dnodeSaveDnodeCfg() {
...
@@ -803,8 +813,9 @@ static void dnodeSaveDnodeCfg() {
void
dnodeUpdateDnodeCfg
(
SDMDnodeCfg
*
pCfg
)
{
void
dnodeUpdateDnodeCfg
(
SDMDnodeCfg
*
pCfg
)
{
if
(
tsDnodeCfg
.
dnodeId
==
0
)
{
if
(
tsDnodeCfg
.
dnodeId
==
0
)
{
dInfo
(
"dnodeId is set to %d
"
,
pCfg
->
dnode
Id
);
dInfo
(
"dnodeId is set to %d
, clusterId is set to %d"
,
pCfg
->
dnodeId
,
pCfg
->
cluster
Id
);
tsDnodeCfg
.
dnodeId
=
pCfg
->
dnodeId
;
tsDnodeCfg
.
dnodeId
=
pCfg
->
dnodeId
;
tsDnodeCfg
.
clusterId
=
pCfg
->
clusterId
;
dnodeSaveDnodeCfg
();
dnodeSaveDnodeCfg
();
}
}
}
}
...
...
src/inc/taoserror.h
浏览文件 @
3c9fcc58
...
@@ -131,6 +131,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_BALANCE_ENABLED, 0, 0x0337, "balance al
...
@@ -131,6 +131,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_BALANCE_ENABLED, 0, 0x0337, "balance al
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_VGROUP_NOT_IN_DNODE
,
0
,
0x0338
,
"vgroup not in dnode"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_VGROUP_NOT_IN_DNODE
,
0
,
0x0338
,
"vgroup not in dnode"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_VGROUP_ALREADY_IN_DNODE
,
0
,
0x0339
,
"vgroup already in dnode"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_VGROUP_ALREADY_IN_DNODE
,
0
,
0x0339
,
"vgroup already in dnode"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_DNODE_NOT_FREE
,
0
,
0x033A
,
"dnode not avaliable"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_DNODE_NOT_FREE
,
0
,
0x033A
,
"dnode not avaliable"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_CLUSTER_ID
,
0
,
0x033B
,
"cluster id not match"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_ACCT_ALREADY_EXIST
,
0
,
0x0340
,
"mnode accounts already exist"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_ACCT_ALREADY_EXIST
,
0
,
0x0340
,
"mnode accounts already exist"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_ACCT
,
0
,
0x0341
,
"mnode invalid account"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_ACCT
,
0
,
0x0341
,
"mnode invalid account"
)
...
...
src/inc/taosmsg.h
浏览文件 @
3c9fcc58
...
@@ -547,6 +547,7 @@ typedef struct {
...
@@ -547,6 +547,7 @@ typedef struct {
typedef
struct
{
typedef
struct
{
int32_t
dnodeId
;
int32_t
dnodeId
;
int32_t
clusterId
;
uint32_t
moduleStatus
;
uint32_t
moduleStatus
;
uint32_t
numOfVnodes
;
uint32_t
numOfVnodes
;
uint32_t
reserved
;
uint32_t
reserved
;
...
@@ -587,6 +588,7 @@ typedef struct {
...
@@ -587,6 +588,7 @@ typedef struct {
uint16_t
openVnodes
;
uint16_t
openVnodes
;
uint16_t
numOfCores
;
uint16_t
numOfCores
;
float
diskAvailable
;
// GB
float
diskAvailable
;
// GB
int32_t
clusterId
;
uint8_t
alternativeRole
;
uint8_t
alternativeRole
;
uint8_t
reserve2
[
15
];
uint8_t
reserve2
[
15
];
SClusterCfg
clusterCfg
;
SClusterCfg
clusterCfg
;
...
...
src/mnode/src/mnodeCluster.c
浏览文件 @
3c9fcc58
...
@@ -77,6 +77,7 @@ static int32_t mnodeClusterActionRestored() {
...
@@ -77,6 +77,7 @@ static int32_t mnodeClusterActionRestored() {
}
}
}
}
mnodeUpdateClusterId
();
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -141,7 +142,7 @@ static int32_t mnodeCreateCluster() {
...
@@ -141,7 +142,7 @@ static int32_t mnodeCreateCluster() {
SClusterObj
*
pCluster
=
malloc
(
sizeof
(
SClusterObj
));
SClusterObj
*
pCluster
=
malloc
(
sizeof
(
SClusterObj
));
memset
(
pCluster
,
0
,
sizeof
(
SClusterObj
));
memset
(
pCluster
,
0
,
sizeof
(
SClusterObj
));
pCluster
->
createdTime
=
taosGetTimestampMs
();
pCluster
->
createdTime
=
taosGetTimestampMs
();
pCluster
->
clusterId
=
(
pCluster
->
createdTime
>>
32
)
&
(
pCluster
->
createdTime
)
&
(
*
(
int32_t
*
)
tsFirst
);
pCluster
->
clusterId
=
abs
(((
pCluster
->
createdTime
>>
32
)
&
(
pCluster
->
createdTime
))
|
(
*
(
int32_t
*
)
tsFirst
)
);
SSdbOper
oper
=
{
SSdbOper
oper
=
{
.
type
=
SDB_OPER_GLOBAL
,
.
type
=
SDB_OPER_GLOBAL
,
...
...
src/mnode/src/mnodeDnode.c
浏览文件 @
3c9fcc58
...
@@ -37,6 +37,7 @@
...
@@ -37,6 +37,7 @@
#include "mnodeVgroup.h"
#include "mnodeVgroup.h"
#include "mnodeWrite.h"
#include "mnodeWrite.h"
#include "mnodePeer.h"
#include "mnodePeer.h"
#include "mnodeCluster.h"
int32_t
tsAccessSquence
=
0
;
int32_t
tsAccessSquence
=
0
;
static
void
*
tsDnodeSdb
=
NULL
;
static
void
*
tsDnodeSdb
=
NULL
;
...
@@ -355,6 +356,7 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) {
...
@@ -355,6 +356,7 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) {
pStatus
->
moduleStatus
=
htonl
(
pStatus
->
moduleStatus
);
pStatus
->
moduleStatus
=
htonl
(
pStatus
->
moduleStatus
);
pStatus
->
lastReboot
=
htonl
(
pStatus
->
lastReboot
);
pStatus
->
lastReboot
=
htonl
(
pStatus
->
lastReboot
);
pStatus
->
numOfCores
=
htons
(
pStatus
->
numOfCores
);
pStatus
->
numOfCores
=
htons
(
pStatus
->
numOfCores
);
pStatus
->
clusterId
=
htonl
(
pStatus
->
clusterId
);
uint32_t
version
=
htonl
(
pStatus
->
version
);
uint32_t
version
=
htonl
(
pStatus
->
version
);
if
(
version
!=
tsVersion
)
{
if
(
version
!=
tsVersion
)
{
...
@@ -382,13 +384,19 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) {
...
@@ -382,13 +384,19 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) {
pDnode
->
diskAvailable
=
pStatus
->
diskAvailable
;
pDnode
->
diskAvailable
=
pStatus
->
diskAvailable
;
pDnode
->
alternativeRole
=
pStatus
->
alternativeRole
;
pDnode
->
alternativeRole
=
pStatus
->
alternativeRole
;
pDnode
->
moduleStatus
=
pStatus
->
moduleStatus
;
pDnode
->
moduleStatus
=
pStatus
->
moduleStatus
;
if
(
pStatus
->
dnodeId
==
0
)
{
if
(
pStatus
->
dnodeId
==
0
)
{
mDebug
(
"dnode:%d %s, first access
"
,
pDnode
->
dnodeId
,
pDnode
->
dnodeEp
);
mDebug
(
"dnode:%d %s, first access
, set clusterId %d"
,
pDnode
->
dnodeId
,
pDnode
->
dnodeEp
,
mnodeGetClusterId
()
);
}
else
{
}
else
{
mTrace
(
"dnode:%d, status received, access times %d"
,
pDnode
->
dnodeId
,
pDnode
->
lastAccess
);
if
(
pStatus
->
clusterId
!=
mnodeGetClusterId
())
{
mError
(
"dnode:%d, input clusterId %d not match with exist %d"
,
pDnode
->
dnodeId
,
pStatus
->
clusterId
,
mnodeGetClusterId
());
return
TSDB_CODE_MND_INVALID_CLUSTER_ID
;
}
else
{
mTrace
(
"dnode:%d, status received, access times %d"
,
pDnode
->
dnodeId
,
pDnode
->
lastAccess
);
}
}
}
int32_t
openVnodes
=
htons
(
pStatus
->
openVnodes
);
int32_t
openVnodes
=
htons
(
pStatus
->
openVnodes
);
int32_t
contLen
=
sizeof
(
SDMStatusRsp
)
+
openVnodes
*
sizeof
(
SDMVgroupAccess
);
int32_t
contLen
=
sizeof
(
SDMStatusRsp
)
+
openVnodes
*
sizeof
(
SDMVgroupAccess
);
SDMStatusRsp
*
pRsp
=
rpcMallocCont
(
contLen
);
SDMStatusRsp
*
pRsp
=
rpcMallocCont
(
contLen
);
...
@@ -400,6 +408,7 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) {
...
@@ -400,6 +408,7 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) {
pRsp
->
dnodeCfg
.
dnodeId
=
htonl
(
pDnode
->
dnodeId
);
pRsp
->
dnodeCfg
.
dnodeId
=
htonl
(
pDnode
->
dnodeId
);
pRsp
->
dnodeCfg
.
moduleStatus
=
htonl
((
int32_t
)
pDnode
->
isMgmt
);
pRsp
->
dnodeCfg
.
moduleStatus
=
htonl
((
int32_t
)
pDnode
->
isMgmt
);
pRsp
->
dnodeCfg
.
numOfVnodes
=
htonl
(
openVnodes
);
pRsp
->
dnodeCfg
.
numOfVnodes
=
htonl
(
openVnodes
);
pRsp
->
dnodeCfg
.
clusterId
=
htonl
(
mnodeGetClusterId
());
SDMVgroupAccess
*
pAccess
=
(
SDMVgroupAccess
*
)((
char
*
)
pRsp
+
sizeof
(
SDMStatusRsp
));
SDMVgroupAccess
*
pAccess
=
(
SDMVgroupAccess
*
)((
char
*
)
pRsp
+
sizeof
(
SDMStatusRsp
));
for
(
int32_t
j
=
0
;
j
<
openVnodes
;
++
j
)
{
for
(
int32_t
j
=
0
;
j
<
openVnodes
;
++
j
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录