Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
628a5bba
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
628a5bba
编写于
5月 11, 2022
作者:
S
Shengliang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: node mgmt
上级
a27bffd6
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
73 addition
and
69 deletion
+73
-69
source/dnode/mgmt/mgmt_snode/inc/smInt.h
source/dnode/mgmt/mgmt_snode/inc/smInt.h
+12
-11
source/dnode/mgmt/mgmt_snode/src/smHandle.c
source/dnode/mgmt/mgmt_snode/src/smHandle.c
+27
-16
source/dnode/mgmt/mgmt_snode/src/smInt.c
source/dnode/mgmt/mgmt_snode/src/smInt.c
+26
-30
source/dnode/mgmt/mgmt_snode/src/smWorker.c
source/dnode/mgmt/mgmt_snode/src/smWorker.c
+8
-12
未找到文件。
source/dnode/mgmt/mgmt_snode/inc/smInt.h
浏览文件 @
628a5bba
...
@@ -26,9 +26,10 @@ extern "C" {
...
@@ -26,9 +26,10 @@ extern "C" {
typedef
struct
SSnodeMgmt
{
typedef
struct
SSnodeMgmt
{
SSnode
*
pSnode
;
SSnode
*
pSnode
;
SDnode
*
pDnode
;
SMsgCb
msgCb
;
SMgmtWrapper
*
pWrapper
;
const
char
*
path
;
const
char
*
path
;
const
char
*
name
;
int32_t
dnodeId
;
SRWLatch
latch
;
SRWLatch
latch
;
int8_t
uniqueWorkerInUse
;
int8_t
uniqueWorkerInUse
;
SArray
*
uniqueWorkers
;
// SArray<SMultiWorker*>
SArray
*
uniqueWorkers
;
// SArray<SMultiWorker*>
...
@@ -37,19 +38,19 @@ typedef struct SSnodeMgmt {
...
@@ -37,19 +38,19 @@ typedef struct SSnodeMgmt {
}
SSnodeMgmt
;
}
SSnodeMgmt
;
// smHandle.c
// smHandle.c
void
smInitMsgHandle
(
SMgmtWrapper
*
pWrapper
);
SArray
*
smGetMsgHandles
(
);
int32_t
smProcessCreateReq
(
S
MgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
int32_t
smProcessCreateReq
(
S
SnodeMgmt
*
pMgmt
,
SNodeMsg
*
pMsg
);
int32_t
smProcessDropReq
(
S
MgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
int32_t
smProcessDropReq
(
S
SnodeMgmt
*
pMgmt
,
SNodeMsg
*
pMsg
);
int32_t
smProcessGetMon
SmInfoReq
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pReq
);
int32_t
smProcessGetMon
itorInfoReq
(
SSnodeMgmt
*
pMgmt
,
SNodeMsg
*
pReq
);
// smWorker.c
// smWorker.c
int32_t
smStartWorker
(
SSnodeMgmt
*
pMgmt
);
int32_t
smStartWorker
(
SSnodeMgmt
*
pMgmt
);
void
smStopWorker
(
SSnodeMgmt
*
pMgmt
);
void
smStopWorker
(
SSnodeMgmt
*
pMgmt
);
int32_t
smP
rocessMgmtMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
int32_t
smP
utNodeMsgToMgmtQueue
(
SSnodeMgmt
*
pMgmt
,
SNodeMsg
*
pMsg
);
int32_t
smP
rocessUniqueMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
int32_t
smP
utNodeMsgToUniqueQueue
(
SSnodeMgmt
*
pMgmt
,
SNodeMsg
*
pMsg
);
int32_t
smP
rocessSharedMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
int32_t
smP
utNodeMsgToSharedQueue
(
SSnodeMgmt
*
pMgmt
,
SNodeMsg
*
pMsg
);
int32_t
smP
rocessExecMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
int32_t
smP
utNodeMsgToExecQueue
(
SSnodeMgmt
*
pMgmt
,
SNodeMsg
*
pMsg
);
int32_t
smP
rocessMonitorMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
int32_t
smP
utNodeMsgToMonitorQueue
(
SSnodeMgmt
*
pMgmt
,
SNodeMsg
*
pMsg
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
source/dnode/mgmt/mgmt_snode/src/smHandle.c
浏览文件 @
628a5bba
...
@@ -16,12 +16,12 @@
...
@@ -16,12 +16,12 @@
#define _DEFAULT_SOURCE
#define _DEFAULT_SOURCE
#include "smInt.h"
#include "smInt.h"
void
smGetMonitorInfo
(
SMgmtWrapper
*
pWrapper
,
SMonSmInfo
*
smInfo
)
{}
static
void
smGetMonitorInfo
(
SSnodeMgmt
*
pMgmt
,
SMonSmInfo
*
smInfo
)
{}
int32_t
smProcessGetMon
SmInfoReq
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pReq
)
{
int32_t
smProcessGetMon
itorInfoReq
(
SSnodeMgmt
*
pMgmt
,
SNodeMsg
*
pReq
)
{
SMonSmInfo
smInfo
=
{
0
};
SMonSmInfo
smInfo
=
{
0
};
smGetMonitorInfo
(
p
Wrapper
,
&
smInfo
);
smGetMonitorInfo
(
p
Mgmt
,
&
smInfo
);
dmGet
MonitorSys
Info
(
&
smInfo
.
sys
);
dmGet
System
Info
(
&
smInfo
.
sys
);
monGetLogs
(
&
smInfo
.
log
);
monGetLogs
(
&
smInfo
.
log
);
int32_t
rspLen
=
tSerializeSMonSmInfo
(
NULL
,
0
,
&
smInfo
);
int32_t
rspLen
=
tSerializeSMonSmInfo
(
NULL
,
0
,
&
smInfo
);
...
@@ -43,8 +43,7 @@ int32_t smProcessGetMonSmInfoReq(SMgmtWrapper *pWrapper, SNodeMsg *pReq) {
...
@@ -43,8 +43,7 @@ int32_t smProcessGetMonSmInfoReq(SMgmtWrapper *pWrapper, SNodeMsg *pReq) {
return
0
;
return
0
;
}
}
int32_t
smProcessCreateReq
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
)
{
int32_t
smProcessCreateReq
(
SSnodeMgmt
*
pMgmt
,
SNodeMsg
*
pMsg
)
{
SDnode
*
pDnode
=
pWrapper
->
pDnode
;
SRpcMsg
*
pReq
=
&
pMsg
->
rpcMsg
;
SRpcMsg
*
pReq
=
&
pMsg
->
rpcMsg
;
SDCreateSnodeReq
createReq
=
{
0
};
SDCreateSnodeReq
createReq
=
{
0
};
...
@@ -53,14 +52,14 @@ int32_t smProcessCreateReq(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
...
@@ -53,14 +52,14 @@ int32_t smProcessCreateReq(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
return
-
1
;
return
-
1
;
}
}
if
(
createReq
.
dnodeId
!=
p
Dnode
->
data
.
dnodeId
)
{
if
(
createReq
.
dnodeId
!=
p
Mgmt
->
dnodeId
)
{
terrno
=
TSDB_CODE_INVALID_OPTION
;
terrno
=
TSDB_CODE_INVALID_OPTION
;
dError
(
"failed to create snode since %s"
,
terrstr
());
dError
(
"failed to create snode since %s"
,
terrstr
());
return
-
1
;
return
-
1
;
}
}
bool
deployed
=
true
;
bool
deployed
=
true
;
if
(
dmWriteFile
(
p
Wrapper
,
deployed
)
!=
0
)
{
if
(
dmWriteFile
(
p
Mgmt
->
path
,
pMgmt
->
name
,
deployed
)
!=
0
)
{
dError
(
"failed to write snode file since %s"
,
terrstr
());
dError
(
"failed to write snode file since %s"
,
terrstr
());
return
-
1
;
return
-
1
;
}
}
...
@@ -68,8 +67,7 @@ int32_t smProcessCreateReq(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
...
@@ -68,8 +67,7 @@ int32_t smProcessCreateReq(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
return
0
;
return
0
;
}
}
int32_t
smProcessDropReq
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
)
{
int32_t
smProcessDropReq
(
SSnodeMgmt
*
pMgmt
,
SNodeMsg
*
pMsg
)
{
SDnode
*
pDnode
=
pWrapper
->
pDnode
;
SRpcMsg
*
pReq
=
&
pMsg
->
rpcMsg
;
SRpcMsg
*
pReq
=
&
pMsg
->
rpcMsg
;
SDDropSnodeReq
dropReq
=
{
0
};
SDDropSnodeReq
dropReq
=
{
0
};
...
@@ -78,14 +76,14 @@ int32_t smProcessDropReq(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
...
@@ -78,14 +76,14 @@ int32_t smProcessDropReq(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
return
-
1
;
return
-
1
;
}
}
if
(
dropReq
.
dnodeId
!=
p
Dnode
->
data
.
dnodeId
)
{
if
(
dropReq
.
dnodeId
!=
p
Mgmt
->
dnodeId
)
{
terrno
=
TSDB_CODE_INVALID_OPTION
;
terrno
=
TSDB_CODE_INVALID_OPTION
;
dError
(
"failed to drop snode since %s"
,
terrstr
());
dError
(
"failed to drop snode since %s"
,
terrstr
());
return
-
1
;
return
-
1
;
}
}
bool
deployed
=
false
;
bool
deployed
=
false
;
if
(
dmWriteFile
(
p
Wrapper
,
deployed
)
!=
0
)
{
if
(
dmWriteFile
(
p
Mgmt
->
path
,
pMgmt
->
name
,
deployed
)
!=
0
)
{
dError
(
"failed to write snode file since %s"
,
terrstr
());
dError
(
"failed to write snode file since %s"
,
terrstr
());
return
-
1
;
return
-
1
;
}
}
...
@@ -93,10 +91,23 @@ int32_t smProcessDropReq(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
...
@@ -93,10 +91,23 @@ int32_t smProcessDropReq(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
return
0
;
return
0
;
}
}
void
smInitMsgHandle
(
SMgmtWrapper
*
pWrapper
)
{
SArray
*
smGetMsgHandles
()
{
dmSetMsgHandle
(
pWrapper
,
TDMT_MON_SM_INFO
,
smProcessMonitorMsg
,
0
);
int32_t
code
=
-
1
;
SArray
*
pArray
=
taosArrayInit
(
4
,
sizeof
(
SMgmtHandle
));
if
(
pArray
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MON_SM_INFO
,
smPutNodeMsgToMonitorQueue
,
0
)
==
NULL
)
goto
_OVER
;
// Requests handled by SNODE
// Requests handled by SNODE
dmSetMsgHandle
(
pWrapper
,
TDMT_SND_TASK_DEPLOY
,
smProcessMgmtMsg
,
0
);
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_SND_TASK_DEPLOY
,
smPutNodeMsgToMgmtQueue
,
0
)
==
NULL
)
goto
_OVER
;
dmSetMsgHandle
(
pWrapper
,
TDMT_SND_TASK_EXEC
,
smProcessExecMsg
,
0
);
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_SND_TASK_EXEC
,
smPutNodeMsgToExecQueue
,
0
)
==
NULL
)
goto
_OVER
;
code
=
0
;
_OVER:
if
(
code
!=
0
)
{
taosArrayDestroy
(
pArray
);
return
NULL
;
}
else
{
return
pArray
;
}
}
}
source/dnode/mgmt/mgmt_snode/src/smInt.c
浏览文件 @
628a5bba
...
@@ -17,34 +17,25 @@
...
@@ -17,34 +17,25 @@
#include "smInt.h"
#include "smInt.h"
#include "libs/function/function.h"
#include "libs/function/function.h"
static
int32_t
smRequire
(
SMgmtWrapper
*
pWrapper
,
bool
*
required
)
{
return
dmReadFile
(
pWrapper
,
required
);
}
static
int32_t
smRequire
(
const
SMgmtInputOpt
*
pInput
,
bool
*
required
)
{
return
dmReadFile
(
pInput
->
path
,
pInput
->
name
,
required
);
static
void
smInitOption
(
SSnodeMgmt
*
pMgmt
,
SSnodeOpt
*
pOption
)
{
SMsgCb
msgCb
=
pMgmt
->
pDnode
->
data
.
msgCb
;
msgCb
.
pWrapper
=
pMgmt
->
pWrapper
;
pOption
->
msgCb
=
msgCb
;
}
}
static
void
smClose
(
SMgmtWrapper
*
pWrapper
)
{
static
void
smInitOption
(
SSnodeMgmt
*
pMgmt
,
SSnodeOpt
*
pOption
)
{
pOption
->
msgCb
=
pMgmt
->
msgCb
;
}
SSnodeMgmt
*
pMgmt
=
pWrapper
->
pMgmt
;
if
(
pMgmt
==
NULL
)
return
;
static
void
smClose
(
SSnodeMgmt
*
pMgmt
)
{
dInfo
(
"snode-mgmt start to cleanup"
);
dInfo
(
"snode-mgmt start to cleanup"
);
udfcClose
();
if
(
pMgmt
->
pSnode
!=
NULL
)
{
if
(
pMgmt
->
pSnode
!=
NULL
)
{
smStopWorker
(
pMgmt
);
smStopWorker
(
pMgmt
);
sndClose
(
pMgmt
->
pSnode
);
sndClose
(
pMgmt
->
pSnode
);
pMgmt
->
pSnode
=
NULL
;
pMgmt
->
pSnode
=
NULL
;
}
}
pWrapper
->
pMgmt
=
NULL
;
taosMemoryFree
(
pMgmt
);
taosMemoryFree
(
pMgmt
);
dInfo
(
"snode-mgmt is cleaned up"
);
dInfo
(
"snode-mgmt is cleaned up"
);
}
}
int32_t
smOpen
(
SMgmtWrapper
*
pWrapper
)
{
int32_t
smOpen
(
const
SMgmtInputOpt
*
pInput
,
SMgmtOutputOpt
*
pOutput
)
{
dInfo
(
"snode-mgmt start to init"
);
dInfo
(
"snode-mgmt start to init"
);
SSnodeMgmt
*
pMgmt
=
taosMemoryCalloc
(
1
,
sizeof
(
SSnodeMgmt
));
SSnodeMgmt
*
pMgmt
=
taosMemoryCalloc
(
1
,
sizeof
(
SSnodeMgmt
));
if
(
pMgmt
==
NULL
)
{
if
(
pMgmt
==
NULL
)
{
...
@@ -52,42 +43,47 @@ int32_t smOpen(SMgmtWrapper *pWrapper) {
...
@@ -52,42 +43,47 @@ int32_t smOpen(SMgmtWrapper *pWrapper) {
return
-
1
;
return
-
1
;
}
}
pMgmt
->
path
=
pWrapper
->
path
;
pMgmt
->
path
=
pInput
->
path
;
pMgmt
->
pDnode
=
pWrapper
->
pDnode
;
pMgmt
->
name
=
pInput
->
name
;
pMgmt
->
pWrapper
=
pWrapper
;
pMgmt
->
dnodeId
=
pInput
->
dnodeId
;
pWrapper
->
pMgmt
=
pMgmt
;
pMgmt
->
msgCb
=
pInput
->
msgCb
;
pMgmt
->
msgCb
.
pMgmt
=
pMgmt
;
SSnodeOpt
option
=
{
0
};
SSnodeOpt
option
=
{
0
};
smInitOption
(
pMgmt
,
&
option
);
smInitOption
(
pMgmt
,
&
option
);
pMgmt
->
pSnode
=
sndOpen
(
pMgmt
->
path
,
&
option
);
pMgmt
->
pSnode
=
sndOpen
(
pMgmt
->
path
,
&
option
);
if
(
pMgmt
->
pSnode
==
NULL
)
{
if
(
pMgmt
->
pSnode
==
NULL
)
{
dError
(
"failed to open snode since %s"
,
terrstr
());
dError
(
"failed to open snode since %s"
,
terrstr
());
smClose
(
pMgmt
);
return
-
1
;
return
-
1
;
}
}
dmReportStartup
(
pWrapper
->
pDnode
,
"snode-impl"
,
"initialized"
);
tmsgReportStartup
(
"snode-impl"
,
"initialized"
);
if
(
smStartWorker
(
pMgmt
)
!=
0
)
{
if
(
smStartWorker
(
pMgmt
)
!=
0
)
{
dError
(
"failed to start snode worker since %s"
,
terrstr
());
dError
(
"failed to start snode worker since %s"
,
terrstr
());
smClose
(
pMgmt
);
return
-
1
;
return
-
1
;
}
}
dmReportStartup
(
pWrapper
->
pDnode
,
"snode-worker"
,
"initialized"
);
tmsgReportStartup
(
"snode-worker"
,
"initialized"
);
if
(
udfcOpen
()
!=
0
)
{
if
(
udfcOpen
()
!=
0
)
{
dError
(
"failed to open udfc in snode"
);
dError
(
"failed to open udfc in snode"
);
smClose
(
pMgmt
);
return
-
1
;
}
}
pOutput
->
pMgmt
=
pMgmt
;
return
0
;
return
0
;
}
}
void
smInitWrapper
(
SMgmtWrapper
*
pWrapper
)
{
SMgmtFunc
smGetMgmtFunc
()
{
SMgmtFp
mgmtFp
=
{
0
};
SMgmtFunc
mgmtFunc
=
{
0
};
mgmtFp
.
openFp
=
smOpen
;
mgmtFunc
.
openFp
=
smOpen
;
mgmtFp
.
closeFp
=
smClose
;
mgmtFunc
.
closeFp
=
(
NodeCloseFp
)
smClose
;
mgmtFp
.
createFp
=
smProcessCreateReq
;
mgmtFunc
.
createFp
=
(
NodeCreateFp
)
smProcessCreateReq
;
mgmtFp
.
dropFp
=
smProcessDropReq
;
mgmtFunc
.
dropFp
=
(
NodeDropFp
)
smProcessDropReq
;
mgmtFp
.
requiredFp
=
smRequire
;
mgmtFunc
.
requiredFp
=
smRequire
;
mgmtFunc
.
getHandlesFp
=
smGetMsgHandles
;
smInitMsgHandle
(
pWrapper
);
return
mgmtFunc
;
pWrapper
->
name
=
"snode"
;
pWrapper
->
fp
=
mgmtFp
;
}
}
source/dnode/mgmt/mgmt_snode/src/smWorker.c
浏览文件 @
628a5bba
...
@@ -36,7 +36,7 @@ static void smProcessMonitorQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
...
@@ -36,7 +36,7 @@ static void smProcessMonitorQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
if
(
pMsg
->
rpcMsg
.
msgType
==
TDMT_MON_SM_INFO
)
{
if
(
pMsg
->
rpcMsg
.
msgType
==
TDMT_MON_SM_INFO
)
{
code
=
smProcessGetMon
SmInfoReq
(
pMgmt
->
pWrapper
,
pMsg
);
code
=
smProcessGetMon
itorInfoReq
(
pMgmt
,
pMsg
);
}
else
{
}
else
{
terrno
=
TSDB_CODE_MSG_NOT_PROCESSED
;
terrno
=
TSDB_CODE_MSG_NOT_PROCESSED
;
}
}
...
@@ -163,8 +163,7 @@ static FORCE_INLINE int32_t smGetSWTypeFromMsg(SRpcMsg *pMsg) {
...
@@ -163,8 +163,7 @@ static FORCE_INLINE int32_t smGetSWTypeFromMsg(SRpcMsg *pMsg) {
return
0
;
return
0
;
}
}
int32_t
smProcessMgmtMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
)
{
int32_t
smPutNodeMsgToMgmtQueue
(
SSnodeMgmt
*
pMgmt
,
SNodeMsg
*
pMsg
)
{
SSnodeMgmt
*
pMgmt
=
pWrapper
->
pMgmt
;
SMultiWorker
*
pWorker
=
taosArrayGetP
(
pMgmt
->
uniqueWorkers
,
0
);
SMultiWorker
*
pWorker
=
taosArrayGetP
(
pMgmt
->
uniqueWorkers
,
0
);
if
(
pWorker
==
NULL
)
{
if
(
pWorker
==
NULL
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
terrno
=
TSDB_CODE_INVALID_MSG
;
...
@@ -176,8 +175,7 @@ int32_t smProcessMgmtMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
...
@@ -176,8 +175,7 @@ int32_t smProcessMgmtMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
return
0
;
return
0
;
}
}
int32_t
smProcessMonitorMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
)
{
int32_t
smPutNodeMsgToMonitorQueue
(
SSnodeMgmt
*
pMgmt
,
SNodeMsg
*
pMsg
)
{
SSnodeMgmt
*
pMgmt
=
pWrapper
->
pMgmt
;
SSingleWorker
*
pWorker
=
&
pMgmt
->
monitorWorker
;
SSingleWorker
*
pWorker
=
&
pMgmt
->
monitorWorker
;
dTrace
(
"msg:%p, put into worker:%s"
,
pMsg
,
pWorker
->
name
);
dTrace
(
"msg:%p, put into worker:%s"
,
pMsg
,
pWorker
->
name
);
...
@@ -185,8 +183,7 @@ int32_t smProcessMonitorMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
...
@@ -185,8 +183,7 @@ int32_t smProcessMonitorMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
return
0
;
return
0
;
}
}
int32_t
smProcessUniqueMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
)
{
int32_t
smPutNodeMsgToUniqueQueue
(
SSnodeMgmt
*
pMgmt
,
SNodeMsg
*
pMsg
)
{
SSnodeMgmt
*
pMgmt
=
pWrapper
->
pMgmt
;
int32_t
index
=
smGetSWIdFromMsg
(
&
pMsg
->
rpcMsg
);
int32_t
index
=
smGetSWIdFromMsg
(
&
pMsg
->
rpcMsg
);
SMultiWorker
*
pWorker
=
taosArrayGetP
(
pMgmt
->
uniqueWorkers
,
index
);
SMultiWorker
*
pWorker
=
taosArrayGetP
(
pMgmt
->
uniqueWorkers
,
index
);
if
(
pWorker
==
NULL
)
{
if
(
pWorker
==
NULL
)
{
...
@@ -199,8 +196,7 @@ int32_t smProcessUniqueMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
...
@@ -199,8 +196,7 @@ int32_t smProcessUniqueMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
return
0
;
return
0
;
}
}
int32_t
smProcessSharedMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
)
{
int32_t
smPutNodeMsgToSharedQueue
(
SSnodeMgmt
*
pMgmt
,
SNodeMsg
*
pMsg
)
{
SSnodeMgmt
*
pMgmt
=
pWrapper
->
pMgmt
;
SSingleWorker
*
pWorker
=
&
pMgmt
->
sharedWorker
;
SSingleWorker
*
pWorker
=
&
pMgmt
->
sharedWorker
;
dTrace
(
"msg:%p, put into worker:%s"
,
pMsg
,
pWorker
->
name
);
dTrace
(
"msg:%p, put into worker:%s"
,
pMsg
,
pWorker
->
name
);
...
@@ -208,11 +204,11 @@ int32_t smProcessSharedMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
...
@@ -208,11 +204,11 @@ int32_t smProcessSharedMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
return
0
;
return
0
;
}
}
int32_t
smP
rocessExecMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
)
{
int32_t
smP
utNodeMsgToExecQueue
(
SSnodeMgmt
*
pMgmt
,
SNodeMsg
*
pMsg
)
{
int32_t
workerType
=
smGetSWTypeFromMsg
(
&
pMsg
->
rpcMsg
);
int32_t
workerType
=
smGetSWTypeFromMsg
(
&
pMsg
->
rpcMsg
);
if
(
workerType
==
SND_WORKER_TYPE__SHARED
)
{
if
(
workerType
==
SND_WORKER_TYPE__SHARED
)
{
return
smP
rocessSharedMsg
(
pWrapper
,
pMsg
);
return
smP
utNodeMsgToSharedQueue
(
pMgmt
,
pMsg
);
}
else
{
}
else
{
return
smP
rocessUniqueMsg
(
pWrapper
,
pMsg
);
return
smP
utNodeMsgToUniqueQueue
(
pMgmt
,
pMsg
);
}
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录