Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
4cc2e903
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
4cc2e903
编写于
12月 02, 2020
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-1843
上级
8b4e85dd
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
66 addition
and
104 deletion
+66
-104
src/dnode/inc/dnodeStep.h
src/dnode/inc/dnodeStep.h
+5
-2
src/dnode/src/dnodeMain.c
src/dnode/src/dnodeMain.c
+2
-3
src/dnode/src/dnodePeer.c
src/dnode/src/dnodePeer.c
+2
-3
src/dnode/src/dnodeStep.c
src/dnode/src/dnodeStep.c
+38
-0
src/inc/dnode.h
src/inc/dnode.h
+8
-0
src/mnode/src/mnodeMain.c
src/mnode/src/mnodeMain.c
+2
-3
src/util/inc/tstep.h
src/util/inc/tstep.h
+0
-36
src/util/src/tnettest.c
src/util/src/tnettest.c
+6
-4
src/util/src/tstep.c
src/util/src/tstep.c
+0
-50
src/vnode/src/vnodeMgmt.c
src/vnode/src/vnodeMgmt.c
+3
-3
未找到文件。
src/dnode/inc/dnodeStep.h
浏览文件 @
4cc2e903
...
...
@@ -19,9 +19,12 @@
#ifdef __cplusplus
extern
"C"
{
#endif
#include "dnode.h"
void
dnodeReportStep
(
char
*
name
,
char
*
desc
,
int8_t
finished
);
void
dnodeSendStartupStep
(
SRpcMsg
*
pMsg
);
int32_t
dnodeStepInit
(
SStep
*
pSteps
,
int32_t
stepSize
);
void
dnodeStepCleanup
(
SStep
*
pSteps
,
int32_t
stepSize
);
void
dnodeReportStep
(
char
*
name
,
char
*
desc
,
int8_t
finished
);
void
dnodeSendStartupStep
(
SRpcMsg
*
pMsg
);
#ifdef __cplusplus
}
...
...
src/dnode/src/dnodeMain.c
浏览文件 @
4cc2e903
...
...
@@ -20,7 +20,6 @@
#include "tconfig.h"
#include "tglobal.h"
#include "tfile.h"
#include "tstep.h"
#include "twal.h"
#include "trpc.h"
#include "dnode.h"
...
...
@@ -83,12 +82,12 @@ static int dnodeCreateDir(const char *dir) {
static
void
dnodeCleanupComponents
()
{
int32_t
stepSize
=
sizeof
(
tsDnodeSteps
)
/
sizeof
(
SStep
);
taos
StepCleanup
(
tsDnodeSteps
,
stepSize
);
dnode
StepCleanup
(
tsDnodeSteps
,
stepSize
);
}
static
int32_t
dnodeInitComponents
()
{
int32_t
stepSize
=
sizeof
(
tsDnodeSteps
)
/
sizeof
(
SStep
);
return
taos
StepInit
(
tsDnodeSteps
,
stepSize
);
return
dnode
StepInit
(
tsDnodeSteps
,
stepSize
);
}
int32_t
dnodeInitSystem
()
{
...
...
src/dnode/src/dnodePeer.c
浏览文件 @
4cc2e903
...
...
@@ -58,8 +58,6 @@ int32_t dnodeInitServer() {
dnodeProcessReqMsgFp
[
TSDB_MSG_TYPE_DM_GRANT
]
=
dnodeDispatchToMPeerQueue
;
dnodeProcessReqMsgFp
[
TSDB_MSG_TYPE_DM_STATUS
]
=
dnodeDispatchToMPeerQueue
;
dnodeProcessReqMsgFp
[
TSDB_MSG_TYPE_NETWORK_TEST
]
=
dnodeSendStartupStep
;
SRpcInit
rpcInit
;
memset
(
&
rpcInit
,
0
,
sizeof
(
rpcInit
));
rpcInit
.
localPort
=
tsDnodeDnodePort
;
...
...
@@ -94,8 +92,9 @@ static void dnodeProcessReqMsgFromDnode(SRpcMsg *pMsg, SRpcEpSet *pEpSet) {
.
pCont
=
NULL
,
.
contLen
=
0
};
if
(
pMsg
->
pCont
==
NULL
)
return
;
if
(
pMsg
->
msgType
==
TSDB_MSG_TYPE_NETWORK_TEST
)
return
dnodeSendStartupStep
(
pMsg
);
if
(
dnodeGetRunStatus
()
!=
TSDB_RUN_STATUS_RUNING
)
{
rspMsg
.
code
=
TSDB_CODE_APP_NOT_READY
;
...
...
src/dnode/src/dnodeStep.c
浏览文件 @
4cc2e903
...
...
@@ -15,8 +15,10 @@
#define _DEFAULT_SOURCE
#include "os.h"
#include "taoserror.h"
#include "taosmsg.h"
#include "dnodeInt.h"
#include "dnodeStep.h"
static
SStartupStep
tsStartupStep
;
...
...
@@ -39,7 +41,43 @@ void dnodeSendStartupStep(SRpcMsg *pMsg) {
if
(
step
>
10
)
pStep
->
finished
=
1
;
#endif
dDebug
(
"startup msg is sent, step:%s desc:%s finished:%d"
,
pStep
->
name
,
pStep
->
desc
,
pStep
->
finished
);
SRpcMsg
rpcRsp
=
{.
handle
=
pMsg
->
handle
,
.
pCont
=
pStep
,
.
contLen
=
sizeof
(
SStartupStep
)};
rpcSendResponse
(
&
rpcRsp
);
rpcFreeCont
(
pMsg
->
pCont
);
}
void
taosStepCleanupImp
(
SStep
*
pSteps
,
int32_t
stepId
)
{
for
(
int32_t
step
=
stepId
;
step
>=
0
;
step
--
)
{
SStep
*
pStep
=
pSteps
+
step
;
dDebug
(
"step:%s will cleanup"
,
pStep
->
name
);
if
(
pStep
->
cleanupFp
!=
NULL
)
{
(
*
pStep
->
cleanupFp
)();
}
}
}
int32_t
dnodeStepInit
(
SStep
*
pSteps
,
int32_t
stepSize
)
{
for
(
int32_t
step
=
0
;
step
<
stepSize
;
step
++
)
{
SStep
*
pStep
=
pSteps
+
step
;
if
(
pStep
->
initFp
==
NULL
)
continue
;
dnodeReportStep
(
pStep
->
name
,
"Start initialization"
,
0
);
int32_t
code
=
(
*
pStep
->
initFp
)();
if
(
code
!=
0
)
{
dDebug
(
"step:%s will init"
,
pStep
->
name
);
taosStepCleanupImp
(
pSteps
,
step
);
return
code
;
}
dnodeReportStep
(
pStep
->
name
,
"Initialization complete"
,
step
+
1
>=
stepSize
);
}
return
0
;
}
void
dnodeStepCleanup
(
SStep
*
pSteps
,
int32_t
stepSize
)
{
return
taosStepCleanupImp
(
pSteps
,
stepSize
-
1
);
}
src/inc/dnode.h
浏览文件 @
4cc2e903
...
...
@@ -71,6 +71,14 @@ void dnodeDelayReprocessMWriteMsg(void *pMsg);
void
dnodeSendStatusMsgToMnode
();
typedef
struct
{
char
*
name
;
int32_t
(
*
initFp
)();
void
(
*
cleanupFp
)();
}
SStep
;
int32_t
dnodeStepInit
(
SStep
*
pSteps
,
int32_t
stepSize
);
void
dnodeStepCleanup
(
SStep
*
pSteps
,
int32_t
stepSize
);
void
dnodeReportStep
(
char
*
name
,
char
*
desc
,
int8_t
finished
);
#ifdef __cplusplus
...
...
src/mnode/src/mnodeMain.c
浏览文件 @
4cc2e903
...
...
@@ -21,7 +21,6 @@
#include "tgrant.h"
#include "ttimer.h"
#include "tglobal.h"
#include "tstep.h"
#include "mnode.h"
#include "dnode.h"
#include "mnodeDef.h"
...
...
@@ -64,12 +63,12 @@ static bool mnodeNeedStart() ;
static
void
mnodeCleanupComponents
()
{
int32_t
stepSize
=
sizeof
(
tsMnodeSteps
)
/
sizeof
(
SStep
);
taos
StepCleanup
(
tsMnodeSteps
,
stepSize
);
dnode
StepCleanup
(
tsMnodeSteps
,
stepSize
);
}
static
int32_t
mnodeInitComponents
()
{
int32_t
stepSize
=
sizeof
(
tsMnodeSteps
)
/
sizeof
(
SStep
);
return
taos
StepInit
(
tsMnodeSteps
,
stepSize
);
return
dnode
StepInit
(
tsMnodeSteps
,
stepSize
);
}
int32_t
mnodeStartSystem
()
{
...
...
src/util/inc/tstep.h
已删除
100644 → 0
浏览文件 @
8b4e85dd
/*
* 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/>.
*/
#ifndef TDENGINE_TSTEP_H
#define TDENGINE_TSTEP_H
#ifdef __cplusplus
extern
"C"
{
#endif
typedef
struct
{
const
char
*
const
name
;
int32_t
(
*
initFp
)();
void
(
*
cleanupFp
)();
}
SStep
;
int32_t
taosStepInit
(
SStep
*
pSteps
,
int32_t
stepSize
);
void
taosStepCleanup
(
SStep
*
pSteps
,
int32_t
stepSize
);
#ifdef __cplusplus
}
#endif
#endif // TDENGINE_TUTIL_H
src/util/src/tnettest.c
浏览文件 @
4cc2e903
...
...
@@ -355,7 +355,7 @@ static int32_t taosNetCheckRpc(const char* serverFqdn, uint16_t port, uint16_t p
pRpcConn
=
taosNetInitRpc
(
secretEncrypt
,
spi
);
if
(
NULL
==
pRpcConn
)
{
uError
(
"failed to init client rpc"
);
return
-
1
;
return
TSDB_CODE_RPC_NETWORK_UNAVAIL
;
}
memset
(
&
epSet
,
0
,
sizeof
(
SRpcEpSet
));
...
...
@@ -376,7 +376,7 @@ static int32_t taosNetCheckRpc(const char* serverFqdn, uint16_t port, uint16_t p
if
((
rspMsg
.
code
!=
0
)
||
(
rspMsg
.
msgType
!=
TSDB_MSG_TYPE_NETWORK_TEST
+
1
))
{
uDebug
(
"ret code 0x%x %s"
,
rspMsg
.
code
,
tstrerror
(
rspMsg
.
code
));
return
-
1
;
return
rspMsg
.
code
;
}
int32_t
code
=
0
;
...
...
@@ -406,7 +406,7 @@ static void taosNetTestStartup(char *host, int32_t port) {
SStartupStep
*
pStep
=
malloc
(
sizeof
(
SStartupStep
));
while
(
1
)
{
int32_t
code
=
taosNetCheckRpc
(
host
,
port
,
20
,
0
,
pStep
);
int32_t
code
=
taosNetCheckRpc
(
host
,
port
+
TSDB_PORT_DNODEDNODE
,
20
,
0
,
pStep
);
if
(
code
>
0
)
{
code
=
taosNetParseStartup
(
pStep
);
}
...
...
@@ -414,9 +414,11 @@ static void taosNetTestStartup(char *host, int32_t port) {
if
(
code
>
0
)
{
uDebug
(
"continue check startup step"
);
}
else
{
if
(
code
<
0
)
{
uError
(
"failed to check startup step, code:0x%x %s"
,
code
,
tstrerror
(
code
));
}
break
;
}
taosMsleep
(
500
);
}
free
(
pStep
);
...
...
src/util/src/tstep.c
已删除
100644 → 0
浏览文件 @
8b4e85dd
/*
* 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 "os.h"
#include "tstep.h"
#include "tulog.h"
#include "taoserror.h"
void
taosStepCleanupImp
(
SStep
*
pSteps
,
int32_t
stepId
)
{
for
(
int32_t
step
=
stepId
;
step
>=
0
;
step
--
)
{
SStep
*
pStep
=
pSteps
+
step
;
uDebug
(
"step:%s will cleanup"
,
pStep
->
name
);
if
(
pStep
->
cleanupFp
!=
NULL
)
{
(
*
pStep
->
cleanupFp
)();
}
}
}
int32_t
taosStepInit
(
SStep
*
pSteps
,
int32_t
stepSize
)
{
for
(
int32_t
step
=
0
;
step
<
stepSize
;
step
++
)
{
SStep
*
pStep
=
pSteps
+
step
;
if
(
pStep
->
initFp
==
NULL
)
continue
;
int32_t
code
=
(
*
pStep
->
initFp
)();
if
(
code
!=
0
)
{
uDebug
(
"step:%s will init"
,
pStep
->
name
);
taosStepCleanupImp
(
pSteps
,
step
);
return
code
;
}
}
return
0
;
}
void
taosStepCleanup
(
SStep
*
pSteps
,
int32_t
stepSize
)
{
return
taosStepCleanupImp
(
pSteps
,
stepSize
-
1
);
}
src/vnode/src/vnodeMgmt.c
浏览文件 @
4cc2e903
...
...
@@ -15,7 +15,7 @@
#define _DEFAULT_SOURCE
#include "os.h"
#include "
tstep
.h"
#include "
dnode
.h"
#include "vnodeStatus.h"
#include "vnodeRead.h"
#include "vnodeWrite.h"
...
...
@@ -37,12 +37,12 @@ static SStep tsVnodeSteps[] = {
int32_t
vnodeInitMgmt
()
{
int32_t
stepSize
=
sizeof
(
tsVnodeSteps
)
/
sizeof
(
SStep
);
return
taos
StepInit
(
tsVnodeSteps
,
stepSize
);
return
dnode
StepInit
(
tsVnodeSteps
,
stepSize
);
}
void
vnodeCleanupMgmt
()
{
int32_t
stepSize
=
sizeof
(
tsVnodeSteps
)
/
sizeof
(
SStep
);
taos
StepCleanup
(
tsVnodeSteps
,
stepSize
);
dnode
StepCleanup
(
tsVnodeSteps
,
stepSize
);
}
static
int32_t
vnodeInitHash
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录