Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
6129f132
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看板
未验证
提交
6129f132
编写于
4月 01, 2022
作者:
S
Shengliang Guan
提交者:
GitHub
4月 01, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #11179 from taosdata/feature/shm
shm
上级
613963a1
8eb99ef6
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
56 addition
and
19 deletion
+56
-19
include/os/osProc.h
include/os/osProc.h
+3
-1
source/dnode/mgmt/dm/src/dmFile.c
source/dnode/mgmt/dm/src/dmFile.c
+1
-1
source/dnode/mgmt/main/src/dndExec.c
source/dnode/mgmt/main/src/dndExec.c
+39
-11
source/os/src/osProc.c
source/os/src/osProc.c
+12
-5
source/util/src/tconfig.c
source/util/src/tconfig.c
+1
-1
未找到文件。
include/os/osProc.h
浏览文件 @
6129f132
...
...
@@ -21,9 +21,11 @@ extern "C" {
#endif
int32_t
taosNewProc
(
char
**
args
);
void
taosWaitProc
(
int32_t
pid
);
void
taosKillProc
(
int32_t
pid
);
bool
taosProcExist
(
int32_t
pid
);
void
taosSetProcName
(
int32_t
argc
,
char
**
argv
,
const
char
*
name
);
void
taosSetProcPath
(
int32_t
argc
,
char
**
argv
);
bool
taosProcExists
(
int32_t
pid
);
#ifdef __cplusplus
}
...
...
source/dnode/mgmt/dm/src/dmFile.c
浏览文件 @
6129f132
...
...
@@ -200,7 +200,7 @@ int32_t dmWriteFile(SDnodeMgmt *pMgmt) {
taosMemoryFree
(
content
);
char
realfile
[
PATH_MAX
];
snprintf
(
realfile
,
sizeof
(
realfile
),
"%s%s
m
node.json"
,
pMgmt
->
path
,
TD_DIRSEP
);
snprintf
(
realfile
,
sizeof
(
realfile
),
"%s%s
d
node.json"
,
pMgmt
->
path
,
TD_DIRSEP
);
if
(
taosRenameFile
(
file
,
realfile
)
!=
0
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
...
...
source/dnode/mgmt/main/src/dndExec.c
浏览文件 @
6129f132
...
...
@@ -20,9 +20,9 @@ static bool dndRequireNode(SMgmtWrapper *pWrapper) {
bool
required
=
false
;
int32_t
code
=
(
*
pWrapper
->
fp
.
requiredFp
)(
pWrapper
,
&
required
);
if
(
!
required
)
{
dDebug
(
"node:%s,
no need to start
"
,
pWrapper
->
name
);
dDebug
(
"node:%s,
does not require startup
"
,
pWrapper
->
name
);
}
else
{
dDebug
(
"node:%s, need
to start
"
,
pWrapper
->
name
);
dDebug
(
"node:%s, need
s to be started
"
,
pWrapper
->
name
);
}
return
required
;
}
...
...
@@ -255,17 +255,39 @@ static int32_t dndRunInParentProcess(SDnode *pDnode) {
while
(
1
)
{
if
(
pDnode
->
event
==
DND_EVENT_STOP
)
{
dInfo
(
"dnode is about to stop"
);
break
;
}
for
(
ENodeType
n
=
DNODE
+
1
;
n
<
NODE_MAX
;
++
n
)
{
SMgmtWrapper
*
pWrapper
=
&
pDnode
->
wrappers
[
n
];
if
(
!
pWrapper
->
required
)
continue
;
if
(
pDnode
->
ntype
==
NODE_MAX
)
continue
;
if
(
pWrapper
->
procId
>
0
&&
taosProcExist
(
pWrapper
->
procId
))
{
dInfo
(
"node:%s, send kill signal to the child process:%d"
,
pWrapper
->
name
,
pWrapper
->
procId
);
taosKillProc
(
pWrapper
->
procId
);
}
}
for
(
ENodeType
n
=
DNODE
+
1
;
n
<
NODE_MAX
;
++
n
)
{
SMgmtWrapper
*
pWrapper
=
&
pDnode
->
wrappers
[
n
];
if
(
!
pWrapper
->
required
)
continue
;
if
(
pDnode
->
ntype
==
NODE_MAX
)
continue
;
for
(
ENodeType
n
=
DNODE
+
1
;
n
<
NODE_MAX
;
++
n
)
{
SMgmtWrapper
*
pWrapper
=
&
pDnode
->
wrappers
[
n
];
if
(
!
pWrapper
->
required
)
continue
;
if
(
pDnode
->
ntype
==
NODE_MAX
)
continue
;
if
(
pWrapper
->
procId
<=
0
||
!
taosProcExists
(
pWrapper
->
procId
))
{
dInfo
(
"node:%s, process:%d is killed and needs to be restarted"
,
pWrapper
->
name
,
pWrapper
->
procId
);
dndNewProc
(
pWrapper
,
n
);
if
(
pWrapper
->
procId
>
0
&&
taosProcExist
(
pWrapper
->
procId
))
{
dInfo
(
"node:%s, wait for child process:%d to stop"
,
pWrapper
->
name
,
pWrapper
->
procId
);
taosWaitProc
(
pWrapper
->
procId
);
dInfo
(
"node:%s, child process:%d is stopped"
,
pWrapper
->
name
,
pWrapper
->
procId
);
}
}
break
;
}
else
{
for
(
ENodeType
n
=
DNODE
+
1
;
n
<
NODE_MAX
;
++
n
)
{
SMgmtWrapper
*
pWrapper
=
&
pDnode
->
wrappers
[
n
];
if
(
!
pWrapper
->
required
)
continue
;
if
(
pDnode
->
ntype
==
NODE_MAX
)
continue
;
if
(
pWrapper
->
procId
<=
0
||
!
taosProcExist
(
pWrapper
->
procId
))
{
dInfo
(
"node:%s, process:%d is killed and needs to be restarted"
,
pWrapper
->
name
,
pWrapper
->
procId
);
dndNewProc
(
pWrapper
,
n
);
}
}
}
...
...
@@ -279,6 +301,12 @@ static int32_t dndRunInChildProcess(SDnode *pDnode) {
SMgmtWrapper
*
pWrapper
=
&
pDnode
->
wrappers
[
pDnode
->
ntype
];
dInfo
(
"%s run in child process"
,
pWrapper
->
name
);
pWrapper
->
required
=
dndRequireNode
(
pWrapper
);
if
(
!
pWrapper
->
required
)
{
dError
(
"%s does not require startup"
,
pWrapper
->
name
);
return
-
1
;
}
SMsgCb
msgCb
=
dndCreateMsgcb
(
pWrapper
);
tmsgSetDefaultMsgCb
(
&
msgCb
);
pWrapper
->
procType
=
PROC_CHILD
;
...
...
source/os/src/osProc.c
浏览文件 @
6129f132
...
...
@@ -32,6 +32,18 @@ int32_t taosNewProc(char **args) {
}
}
void
taosWaitProc
(
int32_t
pid
)
{
int32_t
status
=
0
;
waitpid
(
pid
,
&
status
,
0
);
}
void
taosKillProc
(
int32_t
pid
)
{
kill
(
pid
,
SIGINT
);
}
bool
taosProcExist
(
int32_t
pid
)
{
int32_t
p
=
getpgid
(
pid
);
return
p
>=
0
;
}
// the length of the new name must be less than the original name to take effect
void
taosSetProcName
(
int32_t
argc
,
char
**
argv
,
const
char
*
name
)
{
prctl
(
PR_SET_NAME
,
name
);
...
...
@@ -48,8 +60,3 @@ void taosSetProcName(int32_t argc, char **argv, const char *name) {
}
void
taosSetProcPath
(
int32_t
argc
,
char
**
argv
)
{
tsProcPath
=
argv
[
0
];
}
bool
taosProcExists
(
int32_t
pid
)
{
int32_t
p
=
getpgid
(
pid
);
return
p
>=
0
;
}
source/util/src/tconfig.c
浏览文件 @
6129f132
...
...
@@ -590,7 +590,7 @@ void cfgDumpCfg(SConfig *pCfg, bool tsc, bool dump) {
}
int32_t
cfgLoadFromEnvVar
(
SConfig
*
pConfig
)
{
uInfo
(
"load from
global
env variables not implemented yet"
);
uInfo
(
"load from env variables not implemented yet"
);
return
0
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录