Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
dd94e2da
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看板
提交
dd94e2da
编写于
3月 29, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
shm
上级
b2405a00
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
103 addition
and
35 deletion
+103
-35
include/os/os.h
include/os/os.h
+3
-0
source/dnode/mgmt/main/exe/dndMain.c
source/dnode/mgmt/main/exe/dndMain.c
+29
-13
source/dnode/mgmt/main/inc/dnd.h
source/dnode/mgmt/main/inc/dnd.h
+7
-5
source/dnode/mgmt/main/src/dndInt.c
source/dnode/mgmt/main/src/dndInt.c
+0
-13
source/dnode/mgmt/main/src/dndStr.c
source/dnode/mgmt/main/src/dndStr.c
+64
-0
source/util/src/tprocess.c
source/util/src/tprocess.c
+0
-4
未找到文件。
include/os/os.h
浏览文件 @
dd94e2da
...
...
@@ -42,6 +42,9 @@ extern "C" {
#include <sys/types.h>
#include <termios.h>
#include <sys/statvfs.h>
#include <sys/prctl.h>
#include <sys/shm.h>
#include <sys/wait.h>
#if defined(DARWIN)
#else
...
...
source/dnode/mgmt/main/exe/dndMain.c
浏览文件 @
dd94e2da
...
...
@@ -18,14 +18,15 @@
#include "tconfig.h"
static
struct
{
bool
dumpConfig
;
bool
generateGrant
;
bool
printAuth
;
bool
printVersion
;
int8_t
node
;
char
envFile
[
PATH_MAX
];
char
apolloUrl
[
PATH_MAX
];
SDnode
*
pDnode
;
bool
dumpConfig
;
bool
generateGrant
;
bool
printAuth
;
bool
printVersion
;
char
envFile
[
PATH_MAX
];
char
apolloUrl
[
PATH_MAX
];
SArray
*
pArgs
;
// SConfigPair
SDnode
*
pDnode
;
ENodeType
ntype
;
}
global
=
{
0
};
static
void
dndSigintHandle
(
int
signum
,
void
*
info
,
void
*
ctx
)
{
...
...
@@ -64,7 +65,7 @@ static int32_t dndParseArgs(int32_t argc, char const *argv[]) {
}
else
if
(
strcmp
(
argv
[
i
],
"-k"
)
==
0
)
{
global
.
generateGrant
=
true
;
}
else
if
(
strcmp
(
argv
[
i
],
"-n"
)
==
0
)
{
global
.
n
od
e
=
atoi
(
argv
[
++
i
]);
global
.
n
typ
e
=
atoi
(
argv
[
++
i
]);
}
else
if
(
strcmp
(
argv
[
i
],
"-C"
)
==
0
)
{
global
.
dumpConfig
=
true
;
}
else
if
(
strcmp
(
argv
[
i
],
"-V"
)
==
0
)
{
...
...
@@ -97,7 +98,7 @@ static void dndDumpCfg() {
cfgDumpCfg
(
pCfg
,
0
,
1
);
}
SDnodeOpt
dndGetOpt
()
{
static
SDnodeOpt
dndGetOpt
()
{
SConfig
*
pCfg
=
taosGetCfg
();
SDnodeOpt
option
=
{
0
};
...
...
@@ -113,6 +114,20 @@ SDnodeOpt dndGetOpt() {
return
option
;
}
static
int32_t
dndInitLog
()
{
char
logName
[
12
]
=
{
0
};
snprintf
(
logName
,
sizeof
(
logName
),
"%slog"
,
dndNodeLogStr
(
global
.
ntype
));
return
taosCreateLog
(
logName
,
1
,
configDir
,
global
.
envFile
,
global
.
apolloUrl
,
global
.
pArgs
,
0
);
}
static
void
dndSetProcName
(
char
**
argv
)
{
if
(
global
.
ntype
!=
0
)
{
const
char
*
name
=
dndNodeProcStr
(
global
.
ntype
);
prctl
(
PR_SET_NAME
,
name
);
strcpy
(
argv
[
0
],
name
);
}
}
static
int32_t
dndRunDnode
()
{
if
(
dndInit
()
!=
0
)
{
dError
(
"failed to initialize environment since %s"
,
terrstr
());
...
...
@@ -162,12 +177,12 @@ int main(int argc, char const *argv[]) {
return
0
;
}
if
(
taosCreateLog
(
"taosdlog"
,
1
,
configDir
,
global
.
envFile
,
global
.
apolloUrl
,
NULL
,
0
)
!=
0
)
{
printf
(
"failed to start since
read log confi
g error
\n
"
);
if
(
dndInitLog
(
)
!=
0
)
{
printf
(
"failed to start since
init lo
g error
\n
"
);
return
-
1
;
}
if
(
taosInitCfg
(
configDir
,
global
.
envFile
,
global
.
apolloUrl
,
NULL
,
0
)
!=
0
)
{
if
(
taosInitCfg
(
configDir
,
global
.
envFile
,
global
.
apolloUrl
,
global
.
pArgs
,
0
)
!=
0
)
{
dError
(
"failed to start since read config error"
);
return
-
1
;
}
...
...
@@ -179,5 +194,6 @@ int main(int argc, char const *argv[]) {
return
0
;
}
dndSetProcName
((
char
**
)
argv
);
return
dndRunDnode
();
}
source/dnode/mgmt/main/inc/dnd.h
浏览文件 @
dd94e2da
...
...
@@ -131,11 +131,13 @@ typedef struct SDnode {
SMgmtWrapper
wrappers
[
NODE_MAX
];
}
SDnode
;
EDndStatus
dndGetStatus
(
SDnode
*
pDnode
);
void
dndSetStatus
(
SDnode
*
pDnode
,
EDndStatus
stat
);
void
dndSetMsgHandle
(
SMgmtWrapper
*
pWrapper
,
int32_t
msgType
,
NodeMsgFp
nodeMsgFp
,
int32_t
vgId
);
void
dndReportStartup
(
SDnode
*
pDnode
,
const
char
*
pName
,
const
char
*
pDesc
);
void
dndSendMonitorReport
(
SDnode
*
pDnode
);
const
char
*
dndNodeLogStr
(
ENodeType
ntype
);
const
char
*
dndNodeProcStr
(
ENodeType
ntype
);
EDndStatus
dndGetStatus
(
SDnode
*
pDnode
);
void
dndSetStatus
(
SDnode
*
pDnode
,
EDndStatus
stat
);
void
dndSetMsgHandle
(
SMgmtWrapper
*
pWrapper
,
int32_t
msgType
,
NodeMsgFp
nodeMsgFp
,
int32_t
vgId
);
void
dndReportStartup
(
SDnode
*
pDnode
,
const
char
*
pName
,
const
char
*
pDesc
);
void
dndSendMonitorReport
(
SDnode
*
pDnode
);
int32_t
dndSendReqToMnode
(
SMgmtWrapper
*
pWrapper
,
SRpcMsg
*
pMsg
);
int32_t
dndSendReqToDnode
(
SMgmtWrapper
*
pWrapper
,
const
SEpSet
*
pEpSet
,
SRpcMsg
*
pMsg
);
...
...
source/dnode/mgmt/main/src/dndInt.c
浏览文件 @
dd94e2da
...
...
@@ -80,19 +80,6 @@ void dndSetStatus(SDnode *pDnode, EDndStatus status) {
}
}
const
char
*
dndStatStr
(
EDndStatus
status
)
{
switch
(
status
)
{
case
DND_STAT_INIT
:
return
"init"
;
case
DND_STAT_RUNNING
:
return
"running"
;
case
DND_STAT_STOPPED
:
return
"stopped"
;
default:
return
"unknown"
;
}
}
void
dndReportStartup
(
SDnode
*
pDnode
,
const
char
*
pName
,
const
char
*
pDesc
)
{
SStartupReq
*
pStartup
=
&
pDnode
->
startup
;
tstrncpy
(
pStartup
->
name
,
pName
,
TSDB_STEP_NAME_LEN
);
...
...
source/dnode/mgmt/main/src/dndStr.c
0 → 100644
浏览文件 @
dd94e2da
/*
* 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 "dndInt.h"
const
char
*
dndStatStr
(
EDndStatus
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
*
dndNodeLogStr
(
ENodeType
ntype
)
{
switch
(
ntype
)
{
case
VNODES
:
return
"vnode"
;
case
QNODE
:
return
"qnode"
;
case
SNODE
:
return
"snode"
;
case
MNODE
:
return
"mnode"
;
case
BNODE
:
return
"bnode"
;
default:
return
"taosd"
;
}
}
const
char
*
dndNodeProcStr
(
ENodeType
ntype
)
{
switch
(
ntype
)
{
case
VNODES
:
return
"taosv"
;
case
QNODE
:
return
"taosq"
;
case
SNODE
:
return
"taoss"
;
case
MNODE
:
return
"taosm"
;
case
BNODE
:
return
"taosb"
;
default:
return
"taosd"
;
}
}
source/util/src/tprocess.c
浏览文件 @
dd94e2da
...
...
@@ -19,10 +19,6 @@
#include "tlog.h"
#include "tqueue.h"
// todo
#include <sys/shm.h>
#include <sys/wait.h>
#define SHM_DEFAULT_SIZE (20 * 1024 * 1024)
typedef
void
*
(
*
ProcThreadFp
)(
void
*
param
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录