Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
fd7f61a0
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看板
提交
fd7f61a0
编写于
3月 20, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
shm
上级
1363021f
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
62 addition
and
25 deletion
+62
-25
include/dnode/mnode/mnode.h
include/dnode/mnode/mnode.h
+3
-3
source/dnode/mgmt/container/inc/dnd.h
source/dnode/mgmt/container/inc/dnd.h
+2
-0
source/dnode/mgmt/container/src/dndExec.c
source/dnode/mgmt/container/src/dndExec.c
+13
-7
source/dnode/mgmt/container/src/dndTransport.c
source/dnode/mgmt/container/src/dndTransport.c
+9
-4
source/dnode/mgmt/dnode/inc/dm.h
source/dnode/mgmt/dnode/inc/dm.h
+0
-1
source/dnode/mgmt/dnode/inc/dmInt.h
source/dnode/mgmt/dnode/inc/dmInt.h
+1
-0
source/dnode/mgmt/dnode/src/dmInt.c
source/dnode/mgmt/dnode/src/dmInt.c
+9
-1
source/dnode/mgmt/dnode/src/dmWorker.c
source/dnode/mgmt/dnode/src/dmWorker.c
+4
-0
source/dnode/mgmt/mnode/src/mmInt.c
source/dnode/mgmt/mnode/src/mmInt.c
+7
-0
source/dnode/mgmt/test/sut/src/sut.cpp
source/dnode/mgmt/test/sut/src/sut.cpp
+1
-1
source/dnode/mnode/impl/src/mndTrans.c
source/dnode/mnode/impl/src/mndTrans.c
+2
-2
source/dnode/mnode/impl/src/mnode.c
source/dnode/mnode/impl/src/mnode.c
+3
-5
source/dnode/mnode/impl/test/trans/trans.cpp
source/dnode/mnode/impl/test/trans/trans.cpp
+7
-0
tests/script/sh/exec.sh
tests/script/sh/exec.sh
+1
-1
未找到文件。
include/dnode/mnode/mnode.h
浏览文件 @
fd7f61a0
...
...
@@ -67,11 +67,11 @@ void mndClose(SMnode *pMnode);
int32_t
mndAlter
(
SMnode
*
pMnode
,
const
SMnodeOpt
*
pOption
);
/**
* @brief
Drop a mnode.
* @brief
Start mnode
*
* @param p
ath Path of the mnode
.
* @param p
Mnode The mnode object
.
*/
void
mndDestroy
(
const
char
*
path
);
int32_t
mndStart
(
SMnode
*
pMnode
);
/**
* @brief Get mnode monitor info.
...
...
source/dnode/mgmt/container/inc/dnd.h
浏览文件 @
fd7f61a0
...
...
@@ -69,6 +69,7 @@ typedef struct SBnodeMgmt SBnodeMgmt;
typedef
int32_t
(
*
NodeMsgFp
)(
void
*
pMgmt
,
SNodeMsg
*
pMsg
);
typedef
int32_t
(
*
OpenNodeFp
)(
SMgmtWrapper
*
pWrapper
);
typedef
void
(
*
CloseNodeFp
)(
SMgmtWrapper
*
pWrapper
);
typedef
int32_t
(
*
StartNodeFp
)(
SMgmtWrapper
*
pWrapper
);
typedef
int32_t
(
*
CreateNodeFp
)(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
typedef
int32_t
(
*
DropNodeFp
)(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
typedef
int32_t
(
*
RequireNodeFp
)(
SMgmtWrapper
*
pWrapper
,
bool
*
required
);
...
...
@@ -95,6 +96,7 @@ typedef struct SMsgHandle {
typedef
struct
SMgmtFp
{
OpenNodeFp
openFp
;
CloseNodeFp
closeFp
;
StartNodeFp
startFp
;
CreateNodeFp
createMsgFp
;
DropNodeFp
dropMsgFp
;
RequireNodeFp
requiredFp
;
...
...
source/dnode/mgmt/container/src/dndExec.c
浏览文件 @
fd7f61a0
...
...
@@ -84,14 +84,19 @@ static int32_t dndRunInSingleProcess(SDnode *pDnode) {
}
}
SMgmtWrapper
*
pWrapper
=
dndAcquireWrapper
(
pDnode
,
DNODE
);
int32_t
code
=
dmStart
(
pWrapper
->
pMgmt
);
if
(
code
!=
0
)
{
dError
(
"failed to start dnode worker since %s"
,
terrstr
());
dndSetStatus
(
pDnode
,
DND_STAT_RUNNING
);
for
(
ENodeType
n
=
0
;
n
<
NODE_MAX
;
++
n
)
{
SMgmtWrapper
*
pWrapper
=
&
pDnode
->
wrappers
[
n
];
if
(
!
pWrapper
->
required
)
continue
;
if
(
pWrapper
->
fp
.
startFp
==
NULL
)
continue
;
if
((
*
pWrapper
->
fp
.
startFp
)(
pWrapper
)
!=
0
)
{
dError
(
"node:%s, failed to start since %s"
,
pWrapper
->
name
,
terrstr
());
return
-
1
;
}
}
dndReleaseWrapper
(
pWrapper
);
return
code
;
return
0
;
}
static
void
dndClearNodesExecpt
(
SDnode
*
pDnode
,
ENodeType
except
)
{
...
...
@@ -198,6 +203,7 @@ static int32_t dndRunInMultiProcess(SDnode *pDnode) {
}
}
#if 0
SMgmtWrapper *pWrapper = dndAcquireWrapper(pDnode, DNODE);
if (pWrapper->procType == PROC_PARENT && dmStart(pWrapper->pMgmt) != 0) {
dndReleaseWrapper(pWrapper);
...
...
@@ -206,6 +212,7 @@ static int32_t dndRunInMultiProcess(SDnode *pDnode) {
}
dndReleaseWrapper(pWrapper);
#endif
return
0
;
}
...
...
@@ -222,7 +229,6 @@ int32_t dndRun(SDnode *pDnode) {
}
}
dndSetStatus
(
pDnode
,
DND_STAT_RUNNING
);
dndReportStartup
(
pDnode
,
"TDengine"
,
"initialized successfully"
);
while
(
1
)
{
...
...
source/dnode/mgmt/container/src/dndTransport.c
浏览文件 @
fd7f61a0
...
...
@@ -26,8 +26,8 @@ static void dndProcessResponse(void *parent, SRpcMsg *pRsp, SEpSet *pEpSet) {
tmsg_t
msgType
=
pRsp
->
msgType
;
if
(
dndGetStatus
(
pDnode
)
!=
DND_STAT_RUNNING
)
{
if
(
pRsp
==
NULL
||
pRsp
->
pCont
==
NULL
)
return
;
dTrace
(
"rsp:%s ignored since dnode
exit
ing, handle:%p app:%p"
,
TMSG_INFO
(
msgType
),
pRsp
->
handle
,
pRsp
->
ahandle
);
//
if (pRsp == NULL || pRsp->pCont == NULL) return;
dTrace
(
"rsp:%s ignored since dnode
not runn
ing, handle:%p app:%p"
,
TMSG_INFO
(
msgType
),
pRsp
->
handle
,
pRsp
->
ahandle
);
rpcFreeCont
(
pRsp
->
pCont
);
return
;
}
...
...
@@ -276,8 +276,13 @@ static int32_t dndSendRpcReq(STransMgmt *pMgmt, SEpSet *pEpSet, SRpcMsg *pReq) {
int32_t
dndSendReqToDnode
(
SMgmtWrapper
*
pWrapper
,
SEpSet
*
pEpSet
,
SRpcMsg
*
pReq
)
{
if
(
pWrapper
->
procType
==
PROC_CHILD
)
{
}
else
{
STransMgmt
*
pTrans
=
&
pWrapper
->
pDnode
->
trans
;
return
dndSendRpcReq
(
pTrans
,
pEpSet
,
pReq
);
SDnode
*
pDnode
=
pWrapper
->
pDnode
;
if
(
dndGetStatus
(
pDnode
)
!=
DND_STAT_RUNNING
)
{
terrno
=
TSDB_CODE_DND_OFFLINE
;
dError
(
"failed to send rpc msg since %s, handle:%p"
,
terrstr
(),
pReq
->
handle
);
return
-
1
;
}
return
dndSendRpcReq
(
&
pDnode
->
trans
,
pEpSet
,
pReq
);
}
}
...
...
source/dnode/mgmt/dnode/inc/dm.h
浏览文件 @
fd7f61a0
...
...
@@ -30,7 +30,6 @@ void dmInitMsgHandles(SMgmtWrapper *pWrapper);
void
dmGetMnodeEpSet
(
SDnodeMgmt
*
pMgmt
,
SEpSet
*
pEpSet
);
void
dmUpdateMnodeEpSet
(
SDnodeMgmt
*
pMgmt
,
SEpSet
*
pEpSet
);
void
dmSendRedirectRsp
(
SDnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
dmStart
(
SDnodeMgmt
*
pMgmt
);
#ifdef __cplusplus
}
...
...
source/dnode/mgmt/dnode/inc/dmInt.h
浏览文件 @
fd7f61a0
...
...
@@ -53,6 +53,7 @@ int32_t dmProcessGrantRsp(SDnodeMgmt *pMgmt, SNodeMsg *pMsg);
// dmWorker.c
int32_t
dmStartWorker
(
SDnodeMgmt
*
pMgmt
);
void
dmStopWorker
(
SDnodeMgmt
*
pMgmt
);
int32_t
dmStartThread
(
SDnodeMgmt
*
pMgmt
);
int32_t
dmProcessMgmtMsg
(
SDnodeMgmt
*
pMgmt
,
SNodeMsg
*
pMsg
);
#ifdef __cplusplus
...
...
source/dnode/mgmt/dnode/src/dmInt.c
浏览文件 @
fd7f61a0
...
...
@@ -73,7 +73,10 @@ void dmSendRedirectRsp(SDnodeMgmt *pMgmt, SRpcMsg *pReq) {
rpcSendRedirectRsp
(
pReq
->
handle
,
&
epSet
);
}
int32_t
dmStart
(
SDnodeMgmt
*
pMgmt
)
{
return
dmStartWorker
(
pMgmt
);
}
static
int32_t
dmStart
(
SMgmtWrapper
*
pWrapper
)
{
dDebug
(
"dnode mgmt start to run"
);
return
dmStartThread
(
pWrapper
->
pMgmt
);
}
int32_t
dmInit
(
SMgmtWrapper
*
pWrapper
)
{
SDnode
*
pDnode
=
pWrapper
->
pDnode
;
...
...
@@ -105,6 +108,10 @@ int32_t dmInit(SMgmtWrapper *pWrapper) {
return
-
1
;
}
if
(
dmStartWorker
(
pMgmt
)
!=
0
)
{
return
-
1
;
}
pWrapper
->
pMgmt
=
pMgmt
;
dInfo
(
"dnode-mgmt is initialized"
);
return
0
;
...
...
@@ -145,6 +152,7 @@ void dmGetMgmtFp(SMgmtWrapper *pWrapper) {
SMgmtFp
mgmtFp
=
{
0
};
mgmtFp
.
openFp
=
dmInit
;
mgmtFp
.
closeFp
=
dmCleanup
;
mgmtFp
.
startFp
=
dmStart
;
mgmtFp
.
requiredFp
=
dmRequire
;
dmInitMsgHandles
(
pWrapper
);
...
...
source/dnode/mgmt/dnode/src/dmWorker.c
浏览文件 @
fd7f61a0
...
...
@@ -108,6 +108,10 @@ int32_t dmStartWorker(SDnodeMgmt *pMgmt) {
return
-
1
;
}
return
0
;
}
int32_t
dmStartThread
(
SDnodeMgmt
*
pMgmt
)
{
pMgmt
->
threadId
=
taosCreateThread
(
dmThreadRoutine
,
pMgmt
);
if
(
pMgmt
->
threadId
==
NULL
)
{
dError
(
"failed to init dnode thread"
);
...
...
source/dnode/mgmt/mnode/src/mmInt.c
浏览文件 @
fd7f61a0
...
...
@@ -222,10 +222,17 @@ static int32_t mmOpen(SMgmtWrapper *pWrapper) {
return
mmOpenFromMsg
(
pWrapper
,
NULL
);
}
static
int32_t
mmStart
(
SMgmtWrapper
*
pWrapper
)
{
dDebug
(
"mnode mgmt start to run"
);
SMnodeMgmt
*
pMgmt
=
pWrapper
->
pMgmt
;
return
mndStart
(
pMgmt
->
pMnode
);
}
void
mmGetMgmtFp
(
SMgmtWrapper
*
pWrapper
)
{
SMgmtFp
mgmtFp
=
{
0
};
mgmtFp
.
openFp
=
mmOpen
;
mgmtFp
.
closeFp
=
mmClose
;
mgmtFp
.
startFp
=
mmStart
;
mgmtFp
.
createMsgFp
=
mmProcessCreateReq
;
mgmtFp
.
dropMsgFp
=
mmProcessDropReq
;
mgmtFp
.
requiredFp
=
mmRequire
;
...
...
source/dnode/mgmt/test/sut/src/sut.cpp
浏览文件 @
fd7f61a0
...
...
@@ -23,7 +23,7 @@ void Testbase::InitLog(const char* path) {
jniDebugFlag
=
0
;
tmrDebugFlag
=
135
;
uDebugFlag
=
135
;
rpcDebugFlag
=
1
35
;
rpcDebugFlag
=
1
43
;
qDebugFlag
=
0
;
wDebugFlag
=
0
;
sDebugFlag
=
0
;
...
...
source/dnode/mnode/impl/src/mndTrans.c
浏览文件 @
fd7f61a0
...
...
@@ -928,13 +928,13 @@ static int32_t mndTransExecuteActions(SMnode *pMnode, STrans *pTrans, SArray *pA
mDebug
(
"trans:%d, all %d actions execute successfully"
,
pTrans
->
id
,
numOfActions
);
return
0
;
}
else
{
mError
(
"trans:%d, all %d actions executed, code:0x%04x"
,
pTrans
->
id
,
numOfActions
,
errCode
);
mError
(
"trans:%d, all %d actions executed, code:0x%04x"
,
pTrans
->
id
,
numOfActions
,
errCode
&
0XFFFF
);
mndTransResetActions
(
pMnode
,
pTrans
,
pArray
);
terrno
=
errCode
;
return
errCode
;
}
}
else
{
mDebug
(
"trans:%d, %d of %d actions executed, code:0x%04x"
,
pTrans
->
id
,
numOfReceived
,
numOfActions
,
errCode
);
mDebug
(
"trans:%d, %d of %d actions executed, code:0x%04x"
,
pTrans
->
id
,
numOfReceived
,
numOfActions
,
errCode
&
0XFFFF
);
return
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
}
}
...
...
source/dnode/mnode/impl/src/mnode.c
浏览文件 @
fd7f61a0
...
...
@@ -230,7 +230,7 @@ static int32_t mndInitSteps(SMnode *pMnode) {
}
else
{
if
(
mndAllocStep
(
pMnode
,
"mnode-sdb-read"
,
mndReadSdb
,
NULL
)
!=
0
)
return
-
1
;
}
if
(
mndAllocStep
(
pMnode
,
"mnode-timer"
,
mndInitTimer
,
NULL
)
!=
0
)
return
-
1
;
//
if (mndAllocStep(pMnode, "mnode-timer", mndInitTimer, NULL) != 0) return -1;
if
(
mndAllocStep
(
pMnode
,
"mnode-profile"
,
mndInitProfile
,
mndCleanupProfile
)
!=
0
)
return
-
1
;
if
(
mndAllocStep
(
pMnode
,
"mnode-show"
,
mndInitShow
,
mndCleanupShow
)
!=
0
)
return
-
1
;
if
(
mndAllocStep
(
pMnode
,
"mnode-sync"
,
mndInitSync
,
mndCleanupSync
)
!=
0
)
return
-
1
;
...
...
@@ -379,10 +379,8 @@ int32_t mndAlter(SMnode *pMnode, const SMnodeOpt *pOption) {
return
0
;
}
void
mndDestroy
(
const
char
*
path
)
{
mDebug
(
"start to destroy mnode at %s"
,
path
);
taosRemoveDir
(
path
);
mDebug
(
"mnode is destroyed"
);
int32_t
mndStart
(
SMnode
*
pMnode
)
{
return
mndInitTimer
(
pMnode
);
}
int32_t
mndProcessMsg
(
SNodeMsg
*
pMsg
)
{
...
...
source/dnode/mnode/impl/test/trans/trans.cpp
浏览文件 @
fd7f61a0
...
...
@@ -204,6 +204,8 @@ TEST_F(MndTestTrans, 03_Create_Qnode2_Crash) {
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_RPC_NETWORK_UNAVAIL
);
}
taosMsleep
(
1000
);
{
// show trans
test
.
SendShowMetaReq
(
TSDB_MGMT_TABLE_TRANS
,
""
);
...
...
@@ -241,6 +243,7 @@ TEST_F(MndTestTrans, 03_Create_Qnode2_Crash) {
EXPECT_EQ
(
test
.
GetShowRows
(),
0
);
}
uInfo
(
"======== re-create trans"
);
// re-create trans
{
SMCreateQnodeReq
createReq
=
{
0
};
...
...
@@ -255,10 +258,14 @@ TEST_F(MndTestTrans, 03_Create_Qnode2_Crash) {
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_RPC_NETWORK_UNAVAIL
);
}
uInfo
(
"======== kill and restart server"
)
KillThenRestartServer
();
uInfo
(
"======== server2 start"
)
server2
.
DoStart
();
uInfo
(
"======== server2 started"
)
{
int32_t
retry
=
0
;
int32_t
retryMax
=
20
;
...
...
tests/script/sh/exec.sh
浏览文件 @
fd7f61a0
...
...
@@ -74,7 +74,7 @@ BUILD_DIR=$TAOS_DIR/$BIN_DIR
SIM_DIR
=
$TAOS_DIR
/sim
NODE_DIR
=
$SIM_DIR
/
$NODE_NAME
EXE_DIR
=
$BUILD_DIR
/source/dnode/mgmt/
daemo
n
EXE_DIR
=
$BUILD_DIR
/source/dnode/mgmt/
mai
n
CFG_DIR
=
$NODE_DIR
/cfg
LOG_DIR
=
$NODE_DIR
/log
DATA_DIR
=
$NODE_DIR
/data
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录