Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
791c6c84
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
791c6c84
编写于
12月 26, 2021
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
adjust status msg
上级
c1605db6
变更
9
显示空白变更内容
内联
并排
Showing
9 changed file
with
34 addition
and
40 deletion
+34
-40
include/common/tmsg.h
include/common/tmsg.h
+2
-3
include/dnode/mgmt/dnode.h
include/dnode/mgmt/dnode.h
+0
-2
include/dnode/mnode/mnode.h
include/dnode/mnode/mnode.h
+1
-1
source/dnode/mgmt/daemon/src/daemon.c
source/dnode/mgmt/daemon/src/daemon.c
+0
-2
source/dnode/mgmt/impl/inc/dndDnode.h
source/dnode/mgmt/impl/inc/dndDnode.h
+1
-1
source/dnode/mgmt/impl/inc/dndInt.h
source/dnode/mgmt/impl/inc/dndInt.h
+7
-2
source/dnode/mgmt/impl/src/dndDnode.c
source/dnode/mgmt/impl/src/dndDnode.c
+22
-23
source/dnode/mgmt/impl/test/sut/src/server.cpp
source/dnode/mgmt/impl/test/sut/src/server.cpp
+0
-2
source/dnode/mnode/impl/src/mndDnode.c
source/dnode/mnode/impl/src/mndDnode.c
+1
-4
未找到文件。
include/common/tmsg.h
浏览文件 @
791c6c84
...
...
@@ -645,11 +645,10 @@ typedef struct {
int32_t
sver
;
int32_t
dnodeId
;
int32_t
clusterId
;
int64_t
rebootTime
;
// time stamp for last reboot
int64_t
rebootTime
;
int64_t
updateTime
;
int16_t
numOfCores
;
int16_t
numOfSupportMnodes
;
int16_t
numOfSupportVnodes
;
int16_t
numOfSupportQnodes
;
char
dnodeEp
[
TSDB_EP_LEN
];
SClusterCfg
clusterCfg
;
SVnodeLoads
vnodeLoads
;
...
...
include/dnode/mgmt/dnode.h
浏览文件 @
791c6c84
...
...
@@ -28,9 +28,7 @@ typedef struct SDnode SDnode;
typedef
struct
{
int32_t
sver
;
int16_t
numOfCores
;
int16_t
numOfSupportMnodes
;
int16_t
numOfSupportVnodes
;
int16_t
numOfSupportQnodes
;
int8_t
enableTelem
;
int32_t
statusInterval
;
float
numOfThreadsPerCore
;
...
...
include/dnode/mnode/mnode.h
浏览文件 @
791c6c84
...
...
@@ -56,7 +56,7 @@ typedef struct SMnodeCfg {
typedef
struct
{
int32_t
dnodeId
;
int
32
_t
clusterId
;
int
64
_t
clusterId
;
int8_t
replica
;
int8_t
selfIndex
;
SReplica
replicas
[
TSDB_MAX_REPLICA
];
...
...
source/dnode/mgmt/daemon/src/daemon.c
浏览文件 @
791c6c84
...
...
@@ -139,9 +139,7 @@ void dmnWaitSignal() {
void
dmnInitOption
(
SDnodeOpt
*
pOption
)
{
pOption
->
sver
=
30000000
;
//3.0.0.0
pOption
->
numOfCores
=
tsNumOfCores
;
pOption
->
numOfSupportMnodes
=
1
;
pOption
->
numOfSupportVnodes
=
1
;
pOption
->
numOfSupportQnodes
=
1
;
pOption
->
statusInterval
=
tsStatusInterval
;
pOption
->
numOfThreadsPerCore
=
tsNumOfThreadsPerCore
;
pOption
->
ratioOfQueryCores
=
tsRatioOfQueryCores
;
...
...
source/dnode/mgmt/impl/inc/dndDnode.h
浏览文件 @
791c6c84
...
...
@@ -27,7 +27,7 @@ void dndProcessDnodeReq(SDnode *pDnode, SRpcMsg *pMsg, SEpSet *pEpSet);
void
dndProcessDnodeRsp
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
);
int32_t
dndGetDnodeId
(
SDnode
*
pDnode
);
int
32
_t
dndGetClusterId
(
SDnode
*
pDnode
);
int
64
_t
dndGetClusterId
(
SDnode
*
pDnode
);
void
dndGetDnodeEp
(
SDnode
*
pDnode
,
int32_t
dnodeId
,
char
*
pEp
,
char
*
pFqdn
,
uint16_t
*
pPort
);
void
dndGetMnodeEpSet
(
SDnode
*
pDnode
,
SEpSet
*
pEpSet
);
void
dndSendRedirectMsg
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
);
...
...
source/dnode/mgmt/impl/inc/dndInt.h
浏览文件 @
791c6c84
...
...
@@ -22,10 +22,11 @@ extern "C" {
#include "cJSON.h"
#include "os.h"
#include "t
msg
.h"
#include "t
ep
.h"
#include "thash.h"
#include "tlockfree.h"
#include "tlog.h"
#include "tmsg.h"
#include "tqueue.h"
#include "trpc.h"
#include "tthread.h"
...
...
@@ -51,14 +52,18 @@ typedef void (*DndMsgFp)(SDnode *pDnode, SRpcMsg *pMsg, SEpSet *pEps);
typedef
struct
{
char
*
dnode
;
char
*
mnode
;
char
*
qnode
;
char
*
snode
;
char
*
bnode
;
char
*
vnodes
;
}
SDnodeDir
;
typedef
struct
{
int32_t
dnodeId
;
int32_t
dropped
;
int
32
_t
clusterId
;
int
64
_t
clusterId
;
int64_t
rebootTime
;
int64_t
updateTime
;
int8_t
statusSent
;
SEpSet
mnodeEpSet
;
char
*
file
;
...
...
source/dnode/mgmt/impl/src/dndDnode.c
浏览文件 @
791c6c84
...
...
@@ -17,7 +17,6 @@
#include "dndDnode.h"
#include "dndTransport.h"
#include "dndVnodes.h"
#include "tep.h"
int32_t
dndGetDnodeId
(
SDnode
*
pDnode
)
{
SDnodeMgmt
*
pMgmt
=
&
pDnode
->
dmgmt
;
...
...
@@ -27,10 +26,10 @@ int32_t dndGetDnodeId(SDnode *pDnode) {
return
dnodeId
;
}
int
32
_t
dndGetClusterId
(
SDnode
*
pDnode
)
{
int
64
_t
dndGetClusterId
(
SDnode
*
pDnode
)
{
SDnodeMgmt
*
pMgmt
=
&
pDnode
->
dmgmt
;
taosRLockLatch
(
&
pMgmt
->
latch
);
int
32
_t
clusterId
=
pMgmt
->
clusterId
;
int
64
_t
clusterId
=
pMgmt
->
clusterId
;
taosRUnLockLatch
(
&
pMgmt
->
latch
);
return
clusterId
;
}
...
...
@@ -68,7 +67,7 @@ void dndSendRedirectMsg(SDnode *pDnode, SRpcMsg *pMsg) {
SEpSet
epSet
=
{
0
};
dndGetMnodeEpSet
(
pDnode
,
&
epSet
);
dDebug
(
"RPC %p, msg:%s is redirected, num:%d
inU
se:%d"
,
pMsg
->
handle
,
TMSG_INFO
(
msgType
),
epSet
.
numOfEps
,
epSet
.
inUse
);
dDebug
(
"RPC %p, msg:%s is redirected, num:%d
u
se:%d"
,
pMsg
->
handle
,
TMSG_INFO
(
msgType
),
epSet
.
numOfEps
,
epSet
.
inUse
);
for
(
int32_t
i
=
0
;
i
<
epSet
.
numOfEps
;
++
i
)
{
dDebug
(
"mnode index:%d %s:%u"
,
i
,
epSet
.
fqdn
[
i
],
epSet
.
port
[
i
]);
if
(
strcmp
(
epSet
.
fqdn
[
i
],
pDnode
->
opt
.
localFqdn
)
==
0
&&
epSet
.
port
[
i
]
==
pDnode
->
opt
.
serverPort
)
{
...
...
@@ -82,7 +81,7 @@ void dndSendRedirectMsg(SDnode *pDnode, SRpcMsg *pMsg) {
}
static
void
dndUpdateMnodeEpSet
(
SDnode
*
pDnode
,
SEpSet
*
pEpSet
)
{
dInfo
(
"mnode is changed, num:%d
inU
se:%d"
,
pEpSet
->
numOfEps
,
pEpSet
->
inUse
);
dInfo
(
"mnode is changed, num:%d
u
se:%d"
,
pEpSet
->
numOfEps
,
pEpSet
->
inUse
);
SDnodeMgmt
*
pMgmt
=
&
pDnode
->
dmgmt
;
taosWLockLatch
(
&
pMgmt
->
latch
);
...
...
@@ -165,7 +164,7 @@ static int32_t dndReadDnodes(SDnode *pDnode) {
int32_t
code
=
TSDB_CODE_DND_DNODE_READ_FILE_ERROR
;
int32_t
len
=
0
;
int32_t
maxLen
=
30000
;
int32_t
maxLen
=
256
*
1024
;
char
*
content
=
calloc
(
1
,
maxLen
+
1
);
cJSON
*
root
=
NULL
;
FILE
*
fp
=
NULL
;
...
...
@@ -198,11 +197,11 @@ static int32_t dndReadDnodes(SDnode *pDnode) {
pMgmt
->
dnodeId
=
dnodeId
->
valueint
;
cJSON
*
clusterId
=
cJSON_GetObjectItem
(
root
,
"clusterId"
);
if
(
!
clusterId
||
clusterId
->
type
!=
cJSON_
Number
)
{
if
(
!
clusterId
||
clusterId
->
type
!=
cJSON_
String
)
{
dError
(
"failed to read %s since clusterId not found"
,
pMgmt
->
file
);
goto
PRASE_DNODE_OVER
;
}
pMgmt
->
clusterId
=
clusterId
->
valueint
;
pMgmt
->
clusterId
=
atoll
(
clusterId
->
valuestring
)
;
cJSON
*
dropped
=
cJSON_GetObjectItem
(
root
,
"dropped"
);
if
(
!
dropped
||
dropped
->
type
!=
cJSON_Number
)
{
...
...
@@ -217,20 +216,20 @@ static int32_t dndReadDnodes(SDnode *pDnode) {
goto
PRASE_DNODE_OVER
;
}
int32_t
numOf
N
odes
=
cJSON_GetArraySize
(
dnodes
);
if
(
numOf
N
odes
<=
0
)
{
dError
(
"failed to read %s since numOf
Nodes:%d invalid"
,
pMgmt
->
file
,
numOfN
odes
);
int32_t
numOf
Dn
odes
=
cJSON_GetArraySize
(
dnodes
);
if
(
numOf
Dn
odes
<=
0
)
{
dError
(
"failed to read %s since numOf
Dnodes:%d invalid"
,
pMgmt
->
file
,
numOfDn
odes
);
goto
PRASE_DNODE_OVER
;
}
pMgmt
->
dnodeEps
=
calloc
(
1
,
numOf
N
odes
*
sizeof
(
SDnodeEp
)
+
sizeof
(
SDnodeEps
));
pMgmt
->
dnodeEps
=
calloc
(
1
,
numOf
Dn
odes
*
sizeof
(
SDnodeEp
)
+
sizeof
(
SDnodeEps
));
if
(
pMgmt
->
dnodeEps
==
NULL
)
{
dError
(
"failed to calloc dnodeEpList since %s"
,
strerror
(
errno
));
goto
PRASE_DNODE_OVER
;
}
pMgmt
->
dnodeEps
->
num
=
numOf
N
odes
;
pMgmt
->
dnodeEps
->
num
=
numOf
Dn
odes
;
for
(
int32_t
i
=
0
;
i
<
numOf
N
odes
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOf
Dn
odes
;
++
i
)
{
cJSON
*
node
=
cJSON_GetArrayItem
(
dnodes
,
i
);
if
(
node
==
NULL
)
break
;
...
...
@@ -238,28 +237,28 @@ static int32_t dndReadDnodes(SDnode *pDnode) {
cJSON
*
dnodeId
=
cJSON_GetObjectItem
(
node
,
"id"
);
if
(
!
dnodeId
||
dnodeId
->
type
!=
cJSON_Number
)
{
dError
(
"failed to read %s
,
dnodeId not found"
,
pMgmt
->
file
);
dError
(
"failed to read %s
since
dnodeId not found"
,
pMgmt
->
file
);
goto
PRASE_DNODE_OVER
;
}
pDnodeEp
->
id
=
dnodeId
->
valueint
;
cJSON
*
dnodeFqdn
=
cJSON_GetObjectItem
(
node
,
"fqdn"
);
if
(
!
dnodeFqdn
||
dnodeFqdn
->
type
!=
cJSON_String
||
dnodeFqdn
->
valuestring
==
NULL
)
{
dError
(
"failed to read %s
,
dnodeFqdn not found"
,
pMgmt
->
file
);
dError
(
"failed to read %s
since
dnodeFqdn not found"
,
pMgmt
->
file
);
goto
PRASE_DNODE_OVER
;
}
tstrncpy
(
pDnodeEp
->
fqdn
,
dnodeFqdn
->
valuestring
,
TSDB_FQDN_LEN
);
cJSON
*
dnodePort
=
cJSON_GetObjectItem
(
node
,
"port"
);
if
(
!
dnodePort
||
dnodePort
->
type
!=
cJSON_Number
)
{
dError
(
"failed to read %s
,
dnodePort not found"
,
pMgmt
->
file
);
dError
(
"failed to read %s
since
dnodePort not found"
,
pMgmt
->
file
);
goto
PRASE_DNODE_OVER
;
}
pDnodeEp
->
port
=
dnodePort
->
valueint
;
cJSON
*
isMnode
=
cJSON_GetObjectItem
(
node
,
"isMnode"
);
if
(
!
isMnode
||
isMnode
->
type
!=
cJSON_Number
)
{
dError
(
"failed to read %s
,
isMnode not found"
,
pMgmt
->
file
);
dError
(
"failed to read %s
since
isMnode not found"
,
pMgmt
->
file
);
goto
PRASE_DNODE_OVER
;
}
pDnodeEp
->
isMnode
=
isMnode
->
valueint
;
...
...
@@ -303,7 +302,7 @@ static int32_t dndWriteDnodes(SDnode *pDnode) {
}
int32_t
len
=
0
;
int32_t
maxLen
=
30000
;
int32_t
maxLen
=
256
*
1024
;
char
*
content
=
calloc
(
1
,
maxLen
+
1
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"{
\n
"
);
...
...
@@ -331,6 +330,7 @@ static int32_t dndWriteDnodes(SDnode *pDnode) {
free
(
content
);
terrno
=
0
;
pMgmt
->
updateTime
=
taosGetTimestampMs
();
dInfo
(
"successed to write %s"
,
pMgmt
->
file
);
return
0
;
}
...
...
@@ -350,10 +350,9 @@ void dndSendStatusMsg(SDnode *pDnode) {
pStatus
->
dnodeId
=
htonl
(
pMgmt
->
dnodeId
);
pStatus
->
clusterId
=
htonl
(
pMgmt
->
clusterId
);
pStatus
->
rebootTime
=
htobe64
(
pMgmt
->
rebootTime
);
pStatus
->
updateTime
=
htobe64
(
pMgmt
->
updateTime
);
pStatus
->
numOfCores
=
htons
(
pDnode
->
opt
.
numOfCores
);
pStatus
->
numOfSupportMnodes
=
htons
(
pDnode
->
opt
.
numOfCores
);
pStatus
->
numOfSupportVnodes
=
htons
(
pDnode
->
opt
.
numOfCores
);
pStatus
->
numOfSupportQnodes
=
htons
(
pDnode
->
opt
.
numOfCores
);
pStatus
->
numOfSupportVnodes
=
htons
(
pDnode
->
opt
.
numOfSupportVnodes
);
tstrncpy
(
pStatus
->
dnodeEp
,
pDnode
->
opt
.
localEp
,
TSDB_EP_LEN
);
pStatus
->
clusterCfg
.
statusInterval
=
htonl
(
pDnode
->
opt
.
statusInterval
);
...
...
source/dnode/mgmt/impl/test/sut/src/server.cpp
浏览文件 @
791c6c84
...
...
@@ -26,9 +26,7 @@ SDnodeOpt TestServer::BuildOption(const char* path, const char* fqdn, uint16_t p
SDnodeOpt
option
=
{
0
};
option
.
sver
=
1
;
option
.
numOfCores
=
1
;
option
.
numOfSupportMnodes
=
1
;
option
.
numOfSupportVnodes
=
1
;
option
.
numOfSupportQnodes
=
1
;
option
.
statusInterval
=
1
;
option
.
numOfThreadsPerCore
=
1
;
option
.
ratioOfQueryCores
=
1
;
...
...
source/dnode/mnode/impl/src/mndDnode.c
浏览文件 @
791c6c84
...
...
@@ -278,10 +278,9 @@ static void mndParseStatusMsg(SStatusMsg *pStatus) {
pStatus
->
dnodeId
=
htonl
(
pStatus
->
dnodeId
);
pStatus
->
clusterId
=
htonl
(
pStatus
->
clusterId
);
pStatus
->
rebootTime
=
htobe64
(
pStatus
->
rebootTime
);
pStatus
->
updateTime
=
htobe64
(
pStatus
->
updateTime
);
pStatus
->
numOfCores
=
htons
(
pStatus
->
numOfCores
);
pStatus
->
numOfSupportMnodes
=
htons
(
pStatus
->
numOfSupportMnodes
);
pStatus
->
numOfSupportVnodes
=
htons
(
pStatus
->
numOfSupportVnodes
);
pStatus
->
numOfSupportQnodes
=
htons
(
pStatus
->
numOfSupportQnodes
);
pStatus
->
clusterCfg
.
statusInterval
=
htonl
(
pStatus
->
clusterCfg
.
statusInterval
);
pStatus
->
clusterCfg
.
checkTime
=
htobe64
(
pStatus
->
clusterCfg
.
checkTime
);
}
...
...
@@ -356,9 +355,7 @@ static int32_t mndProcessStatusMsg(SMnodeMsg *pMsg) {
pDnode
->
rebootTime
=
pStatus
->
rebootTime
;
pDnode
->
numOfCores
=
pStatus
->
numOfCores
;
pDnode
->
numOfSupportMnodes
=
pStatus
->
numOfSupportMnodes
;
pDnode
->
numOfSupportVnodes
=
pStatus
->
numOfSupportVnodes
;
pDnode
->
numOfSupportQnodes
=
pStatus
->
numOfSupportQnodes
;
pDnode
->
lastAccessTime
=
taosGetTimestampMs
();
pDnode
->
status
=
DND_STATUS_READY
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录