Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c28b6b41
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
c28b6b41
编写于
3月 31, 2022
作者:
S
Shengliang Guan
提交者:
GitHub
3月 31, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #11162 from taosdata/feature/shm
adjust logs
上级
0b335b07
873c2373
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
56 addition
and
38 deletion
+56
-38
source/dnode/mgmt/dm/src/dmMsg.c
source/dnode/mgmt/dm/src/dmMsg.c
+1
-1
source/dnode/mgmt/main/exe/dndMain.c
source/dnode/mgmt/main/exe/dndMain.c
+12
-10
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
+6
-5
source/dnode/mgmt/main/src/dndFile.c
source/dnode/mgmt/main/src/dndFile.c
+3
-3
source/dnode/mgmt/main/src/dndMsg.c
source/dnode/mgmt/main/src/dndMsg.c
+1
-1
source/dnode/mgmt/main/src/dndObj.c
source/dnode/mgmt/main/src/dndObj.c
+5
-5
source/dnode/mgmt/main/src/dndStr.c
source/dnode/mgmt/main/src/dndStr.c
+13
-0
source/os/src/osProc.c
source/os/src/osProc.c
+2
-2
source/util/src/tconfig.c
source/util/src/tconfig.c
+4
-4
source/util/src/tprocess.c
source/util/src/tprocess.c
+8
-7
未找到文件。
source/dnode/mgmt/dm/src/dmMsg.c
浏览文件 @
c28b6b41
...
...
@@ -53,7 +53,7 @@ void dmSendStatusReq(SDnodeMgmt *pMgmt) {
tSerializeSStatusReq
(
pHead
,
contLen
,
&
req
);
taosArrayDestroy
(
req
.
pVloads
);
SRpcMsg
rpcMsg
=
{.
pCont
=
pHead
,
.
contLen
=
contLen
,
.
msgType
=
TDMT_MND_STATUS
,
.
ahandle
=
(
void
*
)
9527
};
SRpcMsg
rpcMsg
=
{.
pCont
=
pHead
,
.
contLen
=
contLen
,
.
msgType
=
TDMT_MND_STATUS
,
.
ahandle
=
(
void
*
)
0x
9527
};
pMgmt
->
statusSent
=
1
;
dTrace
(
"send req:%s to mnode, app:%p"
,
TMSG_INFO
(
rpcMsg
.
msgType
),
rpcMsg
.
ahandle
);
...
...
source/dnode/mgmt/main/exe/dndMain.c
浏览文件 @
c28b6b41
...
...
@@ -30,7 +30,7 @@ static struct {
}
global
=
{
0
};
static
void
dndStopDnode
(
int
signum
,
void
*
info
,
void
*
ctx
)
{
dInfo
(
"s
ignal:%d is
received"
,
signum
);
dInfo
(
"s
ystem signal:%d
received"
,
signum
);
SDnode
*
pDnode
=
atomic_val_compare_exchange_ptr
(
&
global
.
pDnode
,
0
,
global
.
pDnode
);
if
(
pDnode
!=
NULL
)
{
dndHandleEvent
(
pDnode
,
DND_EVENT_STOP
);
...
...
@@ -38,8 +38,10 @@ static void dndStopDnode(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
);
dInfo
(
"sigchild received"
);
if
(
global
.
pDnode
!=
NULL
)
{
dndHandleEvent
(
global
.
pDnode
,
DND_EVENT_CHILD
);
}
}
static
void
dndSetSignalHandle
()
{
...
...
@@ -50,7 +52,7 @@ static void dndSetSignalHandle() {
taosSetSignal
(
SIGBREAK
,
dndStopDnode
);
if
(
!
tsMultiProcess
)
{
}
else
if
(
global
.
ntype
==
DNODE
)
{
}
else
if
(
global
.
ntype
==
DNODE
||
global
.
ntype
==
NODE_MAX
)
{
taosSetSignal
(
SIGCHLD
,
dndHandleChild
);
}
else
{
taosKillChildOnParentStopped
();
...
...
@@ -74,14 +76,14 @@ static int32_t dndParseArgs(int32_t argc, char const *argv[]) {
tstrncpy
(
global
.
apolloUrl
,
argv
[
++
i
],
PATH_MAX
);
}
else
if
(
strcmp
(
argv
[
i
],
"-e"
)
==
0
)
{
tstrncpy
(
global
.
envFile
,
argv
[
++
i
],
PATH_MAX
);
}
else
if
(
strcmp
(
argv
[
i
],
"-k"
)
==
0
)
{
global
.
generateGrant
=
true
;
}
else
if
(
strcmp
(
argv
[
i
],
"-n"
)
==
0
)
{
global
.
ntype
=
atoi
(
argv
[
++
i
]);
if
(
global
.
ntype
<=
DNODE
||
global
.
ntype
>
NODE_MAX
)
{
printf
(
"'-n' range is [1-5], default is 0
\n
"
);
return
-
1
;
}
}
else
if
(
strcmp
(
argv
[
i
],
"-k"
)
==
0
)
{
global
.
generateGrant
=
true
;
}
else
if
(
strcmp
(
argv
[
i
],
"-C"
)
==
0
)
{
global
.
dumpConfig
=
true
;
}
else
if
(
strcmp
(
argv
[
i
],
"-V"
)
==
0
)
{
...
...
@@ -139,7 +141,7 @@ static int32_t dndInitLog() {
static
void
dndSetProcInfo
(
int32_t
argc
,
char
**
argv
)
{
taosSetProcPath
(
argc
,
argv
);
if
(
global
.
ntype
!=
DNODE
)
{
if
(
global
.
ntype
!=
DNODE
&&
global
.
ntype
!=
NODE_MAX
)
{
const
char
*
name
=
dndNodeProcStr
(
global
.
ntype
);
taosSetProcName
(
argc
,
argv
,
name
);
}
...
...
@@ -147,14 +149,14 @@ static void dndSetProcInfo(int32_t argc, char **argv) {
static
int32_t
dndRunDnode
()
{
if
(
dndInit
()
!=
0
)
{
dError
(
"failed to init
ialize
environment since %s"
,
terrstr
());
dError
(
"failed to init environment since %s"
,
terrstr
());
return
-
1
;
}
SDnodeOpt
option
=
dndGetOpt
();
SDnode
*
pDnode
=
dndCreate
(
&
option
);
if
(
pDnode
==
NULL
)
{
dError
(
"failed to to create dnode
object
since %s"
,
terrstr
());
dError
(
"failed to to create dnode since %s"
,
terrstr
());
return
-
1
;
}
else
{
global
.
pDnode
=
pDnode
;
...
...
@@ -184,7 +186,6 @@ int main(int argc, char const *argv[]) {
return
-
1
;
}
dndSetProcInfo
(
argc
,
(
char
**
)
argv
);
if
(
global
.
generateGrant
)
{
dndGenerateGrant
();
return
0
;
...
...
@@ -212,5 +213,6 @@ int main(int argc, char const *argv[]) {
return
0
;
}
dndSetProcInfo
(
argc
,
(
char
**
)
argv
);
return
dndRunDnode
();
}
source/dnode/mgmt/main/inc/dnd.h
浏览文件 @
c28b6b41
...
...
@@ -136,6 +136,7 @@ typedef struct SDnode {
const
char
*
dndNodeLogStr
(
ENodeType
ntype
);
const
char
*
dndNodeProcStr
(
ENodeType
ntype
);
const
char
*
dndEventStr
(
EDndEvent
ev
);
EDndStatus
dndGetStatus
(
SDnode
*
pDnode
);
void
dndSetStatus
(
SDnode
*
pDnode
,
EDndStatus
stat
);
void
dndSetMsgHandle
(
SMgmtWrapper
*
pWrapper
,
tmsg_t
msgType
,
NodeMsgFp
nodeMsgFp
,
int8_t
vgId
);
...
...
source/dnode/mgmt/main/src/dndExec.c
浏览文件 @
c28b6b41
...
...
@@ -150,7 +150,7 @@ static SProcCfg dndGenProcCfg(SMgmtWrapper *pWrapper) {
}
static
int32_t
dndRunInSingleProcess
(
SDnode
*
pDnode
)
{
dInfo
(
"dnode
start to
run in single process"
);
dInfo
(
"dnode run in single process"
);
for
(
ENodeType
n
=
DNODE
;
n
<
NODE_MAX
;
++
n
)
{
SMgmtWrapper
*
pWrapper
=
&
pDnode
->
wrappers
[
n
];
...
...
@@ -189,7 +189,7 @@ static int32_t dndRunInSingleProcess(SDnode *pDnode) {
}
static
int32_t
dndRunInParentProcess
(
SDnode
*
pDnode
)
{
dInfo
(
"dnode
start to
run in parent process"
);
dInfo
(
"dnode run in parent process"
);
SMgmtWrapper
*
pDWrapper
=
&
pDnode
->
wrappers
[
DNODE
];
if
(
dndOpenNode
(
pDWrapper
)
!=
0
)
{
dError
(
"node:%s, failed to start since %s"
,
pDWrapper
->
name
,
terrstr
());
...
...
@@ -201,12 +201,13 @@ static int32_t dndRunInParentProcess(SDnode *pDnode) {
pWrapper
->
required
=
dndRequireNode
(
pWrapper
);
if
(
!
pWrapper
->
required
)
continue
;
int
64
_t
shmsize
=
1024
*
1024
*
2
;
// size will be a configuration item
int
32
_t
shmsize
=
1024
*
1024
*
2
;
// size will be a configuration item
if
(
taosCreateShm
(
&
pWrapper
->
shm
,
shmsize
)
!=
0
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
terrno
);
dError
(
"node:%s, failed to create shm size:%
"
PRId64
"
since %s"
,
pWrapper
->
name
,
shmsize
,
terrstr
());
dError
(
"node:%s, failed to create shm size:%
d
since %s"
,
pWrapper
->
name
,
shmsize
,
terrstr
());
return
-
1
;
}
dInfo
(
"node:%s, shm:%d is created, size:%d"
,
pWrapper
->
name
,
pWrapper
->
shm
.
id
,
shmsize
);
SProcCfg
cfg
=
dndGenProcCfg
(
pWrapper
);
cfg
.
isChild
=
false
;
...
...
@@ -275,7 +276,7 @@ static int32_t dndRunInParentProcess(SDnode *pDnode) {
}
static
int32_t
dndRunInChildProcess
(
SDnode
*
pDnode
)
{
dInfo
(
"dnode
start to
run in child process"
);
dInfo
(
"dnode run in child process"
);
SMgmtWrapper
*
pWrapper
=
&
pDnode
->
wrappers
[
pDnode
->
ntype
];
SMsgCb
msgCb
=
dndCreateMsgcb
(
pWrapper
);
...
...
source/dnode/mgmt/main/src/dndFile.c
浏览文件 @
c28b6b41
...
...
@@ -179,7 +179,7 @@ int32_t dndReadShmFile(SDnode *pDnode) {
}
}
if
(
!
tsMultiProcess
||
pDnode
->
ntype
==
DNODE
||
pDnode
->
ntype
==
DNODE
)
{
if
(
!
tsMultiProcess
||
pDnode
->
ntype
==
DNODE
||
pDnode
->
ntype
==
NODE_MAX
)
{
for
(
ENodeType
ntype
=
DNODE
;
ntype
<
NODE_MAX
;
++
ntype
)
{
SMgmtWrapper
*
pWrapper
=
&
pDnode
->
wrappers
[
ntype
];
if
(
pWrapper
->
shm
.
id
>=
0
)
{
...
...
@@ -194,10 +194,10 @@ int32_t dndReadShmFile(SDnode *pDnode) {
dError
(
"shmid:%d, failed to attach shm since %s"
,
pWrapper
->
shm
.
id
,
terrstr
());
goto
_OVER
;
}
d
Debug
(
"shmid:%d, is attached, size:%d"
,
pWrapper
->
shm
.
id
,
pWrapper
->
shm
.
size
);
d
Info
(
"node:%s, shmid:%d is attached, size:%d"
,
pWrapper
->
name
,
pWrapper
->
shm
.
id
,
pWrapper
->
shm
.
size
);
}
dDebug
(
"successed to
open
%s"
,
file
);
dDebug
(
"successed to
load
%s"
,
file
);
code
=
0
;
_OVER:
...
...
source/dnode/mgmt/main/src/dndMsg.c
浏览文件 @
c28b6b41
...
...
@@ -66,7 +66,7 @@ void dndProcessRpcMsg(SMgmtWrapper *pWrapper, SRpcMsg *pRpc, SEpSet *pEpSet) {
dTrace
(
"msg:%p, is created, handle:%p app:%p user:%s"
,
pMsg
,
pRpc
->
handle
,
pRpc
->
ahandle
,
pMsg
->
user
);
code
=
(
*
msgFp
)(
pWrapper
,
pMsg
);
}
else
if
(
pWrapper
->
procType
==
PROC_PARENT
)
{
dTrace
(
"msg:%p, is created and
will
put into child queue, handle:%p app:%p user:%s"
,
pMsg
,
pRpc
->
handle
,
dTrace
(
"msg:%p, is created and put into child queue, handle:%p app:%p user:%s"
,
pMsg
,
pRpc
->
handle
,
pRpc
->
ahandle
,
pMsg
->
user
);
code
=
taosProcPutToChildQ
(
pWrapper
->
pProc
,
pMsg
,
sizeof
(
SNodeMsg
),
pRpc
->
pCont
,
pRpc
->
contLen
,
PROC_REQ
);
}
else
{
...
...
source/dnode/mgmt/main/src/dndObj.c
浏览文件 @
c28b6b41
...
...
@@ -61,7 +61,7 @@ static void dndClearVars(SDnode *pDnode) {
taosMemoryFreeClear
(
pDnode
->
secondEp
);
taosMemoryFreeClear
(
pDnode
->
dataDir
);
taosMemoryFree
(
pDnode
);
dDebug
(
"dnode
object
memory is cleared, data:%p"
,
pDnode
);
dDebug
(
"dnode memory is cleared, data:%p"
,
pDnode
);
}
SDnode
*
dndCreate
(
const
SDnodeOpt
*
pOption
)
{
...
...
@@ -117,14 +117,14 @@ SDnode *dndCreate(const SDnodeOpt *pOption) {
SMsgCb
msgCb
=
dndCreateMsgcb
(
&
pDnode
->
wrappers
[
0
]);
tmsgSetDefaultMsgCb
(
&
msgCb
);
dInfo
(
"dnode
object
is created, data:%p"
,
pDnode
);
dInfo
(
"dnode is created, data:%p"
,
pDnode
);
code
=
0
;
_OVER:
if
(
code
!=
0
&&
pDnode
)
{
dndClearVars
(
pDnode
);
pDnode
=
NULL
;
dError
(
"failed to create dnode
object
since %s"
,
terrstr
());
dError
(
"failed to create dnode since %s"
,
terrstr
());
}
return
pDnode
;
...
...
@@ -147,11 +147,11 @@ void dndClose(SDnode *pDnode) {
}
dndClearVars
(
pDnode
);
dInfo
(
"dnode
object
is closed, data:%p"
,
pDnode
);
dInfo
(
"dnode is closed, data:%p"
,
pDnode
);
}
void
dndHandleEvent
(
SDnode
*
pDnode
,
EDndEvent
event
)
{
dInfo
(
"dnode
object receive event %d, data:%p"
,
event
,
pDnode
);
dInfo
(
"dnode
receive %s event, data:%p"
,
dndEventStr
(
event
)
,
pDnode
);
if
(
event
==
DND_EVENT_STOP
)
{
pDnode
->
event
=
event
;
}
...
...
source/dnode/mgmt/main/src/dndStr.c
浏览文件 @
c28b6b41
...
...
@@ -62,3 +62,16 @@ const char *dndNodeProcStr(ENodeType ntype) {
return
"taosd"
;
}
}
const
char
*
dndEventStr
(
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"
;
}
}
\ No newline at end of file
source/os/src/osProc.c
浏览文件 @
c28b6b41
...
...
@@ -39,7 +39,7 @@ void taosSetProcName(int32_t argc, char **argv, const char *name) {
argv
[
i
][
j
]
=
0
;
}
if
(
i
==
0
)
{
tstrncpy
(
argv
[
0
],
name
,
len
);
tstrncpy
(
argv
[
0
],
name
,
len
+
1
);
}
}
}
...
...
@@ -48,5 +48,5 @@ void taosSetProcPath(int32_t argc, char **argv) { tsProcPath = argv[0]; }
bool
taosProcExists
(
int32_t
pid
)
{
int32_t
p
=
getpgid
(
pid
);
return
p
=
=
0
;
return
p
>
=
0
;
}
source/util/src/tconfig.c
浏览文件 @
c28b6b41
...
...
@@ -590,12 +590,12 @@ void cfgDumpCfg(SConfig *pCfg, bool tsc, bool dump) {
}
int32_t
cfgLoadFromEnvVar
(
SConfig
*
pConfig
)
{
uInfo
(
"load from global env variables"
);
uInfo
(
"load from global env variables
success
"
);
return
0
;
}
int32_t
cfgLoadFromEnvFile
(
SConfig
*
pConfig
,
const
char
*
filepath
)
{
uInfo
(
"load from env file
%
s"
,
filepath
);
uInfo
(
"load from env file
[%s] succes
s"
,
filepath
);
return
0
;
}
...
...
@@ -649,11 +649,11 @@ int32_t cfgLoadFromCfgFile(SConfig *pConfig, const char *filepath) {
taosCloseFile
(
&
pFile
);
if
(
line
!=
NULL
)
taosMemoryFreeClear
(
line
);
uInfo
(
"load from cfg file
%s
success"
,
filepath
);
uInfo
(
"load from cfg file
[%s]
success"
,
filepath
);
return
0
;
}
int32_t
cfgLoadFromApollUrl
(
SConfig
*
pConfig
,
const
char
*
url
)
{
uInfo
(
"load from apoll url
%
s"
,
url
);
uInfo
(
"load from apoll url
[%s] succes
s"
,
url
);
return
0
;
}
source/util/src/tprocess.c
浏览文件 @
c28b6b41
...
...
@@ -336,7 +336,7 @@ SProcObj *taosProcInit(const SProcCfg *pCfg) {
pProc
->
parentConsumeFp
=
pCfg
->
parentConsumeFp
;
pProc
->
isChild
=
pCfg
->
isChild
;
uDebug
(
"proc:%s, is initialized,
c
hild:%d child queue:%p parent queue:%p"
,
pProc
->
name
,
pProc
->
isChild
,
uDebug
(
"proc:%s, is initialized,
isC
hild:%d child queue:%p parent queue:%p"
,
pProc
->
name
,
pProc
->
isChild
,
pProc
->
pChildQueue
,
pProc
->
pParentQueue
);
return
pProc
;
...
...
@@ -370,7 +370,7 @@ static void taosProcThreadLoop(SProcObj *pProc) {
freeBodyFp
=
pProc
->
parentFreeBodyFp
;
}
uDebug
(
"proc:%s, start to get msg from queue:%p
"
,
pProc
->
name
,
pQueue
);
uDebug
(
"proc:%s, start to get msg from queue:%p
, isChild:%d"
,
pProc
->
name
,
pQueue
,
pProc
->
isChild
);
while
(
1
)
{
int32_t
numOfMsgs
=
taosProcQueuePop
(
pQueue
,
&
pHead
,
&
headLen
,
&
pBody
,
&
bodyLen
,
&
ftype
,
mallocHeadFp
,
freeHeadFp
,
...
...
@@ -399,19 +399,19 @@ int32_t taosProcRun(SProcObj *pProc) {
return
-
1
;
}
uDebug
(
"proc:%s, start to consume queue:%p
"
,
pProc
->
name
,
pProc
->
pChildQueue
);
uDebug
(
"proc:%s, start to consume queue:%p
, thread:%"
PRId64
,
pProc
->
name
,
pProc
->
pChildQueue
,
pProc
->
thread
);
return
0
;
}
static
void
taosProcStop
(
SProcObj
*
pProc
)
{
if
(
!
taosCheckPthreadValid
(
pProc
->
thread
))
return
;
uDebug
(
"proc:%s, start to join thread
"
,
pProc
->
name
);
uDebug
(
"proc:%s, start to join thread
:%"
PRId64
", isChild:%d"
,
pProc
->
name
,
pProc
->
thread
,
pProc
->
isChild
);
SProcQueue
*
pQueue
;
if
(
pProc
->
isChild
)
{
pQueue
=
pProc
->
pParentQueue
;
}
else
{
pQueue
=
pProc
->
pChildQueue
;
}
else
{
pQueue
=
pProc
->
pParentQueue
;
}
tsem_post
(
&
pQueue
->
sem
);
taosThreadJoin
(
pProc
->
thread
,
NULL
);
...
...
@@ -419,8 +419,9 @@ static void taosProcStop(SProcObj *pProc) {
void
taosProcCleanup
(
SProcObj
*
pProc
)
{
if
(
pProc
!=
NULL
)
{
uDebug
(
"proc:%s, clean up"
,
pProc
->
name
);
uDebug
(
"proc:%s,
start to
clean up"
,
pProc
->
name
);
taosProcStop
(
pProc
);
uDebug
(
"proc:%s, is cleaned up"
,
pProc
->
name
);
// taosProcCleanupQueue(pProc->pChildQueue);
// taosProcCleanupQueue(pProc->pParentQueue);
taosMemoryFree
(
pProc
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录