Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
ca3a0b3e
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1187
Star
22018
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看板
未验证
提交
ca3a0b3e
编写于
4月 05, 2022
作者:
S
Shengliang Guan
提交者:
GitHub
4月 05, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #11243 from taosdata/feature/shm
she
上级
1f3d687a
43e84cbd
变更
23
隐藏空白更改
内联
并排
Showing
23 changed file
with
243 addition
and
321 deletion
+243
-321
source/dnode/mgmt/bm/bmHandle.c
source/dnode/mgmt/bm/bmHandle.c
+1
-1
source/dnode/mgmt/bm/bmInt.c
source/dnode/mgmt/bm/bmInt.c
+1
-1
source/dnode/mgmt/dm/dmHandle.c
source/dnode/mgmt/dm/dmHandle.c
+14
-30
source/dnode/mgmt/dm/dmMonitor.c
source/dnode/mgmt/dm/dmMonitor.c
+7
-7
source/dnode/mgmt/dm/dmWorker.c
source/dnode/mgmt/dm/dmWorker.c
+4
-4
source/dnode/mgmt/exe/dndMain.c
source/dnode/mgmt/exe/dndMain.c
+1
-1
source/dnode/mgmt/inc/bmInt.h
source/dnode/mgmt/inc/bmInt.h
+3
-3
source/dnode/mgmt/inc/dmInt.h
source/dnode/mgmt/inc/dmInt.h
+7
-10
source/dnode/mgmt/inc/dnd.h
source/dnode/mgmt/inc/dnd.h
+0
-230
source/dnode/mgmt/inc/dndInt.h
source/dnode/mgmt/inc/dndInt.h
+169
-14
source/dnode/mgmt/inc/mmInt.h
source/dnode/mgmt/inc/mmInt.h
+3
-3
source/dnode/mgmt/inc/qmInt.h
source/dnode/mgmt/inc/qmInt.h
+3
-3
source/dnode/mgmt/inc/smInt.h
source/dnode/mgmt/inc/smInt.h
+3
-3
source/dnode/mgmt/inc/vmInt.h
source/dnode/mgmt/inc/vmInt.h
+3
-3
source/dnode/mgmt/main/dndInt.c
source/dnode/mgmt/main/dndInt.c
+16
-0
source/dnode/mgmt/mm/mmHandle.c
source/dnode/mgmt/mm/mmHandle.c
+1
-1
source/dnode/mgmt/mm/mmInt.c
source/dnode/mgmt/mm/mmInt.c
+1
-1
source/dnode/mgmt/qm/qmHandle.c
source/dnode/mgmt/qm/qmHandle.c
+1
-1
source/dnode/mgmt/qm/qmInt.c
source/dnode/mgmt/qm/qmInt.c
+1
-1
source/dnode/mgmt/sm/smHandle.c
source/dnode/mgmt/sm/smHandle.c
+1
-1
source/dnode/mgmt/sm/smInt.c
source/dnode/mgmt/sm/smInt.c
+1
-1
source/dnode/mgmt/vm/vmHandle.c
source/dnode/mgmt/vm/vmHandle.c
+1
-1
source/dnode/mgmt/vm/vmInt.c
source/dnode/mgmt/vm/vmInt.c
+1
-1
未找到文件。
source/dnode/mgmt/bm/bmHandle.c
浏览文件 @
ca3a0b3e
...
...
@@ -54,4 +54,4 @@ int32_t bmProcessDropReq(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
}
}
void
bmInitMsgHandle
s
(
SMgmtWrapper
*
pWrapper
)
{}
void
bmInitMsgHandle
(
SMgmtWrapper
*
pWrapper
)
{}
source/dnode/mgmt/bm/bmInt.c
浏览文件 @
ca3a0b3e
...
...
@@ -117,7 +117,7 @@ void bmSetMgmtFp(SMgmtWrapper *pWrapper) {
mgmtFp
.
dropMsgFp
=
bmProcessDropReq
;
mgmtFp
.
requiredFp
=
bmRequire
;
bmInitMsgHandle
s
(
pWrapper
);
bmInitMsgHandle
(
pWrapper
);
pWrapper
->
name
=
"bnode"
;
pWrapper
->
fp
=
mgmtFp
;
}
source/dnode/mgmt/dm/dmHandle.c
浏览文件 @
ca3a0b3e
...
...
@@ -171,7 +171,7 @@ static int32_t dmProcessDropNodeMsg(SDnode *pDnode, ENodeType ntype, SNodeMsg *p
return
code
;
}
int32_t
dmProcessCDnode
Msg
(
SDnode
*
pDnode
,
SNodeMsg
*
pMsg
)
{
int32_t
dmProcessCDnode
Req
(
SDnode
*
pDnode
,
SNodeMsg
*
pMsg
)
{
switch
(
pMsg
->
rpcMsg
.
msgType
)
{
case
TDMT_DND_CREATE_MNODE
:
return
dmProcessCreateNodeMsg
(
pDnode
,
MNODE
,
pMsg
);
...
...
@@ -195,37 +195,21 @@ int32_t dmProcessCDnodeMsg(SDnode *pDnode, SNodeMsg *pMsg) {
}
}
static
void
dndGetStartup
(
SDnode
*
pDnode
,
SStartupReq
*
pStartup
)
{
memcpy
(
pStartup
,
&
pDnode
->
startup
,
sizeof
(
SStartupReq
));
pStartup
->
finished
=
(
dndGetStatus
(
pDnode
)
==
DND_STAT_RUNNING
);
}
void
dndProcessStartupReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
)
{
dDebug
(
"startup req is received"
);
SStartupReq
*
pStartup
=
rpcMallocCont
(
sizeof
(
SStartupReq
));
dndGetStartup
(
pDnode
,
pStartup
);
dDebug
(
"startup req is sent, step:%s desc:%s finished:%d"
,
pStartup
->
name
,
pStartup
->
desc
,
pStartup
->
finished
);
SRpcMsg
rpcRsp
=
{
.
handle
=
pReq
->
handle
,
.
pCont
=
pStartup
,
.
contLen
=
sizeof
(
SStartupReq
),
.
ahandle
=
pReq
->
ahandle
};
rpcSendResponse
(
&
rpcRsp
);
}
void
dmInitMsgHandle
(
SMgmtWrapper
*
pWrapper
)
{
// Requests handled by DNODE
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_CREATE_MNODE
,
dmP
utMsgToMgmtWorker
,
DEFAULT_HANDLE
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_DROP_MNODE
,
dmP
utMsgToMgmtWorker
,
DEFAULT_HANDLE
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_CREATE_QNODE
,
dmP
utMsgToMgmtWorker
,
DEFAULT_HANDLE
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_DROP_QNODE
,
dmP
utMsgToMgmtWorker
,
DEFAULT_HANDLE
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_CREATE_SNODE
,
dmP
utMsgToMgmtWorker
,
DEFAULT_HANDLE
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_DROP_SNODE
,
dmP
utMsgToMgmtWorker
,
DEFAULT_HANDLE
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_CREATE_BNODE
,
dmP
utMsgToMgmtWorker
,
DEFAULT_HANDLE
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_DROP_BNODE
,
dmP
utMsgToMgmtWorker
,
DEFAULT_HANDLE
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_CONFIG_DNODE
,
dmP
utMsgToMgmtWorker
,
DEFAULT_HANDLE
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_NETWORK_TEST
,
dmP
utMsgToMgmtWorker
,
DEFAULT_HANDLE
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_CREATE_MNODE
,
dmP
rocessMgmtMsg
,
DEFAULT_HANDLE
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_DROP_MNODE
,
dmP
rocessMgmtMsg
,
DEFAULT_HANDLE
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_CREATE_QNODE
,
dmP
rocessMgmtMsg
,
DEFAULT_HANDLE
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_DROP_QNODE
,
dmP
rocessMgmtMsg
,
DEFAULT_HANDLE
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_CREATE_SNODE
,
dmP
rocessMgmtMsg
,
DEFAULT_HANDLE
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_DROP_SNODE
,
dmP
rocessMgmtMsg
,
DEFAULT_HANDLE
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_CREATE_BNODE
,
dmP
rocessMgmtMsg
,
DEFAULT_HANDLE
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_DROP_BNODE
,
dmP
rocessMgmtMsg
,
DEFAULT_HANDLE
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_CONFIG_DNODE
,
dmP
rocessMgmtMsg
,
DEFAULT_HANDLE
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_NETWORK_TEST
,
dmP
rocessMgmtMsg
,
DEFAULT_HANDLE
);
// Requests handled by MNODE
dndSetMsgHandle
(
pWrapper
,
TDMT_MND_STATUS_RSP
,
dmP
utMsgToStatusWorker
,
DEFAULT_HANDLE
);
dndSetMsgHandle
(
pWrapper
,
TDMT_MND_GRANT_RSP
,
dmP
utMsgToMgmtWorker
,
DEFAULT_HANDLE
);
dndSetMsgHandle
(
pWrapper
,
TDMT_MND_AUTH_RSP
,
dmP
utMsgToMgmtWorker
,
DEFAULT_HANDLE
);
dndSetMsgHandle
(
pWrapper
,
TDMT_MND_STATUS_RSP
,
dmP
rocessStatusMsg
,
DEFAULT_HANDLE
);
dndSetMsgHandle
(
pWrapper
,
TDMT_MND_GRANT_RSP
,
dmP
rocessMgmtMsg
,
DEFAULT_HANDLE
);
dndSetMsgHandle
(
pWrapper
,
TDMT_MND_AUTH_RSP
,
dmP
rocessMgmtMsg
,
DEFAULT_HANDLE
);
}
source/dnode/mgmt/
main/dnd
Monitor.c
→
source/dnode/mgmt/
dm/dm
Monitor.c
浏览文件 @
ca3a0b3e
...
...
@@ -16,7 +16,7 @@
#define _DEFAULT_SOURCE
#include "dndInt.h"
static
int32_t
d
nd
GetMonitorDiskInfo
(
SDnode
*
pDnode
,
SMonDiskInfo
*
pInfo
)
{
static
int32_t
d
m
GetMonitorDiskInfo
(
SDnode
*
pDnode
,
SMonDiskInfo
*
pInfo
)
{
tstrncpy
(
pInfo
->
logdir
.
name
,
tsLogDir
,
sizeof
(
pInfo
->
logdir
.
name
));
pInfo
->
logdir
.
size
=
tsLogSpace
.
size
;
tstrncpy
(
pInfo
->
tempdir
.
name
,
tsTempDir
,
sizeof
(
pInfo
->
tempdir
.
name
));
...
...
@@ -30,14 +30,14 @@ static int32_t dndGetMonitorDiskInfo(SDnode *pDnode, SMonDiskInfo *pInfo) {
return
0
;
}
static
void
d
nd
GetMonitorBasicInfo
(
SDnode
*
pDnode
,
SMonBasicInfo
*
pInfo
)
{
static
void
d
m
GetMonitorBasicInfo
(
SDnode
*
pDnode
,
SMonBasicInfo
*
pInfo
)
{
pInfo
->
protocol
=
1
;
pInfo
->
dnode_id
=
pDnode
->
dnodeId
;
pInfo
->
cluster_id
=
pDnode
->
clusterId
;
tstrncpy
(
pInfo
->
dnode_ep
,
tsLocalEp
,
TSDB_EP_LEN
);
}
static
void
d
nd
GetMonitorDnodeInfo
(
SDnode
*
pDnode
,
SMonDnodeInfo
*
pInfo
)
{
static
void
d
m
GetMonitorDnodeInfo
(
SDnode
*
pDnode
,
SMonDnodeInfo
*
pInfo
)
{
pInfo
->
uptime
=
(
taosGetTimestampMs
()
-
pDnode
->
rebootTime
)
/
(
86400000
.
0
f
);
taosGetCpuUsage
(
&
pInfo
->
cpu_engine
,
&
pInfo
->
cpu_system
);
taosGetCpuCores
(
&
pInfo
->
cpu_cores
);
...
...
@@ -63,7 +63,7 @@ static void dndGetMonitorDnodeInfo(SDnode *pDnode, SMonDnodeInfo *pInfo) {
}
}
void
d
nd
SendMonitorReport
(
SDnode
*
pDnode
)
{
void
d
m
SendMonitorReport
(
SDnode
*
pDnode
)
{
if
(
!
tsEnableMonitor
||
tsMonitorFqdn
[
0
]
==
0
||
tsMonitorPort
==
0
)
return
;
dTrace
(
"send monitor report to %s:%u"
,
tsMonitorFqdn
,
tsMonitorPort
);
...
...
@@ -71,7 +71,7 @@ void dndSendMonitorReport(SDnode *pDnode) {
if
(
pMonitor
==
NULL
)
return
;
SMonBasicInfo
basicInfo
=
{
0
};
d
nd
GetMonitorBasicInfo
(
pDnode
,
&
basicInfo
);
d
m
GetMonitorBasicInfo
(
pDnode
,
&
basicInfo
);
monSetBasicInfo
(
pMonitor
,
&
basicInfo
);
SMonClusterInfo
clusterInfo
=
{
0
};
...
...
@@ -89,11 +89,11 @@ void dndSendMonitorReport(SDnode *pDnode) {
}
SMonDnodeInfo
dnodeInfo
=
{
0
};
d
nd
GetMonitorDnodeInfo
(
pDnode
,
&
dnodeInfo
);
d
m
GetMonitorDnodeInfo
(
pDnode
,
&
dnodeInfo
);
monSetDnodeInfo
(
pMonitor
,
&
dnodeInfo
);
SMonDiskInfo
diskInfo
=
{
0
};
if
(
d
nd
GetMonitorDiskInfo
(
pDnode
,
&
diskInfo
)
==
0
)
{
if
(
d
m
GetMonitorDiskInfo
(
pDnode
,
&
diskInfo
)
==
0
)
{
monSetDiskInfo
(
pMonitor
,
&
diskInfo
);
}
...
...
source/dnode/mgmt/dm/dmWorker.c
浏览文件 @
ca3a0b3e
...
...
@@ -40,7 +40,7 @@ static void *dmThreadRoutine(void *param) {
float
monitorInterval
=
(
curTime
-
lastMonitorTime
)
/
1000
.
0
f
;
if
(
monitorInterval
>=
tsMonitorInterval
)
{
d
nd
SendMonitorReport
(
pDnode
);
d
m
SendMonitorReport
(
pDnode
);
lastMonitorTime
=
curTime
;
}
}
...
...
@@ -79,7 +79,7 @@ static void dmProcessQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
code
=
dmProcessGrantRsp
(
pMgmt
,
pMsg
);
break
;
default:
code
=
dmProcessCDnode
Msg
(
pMgmt
->
pDnode
,
pMsg
);
code
=
dmProcessCDnode
Req
(
pMgmt
->
pDnode
,
pMsg
);
break
;
}
...
...
@@ -122,7 +122,7 @@ void dmStopWorker(SDnodeMgmt *pMgmt) {
dDebug
(
"dnode workers are closed"
);
}
int32_t
dmP
utMsgToMgmtWorker
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
)
{
int32_t
dmP
rocessMgmtMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
)
{
SDnodeMgmt
*
pMgmt
=
pWrapper
->
pMgmt
;
SSingleWorker
*
pWorker
=
&
pMgmt
->
mgmtWorker
;
...
...
@@ -131,7 +131,7 @@ int32_t dmPutMsgToMgmtWorker(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
return
0
;
}
int32_t
dmP
utMsgToStatusWorker
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
)
{
int32_t
dmP
rocessStatusMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
)
{
SDnodeMgmt
*
pMgmt
=
pWrapper
->
pMgmt
;
SSingleWorker
*
pWorker
=
&
pMgmt
->
statusWorker
;
...
...
source/dnode/mgmt/exe/dndMain.c
浏览文件 @
ca3a0b3e
...
...
@@ -14,7 +14,7 @@
*/
#define _DEFAULT_SOURCE
#include "dnd.h"
#include "dnd
Int
.h"
#include "tconfig.h"
static
struct
{
...
...
source/dnode/mgmt/inc/bmInt.h
浏览文件 @
ca3a0b3e
...
...
@@ -16,7 +16,7 @@
#ifndef _TD_DND_BNODE_INT_H_
#define _TD_DND_BNODE_INT_H_
#include "dnd.h"
#include "dnd
Int
.h"
#include "bnode.h"
#ifdef __cplusplus
...
...
@@ -35,8 +35,8 @@ typedef struct SBnodeMgmt {
int32_t
bmOpen
(
SMgmtWrapper
*
pWrapper
);
int32_t
bmDrop
(
SMgmtWrapper
*
pWrapper
);
// bm
Msg
.c
void
bmInitMsgHandle
s
(
SMgmtWrapper
*
pWrapper
);
// bm
Handle
.c
void
bmInitMsgHandle
(
SMgmtWrapper
*
pWrapper
);
int32_t
bmProcessCreateReq
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
int32_t
bmProcessDropReq
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
...
...
source/dnode/mgmt/inc/dmInt.h
浏览文件 @
ca3a0b3e
...
...
@@ -16,7 +16,7 @@
#ifndef _TD_DND_DNODE_INT_H_
#define _TD_DND_DNODE_INT_H_
#include "dnd.h"
#include "dnd
Int
.h"
#ifdef __cplusplus
extern
"C"
{
...
...
@@ -39,12 +39,6 @@ typedef struct SDnodeMgmt {
SMgmtWrapper
*
pWrapper
;
}
SDnodeMgmt
;
// dmInt.c
void
dmSetMgmtFp
(
SMgmtWrapper
*
pWrapper
);
void
dmGetMnodeEpSet
(
SDnodeMgmt
*
pMgmt
,
SEpSet
*
pEpSet
);
void
dmUpdateMnodeEpSet
(
SDnodeMgmt
*
pMgmt
,
SEpSet
*
pEpSet
);
void
dmSendRedirectRsp
(
SDnodeMgmt
*
pMgmt
,
const
SRpcMsg
*
pMsg
);
// dmFile.c
int32_t
dmReadFile
(
SDnodeMgmt
*
pMgmt
);
int32_t
dmWriteFile
(
SDnodeMgmt
*
pMgmt
);
...
...
@@ -57,14 +51,17 @@ int32_t dmProcessConfigReq(SDnodeMgmt *pMgmt, SNodeMsg *pMsg);
int32_t
dmProcessStatusRsp
(
SDnodeMgmt
*
pMgmt
,
SNodeMsg
*
pMsg
);
int32_t
dmProcessAuthRsp
(
SDnodeMgmt
*
pMgmt
,
SNodeMsg
*
pMsg
);
int32_t
dmProcessGrantRsp
(
SDnodeMgmt
*
pMgmt
,
SNodeMsg
*
pMsg
);
int32_t
dmProcessCDnodeMsg
(
SDnode
*
pDnode
,
SNodeMsg
*
pMsg
);
int32_t
dmProcessCDnodeReq
(
SDnode
*
pDnode
,
SNodeMsg
*
pMsg
);
// dmMonitor.c
void
dmSendMonitorReport
(
SDnode
*
pDnode
);
// dmWorker.c
int32_t
dmStartThread
(
SDnodeMgmt
*
pMgmt
);
int32_t
dmStartWorker
(
SDnodeMgmt
*
pMgmt
);
void
dmStopWorker
(
SDnodeMgmt
*
pMgmt
);
int32_t
dmP
utMsgToMgmtWorker
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
int32_t
dmP
utMsgToStatusWorker
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
int32_t
dmP
rocessMgmtMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
int32_t
dmP
rocessStatusMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
#ifdef __cplusplus
}
...
...
source/dnode/mgmt/inc/dnd.h
已删除
100644 → 0
浏览文件 @
1f3d687a
/*
* 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 _TD_DND_H_
#define _TD_DND_H_
#include "os.h"
#include "cJSON.h"
#include "tcache.h"
#include "tcrc32c.h"
#include "tdatablock.h"
#include "tglobal.h"
#include "thash.h"
#include "tlockfree.h"
#include "tlog.h"
#include "tmsg.h"
#include "tmsgcb.h"
#include "tprocess.h"
#include "tqueue.h"
#include "trpc.h"
#include "tthread.h"
#include "ttime.h"
#include "tworker.h"
#include "dnode.h"
#include "monitor.h"
#ifdef __cplusplus
extern
"C"
{
#endif
#define dFatal(...) \
{ \
if (dDebugFlag & DEBUG_FATAL) { \
taosPrintLog("DND FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); \
} \
}
#define dError(...) \
{ \
if (dDebugFlag & DEBUG_ERROR) { \
taosPrintLog("DND ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); \
} \
}
#define dWarn(...) \
{ \
if (dDebugFlag & DEBUG_WARN) { \
taosPrintLog("DND WARN ", DEBUG_WARN, 255, __VA_ARGS__); \
} \
}
#define dInfo(...) \
{ \
if (dDebugFlag & DEBUG_INFO) { \
taosPrintLog("DND ", DEBUG_INFO, 255, __VA_ARGS__); \
} \
}
#define dDebug(...) \
{ \
if (dDebugFlag & DEBUG_DEBUG) { \
taosPrintLog("DND ", DEBUG_DEBUG, dDebugFlag, __VA_ARGS__); \
} \
}
#define dTrace(...) \
{ \
if (dDebugFlag & DEBUG_TRACE) { \
taosPrintLog("DND ", DEBUG_TRACE, dDebugFlag, __VA_ARGS__); \
} \
}
typedef
enum
{
DNODE
,
VNODES
,
QNODE
,
SNODE
,
MNODE
,
BNODE
,
NODE_MAX
}
ENodeType
;
typedef
enum
{
DND_STAT_INIT
,
DND_STAT_RUNNING
,
DND_STAT_STOPPED
}
EDndStatus
;
typedef
enum
{
DND_ENV_INIT
,
DND_ENV_READY
,
DND_ENV_CLEANUP
}
EEnvStatus
;
typedef
enum
{
PROC_SINGLE
,
PROC_CHILD
,
PROC_PARENT
}
EProcType
;
typedef
struct
SMgmtFp
SMgmtFp
;
typedef
struct
SMgmtWrapper
SMgmtWrapper
;
typedef
struct
SMsgHandle
SMsgHandle
;
typedef
struct
SDnodeMgmt
SDnodeMgmt
;
typedef
struct
SVnodesMgmt
SVnodesMgmt
;
typedef
struct
SMnodeMgmt
SMnodeMgmt
;
typedef
struct
SQnodeMgmt
SQnodeMgmt
;
typedef
struct
SSnodeMgmt
SSnodeMgmt
;
typedef
struct
SBnodeMgmt
SBnodeMgmt
;
typedef
int32_t
(
*
NodeMsgFp
)(
SMgmtWrapper
*
pWrapper
,
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
);
typedef
struct
SMsgHandle
{
SMgmtWrapper
*
pQndWrapper
;
SMgmtWrapper
*
pMndWrapper
;
SMgmtWrapper
*
pWrapper
;
}
SMsgHandle
;
typedef
struct
SMgmtFp
{
OpenNodeFp
openFp
;
CloseNodeFp
closeFp
;
StartNodeFp
startFp
;
CreateNodeFp
createMsgFp
;
DropNodeFp
dropMsgFp
;
RequireNodeFp
requiredFp
;
}
SMgmtFp
;
typedef
struct
SMgmtWrapper
{
const
char
*
name
;
char
*
path
;
int32_t
refCount
;
SRWLatch
latch
;
ENodeType
ntype
;
bool
deployed
;
bool
required
;
EProcType
procType
;
int32_t
procId
;
SProcObj
*
pProc
;
SShm
shm
;
void
*
pMgmt
;
SDnode
*
pDnode
;
SMgmtFp
fp
;
int8_t
msgVgIds
[
TDMT_MAX
];
// Handle the case where the same message type is distributed to qnode or vnode
NodeMsgFp
msgFps
[
TDMT_MAX
];
}
SMgmtWrapper
;
typedef
struct
{
void
*
serverRpc
;
void
*
clientRpc
;
SMsgHandle
msgHandles
[
TDMT_MAX
];
}
STransMgmt
;
typedef
struct
SDnode
{
int64_t
clusterId
;
int32_t
dnodeId
;
int32_t
numOfSupportVnodes
;
int64_t
rebootTime
;
char
*
localEp
;
char
*
localFqdn
;
char
*
firstEp
;
char
*
secondEp
;
char
*
dataDir
;
SDiskCfg
*
disks
;
int32_t
numOfDisks
;
uint16_t
serverPort
;
bool
dropped
;
ENodeType
ntype
;
EDndStatus
status
;
EDndEvent
event
;
SStartupReq
startup
;
TdFilePtr
lockfile
;
STransMgmt
trans
;
SMgmtWrapper
wrappers
[
NODE_MAX
];
}
SDnode
;
// dndFile.h
int32_t
dndReadFile
(
SMgmtWrapper
*
pWrapper
,
bool
*
pDeployed
);
int32_t
dndWriteFile
(
SMgmtWrapper
*
pWrapper
,
bool
deployed
);
// dndInt.h
EDndStatus
dndGetStatus
(
SDnode
*
pDnode
);
void
dndSetStatus
(
SDnode
*
pDnode
,
EDndStatus
stat
);
void
dndSetMsgHandle
(
SMgmtWrapper
*
pWrapper
,
tmsg_t
msgType
,
NodeMsgFp
nodeMsgFp
,
int8_t
vgId
);
SMgmtWrapper
*
dndAcquireWrapper
(
SDnode
*
pDnode
,
ENodeType
nodeType
);
int32_t
dndMarkWrapper
(
SMgmtWrapper
*
pWrapper
);
void
dndReleaseWrapper
(
SMgmtWrapper
*
pWrapper
);
void
dndReportStartup
(
SDnode
*
pDnode
,
const
char
*
pName
,
const
char
*
pDesc
);
// dndMonitor.h
void
dndSendMonitorReport
(
SDnode
*
pDnode
);
// dndStr.h
const
char
*
dndStatStr
(
EDndStatus
stat
);
const
char
*
dndNodeLogStr
(
ENodeType
ntype
);
const
char
*
dndNodeProcStr
(
ENodeType
ntype
);
const
char
*
dndEventStr
(
EDndEvent
ev
);
// dndTransport.h
int32_t
dndInitTrans
(
SDnode
*
pDnode
);
void
dndCleanupTrans
(
SDnode
*
pDnode
);
SMsgCb
dndCreateMsgcb
(
SMgmtWrapper
*
pWrapper
);
SProcCfg
dndGenProcCfg
(
SMgmtWrapper
*
pWrapper
);
int32_t
dndInitMsgHandle
(
SDnode
*
pDnode
);
// mgmt
void
dmSetMgmtFp
(
SMgmtWrapper
*
pWrapper
);
void
bmSetMgmtFp
(
SMgmtWrapper
*
pWrapper
);
void
qmSetMgmtFp
(
SMgmtWrapper
*
pMgmt
);
void
smSetMgmtFp
(
SMgmtWrapper
*
pWrapper
);
void
vmSetMgmtFp
(
SMgmtWrapper
*
pWrapper
);
void
mmSetMgmtFp
(
SMgmtWrapper
*
pMgmt
);
void
dmGetMnodeEpSet
(
SDnodeMgmt
*
pMgmt
,
SEpSet
*
pEpSet
);
void
dmUpdateMnodeEpSet
(
SDnodeMgmt
*
pMgmt
,
SEpSet
*
pEpSet
);
void
dmSendRedirectRsp
(
SDnodeMgmt
*
pMgmt
,
const
SRpcMsg
*
pMsg
);
typedef
struct
{
int32_t
openVnodes
;
int32_t
totalVnodes
;
int32_t
masterNum
;
int64_t
numOfSelectReqs
;
int64_t
numOfInsertReqs
;
int64_t
numOfInsertSuccessReqs
;
int64_t
numOfBatchInsertReqs
;
int64_t
numOfBatchInsertSuccessReqs
;
}
SVnodesStat
;
void
vmMonitorVnodeLoads
(
SMgmtWrapper
*
pWrapper
,
SArray
*
pLoads
);
int32_t
vmMonitorTfsInfo
(
SMgmtWrapper
*
pWrapper
,
SMonDiskInfo
*
pInfo
);
void
vmMonitorVnodeReqs
(
SMgmtWrapper
*
pWrapper
,
SMonDnodeInfo
*
pInfo
);
int32_t
mmMonitorMnodeInfo
(
SMgmtWrapper
*
pWrapper
,
SMonClusterInfo
*
pClusterInfo
,
SMonVgroupInfo
*
pVgroupInfo
,
SMonGrantInfo
*
pGrantInfo
);
#ifdef __cplusplus
}
#endif
#endif
/*_TD_DND_H_*/
\ No newline at end of file
source/dnode/mgmt/inc/dndInt.h
浏览文件 @
ca3a0b3e
...
...
@@ -16,34 +16,189 @@
#ifndef _TD_DND_INT_H_
#define _TD_DND_INT_H_
#include "dnd.h"
#include "os.h"
#include "cJSON.h"
#include "tcache.h"
#include "tcrc32c.h"
#include "tdatablock.h"
#include "tglobal.h"
#include "thash.h"
#include "tlockfree.h"
#include "tlog.h"
#include "tmsg.h"
#include "tmsgcb.h"
#include "tprocess.h"
#include "tqueue.h"
#include "trpc.h"
#include "tthread.h"
#include "ttime.h"
#include "tworker.h"
#include "dnode.h"
#include "monitor.h"
#ifdef __cplusplus
extern
"C"
{
#endif
// dndEnv.h
int32_t
dndInit
();
void
dndCleanup
();
#define dFatal(...) { if (dDebugFlag & DEBUG_FATAL) { taosPrintLog("DND FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); }}
#define dError(...) { if (dDebugFlag & DEBUG_ERROR) { taosPrintLog("DND ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); }}
#define dWarn(...) { if (dDebugFlag & DEBUG_WARN) { taosPrintLog("DND WARN ", DEBUG_WARN, 255, __VA_ARGS__); }}
#define dInfo(...) { if (dDebugFlag & DEBUG_INFO) { taosPrintLog("DND ", DEBUG_INFO, 255, __VA_ARGS__); }}
#define dDebug(...) { if (dDebugFlag & DEBUG_DEBUG) { taosPrintLog("DND ", DEBUG_DEBUG, dDebugFlag, __VA_ARGS__); }}
#define dTrace(...) { if (dDebugFlag & DEBUG_TRACE) { taosPrintLog("DND ", DEBUG_TRACE, dDebugFlag, __VA_ARGS__); }}
// dndExec.h
int32_t
dndOpenNode
(
SMgmtWrapper
*
pWrapper
)
;
void
dndCloseNode
(
SMgmtWrapper
*
pWrapper
)
;
int32_t
dndRun
(
SDnode
*
pDnode
)
;
typedef
enum
{
DNODE
,
VNODES
,
QNODE
,
SNODE
,
MNODE
,
BNODE
,
NODE_MAX
}
ENodeType
;
typedef
enum
{
DND_STAT_INIT
,
DND_STAT_RUNNING
,
DND_STAT_STOPPED
}
EDndStatus
;
typedef
enum
{
DND_ENV_INIT
,
DND_ENV_READY
,
DND_ENV_CLEANUP
}
EEnvStatus
;
typedef
enum
{
PROC_SINGLE
,
PROC_CHILD
,
PROC_PARENT
}
EProcType
;
// dndInt.c
SDnode
*
dndCreate
(
const
SDnodeOpt
*
pOption
);
void
dndClose
(
SDnode
*
pDnode
);
void
dndHandleEvent
(
SDnode
*
pDnode
,
EDndEvent
event
);
typedef
struct
SMgmtFp
SMgmtFp
;
typedef
struct
SMgmtWrapper
SMgmtWrapper
;
typedef
struct
SMsgHandle
SMsgHandle
;
typedef
struct
SDnodeMgmt
SDnodeMgmt
;
typedef
struct
SVnodesMgmt
SVnodesMgmt
;
typedef
struct
SMnodeMgmt
SMnodeMgmt
;
typedef
struct
SQnodeMgmt
SQnodeMgmt
;
typedef
struct
SSnodeMgmt
SSnodeMgmt
;
typedef
struct
SBnodeMgmt
SBnodeMgmt
;
typedef
int32_t
(
*
NodeMsgFp
)(
SMgmtWrapper
*
pWrapper
,
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
);
typedef
struct
SMsgHandle
{
SMgmtWrapper
*
pQndWrapper
;
SMgmtWrapper
*
pMndWrapper
;
SMgmtWrapper
*
pWrapper
;
}
SMsgHandle
;
typedef
struct
SMgmtFp
{
OpenNodeFp
openFp
;
CloseNodeFp
closeFp
;
StartNodeFp
startFp
;
CreateNodeFp
createMsgFp
;
DropNodeFp
dropMsgFp
;
RequireNodeFp
requiredFp
;
}
SMgmtFp
;
typedef
struct
SMgmtWrapper
{
const
char
*
name
;
char
*
path
;
int32_t
refCount
;
SRWLatch
latch
;
ENodeType
ntype
;
bool
deployed
;
bool
required
;
EProcType
procType
;
int32_t
procId
;
SProcObj
*
pProc
;
SShm
shm
;
void
*
pMgmt
;
SDnode
*
pDnode
;
SMgmtFp
fp
;
int8_t
msgVgIds
[
TDMT_MAX
];
// Handle the case where the same message type is distributed to qnode or vnode
NodeMsgFp
msgFps
[
TDMT_MAX
];
}
SMgmtWrapper
;
typedef
struct
{
void
*
serverRpc
;
void
*
clientRpc
;
SMsgHandle
msgHandles
[
TDMT_MAX
];
}
STransMgmt
;
typedef
struct
SDnode
{
int64_t
clusterId
;
int32_t
dnodeId
;
int32_t
numOfSupportVnodes
;
int64_t
rebootTime
;
char
*
localEp
;
char
*
localFqdn
;
char
*
firstEp
;
char
*
secondEp
;
char
*
dataDir
;
SDiskCfg
*
disks
;
int32_t
numOfDisks
;
uint16_t
serverPort
;
bool
dropped
;
ENodeType
ntype
;
EDndStatus
status
;
EDndEvent
event
;
SStartupReq
startup
;
TdFilePtr
lockfile
;
STransMgmt
trans
;
SMgmtWrapper
wrappers
[
NODE_MAX
];
}
SDnode
;
// dndMsg.c
void
dndProcessStartupReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
);
// dndEnv.c
const
char
*
dndStatStr
(
EDndStatus
stat
);
const
char
*
dndNodeLogStr
(
ENodeType
ntype
);
const
char
*
dndNodeProcStr
(
ENodeType
ntype
);
const
char
*
dndEventStr
(
EDndEvent
ev
);
// dndExec.c
int32_t
dndOpenNode
(
SMgmtWrapper
*
pWrapper
);
void
dndCloseNode
(
SMgmtWrapper
*
pWrapper
);
// dndFile.c
int32_t
dndReadFile
(
SMgmtWrapper
*
pWrapper
,
bool
*
pDeployed
);
int32_t
dndWriteFile
(
SMgmtWrapper
*
pWrapper
,
bool
deployed
);
TdFilePtr
dndCheckRunning
(
const
char
*
dataDir
);
int32_t
dndReadShmFile
(
SDnode
*
pDnode
);
int32_t
dndWriteShmFile
(
SDnode
*
pDnode
);
// dndInt.c
EDndStatus
dndGetStatus
(
SDnode
*
pDnode
);
void
dndSetStatus
(
SDnode
*
pDnode
,
EDndStatus
stat
);
void
dndSetMsgHandle
(
SMgmtWrapper
*
pWrapper
,
tmsg_t
msgType
,
NodeMsgFp
nodeMsgFp
,
int8_t
vgId
);
SMgmtWrapper
*
dndAcquireWrapper
(
SDnode
*
pDnode
,
ENodeType
nodeType
);
int32_t
dndMarkWrapper
(
SMgmtWrapper
*
pWrapper
);
void
dndReleaseWrapper
(
SMgmtWrapper
*
pWrapper
);
void
dndHandleEvent
(
SDnode
*
pDnode
,
EDndEvent
event
);
void
dndReportStartup
(
SDnode
*
pDnode
,
const
char
*
pName
,
const
char
*
pDesc
);
void
dndProcessStartupReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
);
// dndTransport.c
int32_t
dndInitTrans
(
SDnode
*
pDnode
);
void
dndCleanupTrans
(
SDnode
*
pDnode
);
SMsgCb
dndCreateMsgcb
(
SMgmtWrapper
*
pWrapper
);
SProcCfg
dndGenProcCfg
(
SMgmtWrapper
*
pWrapper
);
int32_t
dndInitMsgHandle
(
SDnode
*
pDnode
);
// mgmt
void
dmSetMgmtFp
(
SMgmtWrapper
*
pWrapper
);
void
bmSetMgmtFp
(
SMgmtWrapper
*
pWrapper
);
void
qmSetMgmtFp
(
SMgmtWrapper
*
pMgmt
);
void
smSetMgmtFp
(
SMgmtWrapper
*
pWrapper
);
void
vmSetMgmtFp
(
SMgmtWrapper
*
pWrapper
);
void
mmSetMgmtFp
(
SMgmtWrapper
*
pMgmt
);
void
dmGetMnodeEpSet
(
SDnodeMgmt
*
pMgmt
,
SEpSet
*
pEpSet
);
void
dmUpdateMnodeEpSet
(
SDnodeMgmt
*
pMgmt
,
SEpSet
*
pEpSet
);
void
dmSendRedirectRsp
(
SDnodeMgmt
*
pMgmt
,
const
SRpcMsg
*
pMsg
);
typedef
struct
{
int32_t
openVnodes
;
int32_t
totalVnodes
;
int32_t
masterNum
;
int64_t
numOfSelectReqs
;
int64_t
numOfInsertReqs
;
int64_t
numOfInsertSuccessReqs
;
int64_t
numOfBatchInsertReqs
;
int64_t
numOfBatchInsertSuccessReqs
;
}
SVnodesStat
;
void
vmMonitorVnodeLoads
(
SMgmtWrapper
*
pWrapper
,
SArray
*
pLoads
);
int32_t
vmMonitorTfsInfo
(
SMgmtWrapper
*
pWrapper
,
SMonDiskInfo
*
pInfo
);
void
vmMonitorVnodeReqs
(
SMgmtWrapper
*
pWrapper
,
SMonDnodeInfo
*
pInfo
);
int32_t
mmMonitorMnodeInfo
(
SMgmtWrapper
*
pWrapper
,
SMonClusterInfo
*
pClusterInfo
,
SMonVgroupInfo
*
pVgroupInfo
,
SMonGrantInfo
*
pGrantInfo
);
#ifdef __cplusplus
}
#endif
...
...
source/dnode/mgmt/inc/mmInt.h
浏览文件 @
ca3a0b3e
...
...
@@ -16,7 +16,7 @@
#ifndef _TD_DND_MNODE_INT_H_
#define _TD_DND_MNODE_INT_H_
#include "dnd.h"
#include "dnd
Int
.h"
#include "mnode.h"
#ifdef __cplusplus
...
...
@@ -46,8 +46,8 @@ int32_t mmOpenFromMsg(SMgmtWrapper *pWrapper, SDCreateMnodeReq *pReq);
int32_t
mmDrop
(
SMgmtWrapper
*
pWrapper
);
int32_t
mmAlter
(
SMnodeMgmt
*
pMgmt
,
SDAlterMnodeReq
*
pReq
);
// mm
Msg
.c
void
mmInitMsgHandle
s
(
SMgmtWrapper
*
pWrapper
);
// mm
Handle
.c
void
mmInitMsgHandle
(
SMgmtWrapper
*
pWrapper
);
int32_t
mmProcessCreateReq
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
int32_t
mmProcessDropReq
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
int32_t
mmProcessAlterReq
(
SMnodeMgmt
*
pMgmt
,
SNodeMsg
*
pMsg
);
...
...
source/dnode/mgmt/inc/qmInt.h
浏览文件 @
ca3a0b3e
...
...
@@ -16,7 +16,7 @@
#ifndef _TD_DND_QNODE_INT_H_
#define _TD_DND_QNODE_INT_H_
#include "dnd.h"
#include "dnd
Int
.h"
#include "qnode.h"
#ifdef __cplusplus
...
...
@@ -36,8 +36,8 @@ typedef struct SQnodeMgmt {
int32_t
qmOpen
(
SMgmtWrapper
*
pWrapper
);
int32_t
qmDrop
(
SMgmtWrapper
*
pWrapper
);
// qm
Msg
.c
void
qmInitMsgHandle
s
(
SMgmtWrapper
*
pWrapper
);
// qm
Handle
.c
void
qmInitMsgHandle
(
SMgmtWrapper
*
pWrapper
);
int32_t
qmProcessCreateReq
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
int32_t
qmProcessDropReq
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
...
...
source/dnode/mgmt/inc/smInt.h
浏览文件 @
ca3a0b3e
...
...
@@ -16,7 +16,7 @@
#ifndef _TD_DND_SNODE_INT_H_
#define _TD_DND_SNODE_INT_H_
#include "dnd.h"
#include "dnd
Int
.h"
#include "snode.h"
#ifdef __cplusplus
...
...
@@ -38,8 +38,8 @@ typedef struct SSnodeMgmt {
int32_t
smOpen
(
SMgmtWrapper
*
pWrapper
);
int32_t
smDrop
(
SMgmtWrapper
*
pWrapper
);
// sm
Msg
.c
void
smInitMsgHandle
s
(
SMgmtWrapper
*
pWrapper
);
// sm
Handle
.c
void
smInitMsgHandle
(
SMgmtWrapper
*
pWrapper
);
int32_t
smProcessCreateReq
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
int32_t
smProcessDropReq
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
...
...
source/dnode/mgmt/inc/vmInt.h
浏览文件 @
ca3a0b3e
...
...
@@ -17,7 +17,7 @@
#define _TD_DND_VNODES_INT_H_
#include "sync.h"
#include "dnd.h"
#include "dnd
Int
.h"
#include "vnode.h"
#ifdef __cplusplus
...
...
@@ -84,8 +84,8 @@ void vmReleaseVnode(SVnodesMgmt *pMgmt, SVnodeObj *pVnode);
int32_t
vmOpenVnode
(
SVnodesMgmt
*
pMgmt
,
SWrapperCfg
*
pCfg
,
SVnode
*
pImpl
);
void
vmCloseVnode
(
SVnodesMgmt
*
pMgmt
,
SVnodeObj
*
pVnode
);
// vm
Msg
.c
void
vmInitMsgHandle
s
(
SMgmtWrapper
*
pWrapper
);
// vm
Handle
.c
void
vmInitMsgHandle
(
SMgmtWrapper
*
pWrapper
);
int32_t
vmProcessCreateVnodeReq
(
SVnodesMgmt
*
pMgmt
,
SNodeMsg
*
pReq
);
int32_t
vmProcessAlterVnodeReq
(
SVnodesMgmt
*
pMgmt
,
SNodeMsg
*
pReq
);
int32_t
vmProcessDropVnodeReq
(
SVnodesMgmt
*
pMgmt
,
SNodeMsg
*
pReq
);
...
...
source/dnode/mgmt/main/dndInt.c
浏览文件 @
ca3a0b3e
...
...
@@ -211,3 +211,19 @@ void dndReportStartup(SDnode *pDnode, const char *pName, const char *pDesc) {
tstrncpy
(
pStartup
->
desc
,
pDesc
,
TSDB_STEP_DESC_LEN
);
pStartup
->
finished
=
0
;
}
static
void
dndGetStartup
(
SDnode
*
pDnode
,
SStartupReq
*
pStartup
)
{
memcpy
(
pStartup
,
&
pDnode
->
startup
,
sizeof
(
SStartupReq
));
pStartup
->
finished
=
(
dndGetStatus
(
pDnode
)
==
DND_STAT_RUNNING
);
}
void
dndProcessStartupReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
)
{
dDebug
(
"startup req is received"
);
SStartupReq
*
pStartup
=
rpcMallocCont
(
sizeof
(
SStartupReq
));
dndGetStartup
(
pDnode
,
pStartup
);
dDebug
(
"startup req is sent, step:%s desc:%s finished:%d"
,
pStartup
->
name
,
pStartup
->
desc
,
pStartup
->
finished
);
SRpcMsg
rpcRsp
=
{
.
handle
=
pReq
->
handle
,
.
pCont
=
pStartup
,
.
contLen
=
sizeof
(
SStartupReq
),
.
ahandle
=
pReq
->
ahandle
};
rpcSendResponse
(
&
rpcRsp
);
}
\ No newline at end of file
source/dnode/mgmt/mm/mmHandle.c
浏览文件 @
ca3a0b3e
...
...
@@ -73,7 +73,7 @@ int32_t mmProcessAlterReq(SMnodeMgmt *pMgmt, SNodeMsg *pMsg) {
}
}
void
mmInitMsgHandle
s
(
SMgmtWrapper
*
pWrapper
)
{
void
mmInitMsgHandle
(
SMgmtWrapper
*
pWrapper
)
{
// Requests handled by DNODE
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_CREATE_MNODE_RSP
,
mmProcessWriteMsg
,
DEFAULT_HANDLE
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_ALTER_MNODE_RSP
,
mmProcessWriteMsg
,
DEFAULT_HANDLE
);
...
...
source/dnode/mgmt/mm/mmInt.c
浏览文件 @
ca3a0b3e
...
...
@@ -236,7 +236,7 @@ void mmSetMgmtFp(SMgmtWrapper *pWrapper) {
mgmtFp
.
dropMsgFp
=
mmProcessDropReq
;
mgmtFp
.
requiredFp
=
mmRequire
;
mmInitMsgHandle
s
(
pWrapper
);
mmInitMsgHandle
(
pWrapper
);
pWrapper
->
name
=
"mnode"
;
pWrapper
->
fp
=
mgmtFp
;
}
...
...
source/dnode/mgmt/qm/qmHandle.c
浏览文件 @
ca3a0b3e
...
...
@@ -54,7 +54,7 @@ int32_t qmProcessDropReq(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
}
}
void
qmInitMsgHandle
s
(
SMgmtWrapper
*
pWrapper
)
{
void
qmInitMsgHandle
(
SMgmtWrapper
*
pWrapper
)
{
// Requests handled by VNODE
dndSetMsgHandle
(
pWrapper
,
TDMT_VND_QUERY
,
qmProcessQueryMsg
,
QNODE_HANDLE
);
dndSetMsgHandle
(
pWrapper
,
TDMT_VND_QUERY_CONTINUE
,
qmProcessQueryMsg
,
QNODE_HANDLE
);
...
...
source/dnode/mgmt/qm/qmInt.c
浏览文件 @
ca3a0b3e
...
...
@@ -120,7 +120,7 @@ void qmSetMgmtFp(SMgmtWrapper *pWrapper) {
mgmtFp
.
dropMsgFp
=
qmProcessDropReq
;
mgmtFp
.
requiredFp
=
qmRequire
;
qmInitMsgHandle
s
(
pWrapper
);
qmInitMsgHandle
(
pWrapper
);
pWrapper
->
name
=
"qnode"
;
pWrapper
->
fp
=
mgmtFp
;
}
source/dnode/mgmt/sm/smHandle.c
浏览文件 @
ca3a0b3e
...
...
@@ -54,7 +54,7 @@ int32_t smProcessDropReq(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
}
}
void
smInitMsgHandle
s
(
SMgmtWrapper
*
pWrapper
)
{
void
smInitMsgHandle
(
SMgmtWrapper
*
pWrapper
)
{
// Requests handled by SNODE
dndSetMsgHandle
(
pWrapper
,
TDMT_SND_TASK_DEPLOY
,
smProcessMgmtMsg
,
DEFAULT_HANDLE
);
dndSetMsgHandle
(
pWrapper
,
TDMT_SND_TASK_EXEC
,
smProcessExecMsg
,
DEFAULT_HANDLE
);
...
...
source/dnode/mgmt/sm/smInt.c
浏览文件 @
ca3a0b3e
...
...
@@ -117,7 +117,7 @@ void smSetMgmtFp(SMgmtWrapper *pWrapper) {
mgmtFp
.
dropMsgFp
=
smProcessDropReq
;
mgmtFp
.
requiredFp
=
smRequire
;
smInitMsgHandle
s
(
pWrapper
);
smInitMsgHandle
(
pWrapper
);
pWrapper
->
name
=
"snode"
;
pWrapper
->
fp
=
mgmtFp
;
}
source/dnode/mgmt/vm/vmHandle.c
浏览文件 @
ca3a0b3e
...
...
@@ -238,7 +238,7 @@ int32_t vmProcessCompactVnodeReq(SVnodesMgmt *pMgmt, SNodeMsg *pMsg) {
return
0
;
}
void
vmInitMsgHandle
s
(
SMgmtWrapper
*
pWrapper
)
{
void
vmInitMsgHandle
(
SMgmtWrapper
*
pWrapper
)
{
// Requests handled by VNODE
dndSetMsgHandle
(
pWrapper
,
TDMT_VND_SUBMIT
,
(
NodeMsgFp
)
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
dndSetMsgHandle
(
pWrapper
,
TDMT_VND_QUERY
,
(
NodeMsgFp
)
vmProcessQueryMsg
,
DEFAULT_HANDLE
);
...
...
source/dnode/mgmt/vm/vmInt.c
浏览文件 @
ca3a0b3e
...
...
@@ -339,7 +339,7 @@ void vmSetMgmtFp(SMgmtWrapper *pWrapper) {
mgmtFp
.
closeFp
=
vmCleanup
;
mgmtFp
.
requiredFp
=
vmRequire
;
vmInitMsgHandle
s
(
pWrapper
);
vmInitMsgHandle
(
pWrapper
);
pWrapper
->
name
=
"vnode"
;
pWrapper
->
fp
=
mgmtFp
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录