Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
a86b9faa
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看板
提交
a86b9faa
编写于
4月 12, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refact(cluster): node mgmt
上级
4fedc23b
变更
16
隐藏空白更改
内联
并排
Showing
16 changed file
with
100 addition
and
32 deletion
+100
-32
source/dnode/mgmt/CMakeLists.txt
source/dnode/mgmt/CMakeLists.txt
+4
-3
source/dnode/mgmt/exe/dndMain.c
source/dnode/mgmt/exe/dndMain.c
+3
-3
source/dnode/mgmt/implement/inc/dndNode.h
source/dnode/mgmt/implement/inc/dndNode.h
+68
-0
source/dnode/mgmt/implement/src/dndEnv.c
source/dnode/mgmt/implement/src/dndEnv.c
+1
-1
source/dnode/mgmt/implement/src/dndExec.c
source/dnode/mgmt/implement/src/dndExec.c
+1
-1
source/dnode/mgmt/implement/src/dndObj.c
source/dnode/mgmt/implement/src/dndObj.c
+1
-1
source/dnode/mgmt/implement/src/dndTransport.c
source/dnode/mgmt/implement/src/dndTransport.c
+1
-1
source/dnode/mgmt/inc/bmInt.h
source/dnode/mgmt/inc/bmInt.h
+1
-1
source/dnode/mgmt/inc/dmInt.h
source/dnode/mgmt/inc/dmInt.h
+1
-1
source/dnode/mgmt/inc/mmInt.h
source/dnode/mgmt/inc/mmInt.h
+1
-1
source/dnode/mgmt/inc/qmInt.h
source/dnode/mgmt/inc/qmInt.h
+1
-1
source/dnode/mgmt/inc/smInt.h
source/dnode/mgmt/inc/smInt.h
+1
-1
source/dnode/mgmt/inc/vmInt.h
source/dnode/mgmt/inc/vmInt.h
+1
-1
source/dnode/mgmt/interface/inc/dndInt.h
source/dnode/mgmt/interface/inc/dndInt.h
+4
-5
source/dnode/mgmt/interface/src/dndFile.c
source/dnode/mgmt/interface/src/dndFile.c
+6
-6
source/dnode/mgmt/interface/src/dndInt.c
source/dnode/mgmt/interface/src/dndInt.c
+5
-5
未找到文件。
source/dnode/mgmt/CMakeLists.txt
浏览文件 @
a86b9faa
...
...
@@ -6,7 +6,7 @@ aux_source_directory(bm DNODE_SRC)
aux_source_directory
(
sm DNODE_SRC
)
aux_source_directory
(
vm DNODE_SRC
)
aux_source_directory
(
mm DNODE_SRC
)
aux_source_directory
(
main
DNODE_SRC
)
aux_source_directory
(
implement/src
DNODE_SRC
)
add_library
(
dnode STATIC
${
DNODE_SRC
}
)
target_link_libraries
(
dnode dnode_interface
...
...
@@ -15,14 +15,15 @@ target_include_directories(
dnode
PUBLIC
"
${
TD_SOURCE_DIR
}
/include/dnode/mgmt"
PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/inc"
PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/i
nterface
/inc"
PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/i
mplement
/inc"
)
aux_source_directory
(
exe EXEC_SRC
)
add_executable
(
taosd
${
EXEC_SRC
}
)
target_include_directories
(
taosd
PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/interface/inc"
PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/inc"
PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/implement/inc"
)
target_link_libraries
(
taosd dnode
)
...
...
source/dnode/mgmt/exe/dndMain.c
浏览文件 @
a86b9faa
...
...
@@ -14,7 +14,7 @@
*/
#define _DEFAULT_SOURCE
#include "dnd
Int
.h"
#include "dnd
Node
.h"
#include "tconfig.h"
static
struct
{
...
...
@@ -129,14 +129,14 @@ static SDnodeOpt dndGetOpt() {
static
int32_t
dndInitLog
()
{
char
logName
[
12
]
=
{
0
};
snprintf
(
logName
,
sizeof
(
logName
),
"%slog"
,
dnd
NodeLogStr
(
global
.
ntype
));
snprintf
(
logName
,
sizeof
(
logName
),
"%slog"
,
dnd
LogName
(
global
.
ntype
));
return
taosCreateLog
(
logName
,
1
,
configDir
,
global
.
envFile
,
global
.
apolloUrl
,
global
.
pArgs
,
0
);
}
static
void
dndSetProcInfo
(
int32_t
argc
,
char
**
argv
)
{
taosSetProcPath
(
argc
,
argv
);
if
(
global
.
ntype
!=
NODE_BEGIN
&&
global
.
ntype
!=
NODE_END
)
{
const
char
*
name
=
dnd
NodeProcStr
(
global
.
ntype
);
const
char
*
name
=
dnd
ProcName
(
global
.
ntype
);
taosSetProcName
(
argc
,
argv
,
name
);
}
}
...
...
source/dnode/mgmt/implement/inc/dndNode.h
0 → 100644
浏览文件 @
a86b9faa
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _TD_DND_NODE_H_
#define _TD_DND_NODE_H_
#include "dndInt.h"
#ifdef __cplusplus
extern
"C"
{
#endif
int32_t
dndOpenNode
(
SMgmtWrapper
*
pWrapper
);
void
dndCloseNode
(
SMgmtWrapper
*
pWrapper
);
void
dndSetMsgHandle
(
SMgmtWrapper
*
pWrapper
,
tmsg_t
msgType
,
NodeMsgFp
nodeMsgFp
,
int8_t
vgId
);
SMgmtWrapper
*
dndAcquireWrapper
(
SDnode
*
pDnode
,
EDndNodeType
nType
);
int32_t
dndMarkWrapper
(
SMgmtWrapper
*
pWrapper
);
void
dndReleaseWrapper
(
SMgmtWrapper
*
pWrapper
);
void
dndHandleEvent
(
SDnode
*
pDnode
,
EDndEvent
event
);
void
dndReportStartup
(
SDnode
*
pDnode
,
const
char
*
pName
,
const
char
*
pDesc
);
void
dndProcessStartupReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
);
// dndTransport.c
int32_t
dndInitTrans
(
SDnode
*
pDnode
);
void
dndCleanupTrans
(
SDnode
*
pDnode
);
SMsgCb
dndCreateMsgcb
(
SMgmtWrapper
*
pWrapper
);
SProcCfg
dndGenProcCfg
(
SMgmtWrapper
*
pWrapper
);
int32_t
dndInitMsgHandle
(
SDnode
*
pDnode
);
void
dndSendRecv
(
SDnode
*
pDnode
,
SEpSet
*
pEpSet
,
SRpcMsg
*
pReq
,
SRpcMsg
*
pRsp
);
// mgmt
void
dmSetMgmtFp
(
SMgmtWrapper
*
pWrapper
);
void
bmSetMgmtFp
(
SMgmtWrapper
*
pWrapper
);
void
qmSetMgmtFp
(
SMgmtWrapper
*
pMgmt
);
void
smSetMgmtFp
(
SMgmtWrapper
*
pWrapper
);
void
vmSetMgmtFp
(
SMgmtWrapper
*
pWrapper
);
void
mmSetMgmtFp
(
SMgmtWrapper
*
pMgmt
);
void
dmGetMnodeEpSet
(
SDnodeData
*
pMgmt
,
SEpSet
*
pEpSet
);
void
dmUpdateMnodeEpSet
(
SDnodeData
*
pMgmt
,
SEpSet
*
pEpSet
);
void
dmSendRedirectRsp
(
SDnodeData
*
pMgmt
,
const
SRpcMsg
*
pMsg
);
void
dmGetMonitorSysInfo
(
SMonSysInfo
*
pInfo
);
void
vmGetVnodeLoads
(
SMgmtWrapper
*
pWrapper
,
SMonVloadInfo
*
pInfo
);
void
mmGetMonitorInfo
(
SMgmtWrapper
*
pWrapper
,
SMonMmInfo
*
mmInfo
);
void
vmGetMonitorInfo
(
SMgmtWrapper
*
pWrapper
,
SMonVmInfo
*
vmInfo
);
void
qmGetMonitorInfo
(
SMgmtWrapper
*
pWrapper
,
SMonQmInfo
*
qmInfo
);
void
smGetMonitorInfo
(
SMgmtWrapper
*
pWrapper
,
SMonSmInfo
*
smInfo
);
void
bmGetMonitorInfo
(
SMgmtWrapper
*
pWrapper
,
SMonBmInfo
*
bmInfo
);
#ifdef __cplusplus
}
#endif
#endif
/*_TD_DND_NODE_H_*/
\ No newline at end of file
source/dnode/mgmt/
main
/dndEnv.c
→
source/dnode/mgmt/
implement/src
/dndEnv.c
浏览文件 @
a86b9faa
...
...
@@ -14,7 +14,7 @@
*/
#define _DEFAULT_SOURCE
#include "dnd
Int
.h"
#include "dnd
Node
.h"
#include "wal.h"
static
int8_t
once
=
DND_ENV_INIT
;
...
...
source/dnode/mgmt/
main
/dndExec.c
→
source/dnode/mgmt/
implement/src
/dndExec.c
浏览文件 @
a86b9faa
...
...
@@ -14,7 +14,7 @@
*/
#define _DEFAULT_SOURCE
#include "dnd
Int
.h"
#include "dnd
Node
.h"
static
bool
dndRequireNode
(
SMgmtWrapper
*
pWrapper
)
{
bool
required
=
false
;
...
...
source/dnode/mgmt/
main
/dndObj.c
→
source/dnode/mgmt/
implement/src
/dndObj.c
浏览文件 @
a86b9faa
...
...
@@ -14,7 +14,7 @@
*/
#define _DEFAULT_SOURCE
#include "dnd
Int
.h"
#include "dnd
Node
.h"
static
int32_t
dndInitVars
(
SDnode
*
pDnode
,
const
SDnodeOpt
*
pOption
)
{
pDnode
->
data
.
supportVnodes
=
pOption
->
numOfSupportVnodes
;
...
...
source/dnode/mgmt/
main
/dndTransport.c
→
source/dnode/mgmt/
implement/src
/dndTransport.c
浏览文件 @
a86b9faa
...
...
@@ -14,7 +14,7 @@
*/
#define _DEFAULT_SOURCE
#include "dnd
Int
.h"
#include "dnd
Node
.h"
#define INTERNAL_USER "_dnd"
#define INTERNAL_CKEY "_key"
...
...
source/dnode/mgmt/inc/bmInt.h
浏览文件 @
a86b9faa
...
...
@@ -16,7 +16,7 @@
#ifndef _TD_DND_BNODE_INT_H_
#define _TD_DND_BNODE_INT_H_
#include "dnd
Int
.h"
#include "dnd
Node
.h"
#include "bnode.h"
...
...
source/dnode/mgmt/inc/dmInt.h
浏览文件 @
a86b9faa
...
...
@@ -16,7 +16,7 @@
#ifndef _TD_DND_DNODE_INT_H_
#define _TD_DND_DNODE_INT_H_
#include "dnd
Int
.h"
#include "dnd
Node
.h"
#ifdef __cplusplus
extern
"C"
{
...
...
source/dnode/mgmt/inc/mmInt.h
浏览文件 @
a86b9faa
...
...
@@ -16,7 +16,7 @@
#ifndef _TD_DND_MNODE_INT_H_
#define _TD_DND_MNODE_INT_H_
#include "dnd
Int
.h"
#include "dnd
Node
.h"
#include "mnode.h"
#ifdef __cplusplus
...
...
source/dnode/mgmt/inc/qmInt.h
浏览文件 @
a86b9faa
...
...
@@ -16,7 +16,7 @@
#ifndef _TD_DND_QNODE_INT_H_
#define _TD_DND_QNODE_INT_H_
#include "dnd
Int
.h"
#include "dnd
Node
.h"
#include "qnode.h"
#ifdef __cplusplus
...
...
source/dnode/mgmt/inc/smInt.h
浏览文件 @
a86b9faa
...
...
@@ -16,7 +16,7 @@
#ifndef _TD_DND_SNODE_INT_H_
#define _TD_DND_SNODE_INT_H_
#include "dnd
Int
.h"
#include "dnd
Node
.h"
#include "snode.h"
#ifdef __cplusplus
...
...
source/dnode/mgmt/inc/vmInt.h
浏览文件 @
a86b9faa
...
...
@@ -17,7 +17,7 @@
#define _TD_DND_VNODES_INT_H_
#include "sync.h"
#include "dnd
Int
.h"
#include "dnd
Node
.h"
#include "vnode.h"
#ifdef __cplusplus
...
...
source/dnode/mgmt/interface/inc/dndInt.h
浏览文件 @
a86b9faa
...
...
@@ -23,11 +23,10 @@
extern
"C"
{
#endif
// dndEnv.c
const
char
*
dndStatStr
(
EDndRunStatus
stat
);
const
char
*
dndNodeLogStr
(
EDndNodeType
ntype
);
const
char
*
dndNodeProcStr
(
EDndNodeType
ntype
);
const
char
*
dndEventStr
(
EDndEvent
ev
);
const
char
*
dndStatName
(
EDndRunStatus
stat
);
const
char
*
dndLogName
(
EDndNodeType
ntype
);
const
char
*
dndProcName
(
EDndNodeType
ntype
);
const
char
*
dndEventName
(
EDndEvent
ev
);
// dndExec.c
int32_t
dndOpenNode
(
SMgmtWrapper
*
pWrapper
);
...
...
source/dnode/mgmt/
main
/dndFile.c
→
source/dnode/mgmt/
interface/src
/dndFile.c
浏览文件 @
a86b9faa
...
...
@@ -23,7 +23,7 @@ int32_t dndReadFile(SMgmtWrapper *pWrapper, bool *pDeployed) {
int64_t
len
=
0
;
char
content
[
MAXLEN
+
1
]
=
{
0
};
cJSON
*
root
=
NULL
;
char
file
[
PATH_MAX
];
char
file
[
PATH_MAX
]
=
{
0
}
;
TdFilePtr
pFile
=
NULL
;
snprintf
(
file
,
sizeof
(
file
),
"%s%s%s.json"
,
pWrapper
->
path
,
TD_DIRSEP
,
pWrapper
->
name
);
...
...
@@ -165,13 +165,13 @@ int32_t dndReadShmFile(SDnode *pDnode) {
}
for
(
EDndNodeType
ntype
=
NODE_BEGIN
+
1
;
ntype
<
NODE_END
;
++
ntype
)
{
snprintf
(
itemName
,
sizeof
(
itemName
),
"%s_shmid"
,
dnd
NodeProcStr
(
ntype
));
snprintf
(
itemName
,
sizeof
(
itemName
),
"%s_shmid"
,
dnd
ProcName
(
ntype
));
cJSON
*
shmid
=
cJSON_GetObjectItem
(
root
,
itemName
);
if
(
shmid
&&
shmid
->
type
==
cJSON_Number
)
{
pDnode
->
wrappers
[
ntype
].
procShm
.
id
=
shmid
->
valueint
;
}
snprintf
(
itemName
,
sizeof
(
itemName
),
"%s_shmsize"
,
dnd
NodeProcStr
(
ntype
));
snprintf
(
itemName
,
sizeof
(
itemName
),
"%s_shmsize"
,
dnd
ProcName
(
ntype
));
cJSON
*
shmsize
=
cJSON_GetObjectItem
(
root
,
itemName
);
if
(
shmsize
&&
shmsize
->
type
==
cJSON_Number
)
{
pDnode
->
wrappers
[
ntype
].
procShm
.
size
=
shmsize
->
valueint
;
...
...
@@ -228,11 +228,11 @@ int32_t dndWriteShmFile(SDnode *pDnode) {
len
+=
snprintf
(
content
+
len
,
MAXLEN
-
len
,
"{
\n
"
);
for
(
EDndNodeType
ntype
=
NODE_BEGIN
+
1
;
ntype
<
NODE_END
;
++
ntype
)
{
SMgmtWrapper
*
pWrapper
=
&
pDnode
->
wrappers
[
ntype
];
len
+=
snprintf
(
content
+
len
,
MAXLEN
-
len
,
"
\"
%s_shmid
\"
:%d,
\n
"
,
dnd
NodeProcStr
(
ntype
),
pWrapper
->
procShm
.
id
);
len
+=
snprintf
(
content
+
len
,
MAXLEN
-
len
,
"
\"
%s_shmid
\"
:%d,
\n
"
,
dnd
ProcName
(
ntype
),
pWrapper
->
procShm
.
id
);
if
(
ntype
==
NODE_END
-
1
)
{
len
+=
snprintf
(
content
+
len
,
MAXLEN
-
len
,
"
\"
%s_shmsize
\"
:%d
\n
"
,
dnd
NodeProcStr
(
ntype
),
pWrapper
->
procShm
.
size
);
len
+=
snprintf
(
content
+
len
,
MAXLEN
-
len
,
"
\"
%s_shmsize
\"
:%d
\n
"
,
dnd
ProcName
(
ntype
),
pWrapper
->
procShm
.
size
);
}
else
{
len
+=
snprintf
(
content
+
len
,
MAXLEN
-
len
,
"
\"
%s_shmsize
\"
:%d,
\n
"
,
dnd
NodeProcStr
(
ntype
),
pWrapper
->
procShm
.
size
);
len
+=
snprintf
(
content
+
len
,
MAXLEN
-
len
,
"
\"
%s_shmsize
\"
:%d,
\n
"
,
dnd
ProcName
(
ntype
),
pWrapper
->
procShm
.
size
);
}
}
len
+=
snprintf
(
content
+
len
,
MAXLEN
-
len
,
"}
\n
"
);
...
...
source/dnode/mgmt/interface/src/dndInt.c
浏览文件 @
a86b9faa
...
...
@@ -20,12 +20,12 @@ EDndRunStatus dndGetStatus(SDnode *pDnode) { return pDnode->status; }
void
dndSetStatus
(
SDnode
*
pDnode
,
EDndRunStatus
status
)
{
if
(
pDnode
->
status
!=
status
)
{
dDebug
(
"dnode status set from %s to %s"
,
dndStat
Str
(
pDnode
->
status
),
dndStatStr
(
status
));
dDebug
(
"dnode status set from %s to %s"
,
dndStat
Name
(
pDnode
->
status
),
dndStatName
(
status
));
pDnode
->
status
=
status
;
}
}
const
char
*
dndStat
Str
(
EDndRunStatus
status
)
{
const
char
*
dndStat
Name
(
EDndRunStatus
status
)
{
switch
(
status
)
{
case
DND_STAT_INIT
:
return
"init"
;
...
...
@@ -38,7 +38,7 @@ const char *dndStatStr(EDndRunStatus status) {
}
}
const
char
*
dnd
NodeLogStr
(
EDndNodeType
ntype
)
{
const
char
*
dnd
LogName
(
EDndNodeType
ntype
)
{
switch
(
ntype
)
{
case
VNODE
:
return
"vnode"
;
...
...
@@ -55,7 +55,7 @@ const char *dndNodeLogStr(EDndNodeType ntype) {
}
}
const
char
*
dnd
NodeProcStr
(
EDndNodeType
ntype
)
{
const
char
*
dnd
ProcName
(
EDndNodeType
ntype
)
{
switch
(
ntype
)
{
case
VNODE
:
return
"taosv"
;
...
...
@@ -72,7 +72,7 @@ const char *dndNodeProcStr(EDndNodeType ntype) {
}
}
const
char
*
dndEvent
Str
(
EDndEvent
ev
)
{
const
char
*
dndEvent
Name
(
EDndEvent
ev
)
{
switch
(
ev
)
{
case
DND_EVENT_START
:
return
"start"
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录