Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
de175185
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看板
提交
de175185
编写于
5月 10, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactror: node mgmt
上级
8e61859d
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
112 addition
and
79 deletion
+112
-79
source/dnode/mgmt/exe/dmMain.c
source/dnode/mgmt/exe/dmMain.c
+2
-2
source/dnode/mgmt/node_common/inc/dmDef.h
source/dnode/mgmt/node_common/inc/dmDef.h
+1
-1
source/dnode/mgmt/node_common/inc/dmInt.h
source/dnode/mgmt/node_common/inc/dmInt.h
+6
-5
source/dnode/mgmt/node_common/src/dmFile.c
source/dnode/mgmt/node_common/src/dmFile.c
+1
-1
source/dnode/mgmt/node_common/src/dmStr.c
source/dnode/mgmt/node_common/src/dmStr.c
+92
-0
source/dnode/mgmt/node_common/src/dmUtil.c
source/dnode/mgmt/node_common/src/dmUtil.c
+1
-61
source/dnode/mgmt/node_mgmt/src/dmExec.c
source/dnode/mgmt/node_mgmt/src/dmExec.c
+8
-8
source/dnode/mgmt/node_mgmt/src/dmObj.c
source/dnode/mgmt/node_mgmt/src/dmObj.c
+1
-1
未找到文件。
source/dnode/mgmt/exe/dmMain.c
浏览文件 @
de175185
...
@@ -163,14 +163,14 @@ static SDnodeOpt dmGetOpt() {
...
@@ -163,14 +163,14 @@ static SDnodeOpt dmGetOpt() {
static
int32_t
dmInitLog
()
{
static
int32_t
dmInitLog
()
{
char
logName
[
12
]
=
{
0
};
char
logName
[
12
]
=
{
0
};
snprintf
(
logName
,
sizeof
(
logName
),
"%slog"
,
dmLogName
(
global
.
ntype
));
snprintf
(
logName
,
sizeof
(
logName
),
"%slog"
,
dm
Node
LogName
(
global
.
ntype
));
return
taosCreateLog
(
logName
,
1
,
configDir
,
global
.
envCmd
,
global
.
envFile
,
global
.
apolloUrl
,
global
.
pArgs
,
0
);
return
taosCreateLog
(
logName
,
1
,
configDir
,
global
.
envCmd
,
global
.
envFile
,
global
.
apolloUrl
,
global
.
pArgs
,
0
);
}
}
static
void
dmSetProcInfo
(
int32_t
argc
,
char
**
argv
)
{
static
void
dmSetProcInfo
(
int32_t
argc
,
char
**
argv
)
{
taosSetProcPath
(
argc
,
argv
);
taosSetProcPath
(
argc
,
argv
);
if
(
global
.
ntype
!=
DNODE
&&
global
.
ntype
!=
NODE_END
)
{
if
(
global
.
ntype
!=
DNODE
&&
global
.
ntype
!=
NODE_END
)
{
const
char
*
name
=
dmProcName
(
global
.
ntype
);
const
char
*
name
=
dm
Node
ProcName
(
global
.
ntype
);
taosSetProcName
(
argc
,
argv
,
name
);
taosSetProcName
(
argc
,
argv
,
name
);
}
}
}
}
...
...
source/dnode/mgmt/node_common/inc/dmDef.h
浏览文件 @
de175185
...
@@ -111,7 +111,7 @@ typedef struct SMgmtWrapper {
...
@@ -111,7 +111,7 @@ typedef struct SMgmtWrapper {
char
*
path
;
char
*
path
;
int32_t
refCount
;
int32_t
refCount
;
SRWLatch
latch
;
SRWLatch
latch
;
EDndNodeType
n
t
ype
;
EDndNodeType
n
odeT
ype
;
bool
deployed
;
bool
deployed
;
bool
required
;
bool
required
;
SMgmtFp
fp
;
SMgmtFp
fp
;
...
...
source/dnode/mgmt/node_common/inc/dmInt.h
浏览文件 @
de175185
...
@@ -26,12 +26,13 @@ extern "C" {
...
@@ -26,12 +26,13 @@ extern "C" {
SMgmtWrapper
*
dmAcquireWrapper
(
SDnode
*
pDnode
,
EDndNodeType
nType
);
SMgmtWrapper
*
dmAcquireWrapper
(
SDnode
*
pDnode
,
EDndNodeType
nType
);
int32_t
dmMarkWrapper
(
SMgmtWrapper
*
pWrapper
);
int32_t
dmMarkWrapper
(
SMgmtWrapper
*
pWrapper
);
void
dmReleaseWrapper
(
SMgmtWrapper
*
pWrapper
);
void
dmReleaseWrapper
(
SMgmtWrapper
*
pWrapper
);
const
char
*
dmStatName
(
EDndRunStatus
stat
);
const
char
*
dmStatStr
(
EDndRunStatus
stype
);
const
char
*
dmLogName
(
EDndNodeType
ntype
);
const
char
*
dmNodeLogName
(
EDndNodeType
ntype
);
const
char
*
dmProcName
(
EDndNodeType
ntype
);
const
char
*
dmNodeProcName
(
EDndNodeType
ntype
);
const
char
*
dmEventName
(
EDndEvent
ev
);
const
char
*
dmEventStr
(
EDndEvent
etype
);
const
char
*
dmProcStr
(
EDndProcType
ptype
);
void
dmSetStatus
(
SDnode
*
pDnode
,
EDndRunStatus
st
at
);
void
dmSetStatus
(
SDnode
*
pDnode
,
EDndRunStatus
st
ype
);
void
dmSetEvent
(
SDnode
*
pDnode
,
EDndEvent
event
);
void
dmSetEvent
(
SDnode
*
pDnode
,
EDndEvent
event
);
void
dmSetMsgHandle
(
SMgmtWrapper
*
pWrapper
,
tmsg_t
msgType
,
NodeMsgFp
nodeMsgFp
,
int8_t
vgId
);
void
dmSetMsgHandle
(
SMgmtWrapper
*
pWrapper
,
tmsg_t
msgType
,
NodeMsgFp
nodeMsgFp
,
int8_t
vgId
);
void
dmReportStartup
(
SDnode
*
pDnode
,
const
char
*
pName
,
const
char
*
pDesc
);
void
dmReportStartup
(
SDnode
*
pDnode
,
const
char
*
pName
,
const
char
*
pDesc
);
...
...
source/dnode/mgmt/node_common/src/dmFile.c
浏览文件 @
de175185
...
@@ -173,7 +173,7 @@ int32_t dmReadShmFile(SMgmtWrapper *pWrapper) {
...
@@ -173,7 +173,7 @@ int32_t dmReadShmFile(SMgmtWrapper *pWrapper) {
}
}
}
}
if
(
!
tsMultiProcess
||
pWrapper
->
pDnode
->
ntype
==
DNODE
||
pWrapper
->
pDnode
->
nt
ype
==
NODE_END
)
{
if
(
!
tsMultiProcess
||
pWrapper
->
nodeType
==
DNODE
||
pWrapper
->
nodeT
ype
==
NODE_END
)
{
if
(
pWrapper
->
procShm
.
id
>=
0
)
{
if
(
pWrapper
->
procShm
.
id
>=
0
)
{
dDebug
(
"node:%s, shmid:%d, is closed, size:%d"
,
pWrapper
->
name
,
pWrapper
->
procShm
.
id
,
pWrapper
->
procShm
.
size
);
dDebug
(
"node:%s, shmid:%d, is closed, size:%d"
,
pWrapper
->
name
,
pWrapper
->
procShm
.
id
,
pWrapper
->
procShm
.
size
);
taosDropShm
(
&
pWrapper
->
procShm
);
taosDropShm
(
&
pWrapper
->
procShm
);
...
...
source/dnode/mgmt/node_common/src/dmStr.c
0 → 100644
浏览文件 @
de175185
/*
* 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/>.
*/
#define _DEFAULT_SOURCE
#include "dmInt.h"
const
char
*
dmStatStr
(
EDndRunStatus
stype
)
{
switch
(
stype
)
{
case
DND_STAT_INIT
:
return
"init"
;
case
DND_STAT_RUNNING
:
return
"running"
;
case
DND_STAT_STOPPED
:
return
"stopped"
;
default:
return
"UNKNOWN"
;
}
}
const
char
*
dmNodeLogName
(
EDndNodeType
ntype
)
{
switch
(
ntype
)
{
case
VNODE
:
return
"vnode"
;
case
QNODE
:
return
"qnode"
;
case
SNODE
:
return
"snode"
;
case
MNODE
:
return
"mnode"
;
case
BNODE
:
return
"bnode"
;
default:
return
"taosd"
;
}
}
const
char
*
dmNodeProcName
(
EDndNodeType
ntype
)
{
switch
(
ntype
)
{
case
VNODE
:
return
"taosv"
;
case
QNODE
:
return
"taosq"
;
case
SNODE
:
return
"taoss"
;
case
MNODE
:
return
"taosm"
;
case
BNODE
:
return
"taosb"
;
default:
return
"taosd"
;
}
}
const
char
*
dmEventStr
(
EDndEvent
ev
)
{
switch
(
ev
)
{
case
DND_EVENT_START
:
return
"start"
;
case
DND_EVENT_STOP
:
return
"stop"
;
case
DND_EVENT_CHILD
:
return
"child"
;
default:
return
"UNKNOWN"
;
}
}
const
char
*
dmProcStr
(
EDndProcType
etype
)
{
switch
(
etype
)
{
case
DND_PROC_SINGLE
:
return
"start"
;
case
DND_PROC_CHILD
:
return
"stop"
;
case
DND_PROC_PARENT
:
return
"child"
;
case
DND_PROC_TEST
:
return
"test"
;
default:
return
"UNKNOWN"
;
}
}
source/dnode/mgmt/node_common/src/dm
Int
.c
→
source/dnode/mgmt/node_common/src/dm
Util
.c
浏览文件 @
de175185
...
@@ -16,69 +16,9 @@
...
@@ -16,69 +16,9 @@
#define _DEFAULT_SOURCE
#define _DEFAULT_SOURCE
#include "dmInt.h"
#include "dmInt.h"
const
char
*
dmStatName
(
EDndRunStatus
status
)
{
switch
(
status
)
{
case
DND_STAT_INIT
:
return
"init"
;
case
DND_STAT_RUNNING
:
return
"running"
;
case
DND_STAT_STOPPED
:
return
"stopped"
;
default:
return
"UNKNOWN"
;
}
}
const
char
*
dmLogName
(
EDndNodeType
ntype
)
{
switch
(
ntype
)
{
case
VNODE
:
return
"vnode"
;
case
QNODE
:
return
"qnode"
;
case
SNODE
:
return
"snode"
;
case
MNODE
:
return
"mnode"
;
case
BNODE
:
return
"bnode"
;
default:
return
"taosd"
;
}
}
const
char
*
dmProcName
(
EDndNodeType
ntype
)
{
switch
(
ntype
)
{
case
VNODE
:
return
"taosv"
;
case
QNODE
:
return
"taosq"
;
case
SNODE
:
return
"taoss"
;
case
MNODE
:
return
"taosm"
;
case
BNODE
:
return
"taosb"
;
default:
return
"taosd"
;
}
}
const
char
*
dmEventName
(
EDndEvent
ev
)
{
switch
(
ev
)
{
case
DND_EVENT_START
:
return
"start"
;
case
DND_EVENT_STOP
:
return
"stop"
;
case
DND_EVENT_CHILD
:
return
"child"
;
default:
return
"UNKNOWN"
;
}
}
void
dmSetStatus
(
SDnode
*
pDnode
,
EDndRunStatus
status
)
{
void
dmSetStatus
(
SDnode
*
pDnode
,
EDndRunStatus
status
)
{
if
(
pDnode
->
status
!=
status
)
{
if
(
pDnode
->
status
!=
status
)
{
dDebug
(
"dnode status set from %s to %s"
,
dmStat
Name
(
pDnode
->
status
),
dmStatName
(
status
));
dDebug
(
"dnode status set from %s to %s"
,
dmStat
Str
(
pDnode
->
status
),
dmStatStr
(
status
));
pDnode
->
status
=
status
;
pDnode
->
status
=
status
;
}
}
}
}
...
...
source/dnode/mgmt/node_mgmt/src/dmExec.c
浏览文件 @
de175185
...
@@ -27,21 +27,21 @@ static bool dmRequireNode(SMgmtWrapper *pWrapper) {
...
@@ -27,21 +27,21 @@ static bool dmRequireNode(SMgmtWrapper *pWrapper) {
static
int32_t
dmInitParentProc
(
SMgmtWrapper
*
pWrapper
)
{
static
int32_t
dmInitParentProc
(
SMgmtWrapper
*
pWrapper
)
{
int32_t
shmsize
=
tsMnodeShmSize
;
int32_t
shmsize
=
tsMnodeShmSize
;
if
(
pWrapper
->
n
t
ype
==
VNODE
)
{
if
(
pWrapper
->
n
odeT
ype
==
VNODE
)
{
shmsize
=
tsVnodeShmSize
;
shmsize
=
tsVnodeShmSize
;
}
else
if
(
pWrapper
->
n
t
ype
==
QNODE
)
{
}
else
if
(
pWrapper
->
n
odeT
ype
==
QNODE
)
{
shmsize
=
tsQnodeShmSize
;
shmsize
=
tsQnodeShmSize
;
}
else
if
(
pWrapper
->
n
t
ype
==
SNODE
)
{
}
else
if
(
pWrapper
->
n
odeT
ype
==
SNODE
)
{
shmsize
=
tsSnodeShmSize
;
shmsize
=
tsSnodeShmSize
;
}
else
if
(
pWrapper
->
n
t
ype
==
MNODE
)
{
}
else
if
(
pWrapper
->
n
odeT
ype
==
MNODE
)
{
shmsize
=
tsMnodeShmSize
;
shmsize
=
tsMnodeShmSize
;
}
else
if
(
pWrapper
->
n
t
ype
==
BNODE
)
{
}
else
if
(
pWrapper
->
n
odeT
ype
==
BNODE
)
{
shmsize
=
tsBnodeShmSize
;
shmsize
=
tsBnodeShmSize
;
}
else
{
}
else
{
return
-
1
;
return
-
1
;
}
}
if
(
taosCreateShm
(
&
pWrapper
->
procShm
,
pWrapper
->
n
t
ype
,
shmsize
)
!=
0
)
{
if
(
taosCreateShm
(
&
pWrapper
->
procShm
,
pWrapper
->
n
odeT
ype
,
shmsize
)
!=
0
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
terrno
);
terrno
=
TAOS_SYSTEM_ERROR
(
terrno
);
dError
(
"node:%s, failed to create shm size:%d since %s"
,
pWrapper
->
name
,
shmsize
,
terrstr
());
dError
(
"node:%s, failed to create shm size:%d since %s"
,
pWrapper
->
name
,
shmsize
,
terrstr
());
return
-
1
;
return
-
1
;
...
@@ -86,7 +86,7 @@ static int32_t dmRunParentProc(SMgmtWrapper *pWrapper) {
...
@@ -86,7 +86,7 @@ static int32_t dmRunParentProc(SMgmtWrapper *pWrapper) {
if
(
pWrapper
->
pDnode
->
ntype
==
NODE_END
)
{
if
(
pWrapper
->
pDnode
->
ntype
==
NODE_END
)
{
dInfo
(
"node:%s, should be started manually in child process"
,
pWrapper
->
name
);
dInfo
(
"node:%s, should be started manually in child process"
,
pWrapper
->
name
);
}
else
{
}
else
{
if
(
dmNewNodeProc
(
pWrapper
,
pWrapper
->
n
t
ype
)
!=
0
)
{
if
(
dmNewNodeProc
(
pWrapper
,
pWrapper
->
n
odeT
ype
)
!=
0
)
{
return
-
1
;
return
-
1
;
}
}
}
}
...
@@ -149,7 +149,7 @@ int32_t dmStartNode(SMgmtWrapper *pWrapper) {
...
@@ -149,7 +149,7 @@ int32_t dmStartNode(SMgmtWrapper *pWrapper) {
dInfo
(
"node:%s, not start in parent process"
,
pWrapper
->
name
);
dInfo
(
"node:%s, not start in parent process"
,
pWrapper
->
name
);
}
else
if
(
pWrapper
->
procType
==
DND_PROC_CHILD
)
{
}
else
if
(
pWrapper
->
procType
==
DND_PROC_CHILD
)
{
dInfo
(
"node:%s, start in child process"
,
pWrapper
->
name
);
dInfo
(
"node:%s, start in child process"
,
pWrapper
->
name
);
if
(
pWrapper
->
n
t
ype
!=
DNODE
)
{
if
(
pWrapper
->
n
odeT
ype
!=
DNODE
)
{
if
(
pWrapper
->
fp
.
startFp
!=
NULL
&&
(
*
pWrapper
->
fp
.
startFp
)(
pWrapper
)
!=
0
)
{
if
(
pWrapper
->
fp
.
startFp
!=
NULL
&&
(
*
pWrapper
->
fp
.
startFp
)(
pWrapper
)
!=
0
)
{
dError
(
"node:%s, failed to start since %s"
,
pWrapper
->
name
,
terrstr
());
dError
(
"node:%s, failed to start since %s"
,
pWrapper
->
name
,
terrstr
());
return
-
1
;
return
-
1
;
...
...
source/dnode/mgmt/node_mgmt/src/dmObj.c
浏览文件 @
de175185
...
@@ -104,7 +104,7 @@ SDnode *dmCreate(const SDnodeOpt *pOption) {
...
@@ -104,7 +104,7 @@ SDnode *dmCreate(const SDnodeOpt *pOption) {
pWrapper
->
path
=
strdup
(
path
);
pWrapper
->
path
=
strdup
(
path
);
pWrapper
->
procShm
.
id
=
-
1
;
pWrapper
->
procShm
.
id
=
-
1
;
pWrapper
->
pDnode
=
pDnode
;
pWrapper
->
pDnode
=
pDnode
;
pWrapper
->
n
t
ype
=
n
;
pWrapper
->
n
odeT
ype
=
n
;
pWrapper
->
procType
=
DND_PROC_SINGLE
;
pWrapper
->
procType
=
DND_PROC_SINGLE
;
taosInitRWLatch
(
&
pWrapper
->
latch
);
taosInitRWLatch
(
&
pWrapper
->
latch
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录