Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
4dc47f7b
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22017
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看板
提交
4dc47f7b
编写于
3月 29, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
set signal
上级
dd94e2da
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
34 addition
and
13 deletion
+34
-13
include/common/tglobal.h
include/common/tglobal.h
+1
-1
include/dnode/mgmt/dnode.h
include/dnode/mgmt/dnode.h
+2
-1
source/common/src/tglobal.c
source/common/src/tglobal.c
+3
-3
source/dnode/mgmt/main/exe/dndMain.c
source/dnode/mgmt/main/exe/dndMain.c
+25
-7
source/dnode/mgmt/main/inc/dnd.h
source/dnode/mgmt/main/inc/dnd.h
+1
-0
source/dnode/mgmt/main/src/dndExec.c
source/dnode/mgmt/main/src/dndExec.c
+1
-1
source/dnode/mgmt/main/src/dndObj.c
source/dnode/mgmt/main/src/dndObj.c
+1
-0
未找到文件。
include/common/tglobal.h
浏览文件 @
4dc47f7b
...
...
@@ -51,7 +51,7 @@ extern int32_t tsCompatibleModel;
extern
bool
tsEnableSlaveQuery
;
extern
bool
tsPrintAuth
;
extern
int64_t
tsTickPerDay
[
3
];
extern
int32_t
tsMultiProcess
;
extern
bool
tsMultiProcess
;
// monitor
extern
bool
tsEnableMonitor
;
...
...
include/dnode/mgmt/dnode.h
浏览文件 @
4dc47f7b
...
...
@@ -48,9 +48,10 @@ typedef struct {
char
secondEp
[
TSDB_EP_LEN
];
SDiskCfg
*
pDisks
;
int32_t
numOfDisks
;
int8_t
ntype
;
}
SDnodeOpt
;
typedef
enum
{
DND_EVENT_START
,
DND_EVENT_STOP
=
1
,
DND_EVENT_
RELOA
D
}
EDndEvent
;
typedef
enum
{
DND_EVENT_START
,
DND_EVENT_STOP
=
1
,
DND_EVENT_
CHIL
D
}
EDndEvent
;
/**
* @brief Initialize and start the dnode.
...
...
source/common/src/tglobal.c
浏览文件 @
4dc47f7b
...
...
@@ -45,7 +45,7 @@ float tsRatioOfQueryCores = 1.0f;
int32_t
tsMaxBinaryDisplayWidth
=
30
;
bool
tsEnableSlaveQuery
=
1
;
bool
tsPrintAuth
=
0
;
int32_t
tsMultiProcess
=
0
;
bool
tsMultiProcess
=
0
;
// monitor
bool
tsEnableMonitor
=
1
;
...
...
@@ -347,7 +347,7 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
if
(
cfgAddBool
(
pCfg
,
"printAuth"
,
tsPrintAuth
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddBool
(
pCfg
,
"slaveQuery"
,
tsEnableSlaveQuery
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddBool
(
pCfg
,
"deadLockKillQuery"
,
tsDeadLockKillQuery
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAdd
Int32
(
pCfg
,
"multiProcess"
,
tsMultiProcess
,
0
,
2
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAdd
Bool
(
pCfg
,
"multiProcess"
,
tsMultiProcess
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddBool
(
pCfg
,
"monitor"
,
tsEnableMonitor
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"monitorInterval"
,
tsMonitorInterval
,
1
,
360000
,
0
)
!=
0
)
return
-
1
;
...
...
@@ -466,7 +466,7 @@ static int32_t taosSetServerCfg(SConfig *pCfg) {
tsPrintAuth
=
cfgGetItem
(
pCfg
,
"printAuth"
)
->
bval
;
tsEnableSlaveQuery
=
cfgGetItem
(
pCfg
,
"slaveQuery"
)
->
bval
;
tsDeadLockKillQuery
=
cfgGetItem
(
pCfg
,
"deadLockKillQuery"
)
->
bval
;
tsMultiProcess
=
cfgGetItem
(
pCfg
,
"multiProcess"
)
->
i32
;
tsMultiProcess
=
cfgGetItem
(
pCfg
,
"multiProcess"
)
->
bval
;
tsEnableMonitor
=
cfgGetItem
(
pCfg
,
"monitor"
)
->
bval
;
tsMonitorInterval
=
cfgGetItem
(
pCfg
,
"monitorInterval"
)
->
i32
;
...
...
source/dnode/mgmt/main/exe/dndMain.c
浏览文件 @
4dc47f7b
...
...
@@ -29,7 +29,7 @@ static struct {
ENodeType
ntype
;
}
global
=
{
0
};
static
void
dndS
igintHandl
e
(
int
signum
,
void
*
info
,
void
*
ctx
)
{
static
void
dndS
topDnod
e
(
int
signum
,
void
*
info
,
void
*
ctx
)
{
dInfo
(
"signal:%d is received"
,
signum
);
SDnode
*
pDnode
=
atomic_val_compare_exchange_ptr
(
&
global
.
pDnode
,
0
,
global
.
pDnode
);
if
(
pDnode
!=
NULL
)
{
...
...
@@ -37,12 +37,29 @@ static void dndSigintHandle(int signum, void *info, void *ctx) {
}
}
static
void
dndHandleChild
(
int
signum
,
void
*
info
,
void
*
ctx
)
{
dInfo
(
"signal:%d is received"
,
signum
);
dndHandleEvent
(
global
.
pDnode
,
DND_EVENT_CHILD
);
}
static
void
dndSetSignalHandle
()
{
taosSetSignal
(
SIGTERM
,
dndSigintHandle
);
taosSetSignal
(
SIGHUP
,
dndSigintHandle
);
taosSetSignal
(
SIGINT
,
dndSigintHandle
);
taosSetSignal
(
SIGABRT
,
dndSigintHandle
);
taosSetSignal
(
SIGBREAK
,
dndSigintHandle
);
taosSetSignal
(
SIGTERM
,
dndStopDnode
);
taosSetSignal
(
SIGHUP
,
dndStopDnode
);
taosSetSignal
(
SIGINT
,
dndStopDnode
);
taosSetSignal
(
SIGABRT
,
dndStopDnode
);
taosSetSignal
(
SIGBREAK
,
dndStopDnode
);
if
(
!
tsMultiProcess
)
{
// Set the single process signal
}
else
if
(
global
.
ntype
==
DNODE
)
{
// Set the parent process signal
// When the child process exits, the parent process receives a signal
taosSetSignal
(
SIGCHLD
,
dndHandleChild
);
}
else
{
// Set child process signal
// When the parent process exits, the child process will receive the SIGKILL signal
prctl
(
PR_SET_PDEATHSIG
,
SIGKILL
);
}
}
static
int32_t
dndParseArgs
(
int32_t
argc
,
char
const
*
argv
[])
{
...
...
@@ -111,6 +128,7 @@ static SDnodeOpt dndGetOpt() {
snprintf
(
option
.
localEp
,
sizeof
(
option
.
localEp
),
"%s:%u"
,
option
.
localFqdn
,
option
.
serverPort
);
option
.
pDisks
=
tsDiskCfg
;
option
.
numOfDisks
=
tsDiskCfgNum
;
option
.
ntype
=
global
.
ntype
;
return
option
;
}
...
...
@@ -121,7 +139,7 @@ static int32_t dndInitLog() {
}
static
void
dndSetProcName
(
char
**
argv
)
{
if
(
global
.
ntype
!=
0
)
{
if
(
global
.
ntype
!=
DNODE
)
{
const
char
*
name
=
dndNodeProcStr
(
global
.
ntype
);
prctl
(
PR_SET_NAME
,
name
);
strcpy
(
argv
[
0
],
name
);
...
...
source/dnode/mgmt/main/inc/dnd.h
浏览文件 @
4dc47f7b
...
...
@@ -123,6 +123,7 @@ typedef struct SDnode {
int32_t
numOfDisks
;
uint16_t
serverPort
;
bool
dropped
;
ENodeType
ntype
;
EDndStatus
status
;
EDndEvent
event
;
SStartupReq
startup
;
...
...
source/dnode/mgmt/main/src/dndExec.c
浏览文件 @
4dc47f7b
...
...
@@ -259,7 +259,7 @@ static int32_t dndRunInMultiProcess(SDnode *pDnode) {
}
int32_t
dndRun
(
SDnode
*
pDnode
)
{
if
(
tsMultiProcess
==
0
)
{
if
(
!
tsMultiProcess
)
{
if
(
dndRunInSingleProcess
(
pDnode
)
!=
0
)
{
dError
(
"failed to run dnode in single process mode since %s"
,
terrstr
());
return
-
1
;
...
...
source/dnode/mgmt/main/src/dndObj.c
浏览文件 @
4dc47f7b
...
...
@@ -26,6 +26,7 @@ static int32_t dndInitMemory(SDnode *pDnode, const SDnodeOpt *pOption) {
pDnode
->
secondEp
=
strdup
(
pOption
->
secondEp
);
pDnode
->
pDisks
=
pOption
->
pDisks
;
pDnode
->
numOfDisks
=
pOption
->
numOfDisks
;
pDnode
->
ntype
=
pOption
->
ntype
;
pDnode
->
rebootTime
=
taosGetTimestampMs
();
if
(
pDnode
->
dataDir
==
NULL
||
pDnode
->
localEp
==
NULL
||
pDnode
->
localFqdn
==
NULL
||
pDnode
->
firstEp
==
NULL
||
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录